log.trace("<test06RequestCounter()");
}
public void test07EndEntityProfileMappings() throws Exception {
// Add a couple of profiles and verify that the mappings and get functions work
EndEntityProfile profile1 = new EndEntityProfile();
profile1.setPrinterName("foo");
endEntityProfileSession.addEndEntityProfile(admin, "TESTEEPROFCACHE1", profile1);
EndEntityProfile profile2 = new EndEntityProfile();
profile2.setPrinterName("bar");
endEntityProfileSession.addEndEntityProfile(admin, "TESTEEPROFCACHE2", profile2);
int pid = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE1");
String name = endEntityProfileSession.getEndEntityProfileName(admin, pid);
int pid1 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE1");
String name1 = endEntityProfileSession.getEndEntityProfileName(admin, pid1);
assertEquals(pid, pid1);
assertEquals(name, name1);
EndEntityProfile profile = endEntityProfileSession.getEndEntityProfile(admin, pid);
assertEquals("foo", profile.getPrinterName());
profile = endEntityProfileSession.getEndEntityProfile(admin, name);
assertEquals("foo", profile.getPrinterName());
int pid2 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE2");
String name2 = endEntityProfileSession.getEndEntityProfileName(admin, pid2);
profile = endEntityProfileSession.getEndEntityProfile(admin, pid2);
assertEquals("bar", profile.getPrinterName());
profile = endEntityProfileSession.getEndEntityProfile(admin, name2);
assertEquals("bar", profile.getPrinterName());
// flush caches and make sure it is read correctly again
endEntityProfileSession.flushProfileCache();
int pid3 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE1");
String name3 = endEntityProfileSession.getEndEntityProfileName(admin, pid3);
assertEquals(pid1, pid3);
assertEquals(name1, name3);
profile = endEntityProfileSession.getEndEntityProfile(admin, pid3);
assertEquals("foo", profile.getPrinterName());
profile = endEntityProfileSession.getEndEntityProfile(admin, name3);
assertEquals("foo", profile.getPrinterName());
int pid4 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE2");
String name4 = endEntityProfileSession.getEndEntityProfileName(admin, pid4);
assertEquals(pid2, pid4);
assertEquals(name2, name4);
profile = endEntityProfileSession.getEndEntityProfile(admin, pid4);
assertEquals("bar", profile.getPrinterName());
profile = endEntityProfileSession.getEndEntityProfile(admin, name4);
assertEquals("bar", profile.getPrinterName());
// Remove a profile and make sure it is not cached still
endEntityProfileSession.removeEndEntityProfile(admin, "TESTEEPROFCACHE1");
profile = endEntityProfileSession.getEndEntityProfile(admin, pid1);
assertNull(profile);
int pid5 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE1");
assertEquals(0, pid5);
String name5 = endEntityProfileSession.getEndEntityProfileName(admin, pid5);
assertNull(name5);
// But the other, non-removed profile should still be there
int pid6 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE2");
String name6 = endEntityProfileSession.getEndEntityProfileName(admin, pid6);
assertEquals(pid2, pid6);
assertEquals(name2, name6);
profile = endEntityProfileSession.getEndEntityProfile(admin, pid6);
assertEquals("bar", profile.getPrinterName());
profile = endEntityProfileSession.getEndEntityProfile(admin, name6);
assertEquals("bar", profile.getPrinterName());
} // test07EndEntityProfileMappings