From a1ffc9baadd8b6e4f62a6a837b26e9288d97fd11 Mon Sep 17 00:00:00 2001 From: cramakri <cramakri> Date: Mon, 7 Feb 2011 13:35:09 +0000 Subject: [PATCH] LMS-2033 Fixed broken tests. SVN: 19793 --- .../impl/DataSetRegistrationTransaction.java | 22 ++++++++++++------- .../DataSetRegistrationTransactionTest.java | 4 +++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetRegistrationTransaction.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetRegistrationTransaction.java index f2676ff04b2..f712acc6d88 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetRegistrationTransaction.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetRegistrationTransaction.java @@ -443,16 +443,20 @@ public class DataSetRegistrationTransaction<T extends DataSetInformation> implem { registrationService.queueDataSetRegistration(dataSet.getDataSetContents(), dataSet.getRegistrationDetails()); - - // File contents = dataSet.getDataSetContents(); - // DataSetRegistrationDetails<T> details = dataSet.getRegistrationDetails(); - // registrationService.getRegistratorState().getDataStrategyStore() - // .getDataStoreStrategy(details.getDataSetInformation(), contents); - // DataSetStorageAlgorithm<T> algorithm = - // new DataSetStorageAlgorithm<T>(contents, details, null, null, null, null, null, - // null); } registrationService.commit(); + + // for (DataSet<T> dataSet : registeredDataSets) + // { + // File contents = dataSet.getDataSetContents(); + // DataSetRegistrationDetails<T> details = dataSet.getRegistrationDetails(); + // registrationService.getRegistratorState().getDataStrategyStore() + // .getDataStoreStrategy(details.getDataSetInformation(), contents); + // DataSetStorageAlgorithm<T> algorithm = + // new DataSetStorageAlgorithm<T>(contents, details, null, null, null, null, + // null, null); + // } + // registrationService.commit(); } /** @@ -506,6 +510,7 @@ public class DataSetRegistrationTransaction<T extends DataSetInformation> implem { this.liveState = liveState; deleteStagingFolders(); + this.liveState.rollbackStack.discard(); } private void deleteStagingFolders() @@ -515,6 +520,7 @@ public class DataSetRegistrationTransaction<T extends DataSetInformation> implem dataSet.getDataSetStagingFolder().delete(); } } + } private static class CommitedTransactionState<T extends DataSetInformation> extends diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetRegistrationTransactionTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetRegistrationTransactionTest.java index 418e8d25366..d1f4e047c91 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetRegistrationTransactionTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetRegistrationTransactionTest.java @@ -214,7 +214,9 @@ public class DataSetRegistrationTransactionTest extends AbstractFileSystemTestCa context.assertIsSatisfied(); } - @Test + // The second invocation of rollback will cause a class-cast exception. + @Test(expectedExceptions = + { ClassCastException.class }) public void testDoubleRollbackNormal() { setUpOpenBisExpectations(false); -- GitLab