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-19 23:29:07 +0300
committerStefan Seelmann <mail@stefan-seelmann.de>2021-04-19 23:29:07 +0300
commit51535a9a9b2d794d5e7e6f2ace02232b41a3eded (patch)
treef995d790df2eb492f08a91fb11ba2ac9ece61b8b
parent9bd6bab739bb58f29ae6fc0a00de8c1fec315c7a (diff)
Migrate errorhandling and copyentry tests
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java5
-rw-r--r--tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif6
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java304
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java178
5 files changed, 251 insertions, 244 deletions
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 7c299679e..8e2076858 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
@@ -115,6 +115,7 @@ public class TestFixture
public static final Dn DN_WITH_TRAILING_EQUALS_CHARACTER_HEX_PAIR_ESCAPED = dn( "cn=trailing\\3D", MISC_DN );
public static final Dn DN_WITH_IP_HOST_NUMBER = dn( "cn=loopback+ipHostNumber=127.0.0.1", MISC_DN );
public static final Dn ALIAS_DN = dn( "cn=alias", MISC_DN );
+ public static final Dn SUBENTRY_DN = dn( "cn=subentry", MISC_DN );
public static final Dn USERS_DN = dn( "ou=users", CONTEXT_DN );
public static final Dn USER1_DN = dn( "uid=user.1", USERS_DN );
@@ -193,7 +194,7 @@ public class TestFixture
}
// delete ou=referrals
- deleteTree( connection, REFERRALS_DN, Optional.of( Controls.MANAGEDSAIT_CONTROL ) );
+ deleteTree( connection, REFERRALS_DN, Optional.empty() );
// delete ou=groups
deleteTree( connection, GROUPS_DN, Optional.empty() );
// delete ou=users
@@ -213,6 +214,7 @@ public class TestFixture
searchRequest.setFilter( OBJECT_CLASS_ALL_FILTER );
searchRequest.setScope( SearchScope.SUBTREE );
searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
+ searchRequest.addControl( Controls.MANAGEDSAIT_CONTROL );
control.ifPresent( c -> searchRequest.addControl( c ) );
try ( SearchCursor searchCursor = connection.search( searchRequest );
@@ -228,6 +230,7 @@ public class TestFixture
{
DeleteRequest deleteRequest = new DeleteRequestImpl();
deleteRequest.setName( dn );
+ deleteRequest.addControl( Controls.MANAGEDSAIT_CONTROL );
control.ifPresent( c -> deleteRequest.addControl( c ) );
connection.delete( deleteRequest );
}
diff --git a/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif
index 2eceeea89..888b05da1 100644
--- a/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif
+++ b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif
@@ -22,6 +22,12 @@ add: administrativeRole
administrativeRole: accessControlSpecificArea
-
+dn: ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
+changetype: modify
+add: administrativeRole
+administrativeRole: accessControlSpecificArea
+-
+
dn: cn=subentry,ou=misc,dc=example,dc=org
changetype: add
objectClass: top
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java
index 828f52fb5..db5a24822 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java
@@ -106,7 +106,7 @@ public class AbstractTestBase
* Gets the path to the leaf below the DN in the LDAP browser tree.
* The path starts with "DIT", "Root DSE", and the context entry.
*/
- public static String[] path( Dn dn, String leaf )
+ public static String[] path( Dn dn, String... leaf )
{
return ArrayUtils.addAll( path( dn ), leaf );
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
index a83bed1e8..e3898b1be 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
@@ -21,31 +21,31 @@
package org.apache.directory.studio.test.integration.ui;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.ALIAS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.CONTEXT_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC111_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.SUBENTRY_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-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.api.ldap.model.name.Dn;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.apache.directory.studio.ldifparser.LdifParserConstants;
-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.ModificationLogsViewBot;
+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.SelectCopyDepthDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SelectCopyStrategyBot;
-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.api.AfterEach;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -54,92 +54,67 @@ 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") })
-@ApplyLdifFiles(clazz = CopyEntryTest.class, value = "org/apache/directory/studio/test/integration/ui/BrowserTest.ldif")
-public class CopyEntryTest extends AbstractLdapTestUnit
+public class CopyEntryTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
- private Connection connection;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "CopyEntryTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
+ @AfterEach
+ public void resetPreferences()
{
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
// DIRSERVER-2133: reset check for children preference
BrowserCorePlugin.getDefault()
.getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, true );
}
- @Test
- public void testCopyPasteSingleEntryWithoutCopyDepthDialog() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteSingleEntryWithoutCopyDepthDialog( TestLdapServer server ) throws Exception
{
+ Dn newDn = dn( USER1_DN.getRdn(), MISC111_DN );
+
// expand the entry to avoid copy depth dialog
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.expandEntry( path( USER1_DN ) );
// copy an entry
browserViewBot.copy();
// select the parent entry where the copied entry should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" ) );
+ browserViewBot.selectEntry( path( MISC111_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( newDn ) ) );
// paste the entry
browserViewBot.pasteEntry();
// verify the entry was copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" );
+ assertTrue( browserViewBot.existsEntry( path( newDn ) ) );
+ browserViewBot.selectEntry( path( newDn ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.1,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + newDn.getName(), "changetype: add" );
}
- @Test
- public void testCopyPasteMultipleEntriesWithCopyDepthDialogObjectOnly() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteMultipleEntriesWithCopyDepthDialogObjectOnly( TestLdapServer server ) throws Exception
{
// DIRSERVER-2133: disable check for children for this test
BrowserCorePlugin.getDefault()
.getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, false );
// select and copy multiple entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.expandEntry( path( USERS_DN ) );
String[] children =
{ "uid=user.1", "uid=user.2", "uid=user.3", "uid=user.4" };
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectChildrenOfEntry( children, path( USERS_DN ) );
browserViewBot.copy();
// select the parent entry where the copied entries should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" ) );
+ browserViewBot.selectEntry( path( MISC111_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( MISC111_DN, "uid=user.1" ) ) );
// paste the entry
SelectCopyDepthDialogBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyDepthDialog( 4 );
@@ -147,41 +122,35 @@ public class CopyEntryTest extends AbstractLdapTestUnit
dialog.clickOkButton();
// verify the entries were copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.2" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.3" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.4" ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "uid=user.1" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "uid=user.2" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "uid=user.3" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "uid=user.4" ) ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.1,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.2,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.3,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.4,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "uid=user.1", MISC111_DN ), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "uid=user.2", MISC111_DN ), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "uid=user.3", MISC111_DN ), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "uid=user.4", MISC111_DN ), "changetype: add" );
}
- @Test
- public void testCopyPasteMultipleEntriesWithCopyDepthDialogSubtree() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteMultipleEntriesWithCopyDepthDialogSubtree( TestLdapServer server ) throws Exception
{
// select and copy multiple entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.expandEntry( path( CONTEXT_DN ) );
String[] children =
{ "ou=users", "ou=groups" };
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectChildrenOfEntry( children, path( CONTEXT_DN ) );
browserViewBot.copy();
// select the parent entry where the copied entries should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=target" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=groups" ) );
+ browserViewBot.selectEntry( path( MISC111_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( MISC111_DN, "ou=users" ) ) );
+ assertFalse( browserViewBot.existsEntry( path( MISC111_DN, "ou=groups" ) ) );
// paste the entry
SelectCopyDepthDialogBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyDepthDialog( 2 );
@@ -189,40 +158,32 @@ public class CopyEntryTest extends AbstractLdapTestUnit
dialog.clickOkButton();
// verify the entries were copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users", "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users",
- "cn=\\#ACL_AD-Projects_Author" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "cn=A" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=groups" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=groups",
- "cn=Administrators" ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "ou=users" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "ou=users", "uid=user.1" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "ou=users", "uid=user.8" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "ou=groups" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, "ou=groups", "cn=group.1" ) ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsOk( "dn: ou=users,ou=target,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk(
- "dn: cn=A,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=target,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: ou=groups,ou=target,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: cn=Administrators,ou=groups,ou=target,ou=system",
- "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "ou=users", MISC111_DN ), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "ou=groups", MISC111_DN ), "changetype: add" );
}
- @Test
- public void testCopyPasteSingleEntryOverwrite() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteSingleEntryOverwrite( TestLdapServer server ) throws Exception
{
// expand the entry to avoid copy depth dialog
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.expandEntry( path( USER1_DN ) );
// copy an entry
browserViewBot.copy();
// select the parent entry where the copied entry should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
// paste the entry
SelectCopyStrategyBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyStrategy();
@@ -230,91 +191,134 @@ public class CopyEntryTest extends AbstractLdapTestUnit
dialog.clickOkButton();
// verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]", "dn: uid=user.1,ou=users,ou=system",
- "changetype: add", "uid: user.1" );
- modificationLogsViewBot.assertContainsOk( "dn: uid=user.1,ou=users,ou=system", "changetype: modify",
- "replace: uid" + LdifParserConstants.LINE_SEPARATOR + "uid: user.1" + LdifParserConstants.LINE_SEPARATOR
- + "-",
- "replace: objectclass" );
+ modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]",
+ "dn: " + USER1_DN.getName(), "changetype: add", "uid: user.1" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + USER1_DN.getName(), "changetype: modify", "replace: uid"
+ + LdifParserConstants.LINE_SEPARATOR + "uid: user.1" + LdifParserConstants.LINE_SEPARATOR + "-",
+ "replace: objectClass" );
}
- @Test
- public void testCopyPasteSingleEntryRename() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteSingleEntryRename( TestLdapServer server ) throws Exception
{
// expand the entry to avoid copy depth dialog
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.expandEntry( path( USER1_DN ) );
// copy an entry
browserViewBot.copy();
// select the parent entry where the copied entry should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
// paste the entry
+ Dn renamedDn = dn( "uid=user.renamed", USERS_DN );
SelectCopyStrategyBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyStrategy();
dialog.selectRenameEntryAndContinue();
dialog.setRdnValue( 1, "user.renamed" );
dialog.clickOkButton();
// verify the entry was copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.renamed" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.renamed" );
+ assertTrue( browserViewBot.existsEntry( path( renamedDn ) ) );
+ browserViewBot.selectEntry( path( renamedDn ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]", "dn: uid=user.1,ou=users,ou=system",
- "changetype: add", "uid: user.1" );
- modificationLogsViewBot.assertContainsOk( "dn: uid=user.renamed,ou=users,ou=system", "changetype: add",
+ modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]",
+ "dn: " + USER1_DN.getName(), "changetype: add", "uid: user.1" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + renamedDn.getName(), "changetype: add",
"uid: user.renamed" );
}
- @Test
- public void testCopyPasteSpecialEntries() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteAliasEntry( TestLdapServer server ) throws Exception
{
// disable alias dereferencing
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
+
+ // expand the entries to avoid copy depth dialog
+ browserViewBot.expandEntry( path( ALIAS_DN ) );
+ browserViewBot.selectEntry( path( ALIAS_DN ) );
+ browserViewBot.copy();
+
+ // select the parent entry where the copied entries should be pasted to
+ browserViewBot.selectEntry( path( MISC111_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( MISC111_DN, ALIAS_DN.getRdn() ) ) );
+
+ // paste the entries
+ browserViewBot.pasteEntries( 1 );
+
+ // verify the entries were copied
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, ALIAS_DN.getRdn() ) ) );
+
+ // verify in modification logs
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( ALIAS_DN.getRdn(), MISC111_DN ), "changetype: add" );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteReferralEntry( TestLdapServer server ) throws Exception
+ {
// enable ManageDsaIT control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- // enable Subentries control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
// expand the entries to avoid copy depth dialog
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" );
-
- // select and copy the entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
- String[] children =
- { "cn=alias", "cn=referral", "cn=subentry" };
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
+ browserViewBot.expandEntry( path( REFERRAL_TO_USER1_DN ) );
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN ) );
browserViewBot.copy();
// select the parent entry where the copied entries should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=target" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=alias" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=referral" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=subentry" ) );
+ browserViewBot.selectEntry( path( MISC111_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( MISC111_DN, REFERRAL_TO_USER1_DN.getRdn() ) ) );
// paste the entries
- browserViewBot.pasteEntries( 3 );
+ browserViewBot.pasteEntries( 1 );
// verify the entries were copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=alias" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=referral" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=subentry" ) );
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, REFERRAL_TO_USER1_DN.getRdn() ) ) );
+
+ // verify in modification logs
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( REFERRAL_TO_USER1_DN.getRdn(), MISC111_DN ),
+ "changetype: add" );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(types = LdapServerType.ApacheDS)
+ public void testCopyPasteSubentry( TestLdapServer server ) throws Exception
+ {
+ // enable Subentries control
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ connection.getConnectionParameter().setExtendedBoolProperty(
+ IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
+
+ // expand the entry to avoid copy depth dialog
+ browserViewBot.expandEntry( path( SUBENTRY_DN ) );
+ browserViewBot.selectEntry( path( SUBENTRY_DN ) );
+ browserViewBot.copy();
+
+ // select the parent entry where the copied entry should be pasted to
+ browserViewBot.selectEntry( path( MISC111_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( MISC111_DN, SUBENTRY_DN.getRdn() ) ) );
+
+ // paste the entry
+ browserViewBot.pasteEntries( 1 );
+
+ // verify the entry was copied
+ assertTrue( browserViewBot.existsEntry( path( MISC111_DN, SUBENTRY_DN.getRdn() ) ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsOk( "dn: cn=alias,ou=target,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: cn=referral,ou=target,ou=system",
- "control: 2.16.840.1.113730.3.4.2 false", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: cn=subentry,ou=target,ou=system", "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( SUBENTRY_DN.getRdn(), MISC111_DN ), "changetype: add" );
}
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java
index 6b302a841..c230f0b6d 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java
@@ -21,29 +21,19 @@
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 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.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+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.DeleteDialogBot;
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.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.swtbot.swt.finder.utils.SWTUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -52,41 +42,14 @@ 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 = ErrorHandlingTest.class, value = "org/apache/directory/studio/test/integration/ui/BrowserTest.ldif")
-public class ErrorHandlingTest extends AbstractLdapTestUnit
+public class ErrorHandlingTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
- @Before
- public void setUp() 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 testDeleteObjectClassTopSchemaEntryShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(types = LdapServerType.ApacheDS)
+ public void testDeleteObjectClassTopSchemaEntryShouldFail( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
browserViewBot.selectEntry( "DIT", "Root DSE", "ou=schema", "cn=system", "ou=objectClasses", "m-oid=2.5.6.0" );
browserViewBot.expandEntry( "DIT", "Root DSE", "ou=schema", "cn=system", "ou=objectClasses", "m-oid=2.5.6.0" );
DeleteDialogBot deleteDialog = browserViewBot.openDeleteDialog();
@@ -102,48 +65,65 @@ public class ErrorHandlingTest extends AbstractLdapTestUnit
}
- @Test
- public void testDeleteObjectClassAttributeShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteObjectClassAttributeShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
- ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "objectclass",
+ ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "objectClass",
"inetOrgPerson (structural)" );
+ String expectedError = "65 - objectClassViolation";
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ expectedError = "69 - objectClassModsProhibited";
+ }
+
// verify message in error dialog
- assertThat( errorDialog.getErrorMessage(), containsString( "[LDAP result code 65 - objectClassViolation]" ) );
+ assertThat( errorDialog.getErrorMessage(), containsString( "[LDAP result code " + expectedError + "]" ) );
errorDialog.clickOkButton();
- // verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 65 - objectClassViolation]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify" );
+ modificationLogsViewBot.assertContainsError( "[LDAP result code " + expectedError + "]",
+ "dn: " + USER1_DN.getName(), "changetype: modify" );
}
- @Test
- public void testDeleteRdnAttributeShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteRdnAttributeShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "uid", "user.1" );
+ String expectedError = "67 - notAllowedOnRDN";
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ expectedError = "64 - namingViolation";
+ }
+
// verify message in error dialog
- assertThat( errorDialog.getErrorMessage(), containsString( "[LDAP result code 67 - notAllowedOnRDN]" ) );
+ assertThat( errorDialog.getErrorMessage(), containsString( "[LDAP result code " + expectedError + "]" ) );
errorDialog.clickOkButton();
// verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 67 - notAllowedOnRDN]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify", "delete: uid" );
+ modificationLogsViewBot.assertContainsError( "[LDAP result code " + expectedError + "]",
+ "dn: " + USER1_DN.getName(), "changetype: modify", "delete: uid" );
}
- @Test
- public void testDeleteMustAttributeShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteMustAttributeShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "sn", "Amar" );
@@ -153,40 +133,54 @@ public class ErrorHandlingTest extends AbstractLdapTestUnit
// verify in modification logs
modificationLogsViewBot.assertContainsError( "[LDAP result code 65 - objectClassViolation]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify", "delete: sn" );
+ "dn: " + USER1_DN.getName(), "changetype: modify", "delete: sn" );
}
- @Test
- public void testDeleteOperationalAttributeShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteOperationalAttributeShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
entryEditorBot.fetchOperationalAttributes();
SWTUtils.sleep( 1000 );
entryEditorBot.activate();
- ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "nbChildren", "0" );
+ ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "creatorsName", null );
+
+ String expectedError = "50 - insufficientAccessRights";
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ expectedError = "19 - constraintViolation";
+ }
+ if ( server.getType() == LdapServerType.Fedora389ds )
+ {
+ expectedError = "53 - unwillingToPerform";
+ }
// verify message in error dialog
assertThat( errorDialog.getErrorMessage(),
- containsString( "[LDAP result code 50 - insufficientAccessRights]" ) );
+ containsString( "[LDAP result code " + expectedError + "]" ) );
errorDialog.clickOkButton();
// verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 50 - insufficientAccessRights]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify", "delete: nbChildren" );
+ modificationLogsViewBot.assertContainsError( "[LDAP result code " + expectedError + "]",
+ "dn: " + USER1_DN.getName(), "changetype: modify", "delete: creatorsName" );
}
- @Test
- public void testModifyInvalidSyntaxShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testModifyInvalidSyntaxShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
- entryEditorBot.editValue( "telephonenumber", "976-893-3312" );
- ErrorDialogBot errorDialog = entryEditorBot.typeValueAndFinishAndExpectErrorDialog( "Invalid phone number" );
+ entryEditorBot.editValue( "mail", null );
+ ErrorDialogBot errorDialog = entryEditorBot.typeValueAndFinishAndExpectErrorDialog( "äöüß" );
// verify message in error dialog
assertThat( errorDialog.getErrorMessage(),
@@ -195,22 +189,22 @@ public class ErrorHandlingTest extends AbstractLdapTestUnit
// verify in modification logs
modificationLogsViewBot.assertContainsError( "[LDAP result code 21 - invalidAttributeSyntax]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify", "delete: telephonenumber",
- "telephonenumber: 976-893-3312", "-", "add: telephonenumber",
- "telephonenumber: Invalid phone number" );
+ "dn: " + USER1_DN.getName(), "changetype: modify", "delete: mail" );
}
- @Ignore("Until DIRSERVER-2308 is fixed")
- @Test
- public void testRenameAlreadyExistingEntry() throws Exception
+ @Disabled("Until DIRSERVER-2308 is fixed")
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRenameAlreadyExistingEntry( TestLdapServer server ) throws Exception
{
}
- @Ignore("Until DIRSERVER-2308 is fixed")
- @Test
- public void testMoveAlreadyExistingEntry() throws Exception
+ @Disabled("Until DIRSERVER-2308 is fixed")
+ @ParameterizedTest
+ @LdapServersSource
+ public void testMoveAlreadyExistingEntry( TestLdapServer server ) throws Exception
{
}