Search in sources :

Example 31 with IPOJOClass

use of org.jboss.tools.hibernate.runtime.spi.IPOJOClass in project jbosstools-hibernate by jbosstools.

the class HibernateMappingExporterFacadeTest method testSetExportPOJODelegate.

@Test
public void testSetExportPOJODelegate() throws Exception {
    IExportPOJODelegate delegate = new IExportPOJODelegate() {

        @Override
        public void exportPOJO(Map<Object, Object> map, IPOJOClass pojoClass) {
        }
    };
    Field delegateField = HibernateMappingExporterExtension.class.getDeclaredField("delegateExporter");
    delegateField.setAccessible(true);
    Assert.assertNull(delegateField.get(hibernateMappingExporter));
    hibernateMappingExporterFacade.setExportPOJODelegate(delegate);
    Assert.assertSame(delegate, delegateField.get(hibernateMappingExporter));
}
Also used : Field(java.lang.reflect.Field) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) IExportPOJODelegate(org.jboss.tools.hibernate.runtime.spi.IExportPOJODelegate) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Example 32 with IPOJOClass

use of org.jboss.tools.hibernate.runtime.spi.IPOJOClass in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreatePOJOClass.

@Test
public void testCreatePOJOClass() {
    POJOClass pojoClass = (POJOClass) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { POJOClass.class }, new TestInvocationHandler());
    IPOJOClass facade = facadeFactory.createPOJOClass(pojoClass);
    Assert.assertSame(pojoClass, ((IFacade) facade).getTarget());
}
Also used : IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) Test(org.junit.Test)

Aggregations

IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)32 Test (org.junit.Test)32 HashMap (java.util.HashMap)24 RootClass (org.hibernate.mapping.RootClass)23 File (java.io.File)16 Field (java.lang.reflect.Field)16 Map (java.util.Map)16 IExportPOJODelegate (org.jboss.tools.hibernate.runtime.spi.IExportPOJODelegate)16 Table (org.hibernate.mapping.Table)15 Method (java.lang.reflect.Method)8 Date (java.util.Date)8 PersistentClass (org.hibernate.mapping.PersistentClass)8 Cfg2HbmTool (org.hibernate.tool.hbm2x.Cfg2HbmTool)8 Cfg2JavaTool (org.hibernate.tool.hbm2x.Cfg2JavaTool)8 TemplateHelper (org.hibernate.tool.hbm2x.TemplateHelper)8 EntityPOJOClass (org.hibernate.tool.hbm2x.pojo.EntityPOJOClass)8 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)8 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)8 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)8 Configuration (org.hibernate.cfg.Configuration)4