use of com.zimbra.cs.account.Zimlet in project zm-mailbox by Zimbra.
the class TestLdapProvZimlet method createZimlet.
private Zimlet createZimlet(String zimletName) throws Exception {
Zimlet zimlet = prov.getZimlet(zimletName);
assertNull(zimlet);
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(Provisioning.A_zimbraZimletVersion, "1.0");
zimlet = prov.createZimlet(zimletName, attrs);
assertNotNull(zimlet);
prov.flushCache(CacheEntryType.zimlet, null);
zimlet = prov.getZimlet(zimletName);
assertNotNull(zimlet);
assertEquals(zimletName.toLowerCase(), zimlet.getName().toLowerCase());
return zimlet;
}
use of com.zimbra.cs.account.Zimlet in project zm-mailbox by Zimbra.
the class TestLdapProvZimlet method createZimletAlreadyExists.
@Test
public void createZimletAlreadyExists() throws Exception {
String ZIMLET_NAME = Names.makeZimletName(genZimletName());
Zimlet zimlet = createZimlet(ZIMLET_NAME);
boolean caughtException = false;
try {
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(Provisioning.A_zimbraZimletVersion, "1.0");
zimlet = prov.createZimlet(ZIMLET_NAME, attrs);
} catch (AccountServiceException e) {
if (AccountServiceException.ZIMLET_EXISTS.equals(e.getCode())) {
caughtException = true;
}
}
assertTrue(caughtException);
deleteZimlet(zimlet);
}
Aggregations