You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by js...@apache.org on 2014/12/08 20:07:41 UTC

ambari git commit: AMBARI-8578. Update Apache Directory Server Library from 1.5.5 to 2.0.0-M19

Repository: ambari
Updated Branches:
  refs/heads/trunk 3ba1889f4 -> 74f9ddcf8


AMBARI-8578. Update Apache Directory Server Library from 1.5.5 to 2.0.0-M19


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/74f9ddcf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/74f9ddcf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/74f9ddcf

Branch: refs/heads/trunk
Commit: 74f9ddcf8b0d9a8c0650de7352015745e8e2af28
Parents: 3ba1889
Author: Robert Levas <rl...@hortonworks.com>
Authored: Mon Dec 8 14:06:00 2014 -0500
Committer: John Speidel <js...@hortonworks.com>
Committed: Mon Dec 8 14:07:27 2014 -0500

----------------------------------------------------------------------
 ambari-project/pom.xml                          | 35 +++++++++++++-
 ambari-server/pom.xml                           | 27 +++++++++++
 ...mbariLdapAuthenticationProviderBaseTest.java | 48 +++++++++++--------
 ...uthenticationProviderForDNWithSpaceTest.java | 47 ++++++++++++-------
 .../AmbariLdapAuthenticationProviderTest.java   | 49 +++++++++++++-------
 ambari-server/src/test/resources/users.ldif     |  2 +-
 .../test/resources/users_for_dn_with_space.ldif |  2 +-
 7 files changed, 154 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/74f9ddcf/ambari-project/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml
index edba1dc..930080e 100644
--- a/ambari-project/pom.xml
+++ b/ambari-project/pom.xml
@@ -186,13 +186,44 @@
       </dependency>
       <dependency>
         <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-server-annotations</artifactId>
+        <version>2.0.0-M19</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-core-integ</artifactId>
+        <version>2.0.0-M19</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-server-integ</artifactId>
+        <version>2.0.0-M19</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-jdbm</artifactId>
+        <version>2.0.0-M5</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
+        <artifactId>apacheds-kerberos-codec</artifactId>
+        <version>2.0.0-M19</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.server</groupId>
         <artifactId>apacheds-core</artifactId>
-        <version>1.5.5</version>
+        <version>2.0.0-M19</version>
       </dependency>
       <dependency>
         <groupId>org.apache.directory.server</groupId>
         <artifactId>apacheds-protocol-ldap</artifactId>
-        <version>1.5.5</version>
+        <version>2.0.0-M19</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.apache.directory.jdbm</groupId>
+            <artifactId>apacheds-jdbm1</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.directory.shared</groupId>

http://git-wip-us.apache.org/repos/asf/ambari/blob/74f9ddcf/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 4076d73..b11538d 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -1433,15 +1433,42 @@
     </dependency>
     <dependency>
       <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-annotations</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-integ</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-integ</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-jdbm</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-kerberos-codec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
       <artifactId>apacheds-core</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.directory.server</groupId>
       <artifactId>apacheds-protocol-ldap</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.directory.shared</groupId>
       <artifactId>shared-ldap</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/ambari/blob/74f9ddcf/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderBaseTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderBaseTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderBaseTest.java
index 2a323f8..ae4757f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderBaseTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderBaseTest.java
@@ -18,33 +18,41 @@
 
 package org.apache.ambari.server.security.authorization;
 
-import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.ldap.LdapServer;
 import org.easymock.EasyMockSupport;
 
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+public class AmbariLdapAuthenticationProviderBaseTest extends EasyMockSupport {
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+  public static DirectoryService getService() {
+    return AbstractLdapTestUnit.service;
+  }
 
-public class AmbariLdapAuthenticationProviderBaseTest extends EasyMockSupport {
 
-  private static final Log logger = LogFactory.getLog(AmbariLdapAuthenticationProviderBaseTest.class);
+  public static void setService(DirectoryService service) {
+    AbstractLdapTestUnit.service = service;
+  }
+
+
+  public static LdapServer getLdapServer() {
+    return AbstractLdapTestUnit.ldapServer;
+  }
+
+
+  public static void setLdapServer(LdapServer ldapServer) {
+    AbstractLdapTestUnit.ldapServer = ldapServer;
+  }
+
+
+  public static KdcServer getKdcServer() {
+    return AbstractLdapTestUnit.kdcServer;
+  }
 
-  protected static void createCleanApacheDSContainerWorkDir() throws IOException{
-    // Set ApacheDsContainer's work dir under the current folder (Jenkins' job workspace) instead of the default /tmp/apacheds-spring-security. See AMBARI-7180
-    SimpleDateFormat sdf = new SimpleDateFormat("HHmmss");
-    String timestamp = sdf.format(new Date());
-    final String workParent = new File(".").getAbsolutePath() + File.separator + "target" + File.separator + timestamp;
-    new File(workParent).mkdirs();
-    // The folder structure looks like {job-root}/target/{timestamp}/apacheds-spring-security
-    final String apacheDSWorkDir = workParent + File.separator + "apacheds-spring-security";
-    FileUtils.deleteDirectory(new File(apacheDSWorkDir));
-    System.setProperty("apacheDSWorkDir", apacheDSWorkDir );
-    logger.info("System property apacheDSWorkDir was set to " + apacheDSWorkDir);
 
+  public static void setKdcServer(KdcServer kdcServer) {
+    AbstractLdapTestUnit.kdcServer = kdcServer;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/74f9ddcf/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java
index c04af86..da8d9bc 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java
@@ -25,16 +25,44 @@ import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.security.ClientSecurityType;
+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.annotations.ContextEntry;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreatePartition;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.junit.*;
+import org.junit.runner.RunWith;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.ldap.server.ApacheDSContainer;
 
 import static org.junit.Assert.*;
 
-public class AmbariLdapAuthenticationProviderForDNWithSpaceTest extends AmbariLdapAuthenticationProviderBaseTest{
-  private static ApacheDSContainer apacheDSContainer;
+@RunWith(FrameworkRunner.class)
+@CreateDS(allowAnonAccess = true,
+    name = "Test",
+    partitions = {
+        @CreatePartition(name = "Root",
+            suffix = "dc=the apache,dc=org",
+            contextEntry = @ContextEntry(
+                entryLdif =
+                    "dn: dc=the apache,dc=org\n" +
+                        "dc: the apache\n" +
+                        "objectClass: top\n" +
+                        "objectClass: domain\n\n" +
+                        "dn: dc=ambari,dc=the apache,dc=org\n" +
+                        "dc: ambari\n" +
+                        "objectClass: top\n" +
+                        "objectClass: domain\n\n"))
+    })
+@CreateLdapServer(allowAnonymousAccess = true,
+    transports = {@CreateTransport(protocol = "LDAP", port = 33389)})
+@ApplyLdifFiles("users_for_dn_with_space.ldif")
+public class AmbariLdapAuthenticationProviderForDNWithSpaceTest extends AmbariLdapAuthenticationProviderBaseTest {
+
   private static Injector injector;
 
   @Inject
@@ -44,14 +72,6 @@ public class AmbariLdapAuthenticationProviderForDNWithSpaceTest extends AmbariLd
   @Inject
   Configuration configuration;
 
-  @BeforeClass
-  public static void beforeClass() throws Exception{
-    createCleanApacheDSContainerWorkDir();
-    apacheDSContainer = new ApacheDSContainer("dc=ambari,dc=the apache,dc=org", "classpath:/users_for_dn_with_space.ldif");
-    apacheDSContainer.setPort(33389);
-    apacheDSContainer.afterPropertiesSet();
-  }
-
   @Before
   public void setUp() {
     injector = Guice.createInjector(new AuthorizationTestModuleForLdapDNWithSpace());
@@ -88,9 +108,4 @@ public class AmbariLdapAuthenticationProviderForDNWithSpaceTest extends AmbariLd
     Authentication auth = authenticationProvider.authenticate(authentication);
     assertTrue(auth == null);
   }
-
-  @AfterClass
-  public static void afterClass() {
-    apacheDSContainer.stop();
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/74f9ddcf/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java
index 6bc692c..d48be85 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java
@@ -27,24 +27,54 @@ import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.security.ClientSecurityType;
+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.annotations.ContextEntry;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreatePartition;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.directory.server.ldap.LdapServer;
+import org.easymock.EasyMockSupport;
 import org.easymock.IAnswer;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
-import org.springframework.security.ldap.server.ApacheDSContainer;
 import static org.easymock.EasyMock.*;
 
 import static org.junit.Assert.*;
 
+@RunWith(FrameworkRunner.class)
+@CreateDS(allowAnonAccess = true,
+    name = "Test",
+    partitions = {
+        @CreatePartition(name = "Root",
+            suffix = "dc=apache,dc=org",
+            contextEntry = @ContextEntry(
+                entryLdif =
+                    "dn: dc=apache,dc=org\n" +
+                        "dc: apache\n" +
+                        "objectClass: top\n" +
+                        "objectClass: domain\n\n" +
+                        "dn: dc=ambari,dc=apache,dc=org\n" +
+                        "dc: ambari\n" +
+                        "objectClass: top\n" +
+                        "objectClass: domain\n\n"))
+    })
+@CreateLdapServer(allowAnonymousAccess = true,
+    transports = {@CreateTransport(protocol = "LDAP", port = 33389)})
+@ApplyLdifFiles("users.ldif")
 public class AmbariLdapAuthenticationProviderTest extends AmbariLdapAuthenticationProviderBaseTest {
 
-  private static ApacheDSContainer apacheDSContainer;
   private static Injector injector;
 
   @Inject
@@ -54,14 +84,6 @@ public class AmbariLdapAuthenticationProviderTest extends AmbariLdapAuthenticati
   @Inject
   Configuration configuration;
 
-  @BeforeClass
-  public static void beforeClass() throws Exception{
-    createCleanApacheDSContainerWorkDir();
-    apacheDSContainer = new ApacheDSContainer("dc=ambari,dc=apache,dc=org", "classpath:/users.ldif");
-    apacheDSContainer.setPort(33389);
-    apacheDSContainer.afterPropertiesSet();
-  }
-
   @Before
   public void setUp() {
     injector = Guice.createInjector(new AuthorizationTestModule());
@@ -167,9 +189,4 @@ public class AmbariLdapAuthenticationProviderTest extends AmbariLdapAuthenticati
     Authentication auth = authenticationProvider.authenticate(authentication);
     Assert.assertTrue(auth == null);
   }
-
-  @AfterClass
-  public static void afterClass() {
-    apacheDSContainer.stop();
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/74f9ddcf/ambari-server/src/test/resources/users.ldif
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/users.ldif b/ambari-server/src/test/resources/users.ldif
index 1f8557e..3620e63 100644
--- a/ambari-server/src/test/resources/users.ldif
+++ b/ambari-server/src/test/resources/users.ldif
@@ -46,6 +46,6 @@ userPassword:password
 
 dn: cn=Ambari Administrators,ou=groups,dc=ambari,dc=apache,dc=org
 objectclass:top
-objectclass:group
+objectclass:groupOfNames
 cn: Ambari Administrators
 member: uid=allowedAdmin,ou=people,dc=ambari,dc=apache,dc=org

http://git-wip-us.apache.org/repos/asf/ambari/blob/74f9ddcf/ambari-server/src/test/resources/users_for_dn_with_space.ldif
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/users_for_dn_with_space.ldif b/ambari-server/src/test/resources/users_for_dn_with_space.ldif
index 5e8f8cf..1cdcb4c 100644
--- a/ambari-server/src/test/resources/users_for_dn_with_space.ldif
+++ b/ambari-server/src/test/resources/users_for_dn_with_space.ldif
@@ -46,6 +46,6 @@ userPassword:password
 
 dn: cn=Ambari Administrators,ou=the groups,dc=ambari,dc=the apache,dc=org
 objectclass:top
-objectclass:group
+objectclass:groupOfNames
 cn: Ambari Administrators
 member: uid=allowedAdmin,ou=the people,dc=ambari,dc=the apache,dc=org