Search in sources :

Example 11 with ServerGroup

use of com.iplanet.services.ldap.ServerGroup in project OpenAM by OpenRock.

the class ServerConfigurationFactoryTest method shouldReturnInstanceBindDN.

@Test
public void shouldReturnInstanceBindDN() throws ConnectionCredentialsNotFound, ServerConfigurationNotFound {
    // Given
    DSConfigMgr configMgr = mock(DSConfigMgr.class);
    ServerGroup serverGroup = mock(ServerGroup.class);
    given(configMgr.getServerGroup(anyString())).willReturn(serverGroup);
    ServerInstance mockInstance = mock(ServerInstance.class);
    given(configMgr.getServerInstance(anyString(), any(LDAPUser.Type.class))).willReturn(mockInstance);
    given(mockInstance.getAuthID()).willReturn("");
    ServerConfigurationFactory parser = new ServerConfigurationFactory(configMgr);
    // When
    String dn = parser.getServerConfiguration("", LDAPUser.Type.AUTH_ADMIN).getBindDN();
    // Then
    verify(mockInstance).getAuthID();
}
Also used : ServerGroup(com.iplanet.services.ldap.ServerGroup) DSConfigMgr(com.iplanet.services.ldap.DSConfigMgr) ServerConfigurationFactory(org.forgerock.openam.sm.ServerConfigurationFactory) Matchers.anyString(org.mockito.Matchers.anyString) ServerInstance(com.iplanet.services.ldap.ServerInstance) Test(org.testng.annotations.Test)

Example 12 with ServerGroup

use of com.iplanet.services.ldap.ServerGroup in project OpenAM by OpenRock.

the class ServerConfigurationFactoryTest method shouldIndicateInvalidIfServerInstanceIsNull.

@Test(expectedExceptions = ConnectionCredentialsNotFound.class)
public void shouldIndicateInvalidIfServerInstanceIsNull() throws ConnectionCredentialsNotFound, ServerConfigurationNotFound {
    // Given
    ServerGroup mockGroup = mock(ServerGroup.class);
    DSConfigMgr mockConfig = mock(DSConfigMgr.class);
    given(mockConfig.getServerGroup(anyString())).willReturn(mockGroup);
    given(mockConfig.getServerInstance(anyString(), any(LDAPUser.Type.class))).willReturn(null);
    ServerConfigurationFactory parser = new ServerConfigurationFactory(mockConfig);
    // When / Then
    parser.getServerConfiguration("", LDAPUser.Type.AUTH_ADMIN);
}
Also used : ServerGroup(com.iplanet.services.ldap.ServerGroup) DSConfigMgr(com.iplanet.services.ldap.DSConfigMgr) ServerConfigurationFactory(org.forgerock.openam.sm.ServerConfigurationFactory) Test(org.testng.annotations.Test)

Example 13 with ServerGroup

use of com.iplanet.services.ldap.ServerGroup in project OpenAM by OpenRock.

the class ServerConfigurationFactoryTest method shouldReturnRequestedServerGroup.

@Test
public void shouldReturnRequestedServerGroup() throws ConnectionCredentialsNotFound, ServerConfigurationNotFound {
    // Given
    String test = "badger";
    ServerGroup mockGroup = mock(ServerGroup.class);
    ServerInstance mockInstance = mock(ServerInstance.class);
    DSConfigMgr mockConfig = mock(DSConfigMgr.class);
    given(mockConfig.getServerGroup(test)).willReturn(mockGroup);
    given(mockConfig.getServerInstance(anyString(), any(LDAPUser.Type.class))).willReturn(mockInstance);
    ServerConfigurationFactory parser = new ServerConfigurationFactory(mockConfig);
    // When
    parser.getServerConfiguration(test, LDAPUser.Type.AUTH_ADMIN);
    // Then
    verify(mockConfig).getServerGroup(test);
}
Also used : ServerGroup(com.iplanet.services.ldap.ServerGroup) DSConfigMgr(com.iplanet.services.ldap.DSConfigMgr) ServerConfigurationFactory(org.forgerock.openam.sm.ServerConfigurationFactory) Matchers.anyString(org.mockito.Matchers.anyString) ServerInstance(com.iplanet.services.ldap.ServerInstance) Test(org.testng.annotations.Test)

Example 14 with ServerGroup

use of com.iplanet.services.ldap.ServerGroup in project OpenAM by OpenRock.

the class ServerGroupConfigurationTest method shouldReturnBindDNFromInstance.

@Test
public void shouldReturnBindDNFromInstance() {
    // Given
    ServerInstance mockInstance = mock(ServerInstance.class);
    ServerGroup mockGroup = mock(ServerGroup.class);
    ServerGroupConfiguration config = new ServerGroupConfiguration(mockGroup, mockInstance);
    // When
    config.getBindDN();
    // Then
    verify(mockInstance).getAuthID();
}
Also used : ServerGroup(com.iplanet.services.ldap.ServerGroup) ServerInstance(com.iplanet.services.ldap.ServerInstance) Test(org.testng.annotations.Test)

Example 15 with ServerGroup

use of com.iplanet.services.ldap.ServerGroup in project OpenAM by OpenRock.

the class ServerGroupConfigurationTest method shouldReturnMaxConnectionsFromInstance.

@Test
public void shouldReturnMaxConnectionsFromInstance() {
    // Given
    ServerInstance mockInstance = mock(ServerInstance.class);
    ServerGroup mockGroup = mock(ServerGroup.class);
    ServerGroupConfiguration config = new ServerGroupConfiguration(mockGroup, mockInstance);
    // When
    config.getMaxConnections();
    // Then
    verify(mockInstance).getMaxConnections();
}
Also used : ServerGroup(com.iplanet.services.ldap.ServerGroup) ServerInstance(com.iplanet.services.ldap.ServerInstance) Test(org.testng.annotations.Test)

Aggregations

ServerGroup (com.iplanet.services.ldap.ServerGroup)16 ServerInstance (com.iplanet.services.ldap.ServerInstance)11 DSConfigMgr (com.iplanet.services.ldap.DSConfigMgr)8 Test (org.testng.annotations.Test)8 Server (com.iplanet.services.ldap.Server)6 LDAPServiceException (com.iplanet.services.ldap.LDAPServiceException)4 ServerConfigurationFactory (org.forgerock.openam.sm.ServerConfigurationFactory)3 SystemProperties (com.iplanet.am.util.SystemProperties)2 IOException (java.io.IOException)2 Collection (java.util.Collection)2 Iterator (java.util.Iterator)2 Properties (java.util.Properties)2 MBeanServer (javax.management.MBeanServer)2 LDAPURL (org.forgerock.openam.ldap.LDAPURL)2 Connection (org.forgerock.opendj.ldap.Connection)2 ConnectionFactory (org.forgerock.opendj.ldap.ConnectionFactory)2 Matchers.anyString (org.mockito.Matchers.anyString)2 SSOToken (com.iplanet.sso.SSOToken)1 CLIException (com.sun.identity.cli.CLIException)1 IOutput (com.sun.identity.cli.IOutput)1