directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject [directory-studio] branch kerby-gssapi-tests updated: Fix
Date Wed, 16 Jun 2021 04:55:20 GMT
This is an automated email from the ASF dual-hosted git repository.

seelmann pushed a commit to branch kerby-gssapi-tests
in repository https://gitbox.apache.org/repos/asf/directory-studio.git


The following commit(s) were added to refs/heads/kerby-gssapi-tests by this push:
     new 80c2d72  Fix
80c2d72 is described below

commit 80c2d72c72fe657fa42be7731d1738ca81757d1b
Author: Stefan Seelmann <mail@stefan-seelmann.de>
AuthorDate: Wed Jun 16 06:55:02 2021 +0200

    Fix
---
 .../core/DirectoryApiConnectionWrapperTest.java    |  8 ++++
 .../test/integration/junit5/TestFixture.java       | 25 ++++++++++++
 .../studio/test/integration/ui/GssApiTest.java     | 44 ----------------------
 .../integration/ui/NewConnectionWizardTest.java    | 10 ++---
 4 files changed, 38 insertions(+), 49 deletions(-)

diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java
b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java
index 982c4a6..1e7cef8 100644
--- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java
@@ -92,6 +92,7 @@ import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 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.Krb5Configuration;
 import org.apache.directory.studio.connection.core.ConnectionParameter.Krb5CredentialConfiguration;
 import org.apache.directory.studio.connection.core.ICertificateHandler.TrustLevel;
 import org.apache.directory.studio.connection.core.IReferralHandler;
@@ -107,6 +108,7 @@ import org.apache.directory.studio.test.integration.junit5.LdapServerType;
 import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
 import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
 import org.apache.directory.studio.test.integration.junit5.SkipTestIfLdapServerIsNotAvailableInterceptor;
+import org.apache.directory.studio.test.integration.junit5.TestFixture;
 import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
 import org.apache.mina.util.AvailablePortFinder;
 import org.eclipse.core.runtime.NullProgressMonitor;
@@ -495,6 +497,8 @@ public class DirectoryApiConnectionWrapperTest
     @LdapServersSource(mode = Mode.All, except = LdapServerType.ApacheDS, reason = "Missing
OSGi import: org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntryModifier
cannot be found by org.apache.directory.server.protocol.shared_2.0.0.AM26")
     public void testSaslGssapiBindPlain( TestLdapServer ldapServer )
     {
+        TestFixture.skipIfKdcServerIsNotAvailable();
+
         ldapServer.setConfidentialityRequired( false );
         StudioProgressMonitor monitor = getProgressMonitor();
         Connection connection = getConnection( monitor, ldapServer, "hnelson", "secret" );
@@ -523,6 +527,8 @@ public class DirectoryApiConnectionWrapperTest
     @LdapServersSource(mode = Mode.All, except = LdapServerType.ApacheDS, reason = "Missing
OSGi import: org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntryModifier
cannot be found by org.apache.directory.server.protocol.shared_2.0.0.AM26")
     public void testSaslGssapiBindLdaps( TestLdapServer ldapServer ) throws Exception
     {
+        TestFixture.skipIfKdcServerIsNotAvailable();
+
         // obtain native TGT
         String[] cmd =
             { "/bin/sh", "-c", "echo secret | /usr/bin/kinit hnelson" };
@@ -561,6 +567,8 @@ public class DirectoryApiConnectionWrapperTest
     @LdapServersSource(mode = Mode.All, except = LdapServerType.ApacheDS, reason = "Missing
OSGi import: org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntryModifier
cannot be found by org.apache.directory.server.protocol.shared_2.0.0.AM26")
     public void testSaslGssapiBindStartTls( TestLdapServer ldapServer )
     {
+        TestFixture.skipIfKdcServerIsNotAvailable();
+
         ldapServer.setConfidentialityRequired( true );
         StudioProgressMonitor monitor = getProgressMonitor();
         Connection connection = getConnection( monitor, ldapServer, "hnelson", "secret" );
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
index 7f87e2a..eec6da0 100644
--- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
@@ -21,6 +21,7 @@
 package org.apache.directory.studio.test.integration.junit5;
 
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -47,6 +48,7 @@ import org.apache.directory.api.ldap.model.schema.comparators.DnComparator;
 import org.apache.directory.ldap.client.api.EntryCursorImpl;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.studio.connection.core.Controls;
+import org.junit.jupiter.api.Assumptions;
 
 
 /**
@@ -93,6 +95,29 @@ public class TestFixture
         }
     }
 
+    public static final String KRB5_REALM = "EXAMPLE>COM";
+    public static final String KDC_HOST = "kerby.example.com";
+    public static final int KDC_PORT = 60088;
+
+    public static void skipIfKdcServerIsNotAvailable()
+    {
+        boolean available = false;
+        try
+        {
+            available = InetAddress.getByName( KDC_HOST ).isReachable( 3 );
+        }
+        catch ( Exception e )
+        {
+            available = false;
+        }
+
+        if ( !available )
+        {
+            Assumptions.assumeTrue( false,
+                "Skip test because KDC server " + KDC_HOST + " is not available" );
+        }
+    }
+
     public static final String OBJECT_CLASS_ALL_FILTER = "(objectClass=*)";
 
     public static final String TEST_FIXTURE_LDIF = "TestFixture.ldif";
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java
b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java
index 8d91121..72dab5d 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java
@@ -22,7 +22,6 @@ package org.apache.directory.studio.test.integration.ui;
 
 
 import static org.apache.directory.studio.test.integration.ui.utils.Constants.LOCALHOST;
-import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.io.File;
@@ -150,48 +149,6 @@ public class GssApiTest extends AbstractTestBase
     }
 
 
-    @Test
-    public void testGssApiUseNativeTgtAndNativeConfigurationAndObtainServiceTicket() throws
Exception
-    {
-        // create the server
-        createServer( serverName );
-
-        // configure ApacheDS and KDC server
-        configureApacheDS( serverName );
-
-        // start ApacheDS
-        serversViewBot.runServer( serverName );
-        serversViewBot.waitForServerStart( serverName );
-
-        // import KDC data
-        connectionsViewBot.createTestConnection( "GssApiTest", ldapPort );
-        importData();
-
-        // obtain native TGT
-        String[] cmd =
-            { "/bin/sh", "-c", "echo secret | /usr/bin/kinit hnelson" };
-        Process process = Runtime.getRuntime().exec( cmd );
-        int exitCode = process.waitFor();
-        assertEquals( 0, exitCode );
-
-        // connect with GSSAPI authentication
-        NewConnectionWizardBot wizardBot = connectionsViewBot.openNewConnectionWizard();
-        wizardBot.typeConnectionName( getConnectionName() );
-        wizardBot.typeHost( LOCALHOST );
-        wizardBot.typePort( ldapPort );
-        wizardBot.clickNextButton();
-        wizardBot.selectGssApiAuthentication();
-        wizardBot.selectUseNativeTgt();
-        wizardBot.selectUseNativeSystemConfiguration();
-
-        // check the connection
-        String result = wizardBot.clickCheckAuthenticationButton();
-        assertNull( result, "Expected OK" );
-
-        wizardBot.clickCancelButton();
-    }
-
-
     private void createServer( String serverName )
     {
         // Showing view
@@ -217,7 +174,6 @@ public class GssApiTest extends AbstractTestBase
         editorBot.enableKerberosServer();
 
         editorBot.setAvailablePorts();
-        editorBot.setKerberosPort( 60088 );
         ldapPort = editorBot.getLdapPort();
         kdcPort = editorBot.getKerberosPort();
 
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
index 4b8a74e..4785dd7 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
@@ -21,7 +21,6 @@
 package org.apache.directory.studio.test.integration.ui;
 
 
-import static org.apache.directory.studio.test.integration.ui.utils.Constants.LOCALHOST;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -44,6 +43,7 @@ import org.apache.directory.studio.connection.core.ConnectionParameter.Encryptio
 import org.apache.directory.studio.test.integration.junit5.LdapServerType;
 import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
 import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
+import org.apache.directory.studio.test.integration.junit5.TestFixture;
 import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
 import org.apache.directory.studio.test.integration.ui.bots.CertificateTrustDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.ErrorDialogBot;
@@ -494,6 +494,8 @@ public class NewConnectionWizardTest extends AbstractTestBase
     @LdapServersSource(mode = Mode.All, except = LdapServerType.ApacheDS, reason = "Missing
OSGi import: org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntryModifier
cannot be found by org.apache.directory.server.protocol.shared_2.0.0.AM26")
     public void testCreateConnectionNoEncryptionSaslGssapiNativeTgtOK( TestLdapServer server
) throws Exception
     {
+        TestFixture.skipIfKdcServerIsNotAvailable();
+
         // obtain native TGT
         String[] cmd =
             { "/bin/sh", "-c", "echo secret | /usr/bin/kinit hnelson" };
@@ -521,6 +523,8 @@ public class NewConnectionWizardTest extends AbstractTestBase
     @LdapServersSource(mode = Mode.All, except = LdapServerType.ApacheDS, reason = "Missing
OSGi import: org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntryModifier
cannot be found by org.apache.directory.server.protocol.shared_2.0.0.AM26")
     public void testCreateConnectionNoEncryptionSaslGssapiObtainOK( TestLdapServer server
)
     {
+        TestFixture.skipIfKdcServerIsNotAvailable();
+
         setConnectionParameters( server, EncryptionMethod.NONE );
 
         wizardBot.selectGssApiAuthentication();
@@ -529,10 +533,6 @@ public class NewConnectionWizardTest extends AbstractTestBase
         wizardBot.typePassword( "secret" );
         wizardBot.selectQualityOfProtection( SaslQoP.AUTH );
         wizardBot.selectProtectionStrength( SaslSecurityStrength.HIGH );
-        wizardBot.selectUseManualConfiguration();
-        wizardBot.typeKerberosRealm( "EXAMPLE.COM" );
-        wizardBot.typeKdcHost( "kerby.example.com" );
-        wizardBot.typeKdcPort( 60088 );
 
         String result = wizardBot.clickCheckAuthenticationButton();
         assertNull( result, "Expected OK" );

Mime
View raw message