public void testBindFailures()
{
StudioProgressMonitor monitor = null;
ConnectionParameter connectionParameter = null;
Connection connection = null;
JNDIConnectionWrapper connectionWrapper = null;
// simple auth without principal and credential
monitor = getProgressMonitor();
connectionParameter = new ConnectionParameter( null, "localhost", ldapServer.getPort(),
EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, "uid=admin", "invalid", null, true, null );
connection = new Connection( connectionParameter );
connectionWrapper = connection.getJNDIConnectionWrapper();
connectionWrapper.connect( monitor );
connectionWrapper.bind( monitor );
assertFalse( connectionWrapper.isConnected() );
assertNotNull( monitor.getException() );
assertTrue( monitor.getException() instanceof NamingException );
// simple auth with invalid principal and credential
monitor = getProgressMonitor();
connectionParameter = new ConnectionParameter( null, "localhost", ldapServer.getPort(),
EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "bar", null, true, null );
connection = new Connection( connectionParameter );
connectionWrapper = connection.getJNDIConnectionWrapper();
connectionWrapper.connect( monitor );
connectionWrapper.bind( monitor );
assertFalse( connectionWrapper.isConnected() );
assertNotNull( monitor.getException() );
assertTrue( monitor.getException() instanceof AuthenticationException );
}