Skip to content
Snippets Groups Projects
Commit 5f2ca797 authored by cramakri's avatar cramakri
Browse files

SP-45 BIS-21 : Adde expectation for drawAUniqueId

SVN: 25337
parent 474d48bd
No related branches found
No related tags found
No related merge requests found
...@@ -69,7 +69,8 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends ...@@ -69,7 +69,8 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends
protected RecordingMatcher<AtomicEntityOperationDetails> setUpDataSetRegistrationExpectations( protected RecordingMatcher<AtomicEntityOperationDetails> setUpDataSetRegistrationExpectations(
final DataSetType dataSetType, final DataSetType tsvDataSetType) final DataSetType dataSetType, final DataSetType tsvDataSetType)
{ {
return setUpDataSetRegistrationExpectations(dataSetType, tsvDataSetType, true); return setUpDataSetRegistrationExpectations(
dataSetType, tsvDataSetType, true);
} }
protected RecordingMatcher<AtomicEntityOperationDetails> setUpDataSetRegistrationExpectations( protected RecordingMatcher<AtomicEntityOperationDetails> setUpDataSetRegistrationExpectations(
...@@ -83,11 +84,13 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends ...@@ -83,11 +84,13 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends
context.checking(new Expectations() context.checking(new Expectations()
{ {
{ {
one(openBisService).createDataSetCode(); one(
openBisService).createDataSetCode();
will(returnValue(DATA_SET_CODE)); will(returnValue(DATA_SET_CODE));
String excelDataSetCode = DATA_SET_CODE + "-EXCEL"; String excelDataSetCode = DATA_SET_CODE + "-EXCEL";
one(openBisService).createDataSetCode(); one(
openBisService).createDataSetCode();
will(returnValue(excelDataSetCode)); will(returnValue(excelDataSetCode));
// Some if there is a multistrain data set type, it needs to be taken care of in // Some if there is a multistrain data set type, it needs to be taken care of in
...@@ -95,33 +98,44 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends ...@@ -95,33 +98,44 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends
if (tsvDataSetType == TSV_MULTISTRAIN_EXPORT_DATA_SET_TYPE) if (tsvDataSetType == TSV_MULTISTRAIN_EXPORT_DATA_SET_TYPE)
{ {
String tsvMultistrain = DATA_SET_CODE + "-TSV-MULTISTRAIN"; String tsvMultistrain = DATA_SET_CODE + "-TSV-MULTISTRAIN";
one(openBisService).createDataSetCode(); one(
openBisService).createDataSetCode();
will(returnValue(tsvMultistrain)); will(returnValue(tsvMultistrain));
} }
String tsvDataSetCode = DATA_SET_CODE + "-TSV"; String tsvDataSetCode = DATA_SET_CODE + "-TSV";
if (requireSingleStrainTsvExport) if (requireSingleStrainTsvExport)
{ {
one(openBisService).createDataSetCode(); one(
openBisService).createDataSetCode();
will(returnValue(tsvDataSetCode)); will(returnValue(tsvDataSetCode));
} }
atLeast(1).of(openBisService).tryToGetExperiment( atLeast(
1).of(
openBisService).tryToGetExperiment(
new ExperimentIdentifierFactory(experiment.getIdentifier()) new ExperimentIdentifierFactory(experiment.getIdentifier())
.createIdentifier()); .createIdentifier());
will(returnValue(experiment)); will(returnValue(experiment));
allowing(openBisService).tryToGetExperiment(null); allowing(
openBisService).tryToGetExperiment(
null);
will(returnValue(null)); will(returnValue(null));
one(dataSetValidator).assertValidDataSet(dataSetType, null); one(
dataSetValidator).assertValidDataSet(
dataSetType, null);
one(dataSetValidator).assertValidDataSet(new DataSetType("EXCEL_ORIGINAL"), one(
dataSetValidator).assertValidDataSet(
new DataSetType("EXCEL_ORIGINAL"),
new File(new File(stagingDirectory, excelDataSetCode), "xls")); new File(new File(stagingDirectory, excelDataSetCode), "xls"));
if (tsvDataSetType == TSV_MULTISTRAIN_EXPORT_DATA_SET_TYPE) if (tsvDataSetType == TSV_MULTISTRAIN_EXPORT_DATA_SET_TYPE)
{ {
one(dataSetValidator).assertValidDataSet( one(
dataSetValidator).assertValidDataSet(
TSV_MULTISTRAIN_EXPORT_DATA_SET_TYPE, TSV_MULTISTRAIN_EXPORT_DATA_SET_TYPE,
new File(new File(stagingDirectory, DATA_SET_CODE new File(new File(stagingDirectory, DATA_SET_CODE
+ "-TSV-MULTISTRAIN"), "tsv-multi")); + "-TSV-MULTISTRAIN"), "tsv-multi"));
...@@ -129,15 +143,25 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends ...@@ -129,15 +143,25 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends
if (requireSingleStrainTsvExport) if (requireSingleStrainTsvExport)
{ {
one(dataSetValidator).assertValidDataSet(TSV_DATA_SET_TYPE, one(
dataSetValidator).assertValidDataSet(
TSV_DATA_SET_TYPE,
new File(new File(stagingDirectory, tsvDataSetCode), "tsv")); new File(new File(stagingDirectory, tsvDataSetCode), "tsv"));
} }
one(openBisService).performEntityOperations(with(atomicatOperationDetails)); one(
openBisService).drawANewUniqueID();
will(returnValue(new Long(1)));
one(
openBisService).performEntityOperations(
with(atomicatOperationDetails));
will(returnValue(new AtomicEntityOperationResult())); will(returnValue(new AtomicEntityOperationResult()));
allowing(openBisService).setStorageConfirmed(with(any(String.class))); allowing(
openBisService).setStorageConfirmed(
with(any(String.class)));
} }
}); });
...@@ -146,19 +170,21 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends ...@@ -146,19 +170,21 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends
protected Properties createThreadProperties() protected Properties createThreadProperties()
{ {
return createThreadPropertiesRelativeToScriptsFolder("data-set-handler.py", return createThreadPropertiesRelativeToScriptsFolder(
"dist/etc/shared/shared-classes.py," + getRegistrationScriptsFolderPath() "data-set-handler.py", "dist/etc/shared/shared-classes.py,"
+ "/data-set-validator.py"); + getRegistrationScriptsFolderPath() + "/data-set-validator.py");
} }
protected void createData(String fileName) throws IOException protected void createData(String fileName) throws IOException
{ {
File dataFile = new File("sourceTest/examples/" + fileName); File dataFile = new File("sourceTest/examples/" + fileName);
FileUtils.copyFileToDirectory(dataFile, workingDirectory); FileUtils.copyFileToDirectory(
dataFile, workingDirectory);
incomingDataSetFile = new File(workingDirectory, dataFile.getName()); incomingDataSetFile = new File(workingDirectory, dataFile.getName());
markerFile = new File(workingDirectory, IS_FINISHED_PREFIX + dataFile.getName()); markerFile = new File(workingDirectory, IS_FINISHED_PREFIX + dataFile.getName());
FileUtilities.writeToFile(markerFile, ""); FileUtilities.writeToFile(
markerFile, "");
} }
protected HashMap<String, NewProperty> getDataSetPropertiesMap( protected HashMap<String, NewProperty> getDataSetPropertiesMap(
...@@ -167,7 +193,8 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends ...@@ -167,7 +193,8 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends
HashMap<String, NewProperty> propertyMap = new HashMap<String, NewProperty>(); HashMap<String, NewProperty> propertyMap = new HashMap<String, NewProperty>();
for (NewProperty prop : dataSetProperties) for (NewProperty prop : dataSetProperties)
{ {
propertyMap.put(prop.getPropertyCode(), prop); propertyMap.put(
prop.getPropertyCode(), prop);
} }
return propertyMap; return propertyMap;
} }
...@@ -177,7 +204,8 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends ...@@ -177,7 +204,8 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends
HashMap<String, NewProperty> propertyMap = HashMap<String, NewProperty> propertyMap =
getDataSetPropertiesMap(dataSet.getDataSetProperties()); getDataSetPropertiesMap(dataSet.getDataSetProperties());
NewProperty property = propertyMap.get("DATA_TYPE"); NewProperty property = propertyMap.get("DATA_TYPE");
assertEquals(expectedValue, property.getValue()); assertEquals(
expectedValue, property.getValue());
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment