Skip to content

Commit fa71be4

Browse files
committed
HBX-3110: Add a functional test to guard the sanity of the Ant examples
- Add a delimiter to 'ant/docs/examples/common/included.xml' to be able to filter the version - Adapt the 'ant/pom.xml' to copy the examples as test resources while filtering for the version - Create a new test class (doing nothing much at this time) Signed-off-by: Koen Aers <[email protected]>
1 parent 1a3f57b commit fa71be4

File tree

3 files changed

+71
-13
lines changed

3 files changed

+71
-13
lines changed

ant/docs/examples/common/included.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
-->
1616
<project name="common" xmlns:ivy="antlib:org.apache.ivy.ant">
1717

18-
<property name="hibernate-tools.version" value="7.1.1.Final"/>
18+
<property name="hibernate-tools.version" value="@project.version@"/>
1919
<property name="javaee-api.version" value="8.0.1"/>
2020
<property name="jdbc-driver.org" value="com.h2database"/>
2121
<property name="jdbc-driver.module" value="h2"/>

ant/pom.xml

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,63 @@
6262

6363
<build>
6464
<plugins>
65+
<plugin>
66+
<groupId>org.apache.maven.plugins</groupId>
67+
<artifactId>maven-resources-plugin</artifactId>
68+
<executions>
69+
<execution>
70+
<id>filter-test-resources</id>
71+
<phase>process-test-resources</phase>
72+
<goals>
73+
<goal>testResources</goal>
74+
</goals>
75+
<configuration>
76+
<resources>
77+
<resource>
78+
<directory>${project.build.testOutputDirectory}</directory>
79+
<filtering>true</filtering>
80+
<includes>
81+
<include>common/included.xml</include>
82+
</includes>
83+
</resource>
84+
</resources>
85+
<delimiters>
86+
<delimiter>@*@</delimiter>
87+
</delimiters>
88+
</configuration>
89+
</execution>
90+
</executions>
91+
</plugin>
6592
<plugin>
6693
<groupId>org.codehaus.mojo</groupId>
6794
<artifactId>build-helper-maven-plugin</artifactId>
6895
<executions>
69-
<execution>
70-
<id>add-test-source</id>
71-
<phase>generate-test-sources</phase>
72-
<goals>
73-
<goal>add-test-source</goal>
74-
</goals>
75-
<configuration>
76-
<sources>
77-
<source>src/it/java</source>
78-
</sources>
79-
</configuration>
80-
</execution>
96+
<execution>
97+
<id>add-test-source</id>
98+
<phase>generate-test-sources</phase>
99+
<goals>
100+
<goal>add-test-source</goal>
101+
</goals>
102+
<configuration>
103+
<sources>
104+
<source>src/it/java</source>
105+
</sources>
106+
</configuration>
107+
</execution>
108+
<execution>
109+
<id>add-test-resource</id>
110+
<phase>generate-test-resources</phase>
111+
<goals>
112+
<goal>add-test-resource</goal>
113+
</goals>
114+
<configuration>
115+
<resources>
116+
<resource>
117+
<directory>docs/examples</directory>
118+
</resource>
119+
</resources>
120+
</configuration>
121+
</execution>
81122
</executions>
82123
</plugin>
83124
<plugin>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.hibernate.tool.ant;
2+
3+
import static org.junit.jupiter.api.Assertions.assertTrue;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
import java.net.URL;
8+
9+
public class ExamplesTestIT {
10+
11+
@Test
12+
public void testSomethin() {
13+
URL url = getClass().getClassLoader().getResource("5-minute-tutorial/build.xml");
14+
System.out.println(url);
15+
}
16+
17+
}

0 commit comments

Comments
 (0)