use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class HibernateMappingExporterExtensionTest method setUp.
@Before
public void setUp() throws Exception {
hibernateMappingExporterExtension = new HibernateMappingExporterExtension(FACADE_FACTORY, null, null);
Method setTemplateHelperMethod = AbstractExporter.class.getDeclaredMethod("setTemplateHelper", new Class[] { TemplateHelper.class });
setTemplateHelperMethod.setAccessible(true);
TemplateHelper templateHelper = new TemplateHelper();
templateHelper.init(null, new String[0]);
setTemplateHelperMethod.invoke(hibernateMappingExporterExtension, new Object[] { templateHelper });
RootClass persistentClass = new RootClass(null);
Table rootTable = new Table();
rootTable.setName("table");
persistentClass.setTable(rootTable);
persistentClass.setEntityName("Bar");
persistentClass.setClassName("foo.Bar");
pojoClass = new EntityPOJOClass(persistentClass, new Cfg2JavaTool());
exportPojoDelegate = (IExportPOJODelegate) Proxy.newProxyInstance(HibernateMappingExporterExtension.class.getClassLoader(), new Class[] { IExportPOJODelegate.class }, new TestInvocationHandler());
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class HibernateMappingExporterExtensionTest method setUp.
@Before
public void setUp() throws Exception {
hibernateMappingExporterExtension = new HibernateMappingExporterExtension(FACADE_FACTORY, null, null);
Method setTemplateHelperMethod = AbstractExporter.class.getDeclaredMethod("setTemplateHelper", new Class[] { TemplateHelper.class });
setTemplateHelperMethod.setAccessible(true);
TemplateHelper templateHelper = new TemplateHelper();
templateHelper.init(null, new String[0]);
setTemplateHelperMethod.invoke(hibernateMappingExporterExtension, new Object[] { templateHelper });
RootClass persistentClass = new RootClass();
Table rootTable = new Table();
rootTable.setName("table");
persistentClass.setTable(rootTable);
persistentClass.setEntityName("Bar");
persistentClass.setClassName("foo.Bar");
pojoClass = new EntityPOJOClass(persistentClass, new Cfg2JavaTool());
exportPojoDelegate = (IExportPOJODelegate) Proxy.newProxyInstance(HibernateMappingExporterExtension.class.getClassLoader(), new Class[] { IExportPOJODelegate.class }, new TestInvocationHandler());
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class Cfg2HbmToolFacadeTest method testGetPersistentClassTag.
@Test
public void testGetPersistentClassTag() {
PersistentClass target = new RootClass();
IPersistentClass persistentClass = new AbstractPersistentClassFacade(FACADE_FACTORY, target) {
};
Assert.assertEquals("class", cfg2HbmToolFacade.getTag(persistentClass));
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class Cfg2HbmToolFacadeTest method testGetPropertyTag.
public void testGetPropertyTag() throws Exception {
RootClass rc = new RootClass();
Property p = new Property();
Mappings m = (Mappings) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Mappings.class }, new TestInvocationHandler());
SimpleValue sv = new SimpleValue(m);
sv.setTypeName("foobar");
p.setValue(sv);
p.setPersistentClass(rc);
rc.setVersion(p);
IProperty property = new AbstractPropertyFacade(FACADE_FACTORY, p) {
};
Assert.assertEquals("version", cfg2HbmToolFacade.getTag(property));
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class Cfg2HbmToolFacadeTest method testGetPropertyTag.
public void testGetPropertyTag() throws Exception {
RootClass rc = new RootClass(null);
Property p = new Property();
MetadataImplementor m = (MetadataImplementor) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { MetadataImplementor.class }, new TestInvocationHandler());
SimpleValue sv = new SimpleValue(m);
sv.setTypeName("foobar");
p.setValue(sv);
p.setPersistentClass(rc);
rc.setVersion(p);
IProperty property = new AbstractPropertyFacade(FACADE_FACTORY, p) {
};
Assert.assertEquals("version", cfg2HbmToolFacade.getTag(property));
}
Aggregations