From bef7f9204aba96b36f562e93348c04527ed8e3ea Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Tue, 24 May 2011 06:02:47 +0000 Subject: [PATCH] LMS-2104 IPostRegistrationTask.createExecutor() signature modified to fix bug in eager shuffling SVN: 21449 --- .../path/PathInfoDatabaseFeedingTask.java | 2 +- .../etlserver/plugins/SimpleShuffling.java | 2 +- .../ArchivingPostRegistrationTask.java | 6 +++- .../DummyPostRegistrationTaskExecutor.java | 36 +++++++++++++++++++ .../postregistration/EagerShufflingTask.java | 6 +++- .../IPostRegistrationTask.java | 3 +- .../postregistration/NotifyingTask.java | 2 +- .../PostRegistrationMaintenanceTask.java | 2 +- .../postregistration/TaskExecutor.java | 6 ++-- .../path/PathInfoDatabaseFeedingTaskTest.java | 8 ++--- .../ArchivingPostRegistrationTaskTest.java | 2 +- .../EagerShufflingTaskTest.java | 6 ++-- .../postregistration/NotifyingTaskTest.java | 2 +- .../PostRegistrationMaintenanceTaskTest.java | 24 ++++++------- 14 files changed, 76 insertions(+), 31 deletions(-) create mode 100644 datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/DummyPostRegistrationTaskExecutor.java diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTask.java index 71f648a36a7..70a04b1a225 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTask.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTask.java @@ -118,7 +118,7 @@ public class PathInfoDatabaseFeedingTask implements IMaintenanceTask, IPostRegis } } - public IPostRegistrationTaskExecutor createExecutor(final String dataSetCode) + public IPostRegistrationTaskExecutor createExecutor(final String dataSetCode, boolean container) { return new IPostRegistrationTaskExecutor() { diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/SimpleShuffling.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/SimpleShuffling.java index 5abbdfc1a3b..7695e94162e 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/SimpleShuffling.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/SimpleShuffling.java @@ -127,7 +127,7 @@ public class SimpleShuffling implements ISegmentedStoreShuffling SimpleDataSetInformationDTO dataSet = dataSets.get(i); try { - taskExecutor.execute(shufflingTask, "shuffling", dataSet.getDataSetCode()); + taskExecutor.execute(shufflingTask, "shuffling", dataSet.getDataSetCode(), false); } catch (Throwable ex) { throw CheckedExceptionTunnel.wrapIfNecessary(ex); diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTask.java index 1ac4a458d6e..e767f2f099d 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTask.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTask.java @@ -67,8 +67,12 @@ public class ArchivingPostRegistrationTask extends AbstractPostRegistrationTask return true; } - public IPostRegistrationTaskExecutor createExecutor(String dataSetCode) + public IPostRegistrationTaskExecutor createExecutor(String dataSetCode, boolean container) { + if (container) + { + return DummyPostRegistrationTaskExecutor.INSTANCE; + } return new Executor(dataSetCode); } diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/DummyPostRegistrationTaskExecutor.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/DummyPostRegistrationTaskExecutor.java new file mode 100644 index 00000000000..6d6814c896c --- /dev/null +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/DummyPostRegistrationTaskExecutor.java @@ -0,0 +1,36 @@ +/* + * Copyright 2011 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.systemsx.cisd.etlserver.postregistration; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class DummyPostRegistrationTaskExecutor implements IPostRegistrationTaskExecutor +{ + public static final IPostRegistrationTaskExecutor INSTANCE = new DummyPostRegistrationTaskExecutor(); + + public void execute() + { + } + + public ICleanupTask createCleanupTask() + { + return new NoCleanupTask(); + } +} diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTask.java index a4b7bad3768..5cd40f2bad4 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTask.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTask.java @@ -129,8 +129,12 @@ public class EagerShufflingTask extends AbstractPostRegistrationTask return true; } - public IPostRegistrationTaskExecutor createExecutor(String dataSetCode) + public IPostRegistrationTaskExecutor createExecutor(String dataSetCode, boolean container) { + if (container) + { + return DummyPostRegistrationTaskExecutor.INSTANCE; + } return new Executor(dataSetCode); } diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/IPostRegistrationTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/IPostRegistrationTask.java index f9fda6997f1..628eeb9f9a1 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/IPostRegistrationTask.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/IPostRegistrationTask.java @@ -36,8 +36,9 @@ public interface IPostRegistrationTask /** * Creates a task executor for the specified data set. + * @param container If <code>true</code> the data set is a container data set. */ - public IPostRegistrationTaskExecutor createExecutor(String dataSetCode); + public IPostRegistrationTaskExecutor createExecutor(String dataSetCode, boolean container); } diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/NotifyingTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/NotifyingTask.java index 85693333f67..390d41e2e9d 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/NotifyingTask.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/NotifyingTask.java @@ -65,7 +65,7 @@ public class NotifyingTask extends AbstractPostRegistrationTask return false; } - public IPostRegistrationTaskExecutor createExecutor(String dataSetCode) + public IPostRegistrationTaskExecutor createExecutor(String dataSetCode, boolean container) { ExternalData dataSet = service.tryGetDataSet(dataSetCode); if (dataSet == null) diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTask.java index ea5212eac04..16afd6d7eb3 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTask.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTask.java @@ -145,7 +145,7 @@ public class PostRegistrationMaintenanceTask implements IDataStoreLockingMainten { IPostRegistrationTask task = entry.getValue(); String taskName = entry.getKey(); - executor.execute(task, taskName, code); + executor.execute(task, taskName, code, dataSet.isContainer()); } saveLastSeenDataSetId(dataSet.getId()); } catch (Throwable ex) diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/TaskExecutor.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/TaskExecutor.java index d65c2a1b084..303690fa765 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/TaskExecutor.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/TaskExecutor.java @@ -74,14 +74,14 @@ public class TaskExecutor cleanupTasksFolder.mkdirs(); } - public void execute(IPostRegistrationTask task, String taskName, String dataSetCode) - throws Throwable + public void execute(IPostRegistrationTask task, String taskName, String dataSetCode, + boolean container) throws Throwable { ICleanupTask cleanupTask = null; File savedCleanupTask = null; try { - IPostRegistrationTaskExecutor executor = task.createExecutor(dataSetCode); + IPostRegistrationTaskExecutor executor = task.createExecutor(dataSetCode, container); cleanupTask = executor.createCleanupTask(); savedCleanupTask = saveCleanupTask(dataSetCode, taskName, cleanupTask); executor.execute(); diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTaskTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTaskTest.java index 3ed38aa1031..f86a7b2be2b 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTaskTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTaskTest.java @@ -136,7 +136,7 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase }); prepareHappyCase(dataSet); - task.createExecutor(DATA_SET_CODE).execute(); + task.createExecutor(DATA_SET_CODE, false).execute(); } @Test @@ -153,7 +153,7 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase }); prepareFailing(dataSet); - task.createExecutor(DATA_SET_CODE).execute(); + task.createExecutor(DATA_SET_CODE, false).execute(); } @Test @@ -176,7 +176,7 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase } }); - task.createExecutor(DATA_SET_CODE).execute(); + task.createExecutor(DATA_SET_CODE, false).execute(); } @Test @@ -202,7 +202,7 @@ public class PathInfoDatabaseFeedingTaskTest extends AbstractFileSystemTestCase } }); - task.createExecutor(DATA_SET_CODE).execute(); + task.createExecutor(DATA_SET_CODE, false).execute(); } private void prepareHappyCase(final IDatasetLocation dataSet) diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTaskTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTaskTest.java index abc385d136b..513aee5b041 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTaskTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTaskTest.java @@ -94,7 +94,7 @@ public class ArchivingPostRegistrationTaskTest extends AssertJUnit LogMonitoringAppender.addAppender(LogCategory.NOTIFY, createEmailMessage(DATASET_CODE)); - task.createExecutor(DATASET_CODE).execute(); + task.createExecutor(DATASET_CODE, false).execute(); appender.verifyLogHasHappened(); context.assertIsSatisfied(); diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTaskTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTaskTest.java index d242bf4c224..22e2fb0f3b7 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTaskTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTaskTest.java @@ -129,7 +129,7 @@ public class EagerShufflingTaskTest extends AbstractFileSystemTestCase } }); - IPostRegistrationTaskExecutor executor = task.createExecutor(DATA_SET_CODE1); + IPostRegistrationTaskExecutor executor = task.createExecutor(DATA_SET_CODE1, false); executor.createCleanupTask(); executor.execute(); @@ -157,7 +157,7 @@ public class EagerShufflingTaskTest extends AbstractFileSystemTestCase } }); - IPostRegistrationTaskExecutor executor = task.createExecutor(DATA_SET_CODE1); + IPostRegistrationTaskExecutor executor = task.createExecutor(DATA_SET_CODE1, false); executor.createCleanupTask(); executor.execute(); @@ -180,7 +180,7 @@ public class EagerShufflingTaskTest extends AbstractFileSystemTestCase RecordingMatcher<String> logMessageMatcher = prepareLogging(LogLevel.WARN); - IPostRegistrationTaskExecutor executor = task.createExecutor(DATA_SET_CODE1); + IPostRegistrationTaskExecutor executor = task.createExecutor(DATA_SET_CODE1, false); executor.createCleanupTask(); executor.execute(); diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/NotifyingTaskTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/NotifyingTaskTest.java index e3160ee4702..986d5a74340 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/NotifyingTaskTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/NotifyingTaskTest.java @@ -85,7 +85,7 @@ public class NotifyingTaskTest extends AbstractFileSystemTestCase } }); NotifyingTask notifyingTask = new NotifyingTask(properties, service); - IPostRegistrationTaskExecutor executor = notifyingTask.createExecutor(DATA_SET_CODE); + IPostRegistrationTaskExecutor executor = notifyingTask.createExecutor(DATA_SET_CODE, false); ICleanupTask cleanupTask = executor.createCleanupTask(); executor.execute(); diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTaskTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTaskTest.java index caf2edab293..1126f21a76f 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTaskTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTaskTest.java @@ -103,9 +103,9 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC return task.requiresDataStoreLock(); } - public IPostRegistrationTaskExecutor createExecutor(String dataSetCode) + public IPostRegistrationTaskExecutor createExecutor(String dataSetCode, boolean container) { - return task.createExecutor(dataSetCode); + return task.createExecutor(dataSetCode, container); } } @@ -283,7 +283,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC DataSetBuilder ds2 = new DataSetBuilder(2).code("ds-2").registrationDate(new Date(4711)); will(returnValue(Arrays.asList(ds2.getDataSet(), ds1.getDataSet()))); - one(task1).createExecutor("ds-1"); + one(task1).createExecutor("ds-1", false); will(returnValue(executor1)); inSequence(sequence); one(executor1).createCleanupTask(); @@ -291,7 +291,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC inSequence(sequence); one(executor1).execute(); inSequence(sequence); - one(task2).createExecutor("ds-1"); + one(task2).createExecutor("ds-1", false); will(returnValue(executor2)); inSequence(sequence); one(executor2).createCleanupTask(); @@ -300,7 +300,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC one(executor2).execute(); inSequence(sequence); - one(task1).createExecutor("ds-2"); + one(task1).createExecutor("ds-2", false); will(returnValue(executor1)); inSequence(sequence); one(executor1).createCleanupTask(); @@ -308,7 +308,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC inSequence(sequence); one(executor1).execute(); inSequence(sequence); - one(task2).createExecutor("ds-2"); + one(task2).createExecutor("ds-2", false); will(returnValue(executor2)); inSequence(sequence); one(executor2).createCleanupTask(); @@ -364,7 +364,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC DataSetBuilder ds2 = new DataSetBuilder(2).code("ds-2").registrationDate(new Date(42)); will(returnValue(Arrays.asList(ds2.getDataSet(), ds1.getDataSet()))); - one(task1).createExecutor("ds-1"); + one(task1).createExecutor("ds-1", false); will(returnValue(executor1)); inSequence(sequence); one(executor1).createCleanupTask(); @@ -372,7 +372,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC inSequence(sequence); one(executor1).execute(); inSequence(sequence); - one(task2).createExecutor("ds-1"); + one(task2).createExecutor("ds-1", false); will(returnValue(executor2)); inSequence(sequence); one(executor2).createCleanupTask(); @@ -420,7 +420,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC DataSetBuilder ds3 = new DataSetBuilder(3).code("ds-3").registrationDate(new Date(4711)); will(returnValue(Arrays.asList(ds2.getDataSet(), ds3.getDataSet(), ds1.getDataSet()))); - one(task1).createExecutor("ds-1"); + one(task1).createExecutor("ds-1", false); will(returnValue(executor1)); inSequence(sequence); one(executor1).createCleanupTask(); @@ -428,7 +428,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC inSequence(sequence); one(executor1).execute(); inSequence(sequence); - one(task2).createExecutor("ds-1"); + one(task2).createExecutor("ds-1", false); will(returnValue(executor2)); inSequence(sequence); one(executor2).createCleanupTask(); @@ -437,7 +437,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC one(executor2).execute(); inSequence(sequence); - one(task1).createExecutor("ds-2"); + one(task1).createExecutor("ds-2", false); will(returnValue(executor1)); inSequence(sequence); one(executor1).createCleanupTask(); @@ -445,7 +445,7 @@ public class PostRegistrationMaintenanceTaskTest extends AbstractFileSystemTestC inSequence(sequence); one(executor1).execute(); inSequence(sequence); - one(task2).createExecutor("ds-2"); + one(task2).createExecutor("ds-2", false); will(returnValue(executor2)); inSequence(sequence); one(executor2).createCleanupTask(); -- GitLab