protected Platform getPlatform(Hybridization hybridization) throws DataRetrievalException {
   ArrayDesign arrayDesign = hybridization.getArrayDesign();
   if (arrayDesign == null) {
     throw new DataRetrievalException(
         "There is no array design associated with the array for the hybridization "
             + hybridization.getName()
             + ", unable to load array data");
   }
   Platform platform = getDao().getPlatform(arrayDesign.getName());
   if (platform == null) {
     throw new DataRetrievalException(
         "The platform named " + arrayDesign.getName() + " hasn't been loaded into the system");
   }
   return platform;
 }
示例#2
0
 @Override
 protected void evaluateResults(
     List<? extends AbstractCaArrayEntity> resultsList,
     ExampleSearch search,
     TestResult testResult) {
   ArrayDesignSearch adSearch = (ArrayDesignSearch) search;
   List<ArrayDesign> adResults = (List<ArrayDesign>) resultsList;
   if (adSearch.getExpectedResults() != null || adSearch.getMinResults() != null) {
     int namedResults = 0;
     for (ArrayDesign arrayDesign : adResults) {
       if (arrayDesign.getName() != null) namedResults++;
     }
     if (adSearch.getExpectedResults() != null && namedResults != adSearch.getExpectedResults()) {
       testResult.setPassed(false);
       String detail =
           "Failed with unexpected number of results, ArrayDesign:"
               + adSearch.getArrayDesign().getName()
               + "- expected number of results: "
               + adSearch.getExpectedResults()
               + ", actual number of results: "
               + namedResults;
       testResult.addDetail(detail);
     } else {
       String detail = "Found expected number of results: " + namedResults;
       testResult.addDetail(detail);
     }
     if (adSearch.getMinResults() != null && namedResults < adSearch.getMinResults()) {
       testResult.setPassed(false);
       String detail =
           "Failed with unexpected minimum number of results, ArrayDesign:"
               + adSearch.getArrayDesign().getName()
               + "- expected number of results: "
               + adSearch.getMinResults()
               + ", actual number of results: "
               + namedResults;
       testResult.addDetail(detail);
     }
   }
   if (adSearch.getExample() == null) {
     if (adSearch.getExceptionClass() != null) {
       if (!adSearch.getExceptionClass().equals(InvalidInputException.class.toString())
           && !adSearch.getExceptionClass().equals(InvalidInputFault.class.toString())) {
         testResult.setPassed(false);
         String detail = "Failed with unexpected exception class: " + adSearch.getExceptionClass();
         testResult.addDetail(detail);
       } else {
         testResult.addDetail("Found expected exception " + adSearch.getExceptionClass());
       }
     }
   }
   for (ArrayDesign arrayDesign : adResults) {
     if (adSearch.getExpectedProvider() != null) {
       if (arrayDesign.getArrayProvider() == null
           || !arrayDesign.getArrayProvider().getName().equals(adSearch.getExpectedProvider())) {
         testResult.setPassed(false);
         String detail =
             "Failed with unexpected array provider: "
                 + (arrayDesign.getArrayProvider() == null
                     ? "null"
                     : arrayDesign.getArrayProvider().getName())
                 + ", expected provider: "
                 + adSearch.getExpectedProvider();
         testResult.addDetail(detail);
       } else {
         String detail = "Found expected provider: " + adSearch.getExpectedProvider();
         testResult.addDetail(detail);
       }
     }
     if (adSearch.getExpectedOrganism() != null) {
       if (arrayDesign.getOrganism() == null
           || !arrayDesign
               .getOrganism()
               .getCommonName()
               .equalsIgnoreCase(adSearch.getExpectedOrganism())) {
         testResult.setPassed(false);
         String detail =
             "Failed with unexpected organism common name: "
                 + (arrayDesign.getOrganism() == null
                     ? "null"
                     : arrayDesign.getOrganism().getCommonName())
                 + ", expected name: "
                 + adSearch.getExpectedOrganism();
         testResult.addDetail(detail);
       } else {
         String detail = "Found expected organism: " + adSearch.getExpectedOrganism();
         testResult.addDetail(detail);
       }
     }
   }
 }