You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2020/03/17 06:46:28 UTC

[syncope] 08/09: [SYNCOPE-1545] Archetype

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

ilgrosso pushed a commit to branch SYNCOPE-1545
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 09d5ad9f052a8c1fd8529710c6375a9976e61c7e
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Sun Mar 15 17:26:24 2020 +0100

    [SYNCOPE-1545] Archetype
---
 .travis.yml                                        |   6 +-
 archetype/pom.xml                                  |  32 +++++
 .../META-INF/maven/archetype-metadata.xml          |  13 ++
 .../main/resources/archetype-resources/fit/pom.xml |  12 +-
 .../main/resources/archetype-resources/wa/pom.xml  | 134 +++++++++++++++++++++
 .../wa/src/test/resources/keymaster.properties     |  19 +++
 archetype/src/main/resources/meta-pom.xml          |   7 ++
 core/idrepo/logic/pom.xml                          |   8 --
 .../org/apache/syncope/fit/core/ReportITCase.java  |   7 +-
 wa/pom.xml                                         |   1 +
 10 files changed, 222 insertions(+), 17 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 0ed30c8..2a83c29 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ cache:
   bundler: false
   cargo: false
   directories:
-    - $HOME/.m2
+    - '$HOME/.m2'
 git:
   depth: 2
 env:
@@ -44,11 +44,11 @@ jobs:
   include:
     - stage: build
       name: "Build"
-      script: mvn -T 1C --quiet -P skipTests,all
+      script: mvn -T 1C -P skipTests,all
       #######################################################
     - stage: validate
       name: "Checkstyle, Legal Files, Modernizer and Release Audit Tool (RAT) Analysis"
-      script: mvn -T 1C checkstyle:check ianal:verify-legal-files modernizer:modernizer apache-rat:check --quiet
+      script: mvn -T 1C checkstyle:check ianal:verify-legal-files modernizer:modernizer apache-rat:check
       ######################################################
     - stage: test
       name: "Unit Tests"
diff --git a/archetype/pom.xml b/archetype/pom.xml
index 54a749a..f500f59 100644
--- a/archetype/pom.xml
+++ b/archetype/pom.xml
@@ -354,6 +354,38 @@ under the License.
           <include>keymaster.properties</include>          
         </includes>
       </resource>
+
+      <resource>
+        <directory>../wa/src/main/resources</directory>
+        <targetPath>${project.build.outputDirectory}/archetype-resources/wa/src/main/resources</targetPath>
+      </resource>
+      <resource>
+        <directory>../wa/src/test/resources</directory>
+        <targetPath>${project.build.outputDirectory}/archetype-resources/wa/src/main/resources</targetPath>
+        <includes>
+          <include>keymaster.properties</include>          
+        </includes>
+      </resource>
+      <resource>
+        <directory>../fit/wa-reference/src/main/resources</directory>
+        <targetPath>${project.build.outputDirectory}/archetype-resources/wa/src/main/resources</targetPath>
+        <includes>
+          <include>application-embedded.properties</include>
+          <include>log4j2.xml</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>../fit/wa-reference/src/main/resources</directory>
+        <targetPath>${project.build.outputDirectory}/archetype-resources/wa/src/test/resources</targetPath>
+        <includes>
+          <include>wa</include>
+          <include>keymaster.properties</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>../fit/wa-reference/src/main/webapp/WEB-INF</directory>
+        <targetPath>${project.build.outputDirectory}/archetype-resources/wa/src/main/webapp/WEB-INF</targetPath>
+      </resource>
     </resources>
   </build>
   
diff --git a/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
index f22b5fb..9fa586c 100644
--- a/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -79,6 +79,19 @@ under the License.
         </fileSet>
       </fileSets>
     </module>
+    <module id="syncope-wa" dir="wa" name="syncope-wa">
+      <fileSets>
+        <fileSet filtered="false" encoding="UTF-8">
+          <directory>src/main/resources</directory>
+        </fileSet>
+        <fileSet filtered="false" encoding="UTF-8">
+          <directory>src/main/webapp</directory>
+        </fileSet>
+        <fileSet filtered="false" encoding="UTF-8">
+          <directory>src/test/resources</directory>
+        </fileSet>
+      </fileSets>
+    </module>
     <module id="syncope-sra" dir="sra" name="syncope-sra">
       <fileSets>
         <fileSet filtered="false" encoding="UTF-8">
diff --git a/archetype/src/main/resources/archetype-resources/fit/pom.xml b/archetype/src/main/resources/archetype-resources/fit/pom.xml
index 53745a8..6be3d9d 100644
--- a/archetype/src/main/resources/archetype-resources/fit/pom.xml
+++ b/archetype/src/main/resources/archetype-resources/fit/pom.xml
@@ -153,6 +153,10 @@ under the License.
                 <copy file="../enduser/target/test-classes/customTemplate.json" 
                       todir="../enduser/target/syncope-enduser/WEB-INF/classes" 
                       overwrite="true"/>
+
+                <copy file="../wa/target/test-classes/keymaster.properties" 
+                      todir="../wa/target/syncope-wa/WEB-INF/classes" 
+                      overwrite="true"/>
               </target>
             </configuration>
             <goals>
@@ -181,7 +185,7 @@ under the License.
               <goal>exec</goal>
             </goals>
             <configuration>
-              <executable>java</executable>
+              <executable>${JAVA_HOME}/bin/java</executable>
               <arguments>
                 <argument>-jar</argument>
                 <argument>${basedir}/../sra/target/syncope-sra.jar</argument>
@@ -253,6 +257,12 @@ under the License.
                 <context>syncope-enduser</context>
               </properties>
             </deployable>
+            <deployable>
+              <location>../wa/target/syncope-wa</location>
+              <properties>
+                <context>syncope-wa</context>
+              </properties>
+            </deployable>
           </deployables>
         </configuration>
       </plugin>
diff --git a/archetype/src/main/resources/archetype-resources/wa/pom.xml b/archetype/src/main/resources/archetype-resources/wa/pom.xml
new file mode 100644
index 0000000..91b4a22
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/wa/pom.xml
@@ -0,0 +1,134 @@
+<?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/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>${groupId}</groupId>
+    <artifactId>${rootArtifactId}</artifactId>
+    <version>${version}</version>
+  </parent>
+
+  <name>Apache Syncope sample project - WA</name>
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <packaging>war</packaging>
+
+  <properties>
+    <guava.version>28.2-jre</guava.version>
+    <opensaml.version>3.4.5</opensaml.version>
+    <bootstrap.version>4.4.1</bootstrap.version>
+    <slf4j.version>2.0.0-alpha1</slf4j.version>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>${groupId}</groupId>
+      <artifactId>syncope-common</artifactId>
+      <version>${project.version}</version>
+    </dependency>  
+    
+    <dependency>
+      <groupId>org.apache.syncope</groupId>
+      <artifactId>syncope-wa</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.syncope.ext.self-keymaster</groupId>
+      <artifactId>syncope-ext-self-keymaster-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.syncope.common.keymaster</groupId>
+      <artifactId>syncope-common-keymaster-client-zookeeper</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <finalName>syncope-wa</finalName>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <inherited>true</inherited>
+        <configuration>
+          <webResources>
+            <resource>
+              <directory>${basedir}/src/main/webapp/WEB-INF</directory>
+              <filtering>true</filtering>
+              <targetPath>WEB-INF</targetPath>
+              <includes>
+                <include>web.xml</include>
+              </includes>
+            </resource>
+          </webResources>
+        </configuration>
+      </plugin>
+    </plugins>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>executable</id>
+      
+      <dependencies>
+        <dependency>
+          <groupId>org.springframework.boot</groupId>
+          <artifactId>spring-boot-starter-undertow</artifactId>
+        </dependency>
+      </dependencies>
+        
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-maven-plugin</artifactId>
+            <configuration>
+              <mainClass>org.apache.syncope.wa.SyncopeWAApplication</mainClass>
+              <layout>ZIP</layout>
+            </configuration>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>repackage</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/archetype/src/main/resources/archetype-resources/wa/src/test/resources/keymaster.properties b/archetype/src/main/resources/archetype-resources/wa/src/test/resources/keymaster.properties
new file mode 100644
index 0000000..033fe3b
--- /dev/null
+++ b/archetype/src/main/resources/archetype-resources/wa/src/test/resources/keymaster.properties
@@ -0,0 +1,19 @@
+# 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.
+keymaster.address=http://localhost:9080/syncope/rest/keymaster
+keymaster.username=${anonymousUser}
+keymaster.password=${anonymousKey}
diff --git a/archetype/src/main/resources/meta-pom.xml b/archetype/src/main/resources/meta-pom.xml
index 8eb4a43..fe5f3e8 100644
--- a/archetype/src/main/resources/meta-pom.xml
+++ b/archetype/src/main/resources/meta-pom.xml
@@ -89,6 +89,12 @@ under the License.
       </dependency>
 
       <dependency>
+        <groupId>org.apache.syncope</groupId>
+        <artifactId>syncope-wa</artifactId>
+        <version>${syncope.version}</version>
+      </dependency>
+
+      <dependency>
         <groupId>org.apache.syncope.ext.self-keymaster</groupId>
         <artifactId>syncope-ext-self-keymaster-rest-cxf</artifactId>
         <version>${syncope.version}</version>
@@ -135,6 +141,7 @@ under the License.
     <module>console</module>
     <module>enduser</module>
     <module>sra</module>
+    <module>wa</module>
     <module>fit</module>
   </modules>
 
diff --git a/core/idrepo/logic/pom.xml b/core/idrepo/logic/pom.xml
index 67df68e..cfc1aac 100644
--- a/core/idrepo/logic/pom.xml
+++ b/core/idrepo/logic/pom.xml
@@ -70,14 +70,6 @@ under the License.
       <groupId>org.apache.xmlgraphics</groupId>
       <artifactId>fop</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.xmlgraphics</groupId>
-      <artifactId>batik-i18n</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.xmlgraphics</groupId>
-      <artifactId>batik-constants</artifactId>
-    </dependency>
 
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
index 918175c..ab9e35e 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ReportITCase.java
@@ -238,8 +238,7 @@ public class ReportITCase extends AbstractITCase {
         assertNotNull(response);
         assertEquals(Response.Status.OK.getStatusCode(), response.getStatusInfo().getStatusCode());
         assertNotNull(response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION));
-        assertTrue(response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION).
-                endsWith('.' + fmt.name().toLowerCase()));
+        assertTrue(response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION).endsWith('.' + fmt.name().toLowerCase()));
 
         Object entity = response.getEntity();
         assertTrue(entity instanceof InputStream);
@@ -249,7 +248,6 @@ public class ReportITCase extends AbstractITCase {
     @Test
     public void executeAndExport() throws IOException {
         ReportTO reportTO = reportService.read("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
-        reportTO.setKey(null);
         reportTO.setName("executeAndExport" + getUUIDString());
         reportTO.setActive(false);
         reportTO.getExecutions().clear();
@@ -282,10 +280,10 @@ public class ReportITCase extends AbstractITCase {
         try {
             Thread.sleep(1000);
         } catch (InterruptedException e) {
+            // ignore
         }
 
         ReportTO reportTO = reportService.read("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
-        reportTO.setKey(null);
         reportTO.setName("deleteExecutions" + getUUIDString());
         reportTO.getExecutions().clear();
         reportTO = createReport(reportTO);
@@ -379,7 +377,6 @@ public class ReportITCase extends AbstractITCase {
     public void issueSYNCOPE102() throws IOException {
         // Create
         ReportTO reportTO = reportService.read("0062ea9c-924d-4ecf-9961-4492a8cc6d1b");
-        reportTO.setKey(null);
         reportTO.setName("issueSYNCOPE102" + getUUIDString());
         reportTO = createReport(reportTO);
         assertNotNull(reportTO);
diff --git a/wa/pom.xml b/wa/pom.xml
index 56c3193..1a5616d 100644
--- a/wa/pom.xml
+++ b/wa/pom.xml
@@ -180,6 +180,7 @@ under the License.
       <groupId>org.apereo.cas</groupId>
       <artifactId>cas-server-webapp-config</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-web</artifactId>