You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by bi...@apache.org on 2020/04/15 16:07:54 UTC

[axis-axis2-java-rampart] 07/12: Merge r1837550 and r1837559 to the 1.7 branch.

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

billblough pushed a commit to branch 1_7
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-rampart.git

commit f3ace87c292567022ef5a3b31b74d5fb61494743
Author: Andreas Veithen <ve...@apache.org>
AuthorDate: Mon Aug 6 20:31:33 2018 +0000

    Merge r1837550 and r1837559 to the 1.7 branch.
---
 modules/rampart-integration/pom.xml                | 29 ++++++++++++-
 modules/rampart-tests/pom.xml                      | 33 ++++++++++++++
 modules/rampart-testutils/pom.xml                  | 39 +++++++++++++++++
 .../testutils/FakeValidationDateAspect.java        | 50 ++++++++++++++++++++++
 .../src/main/resources/META-INF/aop.xml            | 28 ++++++++++++
 pom.xml                                            | 17 ++++++++
 6 files changed, 195 insertions(+), 1 deletion(-)

diff --git a/modules/rampart-integration/pom.xml b/modules/rampart-integration/pom.xml
index d303d48..7af8813 100644
--- a/modules/rampart-integration/pom.xml
+++ b/modules/rampart-integration/pom.xml
@@ -464,10 +464,31 @@
                 </executions>
             </plugin-->
             <plugin>
+                <groupId>com.github.veithen.alta</groupId>
+                <artifactId>alta-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate-properties</goal>
+                        </goals>
+                        <configuration>
+                            <name>aspectjweaver</name>
+                            <value>%file%</value>
+                            <artifacts>
+                                <artifact>
+                                    <groupId>org.aspectj</groupId>
+                                    <artifactId>aspectjweaver</artifactId>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                     <!-- Add the Xerces/Xalan versions expected by OpenSAML to the boot classpath so that the build succeeds on older 1.5 JDKs -->
-                    <argLine>${jacoco.surefireArgLine} -Xbootclasspath/p:${project.build.directory}/endorsed/xml-apis.jar${path.separator}${project.build.directory}/endorsed/xercesImpl.jar${path.separator}${project.build.directory}/endorsed/resolver.jar${path.separator}${project.build.directory}/endorsed/serializer.jar${path.separator}${project.build.directory}/endorsed/xalan.jar</argLine>
+                    <argLine>${jacoco.surefireArgLine} -Xbootclasspath/p:${project.build.directory}/endorsed/xml-apis.jar${path.separator}${project.build.directory}/endorsed/xercesImpl.jar${path.separator}${project.build.directory}/endorsed/resolver.jar${path.separator}${project.build.directory}/endorsed/serializer.jar${path.separator}${project.build.directory}/endorsed/xalan.jar -javaagent:${aspectjweaver}</argLine>
                 </configuration>
             </plugin>
             <plugin>
@@ -517,6 +538,12 @@
             </exclusions>
         </dependency>
         <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-transport-http</artifactId>
             <version>${axis2.version}</version>
diff --git a/modules/rampart-tests/pom.xml b/modules/rampart-tests/pom.xml
index 464af67..cf5febc 100644
--- a/modules/rampart-tests/pom.xml
+++ b/modules/rampart-tests/pom.xml
@@ -53,6 +53,33 @@
                     <skip>true</skip>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>com.github.veithen.alta</groupId>
+                <artifactId>alta-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate-properties</goal>
+                        </goals>
+                        <configuration>
+                            <name>aspectjweaver</name>
+                            <value>%file%</value>
+                            <artifacts>
+                                <artifact>
+                                    <groupId>org.aspectj</groupId>
+                                    <artifactId>aspectjweaver</artifactId>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <argLine>${jacoco.surefireArgLine} -javaagent:${aspectjweaver}</argLine>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
@@ -73,6 +100,12 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
         </dependency>
diff --git a/modules/rampart-testutils/pom.xml b/modules/rampart-testutils/pom.xml
new file mode 100644
index 0000000..8cfb432
--- /dev/null
+++ b/modules/rampart-testutils/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.rampart</groupId>
+        <artifactId>rampart-project</artifactId>
+        <version>1.7.2-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>rampart-testutils</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjrt</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/modules/rampart-testutils/src/main/java/org/apache/rampart/testutils/FakeValidationDateAspect.java b/modules/rampart-testutils/src/main/java/org/apache/rampart/testutils/FakeValidationDateAspect.java
new file mode 100644
index 0000000..da89b43
--- /dev/null
+++ b/modules/rampart-testutils/src/main/java/org/apache/rampart/testutils/FakeValidationDateAspect.java
@@ -0,0 +1,50 @@
+/*
+ * 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.rampart.testutils;
+
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.X509Certificate;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+/**
+ * Aspect that redirects {@link X509Certificate#checkValidity()} to
+ * {@link X509Certificate#checkValidity(Date)} with a fixed date. This allows
+ * executing unit tests relying on certificates that have expired.
+ */
+@Aspect
+public class FakeValidationDateAspect {
+    private final static Date VALIDATION_DATE;
+
+    static {
+        Calendar cal = Calendar.getInstance();
+        cal.setTimeInMillis(0);
+        cal.set(2018, 0, 1);
+        VALIDATION_DATE = cal.getTime();
+    }
+
+    @Around("call(void java.security.cert.X509Certificate.checkValidity()) && target(cert)")
+    public void aroundCheckValidity(X509Certificate cert) throws CertificateExpiredException, CertificateNotYetValidException {
+        cert.checkValidity(VALIDATION_DATE);
+    }
+}
diff --git a/modules/rampart-testutils/src/main/resources/META-INF/aop.xml b/modules/rampart-testutils/src/main/resources/META-INF/aop.xml
new file mode 100644
index 0000000..735ef2d
--- /dev/null
+++ b/modules/rampart-testutils/src/main/resources/META-INF/aop.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<aspectj>
+    <aspects>
+        <aspect name="org.apache.rampart.testutils.FakeValidationDateAspect"/>
+    </aspects>
+    <weaver options="-showWeaveInfo">
+        <include within="org.apache.rampart..*"/>
+        <include within="org.apache.ws.security..*"/>
+    </weaver>
+</aspectj>
diff --git a/pom.xml b/pom.xml
index e94081c..ce58e43 100644
--- a/pom.xml
+++ b/pom.xml
@@ -194,6 +194,11 @@
                     <artifactId>maven-javadoc-plugin</artifactId>
                     <version>2.10.3</version>
                 </plugin>
+                <plugin>
+                    <groupId>com.github.veithen.alta</groupId>
+                    <artifactId>alta-maven-plugin</artifactId>
+                    <version>0.6.2</version>
+                </plugin>
             </plugins>
         </pluginManagement>
         <plugins>
@@ -545,6 +550,17 @@
                 <artifactId>junit</artifactId>
                 <version>3.8.2</version>
             </dependency>
+
+            <dependency>
+                <groupId>org.aspectj</groupId>
+                <artifactId>aspectjrt</artifactId>
+                <version>1.8.2</version>
+            </dependency>
+            <dependency>
+                <groupId>org.aspectj</groupId>
+                <artifactId>aspectjweaver</artifactId>
+                <version>1.8.2</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -599,6 +615,7 @@
         <module>modules/rampart-trust-mar</module>
         <module>modules/rampart-integration</module>
         <module>modules/rampart-samples</module> <!-- Compile sample codes -->
+        <module>modules/rampart-testutils</module>
         <module>modules/distribution</module>
         <module>code-coverage</module>
     </modules>