Skip to content

Commit 0313d38

Browse files
committed
HBX-3110: Add a functional test to guard the sanity of the Ant examples
- Add classpath info to the 'properties/build.xml' file to make this work reliably - Add a test verifying the 'properties' example Signed-off-by: Koen Aers <[email protected]>
1 parent 1d816d1 commit 0313d38

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

ant/docs/examples/properties/build.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@
2323
<property name="thingOne" value="Bar"/>
2424
<echo message="First try without any property set"/>
2525
<hibernatetool destdir="dummy">
26+
<!-- The classpath to be used by the 'hibernatetool' task to look up additional classes or resources -->
27+
<classpath location="."/>
2628
<!-- Dummy configuration, as it is needed for any 'hibernatetool' task -->
2729
<configuration />
2830
<!-- Custom exporter 'HelloExporter' will say 'Hello, World!' -->
2931
<hbmtemplate exporterclass="HelloExporter"/>
3032
</hibernatetool>
3133
<echo message="Now try with a property element: 'greetedOne' is set to 'Foo'"/>
3234
<hibernatetool destdir="dummy">
35+
<!-- The classpath to be used by the 'hibernatetool' task to look up additional classes or resources -->
36+
<classpath location="."/>
3337
<!-- <property> element to be used by the HelloExporter below -->
3438
<property key="greetedOne" value="Foo"/>
3539
<!-- Dummy configuration, as it is needed for any 'hibernatetool' task -->
@@ -39,6 +43,8 @@
3943
</hibernatetool>
4044
<echo message="Lastly try with a propertySet element: 'greetedOne' is set to 'Bar'"/>
4145
<hibernatetool destdir="dummy">
46+
<!-- The classpath to be used by the 'hibernatetool' task to look up additional classes or resources -->
47+
<classpath location="."/>
4248
<!-- <propertySet> element to be used by the HelloExporter below -->
4349
<!-- The property 'thingOne' defined above is mapped to 'greetedOne' and subsequently used -->
4450
<propertySet>

ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ public void testNative() throws Exception {
9999
assertTrue(fooSqlFile.exists());
100100
}
101101

102+
@Test
103+
public void testProperties() throws Exception {
104+
File buildFile = new File(baseFolder, "properties/build.xml");
105+
Project project = createProject(buildFile);
106+
assertNotNull(project);
107+
// File fooSqlFile = new File(baseFolder, "native/generated/foo.sql");
108+
// assertFalse(fooSqlFile.exists());
109+
project.executeTarget("reveng");
110+
// assertTrue(fooSqlFile.exists());
111+
}
112+
102113
private Project createProject(File buildXmlFile) throws Exception {
103114
Project result = new Project();
104115
ProjectHelper projectHelper = ProjectHelper.getProjectHelper();

0 commit comments

Comments
 (0)