コード例 #1
0
ファイル: ImageDAOTest.java プロジェクト: tolweb/tolweb-app
 private void compareImageVersions(ImageVersion v1, ImageVersion v2) {
   assertEquals(v1.getVersionId(), v2.getVersionId());
   assertEquals(v1.getImage().getId(), v2.getImage().getId());
   assertEquals(v1.getVersionName(), v2.getVersionName());
   assertEquals(v1.getContributor().getId(), v2.getContributor().getId());
   assertEquals(v1.getFileName(), v2.getFileName());
   assertEquals(v1.getFileSize(), v2.getFileSize());
   assertEquals(v1.getHeight(), v2.getHeight());
   assertEquals(v1.getWidth(), v2.getWidth());
   assertEquals(v1.getIsMaster(), v2.getIsMaster());
   assertEquals(v1.getIsMaxSize(), v2.getIsMaxSize());
 }
コード例 #2
0
ファイル: ImageDAOTest.java プロジェクト: tolweb/tolweb-app
 public void testImageVersions() {
   NodeImage number3 = dao.getImageWithId(3);
   ImageVersion masterVersion = new ImageVersion();
   masterVersion.setImage(number3);
   masterVersion.setVersionName("master");
   masterVersion.setContributor(david);
   masterVersion.setFileName("xxx.jpg");
   masterVersion.setFileSize("100k");
   masterVersion.setHeight(new Integer(768));
   masterVersion.setWidth(new Integer(1024));
   masterVersion.setIsMaster(true);
   masterVersion.setIsMaxSize(false);
   dao.saveImageVersion(masterVersion);
   ImageVersion dbVersion = dao.getImageVersionWithId(masterVersion.getVersionId());
   assertNotNull(dbVersion);
   compareImageVersions(masterVersion, dbVersion);
   List versionsForImage = dao.getVersionsForImage(number3);
   assertEquals(versionsForImage.size(), 1);
   ImageVersion shouldBeSameAsMasterVersion = (ImageVersion) versionsForImage.get(0);
   assertEquals(shouldBeSameAsMasterVersion.getVersionId(), masterVersion.getVersionId());
   dao.deleteImageVersion(masterVersion);
 }