directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1804081 [5/6] - in /directory/studio/branches/studio-value: ./ dist/ eclipse-trgt-platform/template/ features/apacheds.feature/ features/ldapbrowser.feature/ features/ldifeditor.feature/ features/nls.feature/ features/openldap.feature/ fea...
Date Fri, 04 Aug 2017 08:59:17 GMT
Modified: directory/studio/branches/studio-value/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java Fri Aug  4 08:59:15 2017
@@ -22,14 +22,14 @@ package org.apache.directory.studio.test
 
 
 import static org.apache.directory.studio.test.integration.core.Constants.LOCALHOST;
+import static org.hamcrest.CoreMatchers.hasItems;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
-import java.net.ConnectException;
-import java.nio.channels.UnresolvedAddressException;
+import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -38,31 +38,23 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
 import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
-import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionParameter;
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
-import org.apache.directory.studio.connection.core.ConnectionParameter;
 import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
 import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
 import org.apache.directory.studio.connection.core.ConnectionParameter.NetworkProvider;
 import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
-import org.apache.directory.studio.connection.core.io.ConnectionWrapper;
 import org.apache.directory.studio.connection.core.io.api.DirectoryApiConnectionWrapper;
 import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeRootDSERunnable;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.BrowserConnection;
-import org.apache.mina.util.AvailablePortFinder;
-import org.eclipse.core.runtime.NullProgressMonitor;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 
 
 /**
@@ -71,176 +63,35 @@ import org.junit.runner.RunWith;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-@RunWith(FrameworkRunner.class)
-@CreateLdapServer(transports =
-    { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
-public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
+public class DirectoryApiConnectionWrapperTest extends ConnectionWrapperTestBase
 {
 
-    /**
-     * Tests connecting to the server.
-     */
-    @Test
-    public void testConnect()
+    public DirectoryApiConnectionWrapperTest()
     {
-        StudioProgressMonitor monitor = getProgressMonitor();
-        ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
-            EncryptionMethod.NONE, NetworkProvider.APACHE_DIRECTORY_LDAP_API, AuthenticationMethod.NONE, null, null,
-            null, true, null );
-        Connection connection = new Connection( connectionParameter );
-        ConnectionWrapper connectionWrapper = connection.getConnectionWrapper();
-
-        assertFalse( connectionWrapper.isConnected() );
-
-        connectionWrapper.connect( monitor );
-        assertTrue( connectionWrapper.isConnected() );
-        assertNull( monitor.getException() );
-
-        connectionWrapper.disconnect();
-        assertFalse( connectionWrapper.isConnected() );
-
-        // TODO: SSL, StartTLS
+        super( NetworkProvider.APACHE_DIRECTORY_LDAP_API );
     }
 
 
-    /**
-     * Test failed connections to the server.
-     */
-    @Test
-    public void testConnectFailures()
-    {
-        StudioProgressMonitor monitor = null;
-        ConnectionParameter connectionParameter = null;
-        Connection connection = null;
-        ConnectionWrapper connectionWrapper = null;
-
-        // invalid port
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, LOCALHOST, AvailablePortFinder.getNextAvailable(),
-            EncryptionMethod.NONE, NetworkProvider.APACHE_DIRECTORY_LDAP_API, AuthenticationMethod.NONE, null, null,
-            null, true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        assertFalse( connectionWrapper.isConnected() );
-        assertNotNull( monitor.getException() );
-        assertTrue( monitor.getException() instanceof InvalidConnectionException );
-        assertNotNull( monitor.getException().getCause() );
-        assertTrue( monitor.getException().getCause() instanceof ConnectException );
-
-        // unknown host
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, "555.555.555.555", ldapServer.getPort(),
-            EncryptionMethod.NONE, NetworkProvider.APACHE_DIRECTORY_LDAP_API, AuthenticationMethod.NONE, null, null,
-            null, true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        assertFalse( connectionWrapper.isConnected() );
-        assertNotNull( monitor.getException() );
-        assertTrue( monitor.getException() instanceof InvalidConnectionException );
-        assertNotNull( monitor.getException().getCause() );
-        assertTrue( monitor.getException().getCause() instanceof UnresolvedAddressException );
-
-        // TODO: SSL, StartTLS
-    }
-
+    // see tests in super class
 
-    /**
-     * Test binding to the server.
-     */
     @Test
-    public void testBind()
+    public void testSearchContinuationFollowParent() throws NamingException
     {
         StudioProgressMonitor monitor = getProgressMonitor();
-        ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
-            EncryptionMethod.NONE, NetworkProvider.APACHE_DIRECTORY_LDAP_API, AuthenticationMethod.SIMPLE,
-            "uid=admin,ou=system", "secret", null, true, null );
-        Connection connection = new Connection( connectionParameter );
-        ConnectionWrapper connectionWrapper = connection.getConnectionWrapper();
-
-        assertFalse( connectionWrapper.isConnected() );
-
-        connectionWrapper.connect( monitor );
-        connectionWrapper.bind( monitor );
-        assertTrue( connectionWrapper.isConnected() );
-        assertNull( monitor.getException() );
-
-        connectionWrapper.unbind();
-        connectionWrapper.disconnect();
-        assertFalse( connectionWrapper.isConnected() );
-
-    }
-
-
-    /**
-     * Test failed binds to the server.
-     */
-    @Test
-    public void testBindFailures()
-    {
-        StudioProgressMonitor monitor = null;
-        ConnectionParameter connectionParameter = null;
-        Connection connection = null;
-        ConnectionWrapper connectionWrapper = null;
-
-        // simple auth without principal and credential
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(), EncryptionMethod.NONE,
-            NetworkProvider.APACHE_DIRECTORY_LDAP_API, AuthenticationMethod.SIMPLE, "uid=admin", "invalid", null, true,
-            null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        connectionWrapper.bind( monitor );
-        assertFalse( connectionWrapper.isConnected() );
-        assertNotNull( monitor.getException() );
-        assertTrue( monitor.getException() instanceof Exception );
-        assertTrue( monitor.getException().getMessage().contains( "error code 49 - INVALID_CREDENTIALS" ) );
-
-        // simple auth with invalid principal and credential
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(), EncryptionMethod.NONE,
-            NetworkProvider.APACHE_DIRECTORY_LDAP_API, AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "bar", null,
-            true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        connectionWrapper.bind( monitor );
-        assertFalse( connectionWrapper.isConnected() );
-        assertNotNull( monitor.getException() );
-        assertTrue( monitor.getException() instanceof Exception );
-        assertTrue( monitor.getException().getMessage().contains( "error code 49 - INVALID_CREDENTIALS" ) );
-    }
-
-
-    /**
-     * Test searching.
-     */
-    @Test
-    public void testSearch()
-    {
-        StudioProgressMonitor monitor = null;
-        ConnectionParameter connectionParameter = null;
-        Connection connection = null;
-        ConnectionWrapper connectionWrapper = null;
-
-        // simple auth without principal and credential
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(), EncryptionMethod.NONE,
-            NetworkProvider.APACHE_DIRECTORY_LDAP_API, AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "secret",
-            null, true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        connectionWrapper.bind( monitor );
-        assertTrue( connectionWrapper.isConnected() );
-        assertNull( monitor.getException() );
-
         SearchControls searchControls = new SearchControls();
-        NamingEnumeration<SearchResult> result = connectionWrapper.search( "ou=system", "(objectClass=*)",
-            searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, null, monitor, null );
+        searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        NamingEnumeration<SearchResult> result = getConnectionWrapper( monitor ).search( "ou=referrals,ou=system",
+            "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.FOLLOW, null,
+            monitor, null );
+
+        assertFalse( monitor.isCanceled() );
+        assertFalse( monitor.errorsReported() );
         assertNotNull( result );
+
+        List<String> dns = consume( result, sr -> sr.getNameInNamespace() );
+        assertEquals( 4, dns.size() );
+        assertThat( dns, hasItems( "ou=referrals,ou=system", "ou=referrals,ou=system", "ou=users,ou=system",
+            "uid=user.1,ou=users,ou=system" ) );
     }
 
 
@@ -272,9 +123,9 @@ public class DirectoryApiConnectionWrapp
     public void testConcurrentUseAndCloseOfConnection() throws Exception
     {
         final StudioProgressMonitor monitor = getProgressMonitor();
-        final ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST,
-            ldapServer.getPort(), EncryptionMethod.NONE, NetworkProvider.APACHE_DIRECTORY_LDAP_API,
-            AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "secret", null, true, null );
+        final ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
+            EncryptionMethod.NONE, NetworkProvider.APACHE_DIRECTORY_LDAP_API, AuthenticationMethod.SIMPLE,
+            "uid=admin,ou=system", "secret", null, true, null );
         final Connection connection = new Connection( connectionParameter );
         final BrowserConnection browserConnection = new BrowserConnection( connection );
 
@@ -335,11 +186,4 @@ public class DirectoryApiConnectionWrapp
         assertTrue( closeFuture.isDone() );
     }
 
-
-    private StudioProgressMonitor getProgressMonitor()
-    {
-        StudioProgressMonitor monitor = new StudioProgressMonitor( new NullProgressMonitor() );
-        return monitor;
-    }
-
 }

Modified: directory/studio/branches/studio-value/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/JNDIConnectionWrapperTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/JNDIConnectionWrapperTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/JNDIConnectionWrapperTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/JNDIConnectionWrapperTest.java Fri Aug  4 08:59:15 2017
@@ -21,40 +21,8 @@
 package org.apache.directory.studio.test.integration.core;
 
 
-import static org.apache.directory.studio.test.integration.core.Constants.LOCALHOST;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.ConnectException;
-import java.net.UnknownHostException;
-
-import javax.naming.AuthenticationException;
-import javax.naming.CommunicationException;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
-import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
-import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
-import org.apache.directory.studio.connection.core.ConnectionParameter;
-import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
-import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
 import org.apache.directory.studio.connection.core.ConnectionParameter.NetworkProvider;
-import org.apache.directory.studio.connection.core.io.ConnectionWrapper;
 import org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper;
-import org.apache.mina.util.AvailablePortFinder;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 
 
 /**
@@ -63,176 +31,14 @@ import org.junit.runner.RunWith;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-@RunWith(FrameworkRunner.class)
-@CreateLdapServer(transports =
-    { @CreateTransport(protocol = "LDAP"),
-        @CreateTransport(protocol = "LDAPS") })
-public class JNDIConnectionWrapperTest extends AbstractLdapTestUnit
+public class JNDIConnectionWrapperTest extends ConnectionWrapperTestBase
 {
 
-    /**
-     * Tests connecting to the server.
-     */
-    @Test
-    public void testConnect()
+    public JNDIConnectionWrapperTest()
     {
-        StudioProgressMonitor monitor = getProgressMonitor();
-        ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
-            EncryptionMethod.NONE, NetworkProvider.JNDI, AuthenticationMethod.NONE, null, null, null, true, null );
-        Connection connection = new Connection( connectionParameter );
-        ConnectionWrapper connectionWrapper = connection.getConnectionWrapper();
-
-        assertFalse( connectionWrapper.isConnected() );
-
-        connectionWrapper.connect( monitor );
-        assertTrue( connectionWrapper.isConnected() );
-        assertNull( monitor.getException() );
-
-        connectionWrapper.disconnect();
-        assertFalse( connectionWrapper.isConnected() );
-
-        // TODO: SSL, StartTLS
-    }
-
-
-    /**
-     * Test failed connections to the server.
-     */
-    @Test
-    public void testConnectFailures()
-    {
-        StudioProgressMonitor monitor = null;
-        ConnectionParameter connectionParameter = null;
-        Connection connection = null;
-        ConnectionWrapper connectionWrapper = null;
-
-        // invalid port
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, LOCALHOST, AvailablePortFinder.getNextAvailable(),
-            EncryptionMethod.NONE, NetworkProvider.JNDI, AuthenticationMethod.NONE, null, null, null, true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        assertFalse( connectionWrapper.isConnected() );
-        assertNotNull( monitor.getException() );
-        assertTrue( monitor.getException() instanceof CommunicationException );
-        assertNotNull( monitor.getException().getCause() );
-        assertTrue( monitor.getException().getCause() instanceof ConnectException );
-
-        // unknown host
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, "555.555.555.555", ldapServer.getPort(),
-            EncryptionMethod.NONE, NetworkProvider.JNDI, AuthenticationMethod.NONE, null, null, null, true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        assertFalse( connectionWrapper.isConnected() );
-        assertNotNull( monitor.getException() );
-        assertTrue( monitor.getException() instanceof CommunicationException );
-        assertNotNull( monitor.getException().getCause() );
-        assertTrue( monitor.getException().getCause() instanceof UnknownHostException );
-
-        // TODO: SSL, StartTLS
-    }
-
-
-    /**
-     * Test binding to the server.
-     */
-    @Test
-    public void testBind()
-    {
-        StudioProgressMonitor monitor = getProgressMonitor();
-        ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
-            EncryptionMethod.NONE, NetworkProvider.JNDI, AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "secret",
-            null, true, null );
-        Connection connection = new Connection( connectionParameter );
-        ConnectionWrapper connectionWrapper = connection.getConnectionWrapper();
-
-        assertFalse( connectionWrapper.isConnected() );
-
-        connectionWrapper.connect( monitor );
-        connectionWrapper.bind( monitor );
-        assertTrue( connectionWrapper.isConnected() );
-        assertNull( monitor.getException() );
-
-        connectionWrapper.unbind();
-        connectionWrapper.disconnect();
-        assertFalse( connectionWrapper.isConnected() );
-
+        super( NetworkProvider.JNDI );
     }
 
-
-    /**
-     * Test failed binds to the server.
-     */
-    @Test
-    public void testBindFailures()
-    {
-        StudioProgressMonitor monitor = null;
-        ConnectionParameter connectionParameter = null;
-        Connection connection = null;
-        ConnectionWrapper connectionWrapper = null;
-
-        // simple auth without principal and credential
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(), EncryptionMethod.NONE,
-            NetworkProvider.JNDI, AuthenticationMethod.SIMPLE, "uid=admin", "invalid", null, true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        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,
-            NetworkProvider.JNDI, AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "bar", null, true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        connectionWrapper.bind( monitor );
-        assertFalse( connectionWrapper.isConnected() );
-        assertNotNull( monitor.getException() );
-        assertTrue( monitor.getException() instanceof AuthenticationException );
-    }
-
-
-    /**
-     * Test searching.
-     */
-    @Test
-    public void testSearch()
-    {
-        StudioProgressMonitor monitor = null;
-        ConnectionParameter connectionParameter = null;
-        Connection connection = null;
-        ConnectionWrapper connectionWrapper = null;
-
-        // simple auth without principal and credential
-        monitor = getProgressMonitor();
-        connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(), EncryptionMethod.NONE,
-            NetworkProvider.JNDI, AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "secret", null, true, null );
-        connection = new Connection( connectionParameter );
-        connectionWrapper = connection.getConnectionWrapper();
-        connectionWrapper.connect( monitor );
-        connectionWrapper.bind( monitor );
-        assertTrue( connectionWrapper.isConnected() );
-        assertNull( monitor.getException() );
-
-        SearchControls searchControls = new SearchControls();
-        NamingEnumeration<SearchResult> result = connectionWrapper.search( "ou=system", "objectClass=*",
-            searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, null, monitor, null );
-        assertNotNull( result );
-    }
-
-
-    private StudioProgressMonitor getProgressMonitor()
-    {
-        StudioProgressMonitor monitor = new StudioProgressMonitor( new NullProgressMonitor() );
-        return monitor;
-    }
+    // see tests in super class
 
 }

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java Fri Aug  4 08:59:15 2017
@@ -35,6 +35,7 @@ import org.apache.directory.studio.conne
 import org.apache.directory.studio.ldapservers.LdapServersManager;
 import org.apache.directory.studio.test.integration.ui.bots.ApacheDSConfigurationEditorBot;
 import org.apache.directory.studio.test.integration.ui.bots.ApacheDSServersViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.BotUtils;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionFromServerDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConsoleViewBot;
@@ -43,7 +44,6 @@ import org.apache.directory.studio.test.
 import org.apache.directory.studio.test.integration.ui.bots.NewApacheDSServerWizardBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
 import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.apache.mina.util.AvailablePortFinder;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -247,11 +247,7 @@ public class ApacheDSPluginTest
     {
         ApacheDSConfigurationEditorBot editorBot = serversViewBot.openConfigurationEditor( serverName );
 
-        int ldapPort = AvailablePortFinder.getNextAvailable( 1024 );
-        editorBot.setLdapPort( ldapPort );
-
-        int ldapsPort = AvailablePortFinder.getNextAvailable( ldapPort + 1 );
-        editorBot.setLdapsPort( ldapsPort );
+        editorBot.setAvailablePorts();
 
         editorBot.save();
         editorBot.close();
@@ -353,10 +349,9 @@ public class ApacheDSPluginTest
         int oldLdapsPort = remoteEditorBot.getLdapsPort();
 
         // Set new ports
-        int newLdapPort = AvailablePortFinder.getNextAvailable( 1024 );
-        remoteEditorBot.setLdapPort( newLdapPort );
-        int newLdapsPort = AvailablePortFinder.getNextAvailable( newLdapPort + 1 );
-        remoteEditorBot.setLdapsPort( newLdapsPort );
+        remoteEditorBot.setAvailablePorts();
+        int newLdapPort = remoteEditorBot.getLdapPort();
+        int newLdapsPort = remoteEditorBot.getLdapsPort();
 
         // Save the config editor
         remoteEditorBot.save();
@@ -397,4 +392,36 @@ public class ApacheDSPluginTest
         deleteDialogBot.clickOkButton();
     }
 
+
+    /**
+     * Test for DIRSTUDIO-1118: Run repair
+     */
+    @Test
+    public void repairAndStartAndStop()
+    {
+        String serverName = "Repair";
+        createServer( serverName );
+        setAvailablePorts( serverName );
+
+        // Repair the server
+        serversViewBot.repairServer( serverName );
+        serversViewBot.waitForServerStop( serverName );
+
+        // Wait a bit more after repair, another weird race condition...
+        BotUtils.sleep( 5000 );
+
+        // Start the server after repair
+        serversViewBot.runServer( serverName );
+        serversViewBot.waitForServerStart( serverName );
+
+        // TODO: newer version of ApacheDS may log to console
+
+        // Stopping the server
+        serversViewBot.stopServer( serverName );
+        serversViewBot.waitForServerStop( serverName );
+
+        // Deleting the server
+        DeleteDialogBot deleteDialogBot = serversViewBot.openDeleteServerDialog();
+        deleteDialogBot.clickOkButton();
+    }
 }

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java Fri Aug  4 08:59:15 2017
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.server.annotations.CreateLdapServer;
@@ -44,6 +45,9 @@ import org.apache.directory.studio.ldapb
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Bookmark;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor;
 import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
@@ -55,6 +59,11 @@ import org.apache.directory.studio.test.
 import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
 import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
 import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.PlatformUI;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -541,4 +550,77 @@ public class BrowserTest extends Abstrac
         assertTrue( entry.contains( "uid", "user.1" ) );
     }
 
+
+    /**
+     * Test for DIRSTUDIO-XXX.
+     *
+     * Verify input is set only once when entry is selected.
+     */
+    @Test
+    public void TestSetInputOnlyOnce() throws Exception
+    {
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+
+        // verify link-with-editor is enabled
+        assertTrue( BrowserUIPlugin.getDefault().getPreferenceStore()
+            .getBoolean( BrowserUIConstants.PREFERENCE_BROWSER_LINK_WITH_EDITOR ) );
+
+        // setup counter and listener to record entry editor input changes
+        final AtomicInteger counter = new AtomicInteger();
+        UIThreadRunnable.syncExec( new VoidResult()
+        {
+            public void run()
+            {
+                try
+                {
+                    IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                        .getActiveEditor();
+                    editor.addPropertyListener( new IPropertyListener()
+                    {
+                        @Override
+                        public void propertyChanged( Object source, int propId )
+                        {
+                            if ( source instanceof EntryEditor && propId == BrowserUIConstants.INPUT_CHANGED )
+                            {
+                                counter.incrementAndGet();
+                            }
+                        }
+                    } );
+                }
+                catch ( Exception e )
+                {
+                    throw new RuntimeException( e );
+                }
+            }
+        } );
+
+        // select 3 different entries, select one twice should not set the input again
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.2" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.2" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.3" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.3" );
+
+        // verify that input was only set 3 times.
+        assertEquals( "Only 3 input changes expected.", 3, counter.get() );
+
+        // reset counter
+        counter.set( 0 );
+
+        // use navigation history to go back and forth, each step should set input only once
+        studioBot.navigationHistoryBack();
+        assertEquals( "uid=user.2", browserViewBot.getSelectedEntry() );
+        studioBot.navigationHistoryBack();
+        assertEquals( "uid=user.1", browserViewBot.getSelectedEntry() );
+        studioBot.navigationHistoryForward();
+        assertEquals( "uid=user.2", browserViewBot.getSelectedEntry() );
+        studioBot.navigationHistoryForward();
+        assertEquals( "uid=user.3", browserViewBot.getSelectedEntry() );
+
+        // verify that input was only set 4 times.
+        assertEquals( "Only 4 input changes expected.", 4, counter.get() );
+    }
+
 }

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java Fri Aug  4 08:59:15 2017
@@ -306,7 +306,6 @@ public class EntryEditorTest extends Abs
 
         // assert value after saved and reloaded from server
         SWTUtils.sleep( 1000 );
-        System.out.println( entryEditorBot.getAttributeValues() );
         assertTrue( entryEditorBot.getAttributeValues().contains( "userPassword: CRYPT-SHA-512 hashed password" ) );
 
         // verify and bind with the correct password
@@ -318,8 +317,6 @@ public class EntryEditorTest extends Abs
         assertNull( pwdEditorBot.clickBindButton() );
 
         // verify and bind with the wrong password
-        pwdEditorBot = entryEditorBot.editValueExpectingPasswordEditor( "userPassword",
-            "CRYPT-SHA-512 hashed password" );
         pwdEditorBot.activateCurrentPasswordTab();
         pwdEditorBot.setVerifyPassword( "Wrong Password" );
         assertEquals( "Password verification failed", pwdEditorBot.clickVerifyButton() );

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java Fri Aug  4 08:59:15 2017
@@ -40,6 +40,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
@@ -49,6 +51,7 @@ import org.apache.directory.studio.test.
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
 import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -240,7 +243,7 @@ public class ImportExportTest extends Ab
      * @throws Exception
      */
     @Test
-    public void testImportDontUptateUI() throws Exception
+    public void testImportDoesNotUpdateUI() throws Exception
     {
         URL url = Platform.getInstanceLocation().getURL();
         String destFile = url.getFile() + "ImportDontUpdateUiTest.ldif";
@@ -274,13 +277,17 @@ public class ImportExportTest extends Ab
     @Test
     public void testExportCsvShouldPrefixFormulaWithApostrophe() throws Exception
     {
+        // set CSV encoding explicit to UTF-8, otherwise platform default encoding would be used
+        Preferences store = BrowserCorePlugin.getDefault().getPluginPreferences();
+        store.setDefault( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING, "UTF-8" );
+
         URL url = Platform.getInstanceLocation().getURL();
         final String file = url.getFile() + "ImportExportTest.csv";
         System.out.println( file );
 
         browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
 
-        // export LDIF
+        // export CSV
         ExportWizardBot wizardBot = browserViewBot.openExportCsvWizard();
         assertTrue( wizardBot.isVisible() );
         wizardBot.typeReturningAttributes( "cn, description" );

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java Fri Aug  4 08:59:15 2017
@@ -24,55 +24,29 @@ package org.apache.directory.studio.test
 import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
 import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST_ADDRESS;
 import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.math.BigInteger;
 import java.net.UnknownHostException;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.security.auth.x500.X500Principal;
 
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.api.ldap.model.entry.Modification;
-import org.apache.directory.api.ldap.model.message.ModifyRequest;
-import org.apache.directory.api.ldap.model.message.ModifyRequestImpl;
-import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.connection.core.ConnectionManager;
 import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
-import org.apache.directory.studio.test.integration.ui.bots.CertificateTrustDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ErrorDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.NewConnectionWizardBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
 import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.bouncycastle.x509.X509V1CertificateGenerator;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -90,9 +64,8 @@ import org.junit.runner.RunWith;
     { @CreateTransport(protocol = "LDAP") })
 public class NewConnectionWizardTest extends AbstractLdapTestUnit
 {
-    @Rule public TestName name = new TestName();
-
-    private File ksFile;
+    @Rule
+    public TestName name = new TestName();
 
     private StudioBot studioBot;
     private ConnectionsViewBot connectionsViewBot;
@@ -100,24 +73,6 @@ public class NewConnectionWizardTest ext
 
 
     @Before
-    public void setUpLdaps() throws Exception
-    {
-        // TODO: setup LDAPS
-        //        if ( ldapsService == null )
-        //        {
-        //            ldapsService = new LdapServer();
-        //            ldapsService.setDirectoryService( ldapService.getDirectoryService() );
-        //            int port = AvailablePortFinder.getNextAvailable( ldapService.getPort() + 10 );
-        //            ldapsService.setTcpTransport( new TcpTransport( port ) );
-        //            ldapsService.setEnabled( true );
-        //            ldapsService.setEnableLdaps( true );
-        //            ldapsService.setConfidentialityRequired( true );
-        //            ldapsService.start();
-        //        }
-    }
-
-
-    @Before
     public void setUp() throws Exception
     {
         studioBot = new StudioBot();
@@ -138,31 +93,6 @@ public class NewConnectionWizardTest ext
         studioBot = null;
         connectionsViewBot = null;
         wizardBot = null;
-
-        // delete old key store
-        if ( ksFile != null && ksFile.exists() )
-        {
-            ksFile.delete();
-        }
-
-        // delete custom trust stores
-        X509Certificate[] permanentCertificates = ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager()
-            .getCertificates();
-        for ( X509Certificate certificate : permanentCertificates )
-        {
-            ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().removeCertificate( certificate );
-        }
-        X509Certificate[] temporaryCertificates = ConnectionCorePlugin.getDefault().getSessionTrustStoreManager()
-            .getCertificates();
-        for ( X509Certificate certificate : temporaryCertificates )
-        {
-            ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().removeCertificate( certificate );
-        }
-
-        // delete custom JNDI key store settings
-        System.getProperties().remove( "javax.net.ssl.trustStore" );
-        System.getProperties().remove( "javax.net.ssl.keyStore" );
-        System.getProperties().remove( "javax.net.ssl.keyStorePassword" );
     }
 
 
@@ -297,8 +227,8 @@ public class NewConnectionWizardTest ext
         assertTrue( wizardBot.isDigestMD5AuthenticationSelected() );
         assertTrue( wizardBot.isUserEnabled() );
         assertTrue( wizardBot.isPasswordEnabled() );
-        assertTrue( wizardBot.isRealmEnabled() );
         assertTrue( wizardBot.isSavePasswordEnabled() );
+        assertTrue( wizardBot.isRealmEnabled() );
 
         // select CRAM-MD5
         wizardBot.selectCramMD5Authentication();
@@ -306,8 +236,64 @@ public class NewConnectionWizardTest ext
         assertTrue( wizardBot.isCramMD5AuthenticationSelected() );
         assertTrue( wizardBot.isUserEnabled() );
         assertTrue( wizardBot.isPasswordEnabled() );
+        assertTrue( wizardBot.isSavePasswordEnabled() );
+        assertFalse( wizardBot.isRealmEnabled() );
+
+        // select GSSAPI (Kerberos)
+        wizardBot.selectGssApiAuthentication();
+        // ensure authentication parameter input fields are disabled by default
+        assertTrue( wizardBot.isGssApiAuthenticationSelected() );
+        assertFalse( wizardBot.isUserEnabled() );
+        assertFalse( wizardBot.isPasswordEnabled() );
+        assertFalse( wizardBot.isSavePasswordEnabled() );
         assertFalse( wizardBot.isRealmEnabled() );
+        // by default "Use native TGT" is selected
+        assertTrue( wizardBot.isUseNativeTgtSelected() );
+        assertFalse( wizardBot.isObtainTgtFromKdcSelected() );
+        assertTrue( wizardBot.isUseNativeSystemConfigurationSelected() );
+        assertFalse( wizardBot.isUseConfigurationFileSelected() );
+        assertFalse( wizardBot.isUseManualConfigurationSelected() );
+        assertFalse( wizardBot.isKerberosRealmEnabled() );
+        assertFalse( wizardBot.isKdcHostEnabled() );
+        assertFalse( wizardBot.isKdcPortEnabled() );
+
+        // select GSSAPI (Kerberos) and "Obtain TGT from KDC"
+        wizardBot.selectObtainTgtFromKdc();
+        // ensure authentication parameter input fields are enabled
+        assertTrue( wizardBot.isGssApiAuthenticationSelected() );
+        assertTrue( wizardBot.isUserEnabled() );
+        assertTrue( wizardBot.isPasswordEnabled() );
         assertTrue( wizardBot.isSavePasswordEnabled() );
+        assertFalse( wizardBot.isRealmEnabled() );
+        assertFalse( wizardBot.isUseNativeTgtSelected() );
+
+        // select GSSAPI (Kerberos) and "Use configuration file"
+        wizardBot.selectUseConfigurationFile();
+        assertFalse( wizardBot.isUseNativeSystemConfigurationSelected() );
+        assertTrue( wizardBot.isUseConfigurationFileSelected() );
+        assertFalse( wizardBot.isUseManualConfigurationSelected() );
+        assertFalse( wizardBot.isKerberosRealmEnabled() );
+        assertFalse( wizardBot.isKdcHostEnabled() );
+        assertFalse( wizardBot.isKdcPortEnabled() );
+
+        // select GSSAPI (Kerberos) and "Use manual configuration"
+        wizardBot.selectUseManualConfiguration();
+        assertFalse( wizardBot.isUseNativeSystemConfigurationSelected() );
+        assertFalse( wizardBot.isUseConfigurationFileSelected() );
+        assertTrue( wizardBot.isUseManualConfigurationSelected() );
+        assertTrue( wizardBot.isKerberosRealmEnabled() );
+        assertTrue( wizardBot.isKdcHostEnabled() );
+        assertTrue( wizardBot.isKdcPortEnabled() );
+        assertFalse( wizardBot.isNextButtonEnabled() );
+
+        // select GSSAPI (Kerberos) and "Use native system configuration" again
+        wizardBot.selectUseNativeSystemConfiguration();
+        assertTrue( wizardBot.isUseNativeSystemConfigurationSelected() );
+        assertFalse( wizardBot.isUseConfigurationFileSelected() );
+        assertFalse( wizardBot.isUseManualConfigurationSelected() );
+        assertFalse( wizardBot.isKerberosRealmEnabled() );
+        assertFalse( wizardBot.isKdcHostEnabled() );
+        assertFalse( wizardBot.isKdcPortEnabled() );
 
         wizardBot.clickNextButton();
 
@@ -353,7 +339,7 @@ public class NewConnectionWizardTest ext
         wizardBot.typePassword( "secret" );
 
         // finish dialog
-        wizardBot.clickFinishButton();
+        wizardBot.clickFinishButton( true );
         connectionsViewBot.waitForConnection( getConnectionName() );
 
         // ensure connection was created
@@ -430,7 +416,10 @@ public class NewConnectionWizardTest ext
         // click "Check Network Parameter" button and get the result
         String result1 = wizardBot.clickCheckNetworkParameterButton();
         assertNotNull( "Expected Error", result1 );
-        assertTrue( "'Connection refused' message must occur in error message", result1.contains( "Connection refused" ) );
+        // LDAP API: Connection refused
+        // JNDI: The connection failed
+        assertThat( result1,
+            anyOf( containsString( "Connection refused" ), containsString( "The connection failed" ) ) );
 
         // enter connection parameter with invalid host name
         String hostname = "qwertzuiop.asdfghjkl.yxcvbnm";
@@ -441,8 +430,10 @@ public class NewConnectionWizardTest ext
         String result2 = wizardBot.clickCheckNetworkParameterButton();
         System.out.println( result2 );
         assertNotNull( "Expected Error", result2 );
-        assertThat( "'could not be resolved' message must occur in error message", result2,
-            containsString( "could not be resolved" ) );
+        // LDAP API: could not be resolved
+        // JNDI: The connection failed
+        assertThat( result2,
+            anyOf( containsString( "could not be resolved" ), containsString( "The connection failed" ) ) );
         assertThat( "Unknown host name must occur in error message", result2, containsString( hostname ) );
 
         // disabled this test because it does not work properly
@@ -511,687 +502,4 @@ public class NewConnectionWizardTest ext
         wizardBot.clickCancelButton();
     }
 
-
-    /**
-     * Tests StartTLS with an valid certificate. This is simulated
-     * by putting the self-signed certificate into a temporary key store
-     * and using this key store for JNDI
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testStartTlsCertificateValidationOK() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=localhost", "cn=localhost", startDate, endDate );
-
-        // prepare key store
-        installKeyStoreWithCertificate();
-
-        // let JNDI use the key store
-        System.setProperty( "javax.net.ssl.trustStore", ksFile.getAbsolutePath() );
-        System.setProperty( "javax.net.ssl.keyStore", ksFile.getAbsolutePath() );
-        System.setProperty( "javax.net.ssl.keyStorePassword", "changeit" );
-
-        // enter connection parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPort() );
-        wizardBot.selectStartTlsEncryption();
-
-        // check the certificate, should be OK
-        String result = wizardBot.clickCheckNetworkParameterButton();
-        assertNull( "Expected OK, valid and trusted certificate", result );
-
-        // enter correct authentication parameter
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check the certificate again, should be OK
-        String result2 = wizardBot.clickCheckAuthenticationButton();
-        assertNull( "Expected OK, valid and trusted certificate", result2 );
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests StartTLS with an expired certificate.
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testStartTlsCertificateValidationExpired() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        updateCertificate( "cn=localhost", "cn=localhost", startDate, endDate );
-
-        // enter connection parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPort() );
-        wizardBot.selectStartTlsEncryption();
-
-        // check the certificate, expecting the trust dialog
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckNetworkParameterButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isSelfSigned() );
-        assertTrue( trustDialogBot.isExpired() );
-        assertFalse( trustDialogBot.isNotYetValid() );
-        assertFalse( trustDialogBot.isHostNameMismatch() );
-        assertFalse( trustDialogBot.isIssuerUnkown() );
-        trustDialogBot.selectDontTrust();
-        ErrorDialogBot errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        assertTrue( errorBot.getErrorMessage().contains( "Untrusted certificate" ) );
-        errorBot.clickOkButton();
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests SSL with an not yet valid certificate.
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testStartTlsCertificateValidationNotYetValid() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS + YEAR_MILLIS );
-        updateCertificate( "cn=localhost", "cn=localhost", startDate, endDate );
-
-        // enter connection parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPort() );
-        wizardBot.selectStartTlsEncryption();
-
-        // check the certificate, expecting the trust dialog
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckNetworkParameterButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isSelfSigned() );
-        assertTrue( trustDialogBot.isNotYetValid() );
-        assertFalse( trustDialogBot.isExpired() );
-        assertFalse( trustDialogBot.isHostNameMismatch() );
-        assertFalse( trustDialogBot.isIssuerUnkown() );
-        trustDialogBot.selectDontTrust();
-        ErrorDialogBot errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        assertTrue( errorBot.getErrorMessage().contains( "Untrusted certificate" ) );
-        errorBot.clickOkButton();
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests StartTLS with an invalid certificate (unknown issuer).
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testStartTlsCertificateValidationIssuerUnknown() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=TheUnknownStuntman", "cn=localhost", startDate, endDate );
-
-        // enter connection parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPort() );
-        wizardBot.selectStartTlsEncryption();
-
-        // check the certificate, expecting the trust dialog
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckNetworkParameterButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isIssuerUnkown() );
-        assertFalse( trustDialogBot.isHostNameMismatch() );
-        assertFalse( trustDialogBot.isSelfSigned() );
-        assertFalse( trustDialogBot.isNotYetValid() );
-        assertFalse( trustDialogBot.isExpired() );
-        trustDialogBot.selectDontTrust();
-        ErrorDialogBot errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        assertTrue( errorBot.getErrorMessage().contains( "Untrusted certificate" ) );
-        errorBot.clickOkButton();
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests StartTLS with an certificate, where the certificate's host name
-     * doesn't match the server's host name (localhost)
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testStartTlsCertificateValidationHostnameMismatch() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=TheUnknownStuntman", "cn=ldap.example.com", startDate, endDate );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPort() );
-        wizardBot.selectStartTlsEncryption();
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check the certificate, expecting the trust dialog
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckAuthenticationButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isHostNameMismatch() );
-        assertTrue( trustDialogBot.isIssuerUnkown() );
-        assertFalse( trustDialogBot.isSelfSigned() );
-        assertFalse( trustDialogBot.isNotYetValid() );
-        assertFalse( trustDialogBot.isExpired() );
-        trustDialogBot.selectDontTrust();
-        ErrorDialogBot errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        assertTrue( errorBot.getErrorMessage().contains( "Untrusted certificate" ) );
-        errorBot.clickOkButton();
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests that when selecting "Don't trust" the certificate is not trusted
-     * and not added to any key store.
-     *
-     * @throws Exception
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testStartTlsCertificateDontTrust() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=TheUnknownStuntman", "cn=localhost", startDate, endDate );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPort() );
-        wizardBot.selectStartTlsEncryption();
-
-        // check trust, expect trust dialog, select don't trust
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckNetworkParameterButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectDontTrust();
-        ErrorDialogBot errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        errorBot.clickOkButton();
-
-        // check trust again, expect trust dialog, select don't trust
-        trustDialogBot = wizardBot.clickCheckNetworkParameterButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectDontTrust();
-        errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        errorBot.clickOkButton();
-
-        // certificate must not be added to a trust store
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
-
-        // enter authentication parameter
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check trust again, expect trust dialog, select don't trust
-        trustDialogBot = wizardBot.clickCheckAuthenticationButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectDontTrust();
-        errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        errorBot.clickOkButton();
-
-        // click finish, that opens the connection
-        wizardBot.clickFinishButton();
-
-        // expecting trust dialog again.
-        trustDialogBot = new CertificateTrustDialogBot();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectDontTrust();
-        errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        errorBot.clickOkButton();
-
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
-    }
-
-
-    /**
-     * Tests that when selecting "Trust temporary" the certificate is trusted
-     * and added to the session key store.
-     *
-     * @throws Exception
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testStartTlsCertificateTrustTemporary() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=TheUnknownStuntman", "cn=localhost2", startDate, endDate );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPort() );
-        wizardBot.selectStartTlsEncryption();
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check trust, expect trust dialog, select trust temporary
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckAuthenticationButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectTrustTemporary();
-        trustDialogBot.clickOkButton();
-
-        // TODO: expect ok dialog
-        trustDialogBot.clickOkButton();
-
-        // certificate must be added to the temporary trust store
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
-        assertEquals( 1, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
-
-        // check trust again, now the certificate is already trusted
-        String result = wizardBot.clickCheckAuthenticationButton();
-        assertNull( "Expected OK, valid and trusted certificate", result );
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests that when selecting "Trust permanent" the certificate is trusted
-     * and added to the permanent key store.
-     *
-     * @throws Exception
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testStartTlsCertificateTrustPermanent() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=TheUnknownStuntman", "cn=localhost3", startDate, endDate );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPort() );
-        wizardBot.selectStartTlsEncryption();
-
-        // check trust, expect trust dialog, select trust temporary
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckNetworkParameterButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectTrustPermanent();
-        trustDialogBot.clickOkButton();
-
-        // TODO: expect ok dialog
-        trustDialogBot.clickOkButton();
-
-        // certificate must be added to the temporary trust store
-        assertEquals( 1, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
-
-        // check trust again, now the certificate is already trusted
-        String result = wizardBot.clickCheckNetworkParameterButton();
-        assertNull( "Expected OK, valid and trusted certificate", result );
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests ldaps:// with an valid certificate. This is simulated
-     * by putting the self-signed certificate into a temporary key store
-     * and using this key store for JNDI
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testLdapsCertificateValidationOK() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=localhost", "cn=localhost", startDate, endDate );
-
-        // prepare key store
-        installKeyStoreWithCertificate();
-
-        // let JNDI use the key store
-        System.setProperty( "javax.net.ssl.trustStore", ksFile.getAbsolutePath() );
-        System.setProperty( "javax.net.ssl.keyStore", ksFile.getAbsolutePath() );
-        System.setProperty( "javax.net.ssl.keyStorePassword", "changeit" );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPortSSL() );
-        wizardBot.selectLdapsEncryption();
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check the certificate, should be OK
-        String result = wizardBot.clickCheckAuthenticationButton();
-        assertNull( "Expected OK, valid and trusted certificate", result );
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testLdapsCertificateValidationNotOK() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS + YEAR_MILLIS );
-        updateCertificate( "cn=localhost", "cn=localhost", startDate, endDate );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPortSSL() );
-        wizardBot.selectLdapsEncryption();
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check the certificate, expecting the trust dialog
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckAuthenticationButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isSelfSigned() );
-        assertTrue( trustDialogBot.isNotYetValid() );
-        assertFalse( trustDialogBot.isExpired() );
-        assertFalse( trustDialogBot.isHostNameMismatch() );
-        assertFalse( trustDialogBot.isIssuerUnkown() );
-        trustDialogBot.selectDontTrust();
-        ErrorDialogBot errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        assertTrue( errorBot.getErrorMessage().contains( "failed" ) );
-        errorBot.clickOkButton();
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests that when selecting "Don't trust" the certificate is not trusted
-     * and not added to any key store.
-     *
-     * @throws Exception
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testLdapsCertificateDontTrust() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=TheUnknownStuntman", "cn=localhost4", startDate, endDate );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPortSSL() );
-        wizardBot.selectLdapsEncryption();
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check trust, expect trust dialog, select don't trust
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckAuthenticationButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectDontTrust();
-        ErrorDialogBot errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        errorBot.clickOkButton();
-
-        // check trust again, expect trust dialog, select don't trust
-        trustDialogBot = wizardBot.clickCheckAuthenticationButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectDontTrust();
-        errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        errorBot.clickOkButton();
-
-        // certificate must not be added to a trust store
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
-
-        // click finish, that opens the connection
-        wizardBot.clickFinishButton();
-
-        // expecting trust dialog again.
-        trustDialogBot = new CertificateTrustDialogBot();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectDontTrust();
-        errorBot = trustDialogBot.clickOkButtonExpectingErrorDialog();
-        errorBot.clickOkButton();
-
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
-    }
-
-
-    /**
-     * Tests that when selecting "Trust temporary" the certificate is trusted
-     * and added to the session key store.
-     *
-     * @throws Exception
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testLdapsCertificateTrustTemporary() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=TheUnknownStuntman", "cn=localhost5", startDate, endDate );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPortSSL() );
-        wizardBot.selectLdapsEncryption();
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check trust, expect trust dialog, select trust temporary
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckAuthenticationButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectTrustTemporary();
-        trustDialogBot.clickOkButton();
-
-        // TODO: expect ok dialog
-        trustDialogBot.clickOkButton();
-
-        // certificate must be added to the temporary trust store
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
-        assertEquals( 1, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
-
-        // check trust again, now the certificate is already trusted
-        String result = wizardBot.clickCheckAuthenticationButton();
-        assertNull( "Expected OK, valid and trusted certificate", result );
-
-        wizardBot.clickCancelButton();
-    }
-
-
-    /**
-     * Tests that when selecting "Trust permanent" the certificate is trusted
-     * and added to the permanent key store.
-     *
-     * @throws Exception
-     */
-    @Test
-    @Ignore
-    // till DIRSERVER-1373 is fixed
-    public void testLdapsCertificateTrustPermanent() throws Exception
-    {
-        // prepare certificate
-        Date startDate = new Date( System.currentTimeMillis() - YEAR_MILLIS );
-        Date endDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
-        updateCertificate( "cn=TheUnknownStuntman", "cn=localhost6", startDate, endDate );
-
-        // enter connection parameter and authentication parameter
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapServer.getPortSSL() );
-        wizardBot.selectLdapsEncryption();
-        wizardBot.clickNextButton();
-        wizardBot.typeUser( "uid=admin,ou=system" );
-        wizardBot.typePassword( "secret" );
-
-        // check trust, expect trust dialog, select trust temporary
-        CertificateTrustDialogBot trustDialogBot = wizardBot
-            .clickCheckAuthenticationButtonExpectingCertificateTrustDialog();
-        assertTrue( trustDialogBot.isVisible() );
-        trustDialogBot.selectTrustPermanent();
-        trustDialogBot.clickOkButton();
-
-        // TODO: expect ok dialog
-        trustDialogBot.clickOkButton();
-
-        // certificate must be added to the temporary trust store
-        assertEquals( 1, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
-        assertEquals( 0, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
-
-        // check trust again, now the certificate is already trusted
-        String result = wizardBot.clickCheckAuthenticationButton();
-        assertNull( "Expected OK, valid and trusted certificate", result );
-
-        wizardBot.clickCancelButton();
-    }
-
-    /*
-     * Eventually we have to make several of these parameters configurable,
-     * however note to pass export restrictions we must use a key size of
-     * 512 or less here as the default.  Users can configure this setting
-     * later based on their own legal situations.  This is required to
-     * classify ApacheDS in the ECCN 5D002 category.  Please see the following
-     * page for more information:
-     *
-     *    http://www.apache.org/dev/crypto.html
-     *
-     * Also ApacheDS must be classified on the following page:
-     *
-     *    http://www.apache.org/licenses/exports
-     */
-    private static final int KEY_SIZE = 512;
-    private static final long YEAR_MILLIS = 365L * 24L * 3600L * 1000L;
-    private static final String PRIVATE_KEY_AT = "privateKey";
-    private static final String PUBLIC_KEY_AT = "publicKey";
-    private static final String KEY_ALGORITHM_AT = "keyAlgorithm";
-    private static final String PRIVATE_KEY_FORMAT_AT = "privateKeyFormat";
-    private static final String PUBLIC_KEY_FORMAT_AT = "publicKeyFormat";
-    private static final String USER_CERTIFICATE_AT = "userCertificate";
-    private static final String PRINCIPAL = "uid=admin,ou=system";
-
-
-    /**
-     *
-     */
-    private void updateCertificate( String issuerDN, String subjectDN, Date startDate, Date expiryDate )
-        throws Exception
-    {
-        Dn dn = new Dn( PRINCIPAL );
-        List<Modification> modifications = new ArrayList<Modification>();
-
-        // Get old key algorithm
-        Entry entry = service.getAdminSession().lookup( dn );
-        String keyAlgo = entry.get( KEY_ALGORITHM_AT ).getString();
-
-        // Generate key pair
-        KeyPairGenerator generator = KeyPairGenerator.getInstance( keyAlgo );
-        generator.initialize( KEY_SIZE );
-        KeyPair keypair = generator.genKeyPair();
-
-        // Generate the private key attributes
-        PrivateKey privateKey = keypair.getPrivate();
-
-        // Generate public key
-        PublicKey publicKey = keypair.getPublic();
-
-        // Generate the self-signed certificate
-        BigInteger serialNumber = BigInteger.valueOf( System.currentTimeMillis() );
-        X509V1CertificateGenerator certGen = new X509V1CertificateGenerator();
-        X500Principal issuerName = new X500Principal( issuerDN );
-        X500Principal subjectName = new X500Principal( subjectDN );
-        certGen.setSerialNumber( serialNumber );
-        certGen.setIssuerDN( issuerName );
-        certGen.setNotBefore( startDate );
-        certGen.setNotAfter( expiryDate );
-        certGen.setSubjectDN( subjectName );
-        certGen.setPublicKey( publicKey );
-        certGen.setSignatureAlgorithm( "SHA1With" + keyAlgo );
-        X509Certificate cert = certGen.generate( privateKey, "BC" );
-
-        // Write the modifications
-        ModifyRequest request = new ModifyRequestImpl();
-        request.setName( dn );
-        request.replace( PRIVATE_KEY_AT, privateKey.getEncoded() );
-        request.replace( PRIVATE_KEY_FORMAT_AT, privateKey.getFormat() );
-        request.replace( PUBLIC_KEY_AT, publicKey.getEncoded() );
-        request.replace( PUBLIC_KEY_FORMAT_AT, publicKey.getFormat() );
-        request.replace( USER_CERTIFICATE_AT, cert.getEncoded() );
-        service.getAdminSession().modify( dn, modifications );
-
-        // TODO: activate when DIRSERVER-1373 is fixed
-        //ldapService.reloadSslContext();
-        //ldapsService.reloadSslContext();
-    }
-
-
-    private void installKeyStoreWithCertificate() throws Exception
-    {
-        if ( ksFile != null && ksFile.exists() )
-        {
-            ksFile.delete();
-        }
-        ksFile = File.createTempFile( "testStore", "ks" );
-
-        CoreSession session = service.getAdminSession();
-        Entry entry = session.lookup( new Dn( "uid=admin,ou=system" ), new String[]
-            { USER_CERTIFICATE_AT } );
-        byte[] userCertificate = entry.get( USER_CERTIFICATE_AT ).getBytes();
-        assertNotNull( userCertificate );
-
-        ByteArrayInputStream in = new ByteArrayInputStream( userCertificate );
-        CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
-        Certificate cert = factory.generateCertificate( in );
-        KeyStore ks = KeyStore.getInstance( KeyStore.getDefaultType() );
-        ks.load( null, null );
-        ks.setCertificateEntry( "apacheds", cert );
-        ks.store( new FileOutputStream( ksFile ), "changeit".toCharArray() );
-    }
 }

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java Fri Aug  4 08:59:15 2017
@@ -35,6 +35,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
+import org.apache.directory.studio.connection.core.ConnectionParameter.NetworkProvider;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
@@ -81,7 +82,7 @@ public class NewEntryWizardTest extends
         Entry entry = new DefaultEntry( service.getSchemaManager() );
         entry.setDn( new Dn( "cn=referral,ou=system" ) );
         entry.add( "objectClass", "top", "referral", "extensibleObject" );
-        entry.add( "cn", "referralDialogTest" );
+        entry.add( "cn", "referral" );
         entry.add( "ref", "ldap://"+LOCALHOST+":" + ldapServer.getPort() + "/ou=users,ou=system" );
         service.getAdminSession().add( entry );
 

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java Fri Aug  4 08:59:15 2017
@@ -21,17 +21,22 @@
 package org.apache.directory.studio.test.integration.ui;
 
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
+import java.security.cert.X509Certificate;
+import java.util.Date;
 import java.util.List;
 
 import org.apache.directory.api.util.FileUtils;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.test.integration.ui.bots.CertificateValidationPreferencePageBot;
+import org.apache.directory.studio.test.integration.ui.bots.CertificateViewerDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.PreferencesBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
 import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
@@ -114,4 +119,56 @@ public class PreferencesTest extends Abs
         assertFalse( file.exists() );
     }
 
+
+    /**
+     * Test for DIRSTUDIO-1095
+     * (NullPointerException on certificates preference page).
+     */
+    @Test
+    public void testCertificatValidationPage() throws Exception
+    {
+        // verify there is no certificate yet.
+        PreferencesBot preferencesBot = studioBot.openPreferences();
+        CertificateValidationPreferencePageBot pageBot = preferencesBot.openCertificatValidationPage();
+        pageBot.activatePermanentTab();
+        assertEquals( 0, pageBot.getCertificateCount() );
+        pageBot.activateTemporaryTab();
+        assertEquals( 0, pageBot.getCertificateCount() );
+        preferencesBot.clickCancelButton();
+
+        // add a certificate (not possible via native file dialog)
+        Date startDate = new Date( System.currentTimeMillis() - 1000 );
+        Date endDate = new Date( System.currentTimeMillis() + 1000 );
+        X509Certificate certificate = CertificateUtils.createCertificate( "cn=localhost", "cn=localhost", startDate,
+            endDate, CertificateUtils.createKeyPair() );
+        ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().addCertificate( certificate );
+
+        // verify there is one certificate now
+        preferencesBot = studioBot.openPreferences();
+        pageBot = preferencesBot.openCertificatValidationPage();
+        pageBot.activatePermanentTab();
+        assertEquals( 1, pageBot.getCertificateCount() );
+        pageBot.activateTemporaryTab();
+        assertEquals( 0, pageBot.getCertificateCount() );
+
+        // view the certificate
+        pageBot.activatePermanentTab();
+        pageBot.selectCertificate( 0 );
+        CertificateViewerDialogBot certificateViewerDialogBot = pageBot.clickViewButton();
+        assertTrue( certificateViewerDialogBot.isVisible() );
+        certificateViewerDialogBot.clickCloseButton();
+
+        // delete the certificate
+        pageBot.clickRemoveButton();
+
+        // verify there is no certificate left
+        pageBot.activatePermanentTab();
+        assertEquals( 0, pageBot.getCertificateCount() );
+        pageBot.activateTemporaryTab();
+        assertEquals( 0, pageBot.getCertificateCount() );
+        assertEquals( 0, ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().getCertificates().length );
+        assertEquals( 0, ConnectionCorePlugin.getDefault().getSessionTrustStoreManager().getCertificates().length );
+        preferencesBot.clickCancelButton();
+    }
+
 }

Modified: directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java?rev=1804081&r1=1804080&r2=1804081&view=diff
==============================================================================
--- directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java (original)
+++ directory/studio/branches/studio-value/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java Fri Aug  4 08:59:15 2017
@@ -286,7 +286,6 @@ public class RcpAppTest extends Abstract
     public void testVisiblePreferencePages() throws Exception
     {
         PreferencesBot prefs = studioBot.openPreferences();
-        bot.sleep( 5000 );
 
         assertTrue( prefs.pageExists( "Apache Directory Studio" ) );
         assertTrue( prefs.pageExists( "Apache Directory Studio", "Connections" ) );
@@ -323,8 +322,11 @@ public class RcpAppTest extends Abstract
 
 
     /**
-     * Verify hidden preference pages. Many unwanted prefernce pages are contributed 
-     * by org.eclipse.* plugins, we configured to hide them in rcp/plugin.xml. 
+     * Verify hidden preference pages. Many unwanted preference pages are contributed 
+     * by org.eclipse.* plugins, we configured to hide them in rcp/plugin.xml.
+     * 
+     * Note: This test fails when running from Eclipse IDE and all workspace plugins 
+     * are part of the target platform.
      */
     @Test
     public void testHiddenPreferencePages() throws Exception



Mime
View raw message