Search in sources :

Example 46 with AbstractValueFacade

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

the class ValueFacadeTest method testSetReferencedEntityName.

@Test
public void testSetReferencedEntityName() {
    ManyToOne valueTarget = new ManyToOne(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueTarget.getReferencedEntityName());
    valueFacade.setReferencedEntityName("Foo");
    assertEquals("Foo", valueTarget.getReferencedEntityName());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) ManyToOne(org.hibernate.mapping.ManyToOne) Test(org.junit.jupiter.api.Test)

Example 47 with AbstractValueFacade

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

the class ValueFacadeTest method testGetCollectionTable.

@Test
public void testGetCollectionTable() {
    Table tableTarget = new Table();
    Collection valueTarget = new Set(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueFacade.getCollectionTable());
    valueTarget.setCollectionTable(tableTarget);
    assertSame(tableTarget, ((IFacade) valueFacade.getCollectionTable()).getTarget());
}
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) Test(org.junit.jupiter.api.Test)

Example 48 with AbstractValueFacade

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

the class ValueFacadeTest method testGetParentProperty.

@Test
public void testGetParentProperty() {
    Component componentTarget = new Component(DummyMetadataBuildingContext.INSTANCE, new RootClass(DummyMetadataBuildingContext.INSTANCE));
    IValue valueFacade = new AbstractValueFacade(FACADE_FACTORY, componentTarget) {
    };
    assertNull(valueFacade.getParentProperty());
    componentTarget.setParentProperty("foobar");
    assertEquals("foobar", valueFacade.getParentProperty());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Component(org.hibernate.mapping.Component) Test(org.junit.jupiter.api.Test)

Example 49 with AbstractValueFacade

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

the class ValueFacadeTest method testIsSet.

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

Example 50 with AbstractValueFacade

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

the class ValueFacadeTest method testSetFetchModeJoin.

@Test
public void testSetFetchModeJoin() {
    SimpleValue simpleValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    assertNotEquals(FetchMode.JOIN, simpleValueTarget.getFetchMode());
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    valueFacade.setFetchModeJoin();
    assertNotEquals(FetchMode.JOIN, simpleValueTarget.getFetchMode());
    Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
    assertNotEquals(FetchMode.JOIN, collectionTarget.getFetchMode());
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, collectionTarget) {
    };
    valueFacade.setFetchModeJoin();
    assertEquals(FetchMode.JOIN, collectionTarget.getFetchMode());
    ManyToOne manyToOneTarget = new ManyToOne(DummyMetadataBuildingContext.INSTANCE, null);
    assertNotEquals(FetchMode.JOIN, manyToOneTarget.getFetchMode());
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, manyToOneTarget) {
    };
    valueFacade.setFetchModeJoin();
    assertEquals(FetchMode.JOIN, manyToOneTarget.getFetchMode());
}
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) ManyToOne(org.hibernate.mapping.ManyToOne) 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