From a3b9e60439cc7756a9ca4c30c3edabaf8a08bdf3 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Tue, 18 Sep 2012 07:04:13 +0000 Subject: [PATCH] DsComponentTest: delete all data sets registered during tests in order to fix broken test OpenbisServiceFacadeTest. SVN: 26650 --- .../systemtests/DssComponentTest.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/DssComponentTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/DssComponentTest.java index 30df5c2b614..2ef1bf54ec7 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/DssComponentTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/DssComponentTest.java @@ -29,6 +29,7 @@ import java.util.regex.Pattern; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.time.DateUtils; +import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -75,6 +76,15 @@ public class DssComponentTest extends SystemTestCase // Keep track of the number of times a data set was registered during the course of running the // tests private int putCount = 0; + + private List<String> registeredDataSets = new ArrayList<String>(); + + @AfterClass + public void deleteRegisteredDataSets() + { + IEncapsulatedOpenBISService openBISService = ServiceProvider.getOpenBISService(); + openBISService.removeDataSetsPermanently(registeredDataSets, "DssComponentTest"); + } @BeforeMethod public void beforeMethod() @@ -87,11 +97,18 @@ public class DssComponentTest extends SystemTestCase { File exampleDataSet = new File(workingDirectory, "my-data"); NewDataSetDTO newDataset = createNewDataSetDTO(exampleDataSet); - IDataSetDss dataSet = dss.putDataSet(newDataset, exampleDataSet); + IDataSetDss dataSet = registerDataSet(exampleDataSet, newDataset); checkDataSet(dataSet); putCount++; } + private IDataSetDss registerDataSet(File exampleDataSet, NewDataSetDTO newDataset) + { + IDataSetDss dataSet = dss.putDataSet(newDataset, exampleDataSet); + registeredDataSets.add(dataSet.getCode()); + return dataSet; + } + @Test public void testFailingPutDataSet() throws Exception { @@ -233,7 +250,7 @@ public class DssComponentTest extends SystemTestCase File exampleDataSet = new File(workingDirectory, "my-data"); NewDataSetDTO newDataset = createNewDataSetDTO(exampleDataSet); newDataset.setParentDataSetCodes(Arrays.asList(code)); - IDataSetDss dataSet = dss.putDataSet(newDataset, exampleDataSet); + IDataSetDss dataSet = registerDataSet(exampleDataSet, newDataset); checkDataSet(dataSet); putCount++; } @@ -349,7 +366,7 @@ public class DssComponentTest extends SystemTestCase dss = createDssComponent("observer"); File exampleDataSet = new File(workingDirectory, "observer-data"); NewDataSetDTO newDataset = createNewDataSetDTO(exampleDataSet); - dss.putDataSet(newDataset, exampleDataSet); + registerDataSet(exampleDataSet, newDataset); putCount++; } -- GitLab