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 2018/09/08 20:57:01 UTC

[directory-studio] branch master updated: Add test for DIRSTUDIO-1160

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 7c986c9  Add test for DIRSTUDIO-1160
7c986c9 is described below

commit 7c986c91f3b8a49e7fcab5808c4f5eb8b5e7352e
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Sat Sep 8 22:56:52 2018 +0200

    Add test for DIRSTUDIO-1160
---
 .../test/integration/ui/ImportExportTest.java      | 36 ++++++++++++++++++++++
 .../studio/test/integration/ui/DIRSTUDIO-1160.ldif | 14 +++++++++
 2 files changed, 50 insertions(+)

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 70c3d9d..d66693d 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
@@ -46,6 +46,7 @@ import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 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.StudioBot;
@@ -303,4 +304,39 @@ public class ImportExportTest extends AbstractLdapTestUnit
             lines.get( 1 ) );
     }
 
+
+    /**
+     * 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
+    {
+        URL url = Platform.getInstanceLocation().getURL();
+        String destFile = url.getFile() + "DIRSTUDIO-1160.ldif";
+        InputStream is = getClass().getResourceAsStream( "DIRSTUDIO-1160.ldif" );
+        String ldifContent = IOUtils.toString( is, StandardCharsets.UTF_8 );
+        FileUtils.writeStringToFile( new File( destFile ), ldifContent, StandardCharsets.UTF_8, false );
+
+        // import the LDIF
+        ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
+        importWizardBot.typeFile( destFile );
+        importWizardBot.clickFinishButton();
+
+        Thread.sleep( 10000 );
+        browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=U0034692" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=U0034692" );
+
+        EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=U0034692,ou=users,ou=system" );
+        entryEditorBot.activate();
+        assertTrue( entryEditorBot.getAttributeValues().contains( "description: Initial import" ) );
+        assertTrue( entryEditorBot.getAttributeValues().contains( "description: Good#Stuff" ) );
+        assertTrue( entryEditorBot.getAttributeValues().contains( "description: account#oldUserID#ABC123" ) );
+        assertTrue( entryEditorBot.getAttributeValues()
+            .contains( "description: person#homeEmailAddress#jhon.doe@apache.com" ) );
+        assertTrue( entryEditorBot.getAttributeValues().contains( "description: Thöis ås a täst yes" ) );
+    }
 }
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
new file mode 100644
index 0000000..fd8c720
--- /dev/null
+++ b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif
@@ -0,0 +1,14 @@
+version: 1
+
+dn: cn=U0034692,ou=users,ou=system
+sn: Doe
+displayName:: SsO2aG4gRG/DpGXDtg==
+givenName:: SsO2aG4gRG/DpGXDtg==
+objectClass: inetOrgPerson
+uid: MyTestUser
+description: account#oldUserID#ABC123
+description: person#homeEmailAddress#jhon.doe@apache.com
+description:: VGjDtmlzIMOlcyBhIHTDpHN0IHllcw==
+description: Initial import
+description: Good#Stuff
+