Search in sources :

Example 1 with AbstractPropertyFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateSpecialRootClass.

@Test
public void testCreateSpecialRootClass() {
    Property property = new Property();
    property.setValue(new SimpleValue());
    IProperty propertyFacade = new AbstractPropertyFacade(facadeFactory, property) {
    };
    IPersistentClass specialRootClass = facadeFactory.createSpecialRootClass(propertyFacade);
    Assert.assertSame(property, ((IFacade) specialRootClass.getProperty()).getTarget());
}
Also used : AbstractPropertyFacade(org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 2 with AbstractPropertyFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade in project jbosstools-hibernate by jbosstools.

the class FacadeFactoryTest method testCreateSpecialRootClass.

@Test
public void testCreateSpecialRootClass() {
    Property property = new Property();
    Mappings m = (Mappings) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Mappings.class }, new TestInvocationHandler());
    property.setValue(new SimpleValue(m));
    IProperty propertyFacade = new AbstractPropertyFacade(facadeFactory, property) {
    };
    IPersistentClass specialRootClass = facadeFactory.createSpecialRootClass(propertyFacade);
    Assert.assertSame(property, ((IFacade) specialRootClass.getProperty()).getTarget());
}
Also used : Mappings(org.hibernate.cfg.Mappings) AbstractPropertyFacade(org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 3 with AbstractPropertyFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade 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));
}
Also used : RootClass(org.hibernate.mapping.RootClass) Mappings(org.hibernate.cfg.Mappings) AbstractPropertyFacade(org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) SimpleValue(org.hibernate.mapping.SimpleValue)

Example 4 with AbstractPropertyFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade 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));
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractPropertyFacade(org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) MetadataImplementor(org.hibernate.boot.spi.MetadataImplementor) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) SimpleValue(org.hibernate.mapping.SimpleValue)

Example 5 with AbstractPropertyFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade 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));
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractPropertyFacade(org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) MetadataImplementor(org.hibernate.boot.spi.MetadataImplementor) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) SimpleValue(org.hibernate.mapping.SimpleValue)

Aggregations

Property (org.hibernate.mapping.Property)12 SimpleValue (org.hibernate.mapping.SimpleValue)12 AbstractPropertyFacade (org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade)12 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)12 RootClass (org.hibernate.mapping.RootClass)11 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)11 PersistentClass (org.hibernate.mapping.PersistentClass)10 Mappings (org.hibernate.cfg.Mappings)6 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)4 Test (org.junit.Test)4 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)3 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)3