Skip to content

Commit

Permalink
add integration test (#18)
Browse files Browse the repository at this point in the history
This closes #15
  • Loading branch information
kwin authored Mar 26, 2021
1 parent fa8fe62 commit 73caaf3
Show file tree
Hide file tree
Showing 19 changed files with 202 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ jobs:
- name: Build with Maven
if: github.ref != 'refs/heads/main'
run: mvn -B clean install
- name: Upload IT
uses: actions/upload-artifact@v2
with:
name: IT
path: target/it/
- name: Deploy with Maven
if: github.ref == 'refs/heads/main'
run: mvn -B clean deploy
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ modules.xml
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
Expand Down
29 changes: 26 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</distributionManagement>

<properties>
<maven.version>3.3.9</maven.version>
<maven.version>3.5.4</maven.version>
<java.target.version>8</java.target.version> <!-- used for compiler plugin and animal-sniffer, for compatibility reasons with Java 9 only the values 6,7,8 and 9 is allowed -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<arguments /> <!-- additional arguments for the forked Maven run during releases -->
Expand Down Expand Up @@ -181,7 +181,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.19</version>
<version>1.20</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -198,6 +198,10 @@
<artifactId>license-maven-plugin</artifactId>
<version>2.0.0</version>
</plugin>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.2.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down Expand Up @@ -252,6 +256,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
<configuration>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<postBuildHookScript>verify.groovy</postBuildHookScript>
<streamLogsOnFailures>true</streamLogsOnFailures>
<!-- reuse global repo for speeding up builds
<localRepositoryPath>target/it-repo</localRepositoryPath> -->
</configuration>
</execution>
</executions>
</plugin>
<!-- always generate javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -295,7 +318,7 @@
<artifactId>license-maven-plugin</artifactId>
<configuration>
<licenseName>epl_only_v1</licenseName>
<excludes>test/resources/**</excludes>
<excludes>test/resources/**,it/**</excludes>
</configuration>
<executions>
<execution>
Expand Down
13 changes: 13 additions & 0 deletions src/it/project1/application-package/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<artifactId>application-package</artifactId>
<packaging>content-package</packaging>
<parent>
<groupId>biz.netcentric.filevault.validator.aem.cloud.it</groupId>
<artifactId>project1</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/example">
</filter>
<filter root="/libs/cq">
</filter>
</workspaceFilter>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
just an example
26 changes: 26 additions & 0 deletions src/it/project1/content-package/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<artifactId>content-package</artifactId>
<packaging>content-package</packaging>
<parent>
<groupId>biz.netcentric.filevault.validator.aem.cloud.it</groupId>
<artifactId>project1</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<build>
<plugins>
<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<configuration>
<properties>
<installhook.test.class>my.custom.Hook</installhook.test.class>
</properties>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/content/example">
</filter>
<filter root="/var/example" />
</workspaceFilter>
Binary file not shown.
Empty file.
Empty file.
Empty file.
24 changes: 24 additions & 0 deletions src/it/project1/mixed-package/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<artifactId>mixed-package</artifactId>
<packaging>content-package</packaging>
<parent>
<groupId>biz.netcentric.filevault.validator.aem.cloud.it</groupId>
<artifactId>project1</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<build>
<plugins>
<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<configuration>
<packageType>mixed</packageType>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/example">
</filter>
<filter root="/content/example">
</filter>
</workspaceFilter>
Empty file.
Empty file.
86 changes: 86 additions & 0 deletions src/it/project1/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<groupId>biz.netcentric.filevault.validator.aem.cloud.it</groupId>
<artifactId>project1</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>

<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<version>1.1.6</version>
<extensions>true</extensions>
<configuration>
<failOnDuplicateEntries>false</failOnDuplicateEntries>
<filterSource>src/main/META-INF/vault/filter.xml</filterSource>
<validatorsSettings>
<jackrabbit-filter>
<!-- define additional valid roots which are always provided in AEM -->
<options>
<validRoots>/,/libs,/apps,/apps/kaw,/etc,/var,/tmp,/conf,/content,/content/campaigns/,/content/cq:tags/,/content/dam,/content/experience-fragments/,/content/projects/,/content/screens/,/etc/packages</validRoots>
</options>
</jackrabbit-filter>
<netcentric-aem-cloud>
<defaultSeverity>warn</defaultSeverity>
</netcentric-aem-cloud>
</validatorsSettings>
</configuration>
<dependencies>
<dependency>
<groupId>biz.netcentric.filevault.validator</groupId>
<artifactId>aem-cloud-validator</artifactId>
<version>@project.version@</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>

</build>

<profiles>
<profile>
<!-- this profile is active for content-packages only -->
<id>packaging-contentpackage</id>
<!-- profile inheritance does not work in Maven (https://issues.apache.org/jira/browse/MNG-5127)
therefore the activation section needs to be copied from cq-parent -->
<activation>
<file>
<exists>${basedir}/src/main/jcr_root</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<modules>
<module>application-package</module>
<module>content-package</module>
<module>mixed-package</module>
</modules>

</project>
6 changes: 6 additions & 0 deletions src/it/project1/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
String buildLog = new File(basedir, 'build.log').text

assert buildLog.contains('[WARNING] ValidationViolation: "netcentric-aem-cloud: Nodes below \'/libs\' may be overwritten by future product upgrades. Rather use \'/apps\'. Further details at https://experienceleague.adobe.com/docs/experience-manager-cloud-service/implementing/developing/full-stack/overlays.html?lang=en#developing", filePath=jcr_root/libs/cq/test/test.jsp, nodePath=/libs/cq/test/test.jsp') : 'libs violation not found'
assert buildLog.contains('[WARNING] ValidationViolation: "netcentric-aem-cloud: Using mutable nodes in this repository location is not allowed as it is not writable by the underlying service user on publish. Consider to use repoinit scripts instead or move that content to another location. Further details at https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/debugging/debugging-aem-as-a-cloud-service/build-and-deployment.html?lang=en#including-%2Fvar-in-content-package", filePath=jcr_root/var/example/test.txt, nodePath=/var/example/test.txt') : 'read only path in mutable package not detected'
assert buildLog.contains('[WARNING] ValidationViolation: "netcentric-aem-cloud: Using install hooks in mutable content packages leads to deployment failures as the underlying service user on the publish does not have the right to execute those.", filePath=META-INF/vault/hooks/vault-hook-example-3.0.0.jar') : 'external hook violation not found'
assert buildLog.contains('[WARNING] ValidationViolation: "netcentric-aem-cloud: Mutable nodes in mixed package types are not installed!", filePath=jcr_root/content/example/test.txt, nodePath=/content/example/test.txt') : 'mutable content in mixed package not found'

0 comments on commit 73caaf3

Please sign in to comment.