directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r887714 - in /directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui: ApacheDsUtils.java BrowserTest.java NewEntryWizardTest.java bots/NewEntryWizardBot.java
Date Sun, 06 Dec 2009 16:57:43 GMT
Author: seelmann
Date: Sun Dec  6 16:57:42 2009
New Revision: 887714

URL: http://svn.apache.org/viewvc?rev=887714&view=rev
Log:
Tests for DIRSTUDIO-603 (Error browsing/entering rfc2307 compliant host entry)

Added:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDsUtils.java
Modified:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java

Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDsUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDsUtils.java?rev=887714&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDsUtils.java
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDsUtils.java
Sun Dec  6 16:57:42 2009
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.test.integration.ui;
+
+
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+
+import org.apache.directory.server.ldap.LdapServer;
+
+
+/**
+ * Utils for ApacheDS.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ApacheDsUtils
+{
+    public static void enableSchema( LdapServer ldapServer, String schema ) throws Exception
+    {
+        DirContext schemaRoot = ( DirContext ) getWiredContext( ldapServer ).lookup( "ou=schema"
);
+        Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=" + schema );
+        boolean isKrb5KdcDisabled = false;
+        if ( krb5kdcAttrs.get( "m-disabled" ) != null )
+        {
+            isKrb5KdcDisabled = ( ( String ) krb5kdcAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase(
"TRUE" );
+        }
+        // if krb5kdc is disabled then enable it
+        if ( isKrb5KdcDisabled )
+        {
+            Attribute disabled = new BasicAttribute( "m-disabled" );
+            ModificationItem[] mods = new ModificationItem[]
+                { new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
+            schemaRoot.modifyAttributes( "cn=" + schema, mods );
+        }
+    }
+
+}

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java?rev=887714&r1=887713&r2=887714&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
Sun Dec  6 16:57:42 2009
@@ -470,4 +470,27 @@
         assertEquals( "No modification expected", "", modificationLogsViewBot.getModificationLogsText()
);
     }
 
+
+    /**
+     * Test for DIRSTUDIO-603, DIRSHARED-41.
+     * (Error browsing/entering rfc2307 compliant host entry.)
+     */
+    @Test
+    public void testBrowseDnWithIpHostNumber() throws Exception
+    {
+        ApacheDsUtils.enableSchema( ldapServer, "nis" );
+
+        // create entry with multi-valued RDN containing an IP address value
+        ServerEntry entry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries()
);
+        entry.setDn( new LdapDN( "cn=loopback+ipHostNumber=127.0.0.1,ou=users,ou=system"
) );
+        entry.add( "objectClass", "top", "device", "ipHost" );
+        entry.add( "cn", "loopback" );
+        entry.add( "ipHostNumber", "127.0.0.1" );
+        ldapServer.getDirectoryService().getAdminSession().add( entry );
+
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=loopback+ipHostNumber=127.0.0.1" ) );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=loopback+ipHostNumber=127.0.0.1"
);
+    }
+
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java?rev=887714&r1=887713&r2=887714&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
Sun Dec  6 16:57:42 2009
@@ -78,22 +78,9 @@
     {
         ErrorDialog.AUTOMATED_MODE = false;
 
-        // check if krb5kdc is disabled
-        DirContext schemaRoot = ( DirContext ) getWiredContext( ldapServer ).lookup( "ou=schema"
);
-        Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=Krb5kdc" );
-        boolean isKrb5KdcDisabled = false;
-        if ( krb5kdcAttrs.get( "m-disabled" ) != null )
-        {
-            isKrb5KdcDisabled = ( ( String ) krb5kdcAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase(
"TRUE" );
-        }
-        // if krb5kdc is disabled then enable it
-        if ( isKrb5KdcDisabled )
-        {
-            Attribute disabled = new BasicAttribute( "m-disabled" );
-            ModificationItem[] mods = new ModificationItem[]
-                { new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
-            schemaRoot.modifyAttributes( "cn=Krb5kdc", mods );
-        }
+        // enable krb5kdc and nis schemas
+        ApacheDsUtils.enableSchema( ldapServer, "krb5kdc" );
+        ApacheDsUtils.enableSchema( ldapServer, "nis" );
 
         // create referral entry
         ServerEntry entry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries()
);
@@ -407,4 +394,37 @@
         assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=\\#123456"
) );
         browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=\\#123456" );
     }
+
+
+    /**
+     * Test for DIRSTUDIO-603, DIRSHARED-41.
+     * 
+     * Create an entry with multi-valued RDN and numeric OID (IP address) in RDN value.
+     */
+    @Test
+    public void testCreateMvRdnWithNumericOid()
+    {
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+
+        NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
+
+        wizardBot.selectCreateEntryFromScratch();
+        wizardBot.clickNextButton();
+
+        wizardBot.addObjectClasses( "device" );
+        wizardBot.addObjectClasses( "ipHost" );
+        wizardBot.clickNextButton();
+
+        wizardBot.clickAddRdnButton( 1 );
+        wizardBot.setRdnType( 1, "cn" );
+        wizardBot.setRdnValue( 1, "loopback" );
+        wizardBot.setRdnType( 2, "ipHostNumber" );
+        wizardBot.setRdnValue( 2, "127.0.0.1" );
+        wizardBot.clickNextButton();
+
+        wizardBot.clickFinishButton();
+
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=loopback+ipHostNumber=127.0.0.1"
) );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=loopback+ipHostNumber=127.0.0.1"
);
+    }
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java?rev=887714&r1=887713&r2=887714&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java
Sun Dec  6 16:57:42 2009
@@ -59,6 +59,13 @@
     }
 
 
+    public void clickAddRdnButton( int number )
+    {
+        int index = number - 1;
+        bot.button( "  +   ", index ).click();
+    }
+
+
     public void setRdnValue( int number, String text )
     {
         int index = number - 1;



Mime
View raw message