Search in sources :

Example 36 with RootClass

use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.

the class Cfg2HbmToolFacadeTest method testGetTagPersistentClass.

@Test
public void testGetTagPersistentClass() {
    PersistentClass target = new RootClass();
    IPersistentClass persistentClass = FACADE_FACTORY.createPersistentClass(target);
    assertEquals("class", cfg2HbmToolFacade.getTag(persistentClass));
}
Also used : RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) Test(org.junit.jupiter.api.Test)

Example 37 with RootClass

use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.

the class Cfg2HbmToolFacadeTest method testGetTagProperty.

@Test
public void testGetTagProperty() throws Exception {
    RootClass rc = new RootClass();
    Property p = new Property();
    Table t = new Table();
    SimpleValue sv = new SimpleValue(null, t);
    sv.setTypeName("foobar");
    p.setValue(sv);
    p.setPersistentClass(rc);
    rc.setVersion(p);
    IProperty property = new AbstractPropertyFacade(FACADE_FACTORY, p) {
    };
    assertEquals("version", cfg2HbmToolFacade.getTag(property));
}
Also used : RootClass(org.hibernate.mapping.RootClass) Table(org.hibernate.mapping.Table) 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) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 38 with RootClass

use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewSpecialRootClass.

@Test
public void testNewSpecialRootClass() {
    IProperty property = service.newProperty();
    IPersistentClass pc = service.newRootClass();
    property.setPersistentClass(pc);
    IPersistentClass specialRootClass = service.newSpecialRootClass(property);
    assertNotNull(specialRootClass);
    Object target = ((IFacade) specialRootClass).getTarget();
    assertNotNull(target);
    assertTrue(target instanceof RootClass);
    assertSame(property, specialRootClass.getProperty());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.jupiter.api.Test)

Example 39 with RootClass

use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testGetEntityName.

@Test
public void testGetEntityName() {
    SimpleValue simpleValueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(simpleValueTarget);
    assertNull(valueFacade.getEntityName());
    RootClass pc = new RootClass();
    pc.setEntityName("foobar");
    OneToOne oneToOneTarget = new OneToOne(null, null, pc);
    valueFacade = FACADE_FACTORY.createValue(oneToOneTarget);
    assertEquals("foobar", valueFacade.getEntityName());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 40 with RootClass

use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testGetParentProperty.

@Test
public void testGetParentProperty() {
    Component componentTarget = new Component(null, new RootClass());
    IValue valueFacade = FACADE_FACTORY.createValue(componentTarget);
    assertNull(valueFacade.getParentProperty());
    componentTarget.setParentProperty("foobar");
    assertEquals("foobar", valueFacade.getParentProperty());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) Component(org.hibernate.mapping.Component) Test(org.junit.jupiter.api.Test)

Aggregations

RootClass (org.hibernate.mapping.RootClass)609 Test (org.junit.jupiter.api.Test)471 PersistentClass (org.hibernate.mapping.PersistentClass)166 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)162 Field (java.lang.reflect.Field)149 SimpleValue (org.hibernate.mapping.SimpleValue)142 Table (org.hibernate.mapping.Table)136 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)130 Property (org.hibernate.mapping.Property)124 Component (org.hibernate.mapping.Component)109 Column (org.hibernate.mapping.Column)53 ArrayList (java.util.ArrayList)51 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)51 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)44 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)43 Configuration (org.hibernate.cfg.Configuration)37 OneToOne (org.hibernate.mapping.OneToOne)37 MetadataSources (org.hibernate.boot.MetadataSources)35 Test (org.junit.Test)35 SingleTableSubclass (org.hibernate.mapping.SingleTableSubclass)34