コード例 #1
0
 /**
  * Dumps <code>TRACE</code> data for a given metadata store.
  *
  * @param store The store to dump <code>TRACE</code> data for.
  */
 private void traceMetadataStoreData(OMEROMetadataStoreClient store) {
   containerCache = store.getContainerCache();
   referenceCache = store.getReferenceCache();
   log.trace("Starting container cache...");
   for (LSID key : containerCache.keySet()) {
     String s =
         String.format(
             "%s == %s,%s",
             key, containerCache.get(key).sourceObject, containerCache.get(key).LSID);
     log.trace(s);
   }
   log.trace("Starting reference cache...");
   for (LSID key : referenceCache.keySet()) {
     for (LSID value : referenceCache.get(key)) {
       String s = String.format("%s == %s", key, value);
       log.trace(s);
     }
   }
   log.trace("containerCache contains " + containerCache.size() + " entries.");
   log.trace("referenceCache contains " + store.countCachedReferences(null, null) + " entries.");
   List<IObjectContainer> imageContainers = store.getIObjectContainers(Image.class);
   for (IObjectContainer imageContainer : imageContainers) {
     Image image = (Image) imageContainer.sourceObject;
     log.trace(
         String.format(
             "Image indexes:%s name:%s", imageContainer.indexes, image.getName().getValue()));
   }
 }
コード例 #2
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testLogicalChannelRefs() {
   Class<? extends IObject> klass = LogicalChannel.class;
   List<IObjectContainer> containers = store.getIObjectContainers(klass);
   referenceCache = store.getReferenceCache();
   for (IObjectContainer container : containers) {
     LSID lsid = new LSID(container.LSID);
     if (!referenceCache.containsKey(lsid)) {
       continue;
     }
     List<LSID> references = referenceCache.get(lsid);
     assertTrue(references.size() > 0);
     for (LSID referenceLSID : references) {
       String asString = referenceLSID.toString();
       if (asString.endsWith(OMEROMetadataStoreClient.OMERO_EMISSION_FILTER_SUFFIX)
           || asString.endsWith(OMEROMetadataStoreClient.OMERO_EXCITATION_FILTER_SUFFIX)) {
         int index = asString.lastIndexOf(':');
         referenceLSID = new LSID(asString.substring(0, index));
       }
       assertNotNull(referenceLSID);
       List<Class<? extends IObject>> klasses = new ArrayList<Class<? extends IObject>>();
       klasses.add(Filter.class);
       klasses.add(FilterSet.class);
       String e = String.format("LSID %s not found in container cache", referenceLSID);
       assertTrue(e, authoritativeLSIDExists(klasses, referenceLSID));
     }
   }
 }
コード例 #3
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testPlatesExist() {
   List<IObjectContainer> containers = store.getIObjectContainers(WellSample.class);
   for (IObjectContainer container : containers) {
     Map<String, Integer> indexes = container.indexes;
     Integer plateIndex = indexes.get(Index.PLATE_INDEX.getValue());
     String e = String.format("Plate %d not found in container cache", plateIndex);
     assertTrue(e, store.countCachedContainers(Plate.class, plateIndex) > 0);
   }
 }
コード例 #4
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testPlaneInfoZCT() {
   List<IObjectContainer> containers = store.getIObjectContainers(PlaneInfo.class);
   for (IObjectContainer container : containers) {
     PlaneInfo planeInfo = (PlaneInfo) container.sourceObject;
     assertNotNull("theZ is null", planeInfo.getTheZ());
     assertNotNull("theC is null", planeInfo.getTheC());
     assertNotNull("theT is null", planeInfo.getTheT());
   }
 }
コード例 #5
0
 /**
  * Examines the container cache and returns whether or not an LSID is present.
  *
  * @param klass Instance class of the source object container.
  * @param lsid LSID to compare against.
  * @return <code>true</code> if the object exists in the container cache, and <code>false</code>
  *     otherwise.
  */
 private boolean authoritativeLSIDExists(Class<? extends IObject> klass, LSID lsid) {
   List<IObjectContainer> containers = store.getIObjectContainers(klass);
   for (IObjectContainer container : containers) {
     LSID containerLSID = new LSID(container.LSID);
     if (containerLSID.equals(lsid)) {
       return true;
     }
   }
   return false;
 }
コード例 #6
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testObjectiveSettingsIndexes() {
   Class<? extends IObject> klass = ObjectiveSettings.class;
   List<IObjectContainer> containers = store.getIObjectContainers(klass);
   for (IObjectContainer container : containers) {
     Map<String, Integer> indexes = container.indexes;
     Integer imageIndex = indexes.get(Index.IMAGE_INDEX.getValue());
     int imageCount = store.countCachedContainers(Image.class, null);
     String e = String.format("imageIndex %d >= imageCount %d", imageIndex, imageCount);
     assertFalse(e, imageIndex >= imageCount);
   }
 }
コード例 #7
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testOTFIsReferenced() {
   Class<? extends IObject> klass = OTF.class;
   List<IObjectContainer> containers = store.getIObjectContainers(klass);
   referenceCache = store.getReferenceCache();
   for (IObjectContainer container : containers) {
     LSID lsid = new LSID(container.LSID);
     for (LSID target : referenceCache.keySet()) {
       for (LSID reference : referenceCache.get(target)) {
         if (reference.equals(lsid)) {
           return;
         }
       }
     }
     fail(String.format("%s %s not referenced by any object.", klass, lsid));
   }
 }
コード例 #8
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testCreationDateIsReasonable() {
   List<IObjectContainer> containers = store.getIObjectContainers(Image.class);
   for (IObjectContainer container : containers) {
     Image image = (Image) container.sourceObject;
     assertNotNull(image.getAcquisitionDate());
     Date acquisitionDate = new Date(image.getAcquisitionDate().getValue());
     Date now = new Date(System.currentTimeMillis());
     Date january1st1995 = new GregorianCalendar(1995, 1, 1).getTime();
     if (acquisitionDate.after(now)) {
       fail(String.format("%s after %s", acquisitionDate, now));
     }
     if (acquisitionDate.before(january1st1995)) {
       fail(String.format("%s before %s", acquisitionDate, january1st1995));
     }
   }
 }
コード例 #9
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testLightSourceSettingsLightSourceRef() {
   Class<? extends IObject> klass = LightSettings.class;
   List<IObjectContainer> containers = store.getIObjectContainers(klass);
   referenceCache = store.getReferenceCache();
   for (IObjectContainer container : containers) {
     LSID lsid = new LSID(container.LSID);
     String e = String.format("%s %s not found in reference cache", klass, container.LSID);
     assertTrue(e, referenceCache.containsKey(lsid));
     List<LSID> references = referenceCache.get(lsid);
     assertTrue(references.size() > 0);
     for (LSID referenceLSID : references) {
       assertNotNull(referenceLSID);
       klass = LightSource.class;
       e = String.format("%s with LSID %s not found in container cache", klass, referenceLSID);
       assertTrue(e, authoritativeLSIDExists(klass, referenceLSID));
     }
   }
 }
コード例 #10
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testChannelCount() {
   List<IObjectContainer> containers = store.getIObjectContainers(Pixels.class);
   for (IObjectContainer container : containers) {
     Pixels pixels = (Pixels) container.sourceObject;
     assertNotNull(pixels.getSizeC());
     int sizeC = pixels.getSizeC().getValue();
     Integer imageIndex = container.indexes.get(Index.IMAGE_INDEX.getValue());
     int count = store.countCachedContainers(Channel.class, imageIndex);
     String e = String.format("Pixels sizeC %d != channel object count %d", sizeC, count);
     for (int c = 0; c < sizeC; c++) {
       count = store.countCachedContainers(Channel.class, imageIndex, c);
       e =
           String.format(
               "Missing channel object; imageIndex=%d " + "channelIndex=%d", imageIndex, c);
       assertEquals(e, 1, count);
     }
   }
 }
コード例 #11
0
 @Test(dependsOnMethods = {"testMetadataLevel"})
 public void testFilterSetRefs() {
   Class<? extends IObject> klass = FilterSet.class;
   List<IObjectContainer> containers = store.getIObjectContainers(klass);
   referenceCache = store.getReferenceCache();
   for (IObjectContainer container : containers) {
     LSID lsid = new LSID(container.LSID);
     if (!referenceCache.containsKey(lsid)) {
       continue;
     }
     List<LSID> references = referenceCache.get(lsid);
     assertTrue(references.size() > 0);
     for (LSID referenceLSID : references) {
       assertNotNull(referenceLSID);
       List<Class<? extends IObject>> klasses = new ArrayList<Class<? extends IObject>>();
       klasses.add(Filter.class);
       klasses.add(Dichroic.class);
       String e = String.format("LSID %s not found in container cache", referenceLSID);
       assertTrue(e, authoritativeLSIDExists(klasses, referenceLSID));
     }
   }
 }