You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2019/04/17 15:44:19 UTC

[directory-server] 02/08: Added a test for NIS

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

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

commit 8942572f06908aa32ea746b6e7a73dbe0b260ab0
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Mon Feb 11 06:03:10 2019 +0100

    Added a test for NIS
---
 .../server/core/operations/add/AddIT.java          | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddIT.java b/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddIT.java
index ee52f3d..83d8307 100644
--- a/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddIT.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddIT.java
@@ -22,6 +22,7 @@ package org.apache.directory.server.core.operations.add;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.entry.DefaultEntry;
@@ -32,6 +33,7 @@ import org.apache.directory.server.core.annotations.ContextEntry;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.annotations.CreateIndex;
 import org.apache.directory.server.core.annotations.CreatePartition;
+import org.apache.directory.server.core.annotations.LoadSchema;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
@@ -47,6 +49,8 @@ import org.junit.runner.RunWith;
 @RunWith(FrameworkRunner.class)
 @CreateDS(
     name = "AddITDS",
+        loadedSchemas =
+        { @LoadSchema(name = "nis", enabled = true) },
     partitions =
         {
             @CreatePartition(
@@ -179,4 +183,26 @@ public class AddIT extends AbstractLdapTestUnit
         assertEquals( "a\\b", entry.get( "cn" ).get().getString() );
     }
 
+
+    /**
+     * Test The addition of a nisMapName attributeType
+     */
+    @Test
+    public void testAddNisMapName() throws Exception
+    {
+        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+
+        Dn dn = new Dn( "nisMapName=netgroup.byhost,ou=system" );
+        Entry entry = new DefaultEntry( dn,
+            "ObjectClass: top",
+            "ObjectClass: nisMap",
+            "nisMapName:  netgroup.byhost" );
+
+        connection.add( entry );
+        
+        Entry result = connection.lookup( dn );
+        
+        assertNotNull( result );
+        assertEquals( "netgroup.byhost", result.get( "nismapname" ).getString() );
+    }
 }