Esempio n. 1
0
 public void process(PhotoImage img, Collection<String> errs) throws Exception {
   ImageServer is = Persistent.getImageServer();
   is.getThumbnail(img);
   for (PhotoDimensions dim : sizes) {
     is.getImage(img, dim);
   }
 }
Esempio n. 2
0
 public void process(PhotoImage img, Collection<String> errs) throws Exception {
   byte[] pi = Persistent.getImageServer().getImage(img, null);
   PhotoParser.Result res = PhotoParser.getInstance().parseImage(pi);
   String storedMd5 = img.getMd5();
   assert storedMd5 != null : "No MD5 for image " + img.getId();
   if (!storedMd5.equals(res.getMd5())) {
     errs.add("MD5 is incorrect for img " + img.getId());
   }
 }
Esempio n. 3
0
 public void process(PhotoImage img, Collection<String> errs) throws Exception {
   ImageServer is = Persistent.getImageServer();
   if (is instanceof ImageServerImpl) {
     ImageServerImpl isi = (ImageServerImpl) is;
     byte[] fromDB = isi.getImage(img, null, false);
     byte[] fromCache = isi.getImage(img, null, true);
     if (!Arrays.equals(fromDB, fromCache)) {
       errs.add("Didn't get the same result from cache and DB for " + img.getId());
     }
   } else {
     errs.add("Can't validate " + img.getId() + " because server is not ImageServerImpl");
   }
 }