From 864cef63d5fb82d33252bab873cc514d912465a3 Mon Sep 17 00:00:00 2001 From: jakubs <jakubs> Date: Wed, 30 Jan 2013 15:32:39 +0000 Subject: [PATCH] resolve old todo - create a test SVN: 28247 --- .../server/business/bo/DataBOTest.java | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) 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 f0d9d53f44e..895fcadd899 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()); } -- GitLab