From f4c521e743b43cc48c45c0983e07ee3ef95bb9ea Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Thu, 21 Jan 2010 18:07:41 +0000 Subject: [PATCH] fix: compile errors due to changed CIFEX listener class SVN: 14397 --- .../dss/generic/server/UploadingCommand.java | 35 ++++++++-------- .../generic/server/UploadingCommandTest.java | 41 +++++++++++-------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommand.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommand.java index 1375fbe8c0f..1baa30a7990 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommand.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommand.java @@ -80,12 +80,7 @@ class UploadingCommand implements IDataSetCommand this.zipFile = zipFile; } - public void warningOccured(String warningMessage) - { - operationLog.warn(warningMessage); - } - - public void start(File file, long fileSize) + public void start(File file, long fileSize, Long fileIdOrNull) { if (operationLog.isInfoEnabled()) { @@ -97,7 +92,8 @@ class UploadingCommand implements IDataSetCommand { } - public void finished(boolean successful) + public void finished(boolean successful, List<String> warningMessages, + List<Throwable> exceptions) { if (successful) { @@ -109,22 +105,29 @@ class UploadingCommand implements IDataSetCommand { operationLog.warn("Uploading of zip file " + zipFile + " has been aborted or failed."); + for (String warningMessage : warningMessages) + { + operationLog.warn(warningMessage); + + } + for (Throwable throwable : exceptions) + { + notificationLog.error("An error occured during uploading of zip file " + + zipFile + ".", throwable); + } sendEMail("Uploading of zip file " + zipFile.getName() + " with requested data sets failed."); } } - public void exceptionOccured(Throwable throwable) - { - notificationLog.error("An error occured during uploading of zip file " + zipFile + ".", - throwable); - } } private static final class MetaDataBuilder { private static final String DATA_SET = "data_set"; + private static final String SAMPLE = "sample"; + private static final String EXPERIMENT = "experiment"; private static final char DELIM = '\t'; @@ -133,22 +136,22 @@ class UploadingCommand implements IDataSetCommand new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); private final StringBuilder builder = new StringBuilder(); - + void dataSetProperties(List<IEntityProperty> properties) { addProperties(DATA_SET, properties); } - + void sampleProperties(List<IEntityProperty> properties) { addProperties(SAMPLE, properties); } - + void experimentProperties(List<IEntityProperty> properties) { addProperties(EXPERIMENT, properties); } - + void addProperties(String category, List<IEntityProperty> properties) { for (IEntityProperty property : properties) diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommandTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommandTest.java index 5e9bcfbfb1b..5375dd76376 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommandTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommandTest.java @@ -260,13 +260,15 @@ public class UploadingCommandTest extends AssertJUnit one(uploader).upload( Collections.singletonList(new File(TMP, ZIP_FILENAME + ".zip")), "id:user", null); - will(new CustomAction("report 'finish' to listener") { - public Object invoke(Invocation invocation) throws Throwable + will(new CustomAction("report 'finish' to listener") { - listener[0].finished(true); - return null; - } - }); + public Object invoke(Invocation invocation) throws Throwable + { + listener[0].finished(true, Collections.<String> emptyList(), + Collections.<Throwable> emptyList()); + return null; + } + }); } }); @@ -326,13 +328,15 @@ public class UploadingCommandTest extends AssertJUnit one(uploader).upload( Collections.singletonList(new File(TMP, ZIP_FILENAME + ".zip")), "id:user", null); - will(new CustomAction("report 'abort' to listener") { - public Object invoke(Invocation invocation) throws Throwable + will(new CustomAction("report 'abort' to listener") { - listener[0].finished(false); - return null; - } - }); + public Object invoke(Invocation invocation) throws Throwable + { + listener[0].finished(false, Collections.<String> emptyList(), + Collections.<Throwable> emptyList()); + return null; + } + }); } }); @@ -377,20 +381,23 @@ public class UploadingCommandTest extends AssertJUnit assertEquals("data_set\tcode\t1\n" + "data_set\tproduction_timestamp\t\n" + "data_set\tproducer_code\t\n" + "data_set\tdata_set_type\tD\n" + "data_set\tis_measured\tFALSE\n" + "data_set\tis_complete\tFALSE\n" - + "data_set\tparent_codes\tparent2,parent1\n" + "experiment\tgroup_code\tg1\n" - + "experiment\tproject_code\tp1\n" + "experiment\texperiment_code\texp1\n" + + "data_set\tparent_codes\tparent2,parent1\n" + + "experiment\tgroup_code\tg1\n" + "experiment\tproject_code\tp1\n" + + "experiment\texperiment_code\texp1\n" + "experiment\texperiment_type_code\tE\n" + "experiment\tregistration_timestamp\t1970-01-01 01:00:00 +0100\n" + "experiment\tregistrator\tCharles Darwin <cd@cd.org>\n", outputStream .toString()); } catch (AssertionError err) { - // We have an ambiguity here: sometimes we get "parent1,parent2", sometimes we get "parent2,parent1" + // We have an ambiguity here: sometimes we get "parent1,parent2", sometimes we get + // "parent2,parent1" assertEquals("data_set\tcode\t1\n" + "data_set\tproduction_timestamp\t\n" + "data_set\tproducer_code\t\n" + "data_set\tdata_set_type\tD\n" + "data_set\tis_measured\tFALSE\n" + "data_set\tis_complete\tFALSE\n" - + "data_set\tparent_codes\tparent1,parent2\n" + "experiment\tgroup_code\tg1\n" - + "experiment\tproject_code\tp1\n" + "experiment\texperiment_code\texp1\n" + + "data_set\tparent_codes\tparent1,parent2\n" + + "experiment\tgroup_code\tg1\n" + "experiment\tproject_code\tp1\n" + + "experiment\texperiment_code\texp1\n" + "experiment\texperiment_type_code\tE\n" + "experiment\tregistration_timestamp\t1970-01-01 01:00:00 +0100\n" + "experiment\tregistrator\tCharles Darwin <cd@cd.org>\n", outputStream -- GitLab