Search in sources :

Example 36 with AbstractValueFacade

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

the class ValueFacadeTest method testSetLazy.

@Test
public void testSetLazy() {
    Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, collectionTarget) {
    };
    valueFacade.setLazy(true);
    assertTrue(collectionTarget.isLazy());
    valueFacade.setLazy(false);
    assertFalse(collectionTarget.isLazy());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Collection(org.hibernate.mapping.Collection) Bag(org.hibernate.mapping.Bag) IdentifierBag(org.hibernate.mapping.IdentifierBag) Test(org.junit.jupiter.api.Test)

Example 37 with AbstractValueFacade

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

the class ValueFacadeTest method testIsMap.

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

Example 38 with AbstractValueFacade

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

the class ValueFacadeTest method testSetAssociatedClass.

@Test
public void testSetAssociatedClass() {
    RootClass rootClassTarget = new RootClass(DummyMetadataBuildingContext.INSTANCE);
    IPersistentClass rootClassFacade = FACADE_FACTORY.createPersistentClass(rootClassTarget);
    OneToMany oneToManyTarget = new OneToMany(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, oneToManyTarget) {
    };
    assertNull(oneToManyTarget.getAssociatedClass());
    valueFacade.setAssociatedClass(rootClassFacade);
    assertSame(rootClassTarget, oneToManyTarget.getAssociatedClass());
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) OneToMany(org.hibernate.mapping.OneToMany) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.jupiter.api.Test)

Example 39 with AbstractValueFacade

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

the class ValueFacadeTest method testAddColumn.

@Test
public void testAddColumn() {
    SimpleValue simpleValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    simpleValueTarget.setTable(new Table());
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    Iterator<?> columnIterator = simpleValueTarget.getColumnIterator();
    assertFalse(columnIterator.hasNext());
    Column columnTarget = new Column();
    IColumn columnFacade = FACADE_FACTORY.createColumn(columnTarget);
    valueFacade.addColumn(columnFacade);
    columnIterator = simpleValueTarget.getColumnIterator();
    assertTrue(columnIterator.hasNext());
    assertSame(columnTarget, columnIterator.next());
}
Also used : ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Column(org.hibernate.mapping.Column) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 40 with AbstractValueFacade

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

the class ValueFacadeTest method testGetOwner.

@Test
public void testGetOwner() {
    RootClass rc = new RootClass(DummyMetadataBuildingContext.INSTANCE);
    Component componentTarget = new Component(DummyMetadataBuildingContext.INSTANCE, rc);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, componentTarget) {
    };
    assertSame(rc, ((IFacade) valueFacade.getOwner()).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Component(org.hibernate.mapping.Component) 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