Skip to content
Snippets Groups Projects
Commit 060653a8 authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-1286 : QGF: Setup of automatic testing of dropboxes - control database kind

SVN: 33034
parent eca47853
No related branches found
No related tags found
No related merge requests found
......@@ -28,11 +28,22 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService
public class GenericSystemTest extends SystemTestCase
{
protected String getDBScriptFolder()
{
return "sourceTest";
}
protected String getDBKind()
{
return "test";
}
@Override
@BeforeSuite
public void beforeSuite() throws Exception
{
System.setProperty(TestInitializer.getScriptFolderTestDBPropertyName(), "sourceTest");
System.setProperty(TestInitializer.getScriptFolderTestDBPropertyName(), getDBScriptFolder());
System.setProperty(TestInitializer.getDBKindPropertyName(), getDBKind());
super.beforeSuite();
}
......
/*
* Copyright 2014 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.bsse.cisd.dsu.dss.systemtests;
/**
* @author pkupczyk
*/
public class DSUContants
{
public static final String DB_KIND = "test_deep_sequencing_unit";
}
/*
* Copyright 2014 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.bsse.cisd.dsu.dss.systemtests;
import ch.systemsx.cisd.openbis.datastoreserver.systemtests.GenericDropboxSystemTest;
/**
* @author pkupczyk
*/
public abstract class DSUDropboxSystemTest extends GenericDropboxSystemTest
{
@Override
protected String getDBKind()
{
return DSUContants.DB_KIND;
}
}
/*
* Copyright 2014 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.bsse.cisd.dsu.dss.systemtests;
import ch.systemsx.cisd.openbis.datastoreserver.systemtests.GenericSystemTest;
/**
* @author pkupczyk
*/
public class DSUSystemTest extends GenericSystemTest
{
@Override
protected String getDBKind()
{
return DSUContants.DB_KIND;
}
}
......@@ -21,7 +21,6 @@ import java.util.List;
import org.testng.Assert;
import org.testng.annotations.Test;
import ch.systemsx.cisd.openbis.datastoreserver.systemtests.GenericDropboxSystemTest;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Experiment;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria;
import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClause;
......@@ -31,7 +30,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE;
/**
* @author pkupczyk
*/
public class DemoDropboxTest extends GenericDropboxSystemTest
public class DemoDropboxTest extends DSUDropboxSystemTest
{
@Override
......@@ -47,7 +46,7 @@ public class DemoDropboxTest extends GenericDropboxSystemTest
}
@Test
public void testDropbox1() throws Exception
public void testDropbox() throws Exception
{
importData("demo-data");
waitUntilDataImported();
......@@ -62,19 +61,4 @@ public class DemoDropboxTest extends GenericDropboxSystemTest
Assert.assertEquals(experiments.size(), 2);
}
@Test(enabled = false)
public void testDropbox2() throws Exception
{
// WARNING: this test fails and shows that transaction is not rolled back after testDropbox1 is executed
// (the newly created experiments still exist)
String sessionToken = getGeneralInformationService().tryToAuthenticateForAllServices("test", "password");
SearchCriteria criteria = new SearchCriteria();
criteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, "DEMO-EXPERIMENT*"));
List<Experiment> experiments = getGeneralInformationService().searchForExperiments(sessionToken, criteria);
Assert.assertEquals(experiments.size(), 0);
}
}
\ No newline at end of file
......@@ -51,10 +51,14 @@ public class TestInitializer
private static final String LUCENE_INDEX_PATH = "targets/lucene/indices";
private static final String DB_KIND_PROPERTY_NAME = "dbKind";
private static final String SCRIPT_FOLDER_TEST_DB_PROPERTY_NAME = "scriptFolderTestDB";
private static final String SCRIPT_FOLDER_EMPTY_DB_PROPERTY_NAME = "scriptFolderEmptyDB";
private static final String DEFAULT_DB_KIND = "test";
private static final String DEFAULT_SCRIPT_FOLDER_TEST_DB = "../openbis/sourceTest";
private static final String DEFAULT_SCRIPT_FOLDER_EMPTY_DB = "../openbis/source";
......@@ -141,10 +145,8 @@ public class TestInitializer
// and in the right place when we run tests
restoreSearchIndex();
String projectName = System.getProperty("ant.project.name", "");
System.setProperty("database.create-from-scratch", "true");
System.setProperty("database.kind", projectName.isEmpty() ? "test" : "test_" + projectName);
System.setProperty("database.kind", getDBKind());
System.setProperty("script-folder", scriptFolder);
System.setProperty("hibernate.search.index-mode", hibernateIndexMode.name());
System.setProperty("hibernate.search.index-base", LUCENE_INDEX_PATH);
......@@ -177,6 +179,11 @@ public class TestInitializer
}
}
public static String getDBKindPropertyName()
{
return TestInitializer.class.getName() + "." + DB_KIND_PROPERTY_NAME;
}
public static String getScriptFolderTestDBPropertyName()
{
return TestInitializer.class.getName() + "." + SCRIPT_FOLDER_TEST_DB_PROPERTY_NAME;
......@@ -187,6 +194,11 @@ public class TestInitializer
return TestInitializer.class.getName() + "." + SCRIPT_FOLDER_EMPTY_DB_PROPERTY_NAME;
}
private static String getDBKind()
{
return getSystemProperty(getDBKindPropertyName(), DEFAULT_DB_KIND);
}
private static String getScriptFolderTestDB()
{
return getSystemProperty(getScriptFolderTestDBPropertyName(), DEFAULT_SCRIPT_FOLDER_TEST_DB);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment