Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/apache/directory-studio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Seelmann <mail@stefan-seelmann.de>2021-04-25 14:19:22 +0300
committerStefan Seelmann <mail@stefan-seelmann.de>2021-04-25 14:19:22 +0300
commitf70a4151e91cc540c555754874b01a1da5f42ac6 (patch)
treec1fc4c9e6a84a581471daceb196cc6e83ef1036c
parent706b4e5a359d7caee9acadc0759348d2f8c585d8 (diff)
Migrate extendedop and gssapi tests
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java75
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java211
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java80
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/GeneratedPasswordDialogBot.java37
5 files changed, 224 insertions, 181 deletions
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java
index 44642673e..f115fef4e 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java
@@ -21,27 +21,18 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
import static org.junit.Assert.assertEquals;
import java.net.URL;
-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.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.ExportConnectionsWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.ImportConnectionsWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.NewConnectionFolderDialogBot;
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.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.eclipse.core.runtime.Platform;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -50,36 +41,15 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class ConnectionViewTest extends AbstractLdapTestUnit
+public class ConnectionViewTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
-
- @Test
- public void testCreateAndDeleteConnections()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateAndDeleteConnections( TestLdapServer server )
{
String connectionName = "Test connection 1";
- createConnection( connectionName );
+ createConnection( connectionName, server );
// ensure connection is visible in Connections view
assertEquals( 1, connectionsViewBot.getCount() );
@@ -93,8 +63,9 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
}
- @Test
- public void testCreateAndDeleteConnectionFolders()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateAndDeleteConnectionFolders( TestLdapServer server )
{
String folderName = "Connection folder 1";
String subFolder1Name = "Connection folder 2";
@@ -131,8 +102,9 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
}
- @Test
- public void testExportImportConnections() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportConnections( TestLdapServer server ) throws Exception
{
String connection1Name = "Test connection 1";
String connection2Name = "Test connection 2";
@@ -142,14 +114,14 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
String subFolder2Name = "Connection folder 3";
// create connections and folders
- createConnection( connection1Name );
+ createConnection( connection1Name, server );
createConnectionFolder( folderName );
connectionsViewBot.select( folderName );
- createConnection( connection2Name );
+ createConnection( connection2Name, server );
connectionsViewBot.select( folderName );
createConnectionFolder( subFolder1Name );
connectionsViewBot.select( folderName, subFolder1Name );
- createConnection( connection3Name );
+ createConnection( connection3Name, server );
connectionsViewBot.select( folderName );
createConnectionFolder( subFolder2Name );
@@ -164,7 +136,7 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
// export connections and folders
URL url = Platform.getInstanceLocation().getURL();
- final String file = url.getFile() + "ImportExportConnections.zip";
+ final String file = url.getFile() + "ImportExportConnections" + server.getType() + ".zip";
ExportConnectionsWizardBot exportConnectionsWizardBot = connectionsViewBot.openExportConnectionsWizard();
exportConnectionsWizardBot.typeFile( file );
exportConnectionsWizardBot.clickFinishButton();
@@ -189,25 +161,24 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
}
- private void createConnection( String connectionName )
+ private void createConnection( String connectionName, TestLdapServer server )
{
NewConnectionWizardBot wizardBot = connectionsViewBot.openNewConnectionWizard();
// enter connection parameter
wizardBot.typeConnectionName( connectionName );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( server.getHost() );
+ wizardBot.typePort( server.getPort() );
// jump to auth page
wizardBot.clickNextButton();
// enter authentication parameters
- wizardBot.typeUser( "uid=admin,ou=system" );
- wizardBot.typePassword( "secret" );
+ wizardBot.typeUser( server.getAdminDn() );
+ wizardBot.typePassword( server.getAdminPassword() );
// finish dialog
wizardBot.clickFinishButton( true );
- // connectionsViewBot.waitForConnection( connectionName );
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java
index 0bc2f6856..71ccdce5e 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java
@@ -21,32 +21,25 @@
package org.apache.directory.studio.test.integration.ui;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.ldap.handlers.extended.PwdModifyHandler;
+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.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.BotUtils;
-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.EntryEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.ErrorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.GeneratedPasswordDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.PasswordEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.PasswordModifyExtendedOperationDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -55,50 +48,22 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") }, extendedOpHandlers =
- { PwdModifyHandler.class })
-@ApplyLdifFiles(clazz = ExtendedOperationsTest.class, value = "org/apache/directory/studio/test/integration/ui/BrowserTest.ldif")
-public class ExtendedOperationsTest extends AbstractLdapTestUnit
+public class ExtendedOperationsTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- @Before
- public void setUp() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testPasswordModifyExtendedOperationDialogValidation( TestLdapServer server ) throws Exception
{
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connectionsViewBot.createTestConnection( "BrowserTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
-
- @Test
- public void testPasswordModifyExtendedOperationDialogValidation()
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
// Open dialog
PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
assertTrue( dialogBot.isVisible() );
// Verify default UI state
- assertEquals( "uid=user.1,ou=users,ou=system", dialogBot.getUserIdentity() );
+ assertEquals( USER1_DN.getName(), dialogBot.getUserIdentity() );
assertFalse( dialogBot.useBindUserIdentity() );
assertEquals( "", dialogBot.getOldPassword() );
assertFalse( dialogBot.noOldPassword() );
@@ -154,17 +119,19 @@ public class ExtendedOperationsTest extends AbstractLdapTestUnit
}
- @Test
- public void testPasswordModifyExtendedOperationDialogOk()
+ @ParameterizedTest
+ @LdapServersSource(types =
+ { LdapServerType.ApacheDS, LdapServerType.OpenLdap })
+ public void testPasswordModifyExtendedOperationDialogSetNewPassword( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String random = RandomStringUtils.random( 20 );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- String dn = "uid=user.1,ou=users,ou=system";
+ browserViewBot.selectEntry( path( USER1_DN ) );
// Open dialog
PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
assertTrue( dialogBot.isVisible() );
- assertEquals( dn, dialogBot.getUserIdentity() );
+ assertEquals( USER1_DN.getName(), dialogBot.getUserIdentity() );
// Change password
dialogBot.noOldPassword( true );
@@ -174,24 +141,101 @@ public class ExtendedOperationsTest extends AbstractLdapTestUnit
// Verify and bind with the correct password
browserViewBot.refresh();
BotUtils.sleep( 1000L );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
- PasswordEditorDialogBot pwdEditorBot = entryEditorBot.editValueExpectingPasswordEditor( "userPassword",
- "Plain text password" );
+ PasswordEditorDialogBot pwdEditorBot = entryEditorBot.editValueExpectingPasswordEditor( "userPassword", null );
pwdEditorBot.activateCurrentPasswordTab();
pwdEditorBot.setVerifyPassword( random );
assertNull( pwdEditorBot.clickVerifyButton() );
assertNull( pwdEditorBot.clickBindButton() );
+
pwdEditorBot.clickCancelButton();
}
- @Test
- public void testPasswordModifyExtendedOperationDialogError()
+ @ParameterizedTest
+ @LdapServersSource(types =
+ { LdapServerType.ApacheDS, LdapServerType.OpenLdap })
+ public void testPasswordModifyExtendedOperationDialogGenerateNewPassword( TestLdapServer server ) throws Exception
+ {
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+
+ // Open dialog
+ PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
+ assertTrue( dialogBot.isVisible() );
+ assertEquals( USER1_DN.getName(), dialogBot.getUserIdentity() );
+
+ // Generate password
+ dialogBot.noOldPassword( true );
+ dialogBot.generateNewPassword( true );
+
+ // ApacheDS does not support password generation
+ if ( server.getType() == LdapServerType.ApacheDS )
+ {
+ ErrorDialogBot errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
+ assertThat( errorBot.getErrorMessage(), containsString( "null new password" ) );
+ errorBot.clickOkButton();
+ dialogBot.activate();
+ dialogBot.clickCancelButton();
+ }
+ else
+ {
+ dialogBot.clickOkButton();
+ GeneratedPasswordDialogBot generatedPasswordDialogBot = new GeneratedPasswordDialogBot();
+ String generatedPassword = generatedPasswordDialogBot.getGeneratedPassword();
+ generatedPasswordDialogBot.clickOkButton();
+
+ // Verify and bind with the correct password
+ browserViewBot.refresh();
+ BotUtils.sleep( 1000L );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
+ entryEditorBot.activate();
+ PasswordEditorDialogBot pwdEditorBot = entryEditorBot.editValueExpectingPasswordEditor( "userPassword",
+ null );
+ pwdEditorBot.activateCurrentPasswordTab();
+ pwdEditorBot.setVerifyPassword( generatedPassword );
+ assertNull( pwdEditorBot.clickVerifyButton() );
+ assertNull( pwdEditorBot.clickBindButton() );
+ pwdEditorBot.clickCancelButton();
+ }
+
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(types = LdapServerType.Fedora389ds)
+ public void testPasswordModifyExtendedOperationRequiresSecureConnection( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String random = RandomStringUtils.random( 20 );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- String dn = "uid=user.1,ou=users,ou=system";
+ browserViewBot.selectEntry( path( USER1_DN ) );
+
+ // Open dialog
+ PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
+ assertTrue( dialogBot.isVisible() );
+ assertEquals( USER1_DN.getName(), dialogBot.getUserIdentity() );
+
+ // Change password
+ dialogBot.noOldPassword( true );
+ dialogBot.setNewPassword( random );
+ ErrorDialogBot errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
+ assertThat( errorBot.getErrorMessage(), containsString( "Operation requires a secure connection" ) );
+ errorBot.clickOkButton();
+
+ dialogBot.activate();
+ dialogBot.clickCancelButton();
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void testPasswordModifyExtendedOperationDialogError( TestLdapServer server ) throws Exception
+ {
+ connectionsViewBot.createTestConnection( server );
+ String random = RandomStringUtils.random( 20 );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ String dn = USER1_DN.getName();
// Open dialog
PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
@@ -204,7 +248,18 @@ public class ExtendedOperationsTest extends AbstractLdapTestUnit
dialogBot.setOldPassword( "wrong password" );
dialogBot.setNewPassword( random );
ErrorDialogBot errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
- assertTrue( errorBot.getErrorMessage().contains( "invalid credentials" ) );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "unwilling to verify old password" ) );
+ }
+ else if ( server.getType() == LdapServerType.Fedora389ds )
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "Operation requires a secure connection" ) );
+ }
+ else
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "invalid credentials" ) );
+ }
errorBot.clickOkButton();
// Not existing entry
@@ -213,17 +268,31 @@ public class ExtendedOperationsTest extends AbstractLdapTestUnit
dialogBot.noOldPassword( true );
dialogBot.setNewPassword( random );
errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
- assertTrue( errorBot.getErrorMessage().contains( "The entry does not exist" ) );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "unable to retrieve SASL username" ) );
+ }
+ else if ( server.getType() == LdapServerType.Fedora389ds )
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "Operation requires a secure connection" ) );
+ }
+ else
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "The entry does not exist" ) );
+ }
errorBot.clickOkButton();
// ApacheDS does not support password generation
- dialogBot.activate();
- dialogBot.setUserIdentity( dn );
- dialogBot.noOldPassword( true );
- dialogBot.generateNewPassword( true );
- errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
- assertTrue( errorBot.getErrorMessage().contains( "null new password" ) );
- errorBot.clickOkButton();
+ if ( server.getType() == LdapServerType.ApacheDS )
+ {
+ dialogBot.activate();
+ dialogBot.setUserIdentity( dn );
+ dialogBot.noOldPassword( true );
+ dialogBot.generateNewPassword( true );
+ errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
+ assertThat( errorBot.getErrorMessage(), containsString( "null new password" ) );
+ errorBot.clickOkButton();
+ }
dialogBot.activate();
dialogBot.clickCancelButton();
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 149176b38..b90d2fe53 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
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertNull;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Method;
import java.net.URL;
import java.nio.charset.StandardCharsets;
@@ -36,25 +37,17 @@ import javax.security.auth.kerberos.KerberosPrincipal;
import org.apache.directory.api.util.FileUtils;
import org.apache.directory.api.util.IOUtils;
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.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.ImportWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.NewApacheDSServerWizardBot;
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.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.eclipse.core.runtime.Platform;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
@@ -63,42 +56,15 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-public class GssApiTest
+public class GssApiTest extends AbstractTestBase
{
private static final String serverName = "GssApiTest";
- @Rule
- public TestName name = new TestName();
-
private static int ldapPort;
private static int kdcPort;
+ private TestInfo testInfo;
- private static StudioBot studioBot;
- private static ApacheDSServersViewBot serversViewBot;
- private static ConnectionsViewBot connectionsViewBot;
-
-
- @BeforeClass
- public static void setUpClass() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- serversViewBot = studioBot.getApacheDSServersViewBot();
- connectionsViewBot = studioBot.getConnectionView();
-
- // ErrorDialog.AUTOMATED_MODE = false;
- }
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot.resetLdapPerspective();
- }
-
-
- @BeforeClass
+ @BeforeAll
public static void skipGssApiTestIfNoDefaultRealmIsConfigured()
{
try
@@ -112,31 +78,31 @@ public class GssApiTest
}
catch ( IllegalArgumentException e )
{
- Assume.assumeNoException( "Skipping tests as no default realm (/etc/krb5.conf) is configured", e );
+ Assumptions.assumeTrue( false, "Skipping tests as no default realm (/etc/krb5.conf) is configured" );
}
}
- @After
- public void tearDown() throws Exception
+ @BeforeEach
+ public void beforeEach( TestInfo testInfo )
{
- connectionsViewBot.deleteTestConnections();
+ this.testInfo = testInfo;
+ }
+
+ @AfterEach
+ public void afterEach() throws Exception
+ {
// stop ApacheDS
serversViewBot.stopServer( serverName );
serversViewBot.waitForServerStop( serverName );
-
- // delete ApacheDS
- DeleteDialogBot deleteDialogBot = serversViewBot.openDeleteServerDialog();
- deleteDialogBot.clickOkButton();
-
- Assertions.genericTearDownAssertions();
}
private String getConnectionName()
{
- return "GssApiTest." + name.getMethodName();
+ return testInfo.getTestMethod().map( Method::getName ).orElse( "null" ) + " "
+ + testInfo.getDisplayName();
}
@@ -222,7 +188,7 @@ public class GssApiTest
}
- private static void createServer( String serverName )
+ private void createServer( String serverName )
{
// Showing view
serversViewBot.show();
@@ -240,7 +206,7 @@ public class GssApiTest
}
- private static void configureApacheDS( String serverName ) throws Exception
+ private void configureApacheDS( String serverName ) throws Exception
{
ApacheDSConfigurationEditorBot editorBot = serversViewBot.openConfigurationEditor( serverName );
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 3ead439e2..6576d8b4d 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
@@ -59,7 +59,7 @@ public class NewConnectionWizardTest extends AbstractTestBase
private TestInfo testInfo;
@BeforeEach
- public void xxx( TestInfo testInfo )
+ public void beforeEach( TestInfo testInfo )
{
this.wizardBot = connectionsViewBot.openNewConnectionWizard();
this.testInfo = testInfo;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/GeneratedPasswordDialogBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/GeneratedPasswordDialogBot.java
new file mode 100644
index 000000000..ab88a2d16
--- /dev/null
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/GeneratedPasswordDialogBot.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+public class GeneratedPasswordDialogBot extends DialogBot
+{
+
+ public GeneratedPasswordDialogBot()
+ {
+ super( "Generated Password" );
+ }
+
+
+ public String getGeneratedPassword()
+ {
+ return bot.text( 0 ).getText();
+ }
+
+}