use of com.zimbra.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class TestLdapProvXMPPComponent method getXMPPComponentNotExist.
@Test
public void getXMPPComponentNotExist() throws Exception {
String XMPPCPNT_NAME = Names.makeXMPPName(genXMPPName());
XMPPComponent xmppCpnt = prov.get(Key.XMPPComponentBy.name, XMPPCPNT_NAME);
assertNull(xmppCpnt);
}
use of com.zimbra.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class TestLdapProvXMPPComponent method createXMPPComponent.
@Test
public void createXMPPComponent() throws Exception {
String XMPPCPNT_NAME = Names.makeXMPPName(genXMPPName());
XMPPComponent xmppCpnt = createXMPPComponent(XMPPCPNT_NAME);
deleteXMPPComponent(xmppCpnt);
}
use of com.zimbra.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class TestLdapProvXMPPComponent method createXMPPComponentAlreadyExists.
@Test
public void createXMPPComponentAlreadyExists() throws Exception {
String XMPPCPNT_NAME = Names.makeXMPPName(genXMPPName());
XMPPComponent xmppCpnt = createXMPPComponent(XMPPCPNT_NAME);
boolean caughtException = false;
try {
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(Provisioning.A_zimbraXMPPComponentCategory, "whatever");
attrs.put(Provisioning.A_zimbraXMPPComponentClassName, "whatever");
attrs.put(Provisioning.A_zimbraXMPPComponentType, "whatever");
prov.createXMPPComponent(XMPPCPNT_NAME, domain, server, attrs);
} catch (AccountServiceException e) {
if (AccountServiceException.IM_COMPONENT_EXISTS.equals(e.getCode())) {
caughtException = true;
}
}
assertTrue(caughtException);
deleteXMPPComponent(xmppCpnt);
}
use of com.zimbra.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class TestLdapProvXMPPComponent method createXMPPComponent.
private XMPPComponent createXMPPComponent(String xmppCpntName) throws Exception {
XMPPComponent xmppCpnt = prov.get(Key.XMPPComponentBy.name, xmppCpntName);
assertNull(xmppCpnt);
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(Provisioning.A_zimbraXMPPComponentCategory, "whatever");
attrs.put(Provisioning.A_zimbraXMPPComponentClassName, "whatever");
attrs.put(Provisioning.A_zimbraXMPPComponentType, "whatever");
xmppCpnt = prov.createXMPPComponent(xmppCpntName, domain, server, attrs);
assertNotNull(xmppCpnt);
xmppCpnt = prov.get(Key.XMPPComponentBy.name, xmppCpntName);
assertNotNull(xmppCpnt);
assertEquals(xmppCpntName.toLowerCase(), xmppCpnt.getName().toLowerCase());
return xmppCpnt;
}
use of com.zimbra.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class TestLdapProvXMPPComponent method getAllXMPPComponents.
@Test
public void getAllXMPPComponents() throws Exception {
String XMPPCPNT_NAME_1 = Names.makeXMPPName(genXMPPName("1"));
XMPPComponent xmppCpnt1 = createXMPPComponent(XMPPCPNT_NAME_1);
String XMPPCPNT_NAME_2 = Names.makeXMPPName(genXMPPName("2"));
XMPPComponent xmppCpnt2 = createXMPPComponent(XMPPCPNT_NAME_2);
List<XMPPComponent> allXMPPCpnts = prov.getAllXMPPComponents();
assertEquals(2, allXMPPCpnts.size());
Set<String> allXMPPCpntIds = new HashSet<String>();
for (XMPPComponent xmppCpnt : allXMPPCpnts) {
allXMPPCpntIds.add(xmppCpnt.getId());
}
assertTrue(allXMPPCpntIds.contains(xmppCpnt1.getId()));
assertTrue(allXMPPCpntIds.contains(xmppCpnt2.getId()));
deleteXMPPComponent(xmppCpnt1);
deleteXMPPComponent(xmppCpnt2);
}
Aggregations