/** * Test method for {@link * org.jhove2.persist.berkeleydpl.BerkeleyDbFormatModuleAccessor#setProfiles(org.jhove2.module.format.FormatModule, * java.util.List)}. */ @Test public void testSetProfiles() { List<FormatProfile> profiles; try { profiles = bdbUTF8Module.getProfiles(); assertEquals(1, profiles.size()); bdbASCIIProfile = (ASCIIProfile) profiles.get(0); assertEquals(bdbUTF8Module.getModuleId(), bdbASCIIProfile.getFormatModuleId()); BerkeleyDbFormatModuleAccessor accessor = (BerkeleyDbFormatModuleAccessor) bdbUTF8Module.getModuleAccessor(); profiles = accessor.setProfiles(bdbUTF8Module, null); assertEquals(0, profiles.size()); profiles.add(bdbASCIIProfile); } catch (JHOVE2Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
/** * Test method for {@link * org.jhove2.persist.berkeleydpl.BerkeleyDbFormatModuleAccessor#getProfiles(org.jhove2.module.format.FormatModule)}. */ @Test public void testGetProfiles() { try { List<FormatProfile> profiles = bdbUTF8Module.getProfiles(); assertEquals(1, profiles.size()); } catch (JHOVE2Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
/** * Test method for {@link * org.jhove2.persist.berkeleydpl.BerkeleyDbBaseModuleAccessor#persistModule(org.jhove2.module.Module)}. */ @Test public void testPersistModule() { Long oldId = bdbUTF8Module.getModuleId(); try { bdbUTF8Module = (UTF8Module) bdbUTF8Module.getModuleAccessor().persistModule(bdbUTF8Module); assertEquals(oldId.longValue(), bdbUTF8Module.getModuleId().longValue()); BerkeleyDbBaseModuleAccessor ma = (BerkeleyDbBaseModuleAccessor) bdbUTF8Module.getModuleAccessor(); bdbUTF8Module = (UTF8Module) ma.retrieveModule(bdbUTF8Module.getModuleId()); assertEquals(oldId.longValue(), bdbUTF8Module.getModuleId().longValue()); } catch (JHOVE2Exception e) { e.printStackTrace(); fail(e.getMessage()); } }