Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public void testJpaDefault() throws Exception {
runAntBuild();
verifyResult();
}


protected String hibernateToolTaskXml() {
return hibernateToolTaskXml;
}

private void createBuildXmlFile() throws Exception {
buildXmlFile = new File(getProjectDir(), "build.xml");
assertFalse(buildXmlFile.exists());
Files.writeString(buildXmlFile.toPath(), buildXmlFileContents);
Files.writeString(buildXmlFile.toPath(), constructBuildXmlFileContents());
}

private void createDatabase() throws Exception {
Expand Down Expand Up @@ -108,18 +112,10 @@ private String constructJdbcConnectionString() {
return "jdbc:h2:" + getProjectDir().getAbsolutePath() + "/database/test;AUTO_SERVER=TRUE";
}

private static final String buildXmlFileContents =

"<project name='tutorial' default='reveng'> \n" +
" <taskdef \n" +
" name='hibernatetool' \n" +
" classname='org.hibernate.tool.ant.HibernateToolTask'/> \n" +
" <target name='reveng'> \n" +
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java/> \n" +
" </hibernatetool> \n" +
" </target> \n" +
"</project> \n" ;
private static final String hibernateToolTaskXml =
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java/> \n" +
" </hibernatetool> \n" ;

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public void testNoAnnotations() throws Exception {
runAntBuild();
verifyResult();
}

private void createBuildXmlFile() throws Exception {

protected String hibernateToolTaskXml() {
return hibernateToolTaskXml;
}

private void createBuildXmlFile() throws Exception {
buildXmlFile = new File(getProjectDir(), "build.xml");
assertFalse(buildXmlFile.exists());
Files.writeString(buildXmlFile.toPath(), buildXmlFileContents);
Files.writeString(buildXmlFile.toPath(), constructBuildXmlFileContents());
}

private void createDatabase() throws Exception {
Expand Down Expand Up @@ -108,18 +112,9 @@ private String constructJdbcConnectionString() {
return "jdbc:h2:" + getProjectDir().getAbsolutePath() + "/database/test;AUTO_SERVER=TRUE";
}

private static final String buildXmlFileContents =

"<project name='tutorial' default='reveng'> \n" +
" <taskdef \n" +
" name='hibernatetool' \n" +
" classname='org.hibernate.tool.ant.HibernateToolTask'/> \n" +
" <target name='reveng'> \n" +
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java ejb3='false'/> \n" +
" </hibernatetool> \n" +
" </target> \n" +
"</project> \n" ;

private static final String hibernateToolTaskXml =
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java ejb3='false'/> \n" +
" </hibernatetool> \n" ;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public void testUseGenerics() throws Exception {
runAntBuild();
verifyResult();
}

private void createBuildXmlFile() throws Exception {

protected String hibernateToolTaskXml() {
return hibernateToolTaskXml;
}

private void createBuildXmlFile() throws Exception {
buildXmlFile = new File(getProjectDir(), "build.xml");
assertFalse(buildXmlFile.exists());
Files.writeString(buildXmlFile.toPath(), buildXmlFileContents);
Files.writeString(buildXmlFile.toPath(), constructBuildXmlFileContents());
}

private void createDatabase() throws Exception {
Expand Down Expand Up @@ -118,18 +122,10 @@ private String constructJdbcConnectionString() {
return "jdbc:h2:" + getProjectDir().getAbsolutePath() + "/database/test;AUTO_SERVER=TRUE";
}

private static final String buildXmlFileContents =

"<project name='tutorial' default='reveng'> \n" +
" <taskdef \n" +
" name='hibernatetool' \n" +
" classname='org.hibernate.tool.ant.HibernateToolTask'/> \n" +
" <target name='reveng'> \n" +
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java jdk5='false'/> \n" +
" </hibernatetool> \n" +
" </target> \n" +
"</project> \n" ;
private static final String hibernateToolTaskXml =
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java jdk5='false'/> \n" +
" </hibernatetool> \n" ;

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public void testUseGenerics() throws Exception {
runAntBuild();
verifyResult();
}

private void createBuildXmlFile() throws Exception {

protected String hibernateToolTaskXml() {
return hibernateToolTaskXml;
}

private void createBuildXmlFile() throws Exception {
buildXmlFile = new File(getProjectDir(), "build.xml");
assertFalse(buildXmlFile.exists());
Files.writeString(buildXmlFile.toPath(), buildXmlFileContents);
Files.writeString(buildXmlFile.toPath(), constructBuildXmlFileContents());
}

private void createDatabase() throws Exception {
Expand Down Expand Up @@ -118,18 +122,9 @@ private String constructJdbcConnectionString() {
return "jdbc:h2:" + getProjectDir().getAbsolutePath() + "/database/test;AUTO_SERVER=TRUE";
}

private static final String buildXmlFileContents =

"<project name='tutorial' default='reveng'> \n" +
" <taskdef \n" +
" name='hibernatetool' \n" +
" classname='org.hibernate.tool.ant.HibernateToolTask'/> \n" +
" <target name='reveng'> \n" +
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java/> \n" +
" </hibernatetool> \n" +
" </target> \n" +
"</project> \n" ;

private static final String hibernateToolTaskXml =
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java/> \n" +
" </hibernatetool> \n" ;
}
29 changes: 12 additions & 17 deletions ant/src/it/java/org/hibernate/tool/ant/tutorial/TutorialTestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ public void testTutorial() throws Exception {
runAntBuild();
verifyResult();
}

private void createBuildXmlFile() throws Exception {

protected String hibernateToolTaskXml() {
return hibernateToolTaskXml;
}

private void createBuildXmlFile() throws Exception {
buildXmlFile = new File(getProjectDir(), "build.xml");
assertFalse(buildXmlFile.exists());
Files.writeString(buildXmlFile.toPath(), buildXmlFileContents);
Files.writeString(buildXmlFile.toPath(), constructBuildXmlFileContents());
}

private void createDatabase() throws Exception {
Expand Down Expand Up @@ -106,18 +110,9 @@ private String constructJdbcConnectionString() {
return "jdbc:h2:" + getProjectDir().getAbsolutePath() + "/database/test;AUTO_SERVER=TRUE";
}

private static final String buildXmlFileContents =

"<project name='tutorial' default='reveng'> \n" +
" <taskdef \n" +
" name='hibernatetool' \n" +
" classname='org.hibernate.tool.ant.HibernateToolTask'/> \n" +
" <target name='reveng'> \n" +
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java/> \n" +
" </hibernatetool> \n" +
" </target> \n" +
"</project> \n" ;

private static final String hibernateToolTaskXml =
" <hibernatetool destdir='generated'> \n" +
" <jdbcconfiguration propertyfile='hibernate.properties'/> \n" +
" <hbm2java/> \n" +
" </hibernatetool> \n" ;
}
18 changes: 17 additions & 1 deletion ant/src/it/java/org/hibernate/tool/it/ant/TestTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.io.File;

public class TestTemplate {
public abstract class TestTemplate {

@TempDir
private File projectDir;
Expand All @@ -13,4 +13,20 @@ protected File getProjectDir() {
return projectDir;
}

protected abstract String hibernateToolTaskXml();

protected String constructBuildXmlFileContents() {
return buildXmlFileContents.replace("@hibernateToolTaskXml@", hibernateToolTaskXml());
}

private static final String buildXmlFileContents =
"<project name='tutorial' default='reveng'> \n" +
" <taskdef \n" +
" name='hibernatetool' \n" +
" classname='org.hibernate.tool.ant.HibernateToolTask'/> \n" +
" <target name='reveng'> \n" +
"@hibernateToolTaskXml@" +
" </target> \n" +
"</project> \n" ;

}