Search in sources :

Example 6 with AbstractValueFacade

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

the class ValueFacadeTest method testIsOneToOne.

@Test
public void testIsOneToOne() {
    valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertFalse(valueFacade.isOneToOne());
    OneToOne oneToOne = new OneToOne(DummyMetadataBuildingContext.INSTANCE, null, new RootClass(DummyMetadataBuildingContext.INSTANCE));
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, oneToOne) {
    };
    assertTrue(valueFacade.isOneToOne());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 7 with AbstractValueFacade

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

the class ValueFacadeTest method testGetTable.

@Test
public void testGetTable() {
    Table tableTarget = new Table();
    valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE, tableTarget);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    ITable tableFacade = valueFacade.getTable();
    assertSame(tableTarget, ((IFacade) tableFacade).getTarget());
}
Also used : ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 8 with AbstractValueFacade

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

the class ValueFacadeTest method testGetEntityName.

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

Example 9 with AbstractValueFacade

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

the class ValueFacadeTest method testIsTypeSpecified.

@Test
public void testIsTypeSpecified() {
    SimpleValue valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertFalse(valueFacade.isTypeSpecified());
    valueTarget.setTypeName("org.foo.Bar");
    assertTrue(valueFacade.isTypeSpecified());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 10 with AbstractValueFacade

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

the class ValueFacadeTest method testGetCollectionElement.

@Test
public void testGetCollectionElement() {
    valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    IValue collectionElement = valueFacade.getCollectionElement();
    assertNull(collectionElement);
    Set set = new Set(DummyMetadataBuildingContext.INSTANCE, null);
    set.setElement(valueTarget);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, set) {
    };
    collectionElement = valueFacade.getCollectionElement();
    assertNotNull(collectionElement);
    assertSame(valueTarget, ((IFacade) collectionElement).getTarget());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) Set(org.hibernate.mapping.Set) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractValueFacade (org.jboss.tools.hibernate.runtime.common.AbstractValueFacade)51 Test (org.junit.jupiter.api.Test)51 BasicValue (org.hibernate.mapping.BasicValue)36 SimpleValue (org.hibernate.mapping.SimpleValue)22 RootClass (org.hibernate.mapping.RootClass)11 IdentifierBag (org.hibernate.mapping.IdentifierBag)8 Bag (org.hibernate.mapping.Bag)7 Collection (org.hibernate.mapping.Collection)7 Set (org.hibernate.mapping.Set)7 Component (org.hibernate.mapping.Component)6 Table (org.hibernate.mapping.Table)6 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)6 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)6 ManyToOne (org.hibernate.mapping.ManyToOne)5 PrimitiveArray (org.hibernate.mapping.PrimitiveArray)4 Array (org.hibernate.mapping.Array)3 List (org.hibernate.mapping.List)3 OneToMany (org.hibernate.mapping.OneToMany)3 OneToOne (org.hibernate.mapping.OneToOne)3 Column (org.hibernate.mapping.Column)2