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();
}
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);
}
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);
}
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();
}
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();
}
Aggregations