diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/GenericSystemTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/GenericSystemTest.java index a8e36a631a535084f9ce1099e063f2b9d0c1c3f7..5ecf38a9773ac922c827885e220bfe624017e570 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/GenericSystemTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/GenericSystemTest.java @@ -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(); } diff --git a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUContants.java b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUContants.java new file mode 100644 index 0000000000000000000000000000000000000000..d5eaf3925ccd4c4acd1c25c6d90b2ad26e65db01 --- /dev/null +++ b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUContants.java @@ -0,0 +1,27 @@ +/* + * 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"; + +} diff --git a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUDropboxSystemTest.java b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUDropboxSystemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4d02d819ff7e21fdf1fa8da688e14eae722603aa --- /dev/null +++ b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUDropboxSystemTest.java @@ -0,0 +1,33 @@ +/* + * 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; + } + +} diff --git a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUSystemTest.java b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUSystemTest.java new file mode 100644 index 0000000000000000000000000000000000000000..446c89e3f9b9956c309c2649b47caa1e2143bbe4 --- /dev/null +++ b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DSUSystemTest.java @@ -0,0 +1,33 @@ +/* + * 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; + } + +} diff --git a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DemoDropboxTest.java b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DemoDropboxTest.java index 8db8078c34ad623d7a598e8231f3b8e4cc0d5517..a0506f6df0ce124e62e3f30b3cd558db796443f3 100644 --- a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DemoDropboxTest.java +++ b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/systemtests/DemoDropboxTest.java @@ -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 diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/TestInitializer.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/TestInitializer.java index a275df7884066fde0849c4671077652dc9a359c0..e3bb4b93c43224547d7ab16f27934ada0a3d6c3b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/TestInitializer.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/TestInitializer.java @@ -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);