diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBOTest.java index f0d9d53f44ed89e2a291e44868510c005aae8c8c..895fcadd8991903310e18c1c14999cddcddf2838 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBOTest.java @@ -984,15 +984,49 @@ public class DataBOTest extends AbstractBOTest context.assertIsSatisfied(); } + @Test public void testStorageConfirmed() { - // TODO:KUBA - // create a new data object with external data. - // check that externaldataPE has isstorage confirmed set to false + final DataSetTypePE dataSetType = createDataSetType(); + final FileFormatTypePE fileFormatType = new FileFormatTypePE(); + final VocabularyPE vocabulary = new VocabularyPE(); + vocabulary.addTerm(new VocabularyTermPE()); + VocabularyTermPE vocabularyTerm = new VocabularyTermPE(); + vocabularyTerm.setCode(StorageFormat.PROPRIETARY.toString()); + vocabulary.addTerm(vocabularyTerm); + final LocatorTypePE locatorType = new LocatorTypePE(); + SamplePE sample = new SamplePE(); + sample.setExperiment(new ExperimentPE()); + final DataStorePE dataStore = new DataStorePE(); + prepareDefineExternalData(dataSetType, fileFormatType, vocabulary, locatorType, dataStore); + + final DataPE data = new ExternalDataPE(); + data.setId(4711L); + data.setPlaceholder(true); + + context.checking(new Expectations() + { + { + one(dataDAO).tryToFindDataSetByCode(DATA_SET_CODE); + + will(returnValue(data)); + + one(dataDAO).updateDataSet(with(new DataMatcher()), with(EXAMPLE_PERSON)); + + expectMandatoryPropertiesCheck(this, dataSetType); + } + + }); + + IDataBO dataBO = createDataBO(); + dataBO.define(createDataSet(null), new ExperimentPE(), SourceType.DERIVED); + dataBO.save(); + + assertFalse(dataBO.isStorageConfirmed()); - // call dataBo. setstorageconfirmed on this instance of external data + dataBO.setStorageConfirmed(); - // check that the isstorage confirmed is now true on this element + assertTrue(dataBO.isStorageConfirmed()); }