コード例 #1
0
  @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));
  }
コード例 #2
0
  private ExternalDataPE createExternalData(String dataSetCode, SamplePE sampleOrNull) {
    ExternalDataPE externalData = new ExternalDataPE();

    externalData.setCode(dataSetCode);
    externalData.setDataSetType(getDataSetType(DataSetTypeCode.UNKNOWN));
    externalData.setExperiment(pickAnExperiment());
    if (sampleOrNull != null) {
      externalData.setSampleAcquiredFrom(sampleOrNull);
    } else {
      externalData.setDerived(true);
    }
    externalData.setFileFormatType(pickAFileFormatType());
    externalData.setLocatorType(pickALocatorType());
    externalData.setLocation("abcd");
    externalData.setComplete(BooleanOrUnknown.U);
    externalData.setStorageFormatVocabularyTerm(pickAStorageFormatVocabularyTerm());
    externalData.setPlaceholder(true);
    externalData.setDataStore(pickADataStore());
    return externalData;
  }