Search in sources :

Example 26 with AbstractValueFacade

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

the class ValueFacadeTest method testGetIndex.

@Test
public void testGetIndex() {
    List valueTarget = new List(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueFacade.getIndex());
    SimpleValue indexValue = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueTarget.setIndex(indexValue);
    assertSame(indexValue, ((IFacade) valueFacade.getIndex()).getTarget());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) List(org.hibernate.mapping.List) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 27 with AbstractValueFacade

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

the class ValueFacadeTest method testSetKey.

@Test
public void testSetKey() {
    KeyValue keyValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    IValue keyValueFacade = new AbstractValueFacade(FACADE_FACTORY, keyValueTarget) {
    };
    Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
    IValue collectionFacade = new AbstractValueFacade(FACADE_FACTORY, collectionTarget) {
    };
    assertNull(collectionTarget.getKey());
    collectionFacade.setKey(keyValueFacade);
    assertSame(keyValueTarget, collectionTarget.getKey());
}
Also used : KeyValue(org.hibernate.mapping.KeyValue) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Collection(org.hibernate.mapping.Collection) Bag(org.hibernate.mapping.Bag) IdentifierBag(org.hibernate.mapping.IdentifierBag) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 28 with AbstractValueFacade

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

the class ValueFacadeTest method testIsArray.

@Test
public void testIsArray() {
    SimpleValue simpleValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    assertFalse(valueFacade.isArray());
    Array arrayTarget = new Array(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, arrayTarget) {
    };
    assertTrue(valueFacade.isArray());
}
Also used : Array(org.hibernate.mapping.Array) PrimitiveArray(org.hibernate.mapping.PrimitiveArray) 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 29 with AbstractValueFacade

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

the class ValueFacadeTest method testGetKey.

@Test
public void testGetKey() {
    Map valueTarget = new Map(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueFacade.getKey());
    KeyValue keyValue = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueTarget.setKey(keyValue);
    assertSame(keyValue, ((IFacade) valueFacade.getKey()).getTarget());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) KeyValue(org.hibernate.mapping.KeyValue) Map(org.hibernate.mapping.Map) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 30 with AbstractValueFacade

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

the class ValueFacadeTest method testIsIdentifierBag.

@Test
public void testIsIdentifierBag() {
    SimpleValue simpleValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    assertFalse(valueFacade.isIdentifierBag());
    IdentifierBag identifierBagTarget = new IdentifierBag(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, identifierBagTarget) {
    };
    assertTrue(valueFacade.isIdentifierBag());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) IdentifierBag(org.hibernate.mapping.IdentifierBag) SimpleValue(org.hibernate.mapping.SimpleValue) 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