You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2021/04/20 19:22:57 UTC
[directory-studio] branch DIRSTUDIO-1274-rework-integration-tests
updated (9bd6bab -> bb7f78e)
This is an automated email from the ASF dual-hosted git repository.
seelmann pushed a change to branch DIRSTUDIO-1274-rework-integration-tests
in repository https://gitbox.apache.org/repos/asf/directory-studio.git.
from 9bd6bab Migrate entry editor tests
new 51535a9 Migrate errorhandling and copyentry tests
new bb7f78e Migrate import export test
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../integration/junit5/ApacheDirectoryServer.java | 28 +-
.../test/integration/junit5/TestFixture.java | 6 +-
.../studio/test/integration/junit5/ApacheDS.ldif | 6 +
.../test/integration/junit5/TestFixture.ldif | 9 +
.../test/integration/ui/AbstractTestBase.java | 2 +-
.../studio/test/integration/ui/CopyEntryTest.java | 306 +++++------
.../test/integration/ui/ErrorHandlingTest.java | 178 ++++---
.../test/integration/ui/ImportExportTest.java | 573 +++++++++++++--------
.../studio/test/integration/ui/DIRSTUDIO-1160.ldif | 2 +-
.../ui/ImportExportTest_Modifications.ldif | 83 +--
...pdateUI.ldif => ImportExportTest_User1to8.ldif} | 16 +-
11 files changed, 639 insertions(+), 570 deletions(-)
rename tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/{ImportExportTest_ImportDontUpdateUI.ldif => ImportExportTest_User1to8.ldif} (89%)
[directory-studio] 01/02: Migrate errorhandling and copyentry tests
Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
seelmann pushed a commit to branch DIRSTUDIO-1274-rework-integration-tests
in repository https://gitbox.apache.org/repos/asf/directory-studio.git
commit 51535a9a9b2d794d5e7e6f2ace02232b41a3eded
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Mon Apr 19 22:29:07 2021 +0200
Migrate errorhandling and copyentry tests
---
.../test/integration/junit5/TestFixture.java | 5 +-
.../studio/test/integration/junit5/ApacheDS.ldif | 6 +
.../test/integration/ui/AbstractTestBase.java | 2 +-
.../studio/test/integration/ui/CopyEntryTest.java | 304 +++++++++++----------
.../test/integration/ui/ErrorHandlingTest.java | 178 ++++++------
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 7c29967..8e20768 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 2eceeea..888b05d 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 828f52f..db5a248 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 a83bed1..e3898b1 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 6b302a8..c230f0b 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
{
}
[directory-studio] 02/02: Migrate import export test
Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
seelmann pushed a commit to branch DIRSTUDIO-1274-rework-integration-tests
in repository https://gitbox.apache.org/repos/asf/directory-studio.git
commit bb7f78e027c15b0e3fa8e1871a99c17b54cbbc35
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Tue Apr 20 21:22:38 2021 +0200
Migrate import export test
---
.../integration/junit5/ApacheDirectoryServer.java | 28 +-
.../test/integration/junit5/TestFixture.java | 1 +
.../test/integration/junit5/TestFixture.ldif | 9 +
.../studio/test/integration/ui/CopyEntryTest.java | 16 +-
.../test/integration/ui/ImportExportTest.java | 573 +++++++++++++--------
.../studio/test/integration/ui/DIRSTUDIO-1160.ldif | 2 +-
.../ui/ImportExportTest_Modifications.ldif | 83 +--
...pdateUI.ldif => ImportExportTest_User1to8.ldif} | 16 +-
8 files changed, 395 insertions(+), 333 deletions(-)
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java
index 065ff61..cc7896f 100644
--- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java
@@ -44,20 +44,24 @@ import org.apache.mina.util.AvailablePortFinder;
public class ApacheDirectoryServer extends TestLdapServer
{
- private static DirectoryService service;
- private static LdapServer server;
+ private static ApacheDirectoryServer instance;
- public static ApacheDirectoryServer getInstance()
+ private DirectoryService service;
+ private LdapServer server;
+
+ public static synchronized ApacheDirectoryServer getInstance()
{
- if ( server == null )
+ if ( instance == null )
{
- startServer();
+ int port = AvailablePortFinder.getNextAvailable( 1024 );
+ instance = new ApacheDirectoryServer( port );
+ instance.startServer();
}
- return new ApacheDirectoryServer();
+ return instance;
}
- private static void startServer()
+ private void startServer()
{
try
{
@@ -88,9 +92,15 @@ public class ApacheDirectoryServer extends TestLdapServer
}
- private ApacheDirectoryServer()
+ public DirectoryService getService()
+ {
+ return service;
+ }
+
+
+ private ApacheDirectoryServer( int port )
{
- super( LdapServerType.ApacheDS, LOCALHOST, server.getPort(), "uid=admin,ou=system", "secret" );
+ super( LdapServerType.ApacheDS, LOCALHOST, port, "uid=admin,ou=system", "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 8e20768..929070e 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
@@ -105,6 +105,7 @@ public class TestFixture
public static final Dn MISC111_DN = dn( "ou=misc.1.1.1", MISC11_DN );
public static final Dn BJENSEN_DN = dn( "cn=Barbara Jensen", MISC_DN );
public static final Dn HNELSON_DN = dn( "uid=hnelson", MISC_DN );
+ public static final Dn GERMAN_UMLAUT_DN = dn( "cn=Wolfgang K\u00f6lbel", MISC_DN );
public static final Dn MULTI_VALUED_RDN_DN = dn( "cn=Barbara Jensen+uid=bjensen", MISC_DN );
public static final Dn DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED = dn( "cn=\\#123456", MISC_DN );
public static final Dn DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED = dn( "cn=\\23123456", MISC_DN );
diff --git a/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif
index 522497a..58f3440 100644
--- a/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif
+++ b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif
@@ -77,6 +77,15 @@ userSMIMECertificate:: AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJyg
J2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1d
bX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+
+dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT1taXNjLGRjPWV4YW1wbGUsZGM9b3Jn
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+objectClass: top
+cn:: V29sZmdhbmcgS8O2bGJlbA==
+sn:: S8O2bGJlbA==
+description: =1+1
+
# Multi-valued RDN
dn: cn=Barbara Jensen+uid=bjensen,ou=misc,dc=example,dc=org
objectClass: inetOrgPerson
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 e3898b1..7ee7586 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
@@ -243,19 +243,19 @@ public class CopyEntryTest extends AbstractTestBase
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
- // expand the entries to avoid copy depth dialog
+ // expand the entry 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
+ // select the parent entry where the copied entry should be pasted to
browserViewBot.selectEntry( path( MISC111_DN ) );
assertFalse( browserViewBot.existsEntry( path( MISC111_DN, ALIAS_DN.getRdn() ) ) );
- // paste the entries
+ // paste the entry
browserViewBot.pasteEntries( 1 );
- // verify the entries were copied
+ // verify the entyr was copied
assertTrue( browserViewBot.existsEntry( path( MISC111_DN, ALIAS_DN.getRdn() ) ) );
// verify in modification logs
@@ -272,19 +272,19 @@ public class CopyEntryTest extends AbstractTestBase
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- // expand the entries to avoid copy depth dialog
+ // expand the entry to avoid copy depth dialog
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
+ // select the parent entry where the copied entry should be pasted to
browserViewBot.selectEntry( path( MISC111_DN ) );
assertFalse( browserViewBot.existsEntry( path( MISC111_DN, REFERRAL_TO_USER1_DN.getRdn() ) ) );
- // paste the entries
+ // paste the entry
browserViewBot.pasteEntries( 1 );
- // verify the entries were copied
+ // verify the entry was copied
assertTrue( browserViewBot.existsEntry( path( MISC111_DN, REFERRAL_TO_USER1_DN.getRdn() ) ) );
// verify in modification logs
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
index 8c5e652..aac8eb2 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
@@ -21,6 +21,16 @@
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.GERMAN_UMLAUT_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC111_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_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.USER2_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.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -39,11 +49,8 @@ import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.util.FileUtils;
-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.api.DirectoryService;
import org.apache.directory.server.core.api.partition.Partition;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
@@ -51,25 +58,19 @@ 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.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.test.integration.junit5.ApacheDirectoryServer;
+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.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.ExportWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.ImportWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.SearchLogsViewBot;
-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.Characters;
-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;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -78,39 +79,8 @@ 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 = ImportExportTest.class, value = "org/apache/directory/studio/test/integration/ui/ImportExportTest.ldif")
-public class ImportExportTest extends AbstractLdapTestUnit
+public class ImportExportTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private Connection connection;
- private SearchLogsViewBot searchLogsViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "ImportExportTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- searchLogsViewBot = studioBot.getSearchLogsViewBot();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-395.
@@ -123,13 +93,15 @@ public class ImportExportTest extends AbstractLdapTestUnit
* @throws Exception
* the exception
*/
- @Test
- public void testExportImportLdifWithGermanUmlautInDN() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportLdifWithGermanUmlautInDN( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
URL url = Platform.getInstanceLocation().getURL();
- final String file = url.getFile() + "ImportExportWithGermanUmlautInDnTest.ldif";
+ final String file = url.getFile() + "ImportExportWithGermanUmlautInDnTest" + server.getType().name() + ".ldif";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
// export LDIF
ExportWizardBot wizardBot = browserViewBot.openExportLdifWizard();
@@ -144,14 +116,13 @@ public class ImportExportTest extends AbstractLdapTestUnit
assertEquals( "LDIF must start with version: 1", lines.get( 0 ), "version: 1" );
// verify that the third line of exported LDIF is the Base64 encoded DN
assertEquals( "Expected Base64 encoded DN", lines.get( 2 ),
- "dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT11c2VycyxvdT1zeXN0ZW0=" );
+ "dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT1taXNjLGRjPWV4YW1wbGUsZGM9b3Jn" );
// delete entry
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" ) );
+ assertFalse( browserViewBot.existsEntry( path( GERMAN_UMLAUT_DN ) ) );
// import LDIF
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
@@ -159,9 +130,8 @@ public class ImportExportTest extends AbstractLdapTestUnit
importWizardBot.clickFinishButton();
// verify that entry with umlaut exists
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ assertTrue( browserViewBot.existsEntry( path( GERMAN_UMLAUT_DN ) ) );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
}
@@ -176,13 +146,15 @@ public class ImportExportTest extends AbstractLdapTestUnit
* @throws Exception
* the exception
*/
- @Test
- public void testExportImportDsmlWithGermanUmlautInDN() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportDsmlWithGermanUmlautInDN( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
URL url = Platform.getInstanceLocation().getURL();
- final String file = url.getFile() + "ImportExportWithGermanUmlautInDnTest.dsml";
+ final String file = url.getFile() + "ImportExportWithGermanUmlautInDnTest" + server.getType().name() + ".dsml";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
// export DSML
ExportWizardBot wizardBot = browserViewBot.openExportDsmlWizard();
@@ -196,14 +168,13 @@ public class ImportExportTest extends AbstractLdapTestUnit
// verify that exported DSML contains the Base64 encoded DN
String content = FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
assertTrue( "DSML must contain DN with umlaut.",
- content.contains( "dn=\"cn=Wolfgang K\u00f6lbel,ou=users,ou=system\"" ) );
+ content.contains( "dn=\"" + GERMAN_UMLAUT_DN.getName() + "\"" ) );
// delete entry
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" ) );
+ assertFalse( browserViewBot.existsEntry( path( GERMAN_UMLAUT_DN ) ) );
// import DSML
ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
@@ -211,187 +182,306 @@ public class ImportExportTest extends AbstractLdapTestUnit
importWizardBot.clickFinishButton();
// verify that entry with umlaut exists
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ assertTrue( browserViewBot.existsEntry( path( GERMAN_UMLAUT_DN ) ) );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
}
- @Test
- public void testExportImportLdifSpecialEntries() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportLdifAlias( TestLdapServer server ) throws Exception
{
+ Connection connection = connectionsViewBot.createTestConnection( server );
// disable alias dereferencing
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
+
+ URL url = Platform.getInstanceLocation().getURL();
+ final String file = url.getFile() + "ImportExportAlias" + server.getType().name() + ".ldif";
+
+ browserViewBot.selectEntry( path( ALIAS_DN.getParent() ) );
+
+ // export to LDIF
+ ExportWizardBot wizardBot = browserViewBot.openExportLdifWizard();
+ assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(objectClass=alias)" );
+ wizardBot.setScope( SearchScope.ONELEVEL );
+ wizardBot.setAliasDereferencingMode( AliasDereferencingMethod.NEVER );
+ wizardBot.clickNextButton();
+ wizardBot.typeFile( file );
+ wizardBot.clickFinishButton();
+ wizardBot.waitTillExportFinished( file, 50 );
+
+ List<String> lines = FileUtils.readLines( new File( file ), StandardCharsets.UTF_8 );
+ assertEquals( "LDIF must start with version: 1", lines.get( 0 ), "version: 1" );
+ assertTrue( lines.contains( "dn: " + ALIAS_DN.getName() ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( ALIAS_DN ) );
+ DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
+ assertTrue( dialogBot.isVisible() );
+ dialogBot.clickOkButton();
+ waitAndAssert( false,
+ () -> browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+
+ // import LDIF
+ ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
+ importWizardBot.typeFile( file );
+ importWizardBot.clickFinishButton();
+
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportLdifReferral( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
// enable ManageDsaIT control
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- // enable Subentries control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
URL url = Platform.getInstanceLocation().getURL();
- final String file1 = url.getFile() + "ImportExportSpecialEntries1Test.ldif";
- final String file2 = url.getFile() + "ImportExportSpecialEntries2Test.ldif";
+ final String file = url.getFile() + "ImportExportReferral" + server.getType().name() + ".ldif";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN.getParent() ) );
- // export first LDIF (alias and referral)
+ // export to LDIF
ExportWizardBot wizardBot = browserViewBot.openExportLdifWizard();
assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(" + REFERRAL_TO_USER1_DN.getRdn().getName() + ")" );
wizardBot.setReturningAttributes( "ref" );
wizardBot.setScope( SearchScope.ONELEVEL );
wizardBot.setControlManageDsaIT( true );
- wizardBot.setAliasDereferencingMode( AliasDereferencingMethod.NEVER );
wizardBot.clickNextButton();
- wizardBot.typeFile( file1 );
+ wizardBot.typeFile( file );
wizardBot.clickFinishButton();
- wizardBot.waitTillExportFinished( file1, 200 );
+ wizardBot.waitTillExportFinished( file, 20 );
+
+ List<String> lines = FileUtils.readLines( new File( file ), StandardCharsets.UTF_8 );
+ assertEquals( "LDIF must start with version: 1", lines.get( 0 ), "version: 1" );
+ assertTrue( lines.contains( "dn: " + REFERRAL_TO_USER1_DN.getName() ) );
+ assertTrue( lines.contains( "ref: " + server.getLdapUrl() + "/" + USER1_DN.getName() ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN ) );
+ DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
+ assertTrue( dialogBot.isVisible() );
+ dialogBot.clickOkButton();
+ waitAndAssert( false,
+ () -> browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
+
+ // import LDIF
+ ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
+ importWizardBot.typeFile( file );
+ importWizardBot.clickFinishButton();
+
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(types = LdapServerType.ApacheDS)
+ public void testExportImportLdifSubentry( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ // enable Subentries control
+ connection.getConnectionParameter().setExtendedBoolProperty(
+ IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
+
+ URL url = Platform.getInstanceLocation().getURL();
+ final String file = url.getFile() + "ImportExportSubentry" + server.getType().name() + ".ldif";
- List<String> lines1 = FileUtils.readLines( new File( file1 ), StandardCharsets.UTF_8 );
- assertEquals( "LDIF must start with version: 1", lines1.get( 0 ), "version: 1" );
- assertTrue( lines1.contains( "dn: cn=referral,ou=special,ou=system" ) );
- assertTrue( lines1.contains( "ref: ldap://foo.example.com/ou=system" ) );
- assertTrue( lines1.contains( "dn: cn=alias,ou=special,ou=system" ) );
+ browserViewBot.selectEntry( path( SUBENTRY_DN.getParent() ) );
- // export second LDIF (subentry)
- wizardBot = browserViewBot.openExportLdifWizard();
+ // export to LDIF
+ ExportWizardBot wizardBot = browserViewBot.openExportLdifWizard();
assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(objectClass=subentry)" );
wizardBot.setReturningAttributes( "subtreeSpecification" );
wizardBot.setScope( SearchScope.ONELEVEL );
wizardBot.setControlSubentries( true );
wizardBot.clickNextButton();
- wizardBot.typeFile( file2 );
+ wizardBot.typeFile( file );
wizardBot.clickFinishButton();
- wizardBot.waitTillExportFinished( file2, 100 );
-
- List<String> lines2 = FileUtils.readLines( new File( file2 ), StandardCharsets.UTF_8 );
- assertEquals( "LDIF must start with version: 1", lines2.get( 0 ), "version: 1" );
- assertTrue( lines2.contains( "dn: cn=subentry,ou=special,ou=system" ) );
- assertTrue( lines2.contains( "subtreespecification: { }" ) );
-
- // delete entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
- String[] children =
- { "cn=alias", "cn=referral", "cn=subentry" };
- // select entries twice, sometimes one gets unselected, reason unknown
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
+ wizardBot.waitTillExportFinished( file, 20 );
+
+ List<String> lines = FileUtils.readLines( new File( file ), StandardCharsets.UTF_8 );
+ assertEquals( "LDIF must start with version: 1", lines.get( 0 ), "version: 1" );
+ assertTrue( lines.contains( "dn: " + SUBENTRY_DN.getName() ) );
+ assertTrue( lines.contains( "subtreeSpecification: {}" ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( SUBENTRY_DN ) );
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ () -> browserViewBot.existsEntry( path( SUBENTRY_DN ) ) );
- // import LDIFs
+ // import LDIF
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
- importWizardBot.typeFile( file1 );
- importWizardBot.clickFinishButton();
- importWizardBot = browserViewBot.openImportLdifWizard();
- importWizardBot.typeFile( file2 );
+ importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- // verify that entries exist
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( SUBENTRY_DN ) ) );
}
- @Test
- public void testExportImportDsmlSpecialEntries() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportDsmlAlias( TestLdapServer server ) throws Exception
{
+ Connection connection = connectionsViewBot.createTestConnection( server );
// disable alias dereferencing
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
+
+ URL url = Platform.getInstanceLocation().getURL();
+ final String file = url.getFile() + "ImportExportAlias" + server.getType().name() + ".dsml";
+
+ browserViewBot.selectEntry( path( ALIAS_DN.getParent() ) );
+
+ // export to DSML
+ ExportWizardBot wizardBot = browserViewBot.openExportDsmlWizard();
+ assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(objectClass=alias)" );
+ wizardBot.setScope( SearchScope.ONELEVEL );
+ wizardBot.setAliasDereferencingMode( AliasDereferencingMethod.NEVER );
+ wizardBot.clickNextButton();
+ wizardBot.typeFile( file );
+ wizardBot.selectDsmlRequest();
+ wizardBot.clickFinishButton();
+ wizardBot.waitTillExportFinished( file, 50 );
+
+ // verify that exported DSML contains the entry
+ String content = FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
+ assertTrue( content.contains( "dn=\"" + ALIAS_DN.getName() + "\"" ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( ALIAS_DN ) );
+ DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
+ assertTrue( dialogBot.isVisible() );
+ dialogBot.clickOkButton();
+ waitAndAssert( false,
+ () -> browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+
+ // import DSML
+ ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
+ importWizardBot.typeFile( file );
+ importWizardBot.clickFinishButton();
+
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportDsmlReferral( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
// enable ManageDsaIT control
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- // enable Subentries control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
URL url = Platform.getInstanceLocation().getURL();
- final String file1 = url.getFile() + "ImportExportSpecialEntries1Test.dsml";
- final String file2 = url.getFile() + "ImportExportSpecialEntries2Test.dsml";
+ final String file = url.getFile() + "ImportExportReferral" + server.getType().name() + ".dsml";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN.getParent() ) );
- // export first DSML (alias and referral)
+ // export to DSML
ExportWizardBot wizardBot = browserViewBot.openExportDsmlWizard();
assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(" + REFERRAL_TO_USER1_DN.getRdn().getName() + ")" );
wizardBot.setReturningAttributes( "ref" );
wizardBot.setScope( SearchScope.ONELEVEL );
wizardBot.setControlManageDsaIT( true );
- wizardBot.setAliasDereferencingMode( AliasDereferencingMethod.NEVER );
wizardBot.clickNextButton();
- wizardBot.typeFile( file1 );
+ wizardBot.typeFile( file );
wizardBot.selectDsmlRequest();
wizardBot.clickFinishButton();
- wizardBot.waitTillExportFinished( file1, 800 );
+ wizardBot.waitTillExportFinished( file, 50 );
+
+ // verify that exported DSML contains the entry
+ String content = FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
+ assertTrue( content.contains( "dn=\"" + REFERRAL_TO_USER1_DN.getName() + "\"" ) );
+ assertTrue( content.contains( "<attr name=\"ref\">" ) );
+ assertTrue( content.contains( "<value>" + server.getLdapUrl() + "/" + USER1_DN.getName() + "</value>" ) );
- // verify that exported DSML contains the entries
- String content1 = FileUtils.readFileToString( new File( file1 ), StandardCharsets.UTF_8 );
- assertTrue( content1.contains( "dn=\"cn=referral,ou=special,ou=system\"" ) );
- assertTrue( content1.contains( "<attr name=\"ref\">" ) );
- assertTrue( content1.contains( "<value>ldap://foo.example.com/ou=system</value>" ) );
- assertTrue( content1.contains( "dn=\"cn=alias,ou=special,ou=system\"" ) );
+ // delete entry
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN ) );
+ DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
+ assertTrue( dialogBot.isVisible() );
+ dialogBot.clickOkButton();
+ waitAndAssert( false,
+ () -> browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
- // export second DSML (subentry)
- wizardBot = browserViewBot.openExportDsmlWizard();
+ // import DSML
+ ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
+ importWizardBot.typeFile( file );
+ importWizardBot.clickFinishButton();
+
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(types = LdapServerType.ApacheDS)
+ public void testExportImportDsmlSubentry( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ // enable Subentries control
+ connection.getConnectionParameter().setExtendedBoolProperty(
+ IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
+
+ URL url = Platform.getInstanceLocation().getURL();
+ final String file = url.getFile() + "ImportExportSubentry" + server.getType().name() + ".dsml";
+
+ browserViewBot.selectEntry( path( SUBENTRY_DN.getParent() ) );
+
+ // export to DSML
+ ExportWizardBot wizardBot = browserViewBot.openExportDsmlWizard();
assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(objectClass=subentry)" );
wizardBot.setReturningAttributes( "subtreeSpecification" );
wizardBot.setScope( SearchScope.ONELEVEL );
wizardBot.setControlSubentries( true );
wizardBot.clickNextButton();
- wizardBot.typeFile( file2 );
+ wizardBot.typeFile( file );
wizardBot.selectDsmlRequest();
wizardBot.clickFinishButton();
- wizardBot.waitTillExportFinished( file2, 300 );
-
- // verify that exported DSML contains the entries
- String content2 = FileUtils.readFileToString( new File( file2 ), StandardCharsets.UTF_8 );
- assertTrue( content2.contains( "dn=\"cn=subentry,ou=special,ou=system\"" ) );
- assertTrue( content2.contains( "<attr name=\"subtreespecification\">" ) );
- assertTrue( content2.contains( "<value>{ }</value>" ) );
-
- // delete entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
- String[] children =
- { "cn=alias", "cn=referral", "cn=subentry" };
- // select entries twice, sometimes one gets unselected, reason unknown
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
+ wizardBot.waitTillExportFinished( file, 50 );
+
+ // verify that exported DSML
+ String content = FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
+ System.out.println( content );
+ assertTrue( content.contains( "dn=\"" + SUBENTRY_DN.getName() + "\"" ) );
+ assertTrue( content.contains( "<attr name=\"subtreespecification\">" ) );
+ assertTrue( content.contains( "<value>{}</value>" ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( SUBENTRY_DN ) );
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ () -> browserViewBot.existsEntry( path( SUBENTRY_DN ) ) );
// import DSML
ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
- importWizardBot.typeFile( file1 );
- importWizardBot.clickFinishButton();
- importWizardBot = browserViewBot.openImportDsmlWizard();
- importWizardBot.typeFile( file2 );
+ importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- // verify that entries exist
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( SUBENTRY_DN ) ) );
}
@@ -416,9 +506,11 @@ public class ImportExportTest extends AbstractLdapTestUnit
}
- @Test
- public void testExportWithPagedResultControl() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(types = LdapServerType.ApacheDS)
+ public void testExportWithPagedResultControl( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
URL url = Platform.getInstanceLocation().getURL();
final String file = url.getFile() + "ExportWithPagedResultControl.ldif";
@@ -451,14 +543,16 @@ public class ImportExportTest extends AbstractLdapTestUnit
*
* Import a new context entry must refresh the root DSE and
* show the new context entry in the LDAP Browser view.
- *
- * @throws Exception
- * the exception
*/
- @Test
- public void testImportContextEntryRefreshesRootDSE() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(types = LdapServerType.ApacheDS)
+ public void testImportContextEntryRefreshesRootDSE( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
+
// add a new partition
+ ApacheDirectoryServer apacheds = ( ApacheDirectoryServer ) server;
+ DirectoryService service = apacheds.getService();
Partition partition = new AvlPartition( service.getSchemaManager(), service.getDnFactory() );
partition.setId( "example" );
partition.setSuffixDn( new Dn( "dc=example,dc=com" ) );
@@ -490,24 +584,24 @@ public class ImportExportTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-489.
*
* Verify that there are no UI updates when importing an LDIF.
- *
- * @throws Exception
*/
- @Test
- public void testImportDoesNotUpdateUI() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testImportDoesNotUpdateUI( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( MISC111_DN ) );
+ browserViewBot.expandEntry( path( MISC111_DN ) );
long fireCount0 = EventRegistry.getFireCount();
// import the LDIF
- String file = prepareInputFile( "ImportExportTest_ImportDontUpdateUI.ldif" );
+ String file = prepareInputFile( "ImportExportTest_User1to8.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
+ browserViewBot.waitForEntry( path( MISC111_DN, "uid=User.1" ) );
+ browserViewBot.selectEntry( path( MISC111_DN, "uid=User.1" ) );
long fireCount1 = EventRegistry.getFireCount();
@@ -520,17 +614,19 @@ public class ImportExportTest extends AbstractLdapTestUnit
/**
* Export to CSV and checks that spreadsheet formulas are prefixed with an apostrophe.
*/
- @Test
- public void testExportCsvShouldPrefixFormulaWithApostrophe() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportCsvShouldPrefixFormulaWithApostrophe( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
// 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";
+ final String file = url.getFile() + "ImportExportTest" + server.getType().name() + ".csv";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
// export CSV
ExportWizardBot wizardBot = browserViewBot.openExportCsvWizard();
@@ -545,8 +641,7 @@ public class ImportExportTest extends AbstractLdapTestUnit
// verify that the first line is header
assertEquals( "dn,cn,description", lines.get( 0 ) );
// verify that the second line is actual content and the formula is prefixed with an apostrophe
- assertEquals( "\"cn=Wolfgang K\u00f6lbel,ou=users,ou=system\",\"Wolfgang K\u00f6lbel\",\"'=1+1\"",
- lines.get( 1 ) );
+ assertEquals( "\"" + GERMAN_UMLAUT_DN.getName() + "\",\"Wolfgang K\u00f6lbel\",\"'=1+1\"", lines.get( 1 ) );
}
@@ -554,22 +649,24 @@ public class ImportExportTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-1160.
*
* Attributes silently dropped and not imported when import LDIF and provider is Apache Directory LDAP API.
- *
- * @throws Exception
*/
- @Test
- public void testDIRSTUDIO_1160() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDIRSTUDIO_1160( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
+ Dn dn = dn( "cn=U0034692", MISC_DN );
+
// import the LDIF
String file = prepareInputFile( "DIRSTUDIO-1160.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=U0034692" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=U0034692" );
+ browserViewBot.waitForEntry( path( dn ) );
+ browserViewBot.selectEntry( path( dn ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=U0034692,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn.getName() );
entryEditorBot.activate();
assertTrue( entryEditorBot.getAttributeValues().contains( "description: Initial import" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "description: Good#Stuff" ) );
@@ -583,49 +680,67 @@ public class ImportExportTest extends AbstractLdapTestUnit
/**
* Test LDIF with several modifications.
*/
- @Test
- public void testLdifModification() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testLdifModification( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
// import the LDIF
String file = prepareInputFile( "ImportExportTest_Modifications.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ browserViewBot.waitForEntry( path( USER1_DN ) );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
assertTrue( entryEditorBot.getAttributeValues().contains( "description: " + Characters.ALL ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 0000" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 1388" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 1234" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 2345" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 3456" ) );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "userCertificate: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ if ( server.getType() == LdapServerType.ApacheDS )
+ {
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description: Deutsch" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description: English" ) );
+ }
+ else
+ {
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate;binary: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-de: Deutsch" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-en: English" ) );
+ }
modificationLogsViewBot.waitForText( "add: userCertificate;binary\nuserCertificate;binary:: " );
modificationLogsViewBot.waitForText( "add: description;lang-en\ndescription;lang-en: " );
modificationLogsViewBot.waitForText( "add: description;lang-de\ndescription;lang-de: " );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.2" ) );
+ assertFalse( browserViewBot.existsEntry( path( USER2_DN ) ) );
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.33" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.33" );
+ browserViewBot.waitForEntry( path( USERS_DN, "uid=user.33" ) );
+ browserViewBot.selectEntry( path( USERS_DN, "uid=user.33" ) );
entryEditorBot.activate();
assertTrue( entryEditorBot.getAttributeValues().contains( "uid: user.33" ) );
assertFalse( entryEditorBot.getAttributeValues().contains( "uid: user.3" ) );
}
- @Test
- public void testImportUpdateExistingEntriesFalse() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testImportUpdateExistingEntriesFalse( TestLdapServer server ) throws Exception
{
- String dn = "uid=User.1,ou=users,ou=system";
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), dn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: User.1" ) );
+ connectionsViewBot.createTestConnection( server );
+ Dn dn = dn( "uid=User.1", MISC111_DN );
+ server.withAdminConnection( conn -> {
+ conn.add( new DefaultEntry( conn.getSchemaManager(), dn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: User.1" ) );
+ } );
// import the LDIF
- String file = prepareInputFile( "ImportExportTest_ImportDontUpdateUI.ldif" );
+ String file = prepareInputFile( "ImportExportTest_User1to8.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.setUpdateExistingEntries( false );
@@ -633,9 +748,9 @@ public class ImportExportTest extends AbstractLdapTestUnit
importWizardBot.clickFinishButton();
// check entry was not updated
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn );
+ browserViewBot.waitForEntry( path( dn ) );
+ browserViewBot.selectEntry( path( dn ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn.getName() );
entryEditorBot.activate();
assertTrue( entryEditorBot.getAttributeValues().contains( "sn: X" ) );
assertFalse( entryEditorBot.getAttributeValues().contains( "sn: Amar" ) );
@@ -643,22 +758,26 @@ public class ImportExportTest extends AbstractLdapTestUnit
// check error in modifications logs view
modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]",
- "dn: uid=User.1,ou=users,ou=system", "changetype: add" );
+ "dn: " + dn.getName(), "changetype: add" );
// check error in LDIF log file
String logContent = FileUtils.readFileToString( new File( file + ".log" ), StandardCharsets.UTF_8 );
assertThat( logContent, containsString( "[LDAP result code 68 - entryAlreadyExists]" ) );
}
- @Test
- public void testImportUpdateExistingEntriesTrue() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testImportUpdateExistingEntriesTrue( TestLdapServer server ) throws Exception
{
- String dn = "uid=User.1,ou=users,ou=system";
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), dn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: User.1" ) );
+ connectionsViewBot.createTestConnection( server );
+ Dn dn = dn( "uid=User.1", MISC111_DN );
+ server.withAdminConnection( conn -> {
+ conn.add( new DefaultEntry( conn.getSchemaManager(), dn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: User.1" ) );
+ } );
// import the LDIF
- String file = prepareInputFile( "ImportExportTest_ImportDontUpdateUI.ldif" );
+ String file = prepareInputFile( "ImportExportTest_User1to8.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.setUpdateExistingEntries( true );
@@ -666,9 +785,9 @@ public class ImportExportTest extends AbstractLdapTestUnit
importWizardBot.clickFinishButton();
// check entry was updated
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn );
+ browserViewBot.waitForEntry( path( dn ) );
+ browserViewBot.selectEntry( path( dn ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn.getName() );
entryEditorBot.activate();
assertFalse( entryEditorBot.getAttributeValues().contains( "sn: X" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "sn: Amar" ) );
@@ -676,8 +795,8 @@ public class ImportExportTest extends AbstractLdapTestUnit
// check error and update in modifications logs view
modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]",
- "dn: uid=User.1,ou=users,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: uid=User.1,ou=users,ou=system", "changetype: modify" );
+ "dn: " + dn.getName(), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn.getName(), "changetype: modify" );
// check no error but update in LDIF log file
String logContent = FileUtils.readFileToString( new File( file + ".log" ), StandardCharsets.UTF_8 );
assertThat( logContent, not( containsString( "[LDAP result code 68 - entryAlreadyExists]" ) ) );
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif
index d504a32..3b58de6 100644
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif
+++ b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif
@@ -17,7 +17,7 @@
#
version: 1
-dn: cn=U0034692,ou=users,ou=system
+dn: cn=U0034692,ou=misc,dc=example,dc=org
sn: Doe
displayName:: SsO2aG4gRG/DpGXDtg==
givenName:: SsO2aG4gRG/DpGXDtg==
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif
index 5034e9c..0042152 100644
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif
+++ b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif
@@ -15,85 +15,8 @@
# specific language governing permissions and limitations
# under the License.
#
-dn: uid=user.1,ou=users,ou=system
-changetype: add
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaccf
-sn: Amar
-cn: Aaccf Amar
-initials: AA
-uid: user.1
-mail: user.1@null
-userPassword: password
-telephoneNumber: 976-893-3312
-homePhone: 337-310-0727
-pager: 185-156-4071
-mobile: 626-188-0934
-employeeNumber: 1
-street: 27919 Broadway Street
-l: Tallahassee
-st: DE
-postalCode: 67698
-postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE 67698
-description: This is the description for Aaccf Amar.
-roomNumber: 0000
-
-dn: uid=user.2,ou=users,ou=system
-changetype: add
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaren
-sn: Atp
-cn: Aaren Atp
-initials: AA
-uid: user.2
-mail: user.2@null
-userPassword: password
-telephoneNumber: 147-953-0396
-homePhone: 174-439-5329
-pager: 617-443-8449
-mobile: 045-464-2512
-employeeNumber: 2
-street: 36109 Center Street
-l: Harlingen
-st: CO
-postalCode: 21733
-postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO 21733
-description: This is the description for Aaren Atp.
-roomNumber: 1198
-
-dn: uid=user.3,ou=users,ou=system
-changetype: add
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aarika
-sn: Atpco
-cn: Aarika Atpco
-initials: AA
-uid: user.3
-mail: user.3@null
-userPassword: password
-telephoneNumber: 925-356-4943
-homePhone: 099-983-0308
-pager: 806-672-7363
-mobile: 425-493-8009
-employeeNumber: 3
-street: 14730 Fourteenth Street
-l: Evansville
-st: ND
-postalCode: 95526
-postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND 95526
-description: This is the description for Aarika Atpco.
-roomNumber: 1135
-dn: uid=user.1,ou=users,ou=system
+dn: uid=user.1,ou=users,dc=example,dc=org
changetype: modify
delete: initials
initials: AA
@@ -138,10 +61,10 @@ userCertificate;binary:: MIICcTCCAdqgAwIBAgIBEjANBgkqhkiG9w0BAQUFADBDMRMwEQYKCZI
ORRepiXc0=
-dn: uid=user.2,ou=users,ou=system
+dn: uid=user.2,ou=users,dc=example,dc=org
changetype: delete
-dn: uid=user.3,ou=users,ou=system
+dn: uid=user.3,ou=users,dc=example,dc=org
changetype: moddn
newrdn: uid=user.33
deleteoldrdn: 1
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_ImportDontUpdateUI.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_User1to8.ldif
similarity index 89%
rename from tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_ImportDontUpdateUI.ldif
rename to tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_User1to8.ldif
index 1c800ea..4b39ca7 100644
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_ImportDontUpdateUI.ldif
+++ b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_User1to8.ldif
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
#
-dn: uid=User.1,ou=users,ou=system
+dn: uid=User.1,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -40,7 +40,7 @@ postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE 67698
description: This is the description for Aaccf Amar.
roomNumber: 1388
-dn: uid=user.2,ou=users,ou=system
+dn: uid=user.2,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -65,7 +65,7 @@ postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO 21733
description: This is the description for Aaren Atp.
roomNumber: 1198
-dn: uid=user.3,ou=users,ou=system
+dn: uid=user.3,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -90,7 +90,7 @@ postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND 95526
description: This is the description for Aarika Atpco.
roomNumber: 1135
-dn: uid=user.4,ou=users,ou=system
+dn: uid=user.4,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -115,7 +115,7 @@ postalAddress: Aaron Atrc$98495 Fifteenth Street$Miami, PA 16887
description: This is the description for Aaron Atrc.
roomNumber: 1311
-dn: uid=user.5,ou=users,ou=system
+dn: uid=user.5,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -140,7 +140,7 @@ postalAddress: Aartjan Aalders$52408 Ridge Street$Omaha, AR 08015
description: This is the description for Aartjan Aalders.
roomNumber: 1090
-dn: uid=user.6,ou=users,ou=system
+dn: uid=user.6,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -165,7 +165,7 @@ postalAddress: Abagael Aasen$87514 Dogwood Street$Bloomington, ID 56762
description: This is the description for Abagael Aasen.
roomNumber: 1449
-dn: uid=user.7,ou=users,ou=system
+dn: uid=user.7,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -190,7 +190,7 @@ postalAddress: Abagail Abadines$60751 Main Street$Macon, MI 38755
description: This is the description for Abagail Abadines.
roomNumber: 1312
-dn: uid=user.8,ou=users,ou=system
+dn: uid=user.8,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson