private void assertDataEqual(ExternalDataPE externalData, ExternalDataPE dataSet) { assertEquals(externalData.getCode(), dataSet.getCode()); assertEquals(externalData.getDataSetType(), dataSet.getDataSetType()); assertEquals(externalData.getExperiment(), dataSet.getExperiment()); assertEquals(externalData.getFileFormatType(), dataSet.getFileFormatType()); assertEquals(externalData.getLocatorType(), dataSet.getLocatorType()); assertEquals(externalData.getLocation(), dataSet.getLocation()); assertEquals(externalData.getComplete(), dataSet.getComplete()); assertEquals(externalData.getStorageFormat(), dataSet.getStorageFormat()); assertEquals(externalData.isPlaceholder(), dataSet.isPlaceholder()); assertEquals(externalData.isMeasured(), dataSet.isMeasured()); assertEquals(externalData.tryGetSample(), dataSet.tryGetSample()); }
@Test public void testUpdateDataSetAquiredFromSample() { IExternalDataDAO externalDataDAO = daoFactory.getExternalDataDAO(); DataPE data = new DataPE(); String dataSetCode = daoFactory.getPermIdDAO().createPermId(); data.setCode(dataSetCode); data.setDataSetType(getDataSetType(DataSetTypeCode.UNKNOWN)); data.setExperiment(pickAnExperiment()); data.setSampleAcquiredFrom(pickASample()); data.setPlaceholder(true); data.setDataStore(pickADataStore()); data.setModificationDate(new Date()); externalDataDAO.createDataSet(data); ExternalDataPE externalData = new ExternalDataPE(); externalData.setId(externalDataDAO.tryToFindDataSetByCode(dataSetCode).getId()); externalData.setCode(dataSetCode); externalData.setDataSetType(getDataSetType(DataSetTypeCode.UNKNOWN)); externalData.setDataStore(pickADataStore()); externalData.setExperiment(pickAnExperiment()); externalData.setSampleAcquiredFrom(pickASample()); externalData.setFileFormatType(pickAFileFormatType()); externalData.setLocatorType(pickALocatorType()); externalData.setLocation("abcd"); externalData.setComplete(BooleanOrUnknown.U); externalData.setStorageFormatVocabularyTerm(pickAStorageFormatVocabularyTerm()); externalData.setPlaceholder(true); final Date modificationTimestamp = data.getModificationDate(); externalData.setModificationDate(modificationTimestamp); externalDataDAO.updateDataSet(externalData); ExternalDataPE dataSet = (ExternalDataPE) externalDataDAO.tryToFindDataSetByCode(dataSetCode); assertEquals(externalData.getCode(), dataSet.getCode()); assertEquals(externalData.getDataSetType(), dataSet.getDataSetType()); assertEquals(externalData.getExperiment(), dataSet.getExperiment()); assertEquals(externalData.getFileFormatType(), dataSet.getFileFormatType()); assertEquals(externalData.getLocatorType(), dataSet.getLocatorType()); assertEquals(externalData.getLocation(), dataSet.getLocation()); assertEquals(externalData.getComplete(), dataSet.getComplete()); assertEquals(externalData.getStorageFormat(), dataSet.getStorageFormat()); assertEquals(externalData.isPlaceholder(), dataSet.isPlaceholder()); assertEquals(externalData.isMeasured(), dataSet.isMeasured()); assertFalse(externalData.getModificationDate().equals(modificationTimestamp)); }
@Test public final void testListExternalData() { testCreateDataSetWithSample(); final IExternalDataDAO externalDataDAO = daoFactory.getExternalDataDAO(); List<ExternalDataPE> list = externalDataDAO.listExternalData(pickASample()); assertEquals(1, list.size()); ExternalDataPE dataSet = list.get(0); assertEquals("abcd", dataSet.getLocation()); assertEquals(BooleanOrUnknown.U, dataSet.getComplete()); }