Search in sources :

Example 31 with AbstractValueFacade

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

the class ValueFacadeTest method testGetPropertyIterator.

@Test
public void testGetPropertyIterator() {
    Component componentTarget = new Component(DummyMetadataBuildingContext.INSTANCE, new RootClass(DummyMetadataBuildingContext.INSTANCE));
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, componentTarget) {
    };
    Iterator<IProperty> iter = valueFacade.getPropertyIterator();
    assertFalse(iter.hasNext());
    Property propertyTarget = new Property();
    componentTarget.addProperty(propertyTarget);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, componentTarget) {
    };
    iter = valueFacade.getPropertyIterator();
    assertTrue(iter.hasNext());
    IProperty propertyFacade = iter.next();
    assertSame(propertyTarget, ((IFacade) propertyFacade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) 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 32 with AbstractValueFacade

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

the class ValueFacadeTest method testGetForeignKeyName.

@Test
public void testGetForeignKeyName() {
    SimpleValue simpleValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    assertNull(valueFacade.getForeignKeyName());
    simpleValueTarget.setForeignKeyName("foobar");
    assertEquals("foobar", valueFacade.getForeignKeyName());
}
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 33 with AbstractValueFacade

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

the class ValueFacadeTest method testSetRole.

@Test
public void testSetRole() {
    Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, collectionTarget) {
    };
    assertNull(collectionTarget.getRole());
    valueFacade.setRole("foobar");
    assertEquals("foobar", collectionTarget.getRole());
}
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 34 with AbstractValueFacade

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

the class ValueFacadeTest method testIsPrimitiveArray.

@Test
public void testIsPrimitiveArray() {
    SimpleValue simpleValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    assertFalse(valueFacade.isPrimitiveArray());
    PrimitiveArray primitiveArrayTarget = new PrimitiveArray(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, primitiveArrayTarget) {
    };
    assertTrue(valueFacade.isPrimitiveArray());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) PrimitiveArray(org.hibernate.mapping.PrimitiveArray) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 35 with AbstractValueFacade

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

the class ValueFacadeTest method testSetCollectionTable.

@Test
public void testSetCollectionTable() {
    Table tableTarget = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(tableTarget);
    Collection valueTarget = new Set(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueTarget.getCollectionTable());
    valueFacade.setCollectionTable(tableFacade);
    assertSame(tableTarget, valueTarget.getCollectionTable());
}
Also used : ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) Set(org.hibernate.mapping.Set) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Collection(org.hibernate.mapping.Collection) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) 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