Search in sources :

Example 1 with CodeGenXMLFactory

use of org.hibernate.eclipse.launch.CodeGenXMLFactory in project jbosstools-hibernate by jbosstools.

the class CodeGenXMLFactoryTest method testCodeGenXMLFactoryJpaAll.

@Test
public void testCodeGenXMLFactoryJpaAll() {
    TestLaunchConfig testLaunchConfig = createTestLaunchConfig(false, true, true);
    CodeGenXMLFactory codeGenFactory = new CodeGenXMLFactory4TestJpa(testLaunchConfig);
    String codeGen = adjustXmlText(codeGenFactory.createCodeGenXML());
    String codeGenProperties = codeGenFactory.getPropFileContentPreSave();
    codeGen = updatePaths(codeGen);
    // $NON-NLS-1$
    String sample = getSample("AntCodeGenJpa_test1.xml");
    Assert.assertEquals(sample, codeGen);
    Assert.assertEquals(codeGenProperties.length(), 0);
}
Also used : TestLaunchConfig(org.jboss.tools.hibernate.orm.test.utils.TestLaunchConfig) CodeGenXMLFactory(org.hibernate.eclipse.launch.CodeGenXMLFactory) Test(org.junit.Test)

Example 2 with CodeGenXMLFactory

use of org.hibernate.eclipse.launch.CodeGenXMLFactory in project jbosstools-hibernate by jbosstools.

the class CodeGenXMLFactoryTest method testCodeGenXMLFactoryJpaOne.

@Test
public void testCodeGenXMLFactoryJpaOne() {
    TestLaunchConfig testLaunchConfig = createTestLaunchConfig(false, false, true);
    CodeGenXMLFactory codeGenFactory = new CodeGenXMLFactory4TestJpa(testLaunchConfig);
    String codeGen = adjustXmlText(codeGenFactory.createCodeGenXML());
    String codeGenProperties = codeGenFactory.getPropFileContentPreSave();
    codeGen = updatePaths(codeGen);
    // $NON-NLS-1$
    String sample = getSample("AntCodeGenJpa_test2.xml");
    Assert.assertEquals(sample, codeGen);
    Assert.assertEquals(codeGenProperties.length(), 0);
}
Also used : TestLaunchConfig(org.jboss.tools.hibernate.orm.test.utils.TestLaunchConfig) CodeGenXMLFactory(org.hibernate.eclipse.launch.CodeGenXMLFactory) Test(org.junit.Test)

Example 3 with CodeGenXMLFactory

use of org.hibernate.eclipse.launch.CodeGenXMLFactory in project jbosstools-hibernate by jbosstools.

the class CodeGenXMLFactoryTest method testCodeGenXMLFactoryRevengAll.

@Test
public void testCodeGenXMLFactoryRevengAll() {
    TestLaunchConfig testLaunchConfig = createTestLaunchConfig(true, true, false);
    CodeGenXMLFactory codeGenFactory = new CodeGenXMLFactory4TestSimple(testLaunchConfig);
    String codeGen = adjustXmlText(codeGenFactory.createCodeGenXML());
    String codeGenProperties = codeGenFactory.getPropFileContentPreSave();
    // $NON-NLS-1$
    String sample = getSample("AntCodeGenReveng_test1.xml");
    Assert.assertEquals(sample, codeGen);
    Assert.assertEquals(codeGenProperties.length(), 0);
}
Also used : TestLaunchConfig(org.jboss.tools.hibernate.orm.test.utils.TestLaunchConfig) CodeGenXMLFactory(org.hibernate.eclipse.launch.CodeGenXMLFactory) Test(org.junit.Test)

Example 4 with CodeGenXMLFactory

use of org.hibernate.eclipse.launch.CodeGenXMLFactory in project jbosstools-hibernate by jbosstools.

the class CodeGenXMLFactoryTest method testCodeGenXMLFactoryOne.

@Test
public void testCodeGenXMLFactoryOne() {
    TestLaunchConfig testLaunchConfig = createTestLaunchConfig(false, false, 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_test2.xml");
    Assert.assertEquals(sample, codeGen);
    Assert.assertEquals(codeGenProperties.length(), 0);
}
Also used : TestLaunchConfig(org.jboss.tools.hibernate.orm.test.utils.TestLaunchConfig) CodeGenXMLFactory(org.hibernate.eclipse.launch.CodeGenXMLFactory) Test(org.junit.Test)

Example 5 with CodeGenXMLFactory

use of org.hibernate.eclipse.launch.CodeGenXMLFactory in project jbosstools-hibernate by jbosstools.

the class CodeGenXMLFactoryTest method testCodeGenXMLFactoryInternalPropertiesOne.

@Test
public void testCodeGenXMLFactoryInternalPropertiesOne() {
    TestLaunchConfig testLaunchConfig = createTestLaunchConfig(false, false, false);
    CodeGenXMLFactory codeGenFactory = new CodeGenXMLFactory4TestProperties(testLaunchConfig);
    codeGenFactory.setExternalPropFile(false);
    String codeGen = adjustXmlText(codeGenFactory.createCodeGenXML());
    String codeGenProperties = codeGenFactory.getPropFileContentPreSave();
    codeGen = updatePaths(codeGen);
    // $NON-NLS-1$
    String sample = getSample("AntCodeGenInternalProps_test2.xml");
    // $NON-NLS-1$
    String sampleProperties = getSample("AntCodeGenPropsInternal.hibernate.properties");
    Assert.assertEquals(sample, codeGen);
    Assert.assertEquals(sampleProperties.trim(), codeGenProperties);
}
Also used : TestLaunchConfig(org.jboss.tools.hibernate.orm.test.utils.TestLaunchConfig) CodeGenXMLFactory(org.hibernate.eclipse.launch.CodeGenXMLFactory) Test(org.junit.Test)

Aggregations

CodeGenXMLFactory (org.hibernate.eclipse.launch.CodeGenXMLFactory)13 TestLaunchConfig (org.jboss.tools.hibernate.orm.test.utils.TestLaunchConfig)12 Test (org.junit.Test)12 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IWorkspace (org.eclipse.core.resources.IWorkspace)1 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1