Search in sources :

Example 6 with XMPPComponent

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);
}
Also used : XMPPComponent(com.zimbra.cs.account.XMPPComponent)

Example 7 with XMPPComponent

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);
}
Also used : XMPPComponent(com.zimbra.cs.account.XMPPComponent)

Example 8 with XMPPComponent

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);
}
Also used : AccountServiceException(com.zimbra.cs.account.AccountServiceException) HashMap(java.util.HashMap) XMPPComponent(com.zimbra.cs.account.XMPPComponent)

Example 9 with XMPPComponent

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;
}
Also used : HashMap(java.util.HashMap) XMPPComponent(com.zimbra.cs.account.XMPPComponent)

Example 10 with XMPPComponent

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);
}
Also used : XMPPComponent(com.zimbra.cs.account.XMPPComponent) HashSet(java.util.HashSet)

Aggregations

XMPPComponent (com.zimbra.cs.account.XMPPComponent)20 Element (com.zimbra.common.soap.Element)5 LdapXMPPComponent (com.zimbra.cs.account.ldap.entry.LdapXMPPComponent)5 Provisioning (com.zimbra.cs.account.Provisioning)4 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)4 HashMap (java.util.HashMap)4 Key (com.zimbra.common.account.Key)3 AccountServiceException (com.zimbra.cs.account.AccountServiceException)3 Server (com.zimbra.cs.account.Server)3 XMPPComponentBy (com.zimbra.common.account.Key.XMPPComponentBy)2 ServiceException (com.zimbra.common.service.ServiceException)2 AuthFailedServiceException (com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException)2 Domain (com.zimbra.cs.account.Domain)2 ArrayList (java.util.ArrayList)2 DomainBy (com.zimbra.common.account.Key.DomainBy)1 XMLElement (com.zimbra.common.soap.Element.XMLElement)1 Account (com.zimbra.cs.account.Account)1 AlwaysOnCluster (com.zimbra.cs.account.AlwaysOnCluster)1 DynamicGroup (com.zimbra.cs.account.DynamicGroup)1 Group (com.zimbra.cs.account.Group)1