From 1d816d1ac9d40efcfeaab3f732739546e5f23a2a Mon Sep 17 00:00:00 2001 From: Koen Aers Date: Thu, 11 Sep 2025 11:03:25 +0200 Subject: [PATCH] HBX-3110: Add a functional test to guard the sanity of the Ant examples - Add a test verifying the 'native' example Signed-off-by: Koen Aers --- .../org/hibernate/tool/ant/ExamplesTestIT.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java b/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java index a85ef80d34..74c21aa81e 100644 --- a/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java +++ b/ant/src/it/java/org/hibernate/tool/ant/ExamplesTestIT.java @@ -28,6 +28,10 @@ public class ExamplesTestIT { @BeforeAll public static void beforeAll() throws Exception { + // The needed resource for this test are put in place + // in the 'baseFolder' (normally 'target/test-classes') + // by the 'build-helper-maven-plugin' execution. + // See the 'pom.xml' baseFolder = determineBaseFolder(); editIncludedXml(); overwriteHibernateProperties(); @@ -84,6 +88,17 @@ public void testJpa() throws Exception { assertTrue(barSqlFile.exists()); } + @Test + public void testNative() throws Exception { + File buildFile = new File(baseFolder, "native/build.xml"); + Project project = createProject(buildFile); + assertNotNull(project); + File fooSqlFile = new File(baseFolder, "native/generated/foo.sql"); + assertFalse(fooSqlFile.exists()); + project.executeTarget("reveng"); + assertTrue(fooSqlFile.exists()); + } + private Project createProject(File buildXmlFile) throws Exception { Project result = new Project(); ProjectHelper projectHelper = ProjectHelper.getProjectHelper();