use of org.hibernate.eclipse.launch.CodeGenXMLFactory in project jbosstools-hibernate by jbosstools.
the class CodeGenXMLFactoryTest method testCodeGenXMLFactoryPropertiesOne.
@Test
public void testCodeGenXMLFactoryPropertiesOne() {
TestLaunchConfig testLaunchConfig = createTestLaunchConfig(false, false, false);
CodeGenXMLFactory codeGenFactory = new CodeGenXMLFactory4TestProperties(testLaunchConfig);
String codeGen = adjustXmlText(codeGenFactory.createCodeGenXML());
String codeGenProperties = codeGenFactory.getPropFileContentPreSave();
codeGen = updatePaths(codeGen);
// $NON-NLS-1$
String sample = getSample("AntCodeGenProps_test2.xml");
// $NON-NLS-1$
String sampleProperties = getSample("AntCodeGenProps.hibernate.properties");
Assert.assertEquals(sample, codeGen);
Assert.assertEquals(sampleProperties.trim(), codeGenProperties);
}
use of org.hibernate.eclipse.launch.CodeGenXMLFactory in project jbosstools-hibernate by jbosstools.
the class CodeGenXMLFactoryTest method testCodeGenXMLFactoryAll.
@Test
public void testCodeGenXMLFactoryAll() {
TestLaunchConfig testLaunchConfig = createTestLaunchConfig(false, true, false);
CodeGenXMLFactory codeGenFactory = new CodeGenXMLFactory4TestRelative(testLaunchConfig);
//
// $NON-NLS-1$
String strPlace = "project/src";
codeGenFactory.setPlace2Generate(strPlace);
codeGenFactory.setWorkspacePath(strPlace);
//
String codeGen = adjustXmlText(codeGenFactory.createCodeGenXML());
String codeGenProperties = codeGenFactory.getPropFileContentPreSave();
// $NON-NLS-1$
String sample = getSample("AntCodeGen_test1.xml");
Assert.assertEquals(sample, codeGen);
Assert.assertEquals(codeGenProperties.length(), 0);
}
use of org.hibernate.eclipse.launch.CodeGenXMLFactory in project jbosstools-hibernate by jbosstools.
the class ExportAntCodeGenWizardPage method getInitialContents.
protected InputStream getInitialContents() {
ILaunchConfiguration lc = getSelectedLaunchConfig();
if (lc == null) {
return null;
}
codeGenXMLFactory = new CodeGenXMLFactory(lc);
String externalPropFileName = CodeGenXMLFactory.getExternalPropFileNameStandard(getFileName());
codeGenXMLFactory.setExternalPropFileName(externalPropFileName);
codeGenXMLFactory.setPlace2Generate(getContainerFullPath().toString());
IWorkspace workspace = ResourcesPlugin.getWorkspace();
if (workspace != null && workspace.getRoot() != null && workspace.getRoot().getLocation() != null) {
codeGenXMLFactory.setWorkspacePath(workspace.getRoot().getLocation().toString());
}
String buildXml = codeGenXMLFactory.createCodeGenXML();
return new ByteArrayInputStream(buildXml.getBytes());
}
Aggregations