Skip to content

Commit

Permalink
[ARCHETYPE-274] Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovds committed Nov 22, 2024
1 parent 8c2bbd1 commit 2f76cef
Show file tree
Hide file tree
Showing 18 changed files with 291 additions and 104 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

excludePatterns=build.log,invoker.properties,verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
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>org.apache.maven.plugins.archetype.its</groupId>
<artifactId>archetype274-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>archetype274-archetype</artifactId>
<packaging>maven-archetype</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<archetypeDirectory>src/main/resources</archetypeDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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.
-->
<archetype-descriptor name="include-condition-test">

<requiredProperties>
<requiredProperty key="extraSupport"/>
<requiredProperty key="anotherSupport"/>
</requiredProperties>

<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false" includeCondition="${extraSupport}">
<directory>src/main/resources</directory>
<includes>
<include>**/include-without-filter.txt</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false" includeCondition="${extraSupport}">
<directory>src/main/resources</directory>
<includes>
<include>**/include-with-filter.txt</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false" includeCondition="${anotherSupport}">
<directory>src/main/resources</directory>
<includes>
<include>**/exclude-with-filter.txt</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="false" includeCondition="${anotherSupport}">
<directory>src/main/resources</directory>
<includes>
<include>**/exclude-without-filter.txt</include>
</includes>
</fileSet>
</fileSets>

</archetype-descriptor>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
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>

<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>pom</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class App {
public static void main(String[] args) {
System.out.println("This file should not be included");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this should be excluded: ${package}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this should be excluded: ${package}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this should be included: ${package}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this should be included: ${package}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

invoker.goals.1 = install
invoker.project.1 = archetype

invoker.goals.2 = org.apache.maven.plugins:maven-archetype-plugin:${project.version}:generate
invoker.userPropertiesFile = project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
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>

<groupId>org.apache.maven.plugins.archetype.its</groupId>
<artifactId>archetype274-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>@project.version@</version>
</extension>
</extensions>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-archetype-plugin</artifactId>
<version>@project.version@</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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.

archetypeGroupId=org.apache.maven.plugins.archetype.its
archetypeArtifactId=archetype274-archetype
archetypeVersion=1.0-SNAPSHOT

groupId=com.company
artifactId=myArtifactId
version=1.0-SNAPSHOT
package=com.company.project

extraSupport=true
anotherSupport=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.
*/

import java.io.File

def mainJava = new File(basedir, "/myArtifactId/src/main/java")
def includeFirstResource = new File(basedir, "/myArtifactId/src/main/resources/include-with-filter.txt")
def includeSecondResource = new File(basedir, "/myArtifactId/src/main/resources/include-without-filter.txt")
def excludeFirstResource = new File(basedir, "/myArtifactId/src/main/resources/exclude-with-filter.txt")
def excludeSecondResource = new File(basedir, "/myArtifactId/src/main/resources/exclude-without-filter.txt")

assert mainJava.exists() : "${mainJava} should be present."
assert includeFirstResource.exists() : "${includeFirstResource} should be present."
assert includeSecondResource.exists() : "${includeSecondResource} should be present."
assert !excludeFirstResource.exists() : "${excludeFirstResource} should not be present."
assert !excludeSecondResource.exists() : "${excludeSecondResource} should not be present."


20 changes: 0 additions & 20 deletions test-archetype/pom.xml

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions test-archetype/src/main/resources/archetype-resources/pom.xml

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2f76cef

Please sign in to comment.