You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2022/12/17 13:00:35 UTC
[cxf] branch 3.4.x-fixes updated (2393276e98 -> e896f608e5)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a change to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
from 2393276e98 Recording .gitmergeinfo Changes
new e5167a8c5a CXF-8809: Migrate LDAP systest cases from ApacheDS to UnboundID LDAP (#1042)
new e896f608e5 Recording .gitmergeinfo Changes
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.gitmergeinfo | 2 +
parent/pom.xml | 5 +-
systests/ldap/pom.xml | 36 +++----------
.../cxf/systest/ldap/jaxrs/JAXRSLDAPUserTest.java | 59 +++++++---------------
.../cxf/systest/ldap/sts/LDAPClaimsTest.java | 54 +++++---------------
.../systest/ldap/xkms/LDAPCertificateRepoTest.java | 55 ++++++--------------
systests/ldap/src/test/resources/ldap.xml | 2 +-
7 files changed, 59 insertions(+), 154 deletions(-)
[cxf] 01/02: CXF-8809: Migrate LDAP systest cases from ApacheDS to UnboundID LDAP (#1042)
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit e5167a8c5a093c79b2aa921e1564e906c37e89f9
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Fri Dec 16 20:47:32 2022 -0500
CXF-8809: Migrate LDAP systest cases from ApacheDS to UnboundID LDAP (#1042)
(cherry picked from commit 360f80381d8fc44045a5dcf8fa276f56709d383d)
# Conflicts:
# parent/pom.xml
(cherry picked from commit 6ae75647f08feeec514f343845d9f394d7fa5553)
# Conflicts:
# parent/pom.xml
(cherry picked from commit 33b943951c5150b5270e6865a8ba32c158d7210d)
---
parent/pom.xml | 5 +-
systests/ldap/pom.xml | 36 +++----------
.../cxf/systest/ldap/jaxrs/JAXRSLDAPUserTest.java | 59 +++++++---------------
.../cxf/systest/ldap/sts/LDAPClaimsTest.java | 54 +++++---------------
.../systest/ldap/xkms/LDAPCertificateRepoTest.java | 55 ++++++--------------
systests/ldap/src/test/resources/ldap.xml | 2 +-
6 files changed, 57 insertions(+), 154 deletions(-)
diff --git a/parent/pom.xml b/parent/pom.xml
index 040e3f7f4b..f99a801812 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -80,7 +80,7 @@
<cxf.abdera.version>1.1.3</cxf.abdera.version>
<cxf.activemq.version>5.16.5</cxf.activemq.version>
<cxf.ahc.version>2.12.3</cxf.ahc.version>
- <cxf.apacheds.version>2.0.0.AM26</cxf.apacheds.version>
+ <cxf.arquillian.version>1.6.0.Final</cxf.arquillian.version>
<cxf.arquillian.version>1.1.14.Final</cxf.arquillian.version>
<cxf.arquillian.weld.container.version>2.0.1.Final</cxf.arquillian.weld.container.version>
<cxf.aspectj.version>1.9.1</cxf.aspectj.version>
@@ -165,6 +165,7 @@
<cxf.jsr250.api.version>1.0</cxf.jsr250.api.version>
<cxf.junit.version>4.13.2</cxf.junit.version>
<cxf.kerby.version>2.0.2</cxf.kerby.version>
+ <cxf.ldapsdk.version>6.0.7</cxf.ldapsdk.version>
<cxf.littleproxy.version>1.1.2</cxf.littleproxy.version>
<cxf.logback.classic.version>1.2.10</cxf.logback.classic.version>
<cxf.lucene.version>8.11.2</cxf.lucene.version>
@@ -2438,7 +2439,7 @@
<properties>
<!-- EasyMock stills uses JDK Internal APIs: see please https://bugs.openjdk.java.net/browse/JDK-8255363 -->
<!-- JAXB: see please https://github.com/javaee/jaxb-v2/issues/1184 -->
- <cxf.surefire.fork.vmargs>-ea --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens java.base/sun.security.x509=ALL-UNNAMED --add-opens java.base/sun.security.util=ALL-UNNAMED --add-opens java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED</cxf.surefire.fork.vmargs>
+ <cxf.surefire.fork.vmargs>-ea --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED</cxf.surefire.fork.vmargs>
</properties>
</profile>
</profiles>
diff --git a/systests/ldap/pom.xml b/systests/ldap/pom.xml
index 28df93ddb1..c259d6498d 100644
--- a/systests/ldap/pom.xml
+++ b/systests/ldap/pom.xml
@@ -197,40 +197,16 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-core-annotations</artifactId>
- <version>${cxf.apacheds.version}</version>
+ <groupId>com.unboundid</groupId>
+ <artifactId>unboundid-ldapsdk</artifactId>
+ <version>${cxf.ldapsdk.version}</version>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk15</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-core-integ</artifactId>
- <version>${cxf.apacheds.version}</version>
+ <groupId>org.zapodot</groupId>
+ <artifactId>embedded-ldap-junit</artifactId>
+ <version>0.9.0</version>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk15</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-protocol-shared</artifactId>
- <version>${cxf.apacheds.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk15</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
diff --git a/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/jaxrs/JAXRSLDAPUserTest.java b/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/jaxrs/JAXRSLDAPUserTest.java
index 372a3d79bc..db6738cc4d 100644
--- a/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/jaxrs/JAXRSLDAPUserTest.java
+++ b/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/jaxrs/JAXRSLDAPUserTest.java
@@ -29,56 +29,33 @@ import javax.ws.rs.InternalServerErrorException;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
-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.CreateDS;
-import org.apache.directory.server.core.annotations.CreateIndex;
-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.zapodot.junit.ldap.EmbeddedLdapRule;
+import org.zapodot.junit.ldap.EmbeddedLdapRuleBuilder;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.ClassRule;
import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(FrameworkRunner.class)
-
-//Define the DirectoryService
-@CreateDS(name = "JAXRSLDAPUserTest-class",
- enableAccessControl = false,
- allowAnonAccess = false,
- enableChangeLog = true,
- partitions = {
- @CreatePartition(
- name = "example",
- suffix = "dc=example,dc=com",
- indexes = {
- @CreateIndex(attribute = "objectClass"),
- @CreateIndex(attribute = "dc"),
- @CreateIndex(attribute = "ou")
- }
- )
- }
-)
-
-@CreateLdapServer(
- transports = {
- @CreateTransport(protocol = "LDAP", address = "localhost")
- }
-)
-
-//Inject an file containing entries
-@ApplyLdifFiles("ldap.ldif")
/**
* Add a test for JAX-RS search using the LdapQueryVisitor.
*/
-public class JAXRSLDAPUserTest extends AbstractLdapTestUnit {
+public class JAXRSLDAPUserTest {
public static final String PORT = UserLDAPServer.PORT;
public static final String PORT2 = UserLDAPServer.PORT2;
+
+ @ClassRule
+ public static EmbeddedLdapRule embeddedLdapRule = EmbeddedLdapRuleBuilder
+ .newInstance()
+ .bindingToAddress("localhost")
+ .usingBindCredentials("ldap_su")
+ .usingBindDSN("UID=admin,DC=example,DC=com")
+ .usingDomainDsn("dc=example,dc=com")
+ .importingLdifs("ldap.ldif")
+ .build();
+
private static boolean portUpdated;
@BeforeClass
@@ -104,7 +81,7 @@ public class JAXRSLDAPUserTest extends AbstractLdapTestUnit {
// Read in ldap.xml and substitute in the correct port
Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/ldap-jaxrs.xml");
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
- content = content.replaceAll("portno", Integer.toString(super.getLdapServer().getPort()));
+ content = content.replaceAll("portno", Integer.toString(embeddedLdapRule.embeddedServerPort()));
Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/ldap-jaxrsport.xml");
Files.write(path2, content.getBytes());
@@ -114,7 +91,7 @@ public class JAXRSLDAPUserTest extends AbstractLdapTestUnit {
}
- @org.junit.AfterClass
+ @AfterClass
public static void cleanup() throws Exception {
AbstractClientServerTestBase.stopAllServers();
}
diff --git a/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/sts/LDAPClaimsTest.java b/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/sts/LDAPClaimsTest.java
index 5a96136c5c..d259a0d700 100644
--- a/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/sts/LDAPClaimsTest.java
+++ b/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/sts/LDAPClaimsTest.java
@@ -45,55 +45,29 @@ import org.apache.cxf.sts.claims.LdapGroupClaimsHandler;
import org.apache.cxf.sts.claims.ProcessedClaim;
import org.apache.cxf.sts.claims.ProcessedClaimCollection;
import org.apache.cxf.ws.security.sts.provider.STSException;
-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.CreateDS;
-import org.apache.directory.server.core.annotations.CreateIndex;
-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.apache.wss4j.common.principal.CustomTokenPrincipal;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.zapodot.junit.ldap.EmbeddedLdapRule;
+import org.zapodot.junit.ldap.EmbeddedLdapRuleBuilder;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-
-@RunWith(FrameworkRunner.class)
-
-//Define the DirectoryService
-@CreateDS(name = "LDAPClaimsTest-class",
- enableAccessControl = false,
- allowAnonAccess = false,
- enableChangeLog = true,
- partitions = {
- @CreatePartition(
- name = "example",
- suffix = "dc=example,dc=com",
- indexes = {
- @CreateIndex(attribute = "objectClass"),
- @CreateIndex(attribute = "dc"),
- @CreateIndex(attribute = "ou")
- }
- )
- }
-)
-
-@CreateLdapServer(
- transports = {
- @CreateTransport(protocol = "LDAP", address = "localhost")
- }
-)
-
-//Inject an file containing entries
-@ApplyLdifFiles("ldap.ldif")
+import org.junit.ClassRule;
/**
* Test the LdapClaimsHandler that ships with the STS
*/
-public class LDAPClaimsTest extends AbstractLdapTestUnit {
+public class LDAPClaimsTest {
+ @ClassRule
+ public static EmbeddedLdapRule embeddedLdapRule = EmbeddedLdapRuleBuilder
+ .newInstance()
+ .bindingToAddress("localhost")
+ .usingBindCredentials("ldap_su")
+ .usingBindDSN("UID=admin,DC=example,DC=com")
+ .usingDomainDsn("dc=example,dc=com")
+ .importingLdifs("ldap.ldif")
+ .build();
private static Properties props;
private static boolean portUpdated;
@@ -122,7 +96,7 @@ public class LDAPClaimsTest extends AbstractLdapTestUnit {
// Read in ldap.xml and substitute in the correct port
Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/ldap.xml");
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
- content = content.replaceAll("portno", Integer.toString(super.getLdapServer().getPort()));
+ content = content.replaceAll("portno", Integer.toString(embeddedLdapRule.embeddedServerPort()));
Path path2 = FileSystems.getDefault().getPath(basedir, "/target/test-classes/ldapport.xml");
Files.write(path2, content.getBytes());
diff --git a/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/xkms/LDAPCertificateRepoTest.java b/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/xkms/LDAPCertificateRepoTest.java
index b1e8fb711b..9b0d0d381d 100644
--- a/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/xkms/LDAPCertificateRepoTest.java
+++ b/systests/ldap/src/test/java/org/apache/cxf/systest/ldap/xkms/LDAPCertificateRepoTest.java
@@ -34,54 +34,29 @@ import org.apache.cxf.xkms.x509.repo.CertificateRepo;
import org.apache.cxf.xkms.x509.repo.ldap.LdapCertificateRepo;
import org.apache.cxf.xkms.x509.repo.ldap.LdapSchemaConfig;
import org.apache.cxf.xkms.x509.repo.ldap.LdapSearch;
-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.CreateDS;
-import org.apache.directory.server.core.annotations.CreateIndex;
-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.zapodot.junit.ldap.EmbeddedLdapRule;
+import org.zapodot.junit.ldap.EmbeddedLdapRuleBuilder;
+import org.junit.ClassRule;
import org.junit.Test;
-import org.junit.runner.RunWith;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-@RunWith(FrameworkRunner.class)
-
-//Define the DirectoryService
-@CreateDS(name = "LDAPCertificateRepoTest-class",
- enableAccessControl = false,
- allowAnonAccess = false,
- enableChangeLog = true,
- partitions = {
- @CreatePartition(
- name = "example",
- suffix = "dc=example,dc=com",
- indexes = {
- @CreateIndex(attribute = "objectClass"),
- @CreateIndex(attribute = "dc"),
- @CreateIndex(attribute = "ou")
- }
- )
- }
-)
-
-@CreateLdapServer(
- transports = {
- @CreateTransport(protocol = "LDAP", address = "localhost")
- }
-)
-
-//Inject an file containing entries
-@ApplyLdifFiles("ldap.ldif")
-
/**
* Add a test for the XKMS LDAP CertificateRepo
*/
-public class LDAPCertificateRepoTest extends AbstractLdapTestUnit {
+public class LDAPCertificateRepoTest {
+ @ClassRule
+ public static EmbeddedLdapRule embeddedLdapRule = EmbeddedLdapRuleBuilder
+ .newInstance()
+ .bindingToAddress("localhost")
+ .usingBindCredentials("ldap_su")
+ .usingBindDSN("UID=admin,DC=example,DC=com")
+ .usingDomainDsn("dc=example,dc=com")
+ .importingLdifs("ldap.ldif")
+ .build();
+
private static final String EXPECTED_SUBJECT_DN = "cn=dave,ou=users";
private static final String ROOT_DN = "dc=example,dc=com";
private static final String EXPECTED_SUBJECT_DN2 = "cn=newuser,ou=users";
@@ -160,7 +135,7 @@ public class LDAPCertificateRepoTest extends AbstractLdapTestUnit {
}
private CertificateRepo createLdapCertificateRepo() throws CertificateException {
- LdapSearch ldapSearch = new LdapSearch("ldap://localhost:" + super.getLdapServer().getPort(),
+ LdapSearch ldapSearch = new LdapSearch("ldap://localhost:" + embeddedLdapRule.embeddedServerPort(),
"UID=admin,DC=example,DC=com", "ldap_su", 2);
LdapSchemaConfig ldapSchemaConfig = new LdapSchemaConfig();
diff --git a/systests/ldap/src/test/resources/ldap.xml b/systests/ldap/src/test/resources/ldap.xml
index 4703f8ccd0..a3ba45a2e3 100644
--- a/systests/ldap/src/test/resources/ldap.xml
+++ b/systests/ldap/src/test/resources/ldap.xml
@@ -36,7 +36,7 @@
<entry key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" value="sn"/>
<entry key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" value="mail"/>
<entry key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country" value="c"/>
- <entry key="http://custom/x509" value="usercertificate"/>
+ <entry key="http://custom/x509" value="userCertificate"/>
</util:map>
<bean id="testClaimsHandler" class="org.apache.cxf.sts.claims.LdapClaimsHandler">
<property name="ldapTemplate" ref="ldapTemplate" />
[cxf] 02/02: Recording .gitmergeinfo Changes
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit e896f608e53396fe984b077168a98b524e5515a9
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Fri Dec 16 22:39:05 2022 -0500
Recording .gitmergeinfo Changes
---
.gitmergeinfo | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.gitmergeinfo b/.gitmergeinfo
index b0d892c906..e6e175ec7a 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -218,6 +218,7 @@ B e441840c0212b8559ad406595fa4174a29124652
B e4b56ffecdb410df90d7fb5a8c12982d9e421c0d
B e713fd34837af629711a16a7e376b0a090a393c7
B e7f7b2154ed9f5668a62a7e99f862ca1aef7cd43
+B e81cd0987fe134227487c6398e746f4ad90ff9bf
B e85178929cac18f07e72b67bbc17ec34f0a517a6
B e9f7d1c11998c3d87d71b46d1e877273dfb10c3e
B ebcb82036cd653ff1c29abff2da57c8af8fb53f8
@@ -309,6 +310,7 @@ M 2ffd54661533e8a0f0ca221d1a903a23d44133a9
M 327e0d2a1605f05a25ac491e5d1775d00f018d22
M 32d40493c0db97c4d207e99da5b8c491fc04eedd
M 339363229a72146fcd3a39d8f81df8c20b0f471d
+M 33b943951c5150b5270e6865a8ba32c158d7210d
M 33ecef385c10f1a3351103a01b591bd1fafb46f6
M 361f27feed02ff8e2be6dc68b499e2f6d9c1694c
M 362ac6c46969d8939310b741f0e02754dbc2cf62