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

github.com/apache/directory-studio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Seelmann <mail@stefan-seelmann.de>2021-04-20 22:22:38 +0300
committerStefan Seelmann <mail@stefan-seelmann.de>2021-04-20 22:22:38 +0300
commitbb7f78e027c15b0e3fa8e1871a99c17b54cbbc35 (patch)
treefb09008c8399eb8745a9892da25aa97c2bc0eabc
parent51535a9a9b2d794d5e7e6f2ace02232b41a3eded (diff)
Migrate import export test
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java28
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java1
-rw-r--r--tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif9
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java16
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java573
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif2
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif83
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_User1to8.ldif (renamed from tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_ImportDontUpdateUI.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 065ff6148..cc7896fc7 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 8e2076858..929070e2f 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 522497ad6..58f3440bd 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 e3898b1be..7ee758699 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 8c5e6529e..aac8eb292 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 d504a3282..3b58de635 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 5034e9cb3..0042152e7 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
index 1c800ea13..4b39ca70c 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