Search in sources :

Example 41 with RootClass

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

the class ValueFacadeTest method testGetOwner.

@Test
public void testGetOwner() {
    RootClass rc = new RootClass();
    Component componentTarget = new Component(null, rc);
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    assertSame(rc, ((IFacade) valueFacade.getOwner()).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) Component(org.hibernate.mapping.Component) Test(org.junit.jupiter.api.Test)

Example 42 with RootClass

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

the class ValueFacadeTest method testIsToOne.

@Test
public void testIsToOne() {
    valueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    assertFalse(valueFacade.isToOne());
    ToOne toOne = new OneToOne(null, null, new RootClass());
    valueFacade = FACADE_FACTORY.createValue(toOne);
    assertTrue(valueFacade.isToOne());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) ToOne(org.hibernate.mapping.ToOne) ManyToOne(org.hibernate.mapping.ManyToOne) OneToOne(org.hibernate.mapping.OneToOne) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 43 with RootClass

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

the class ValueFacadeTest method testIsEmbedded.

@Test
public void testIsEmbedded() {
    valueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    assertNull(valueFacade.isEmbedded());
    Component component = new Component(null, new RootClass());
    valueFacade = FACADE_FACTORY.createValue(component);
    component.setEmbedded(true);
    assertTrue(valueFacade.isEmbedded());
    component.setEmbedded(false);
    assertFalse(valueFacade.isEmbedded());
}
Also used : RootClass(org.hibernate.mapping.RootClass) Component(org.hibernate.mapping.Component) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 44 with RootClass

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

the class ValueFacadeTest method testGetPropertyIterator.

@Test
public void testGetPropertyIterator() {
    Component componentTarget = new Component(null, new RootClass());
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    Iterator<IProperty> iter = valueFacade.getPropertyIterator();
    assertFalse(iter.hasNext());
    Property propertyTarget = new Property();
    componentTarget.addProperty(propertyTarget);
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    iter = valueFacade.getPropertyIterator();
    assertTrue(iter.hasNext());
    IProperty propertyFacade = iter.next();
    assertSame(propertyTarget, ((IFacade) propertyFacade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Component(org.hibernate.mapping.Component) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Test(org.junit.jupiter.api.Test)

Example 45 with RootClass

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

the class ValueFacadeTest method testGetAssociatedClass.

@Test
public void testGetAssociatedClass() {
    RootClass rootClass = new RootClass();
    OneToMany oneToManyTarget = new OneToMany(null, null);
    valueFacade = FACADE_FACTORY.createValue(oneToManyTarget);
    assertNull(valueFacade.getAssociatedClass());
    oneToManyTarget.setAssociatedClass(rootClass);
    assertSame(rootClass, ((IFacade) valueFacade.getAssociatedClass()).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToMany(org.hibernate.mapping.OneToMany) 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