Search in sources :

Example 41 with AbstractValueFacade

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

the class ValueFacadeTest method testIsSimpleValue.

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

Example 42 with AbstractValueFacade

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

the class ValueFacadeTest method testSetTable.

@Test
public void testSetTable() {
    Table tableTarget = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(tableTarget);
    SimpleValue valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueTarget.getTable());
    valueFacade.setTable(tableFacade);
    assertSame(tableTarget, valueTarget.getTable());
}
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) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 43 with AbstractValueFacade

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

the class ValueFacadeTest method testIsManyToOne.

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

Example 44 with AbstractValueFacade

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

the class ValueFacadeTest method testSetIndex.

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

Example 45 with AbstractValueFacade

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

the class ValueFacadeTest method testGetAssociatedClass.

@Test
public void testGetAssociatedClass() {
    RootClass rootClass = new RootClass(DummyMetadataBuildingContext.INSTANCE);
    OneToMany oneToManyTarget = new OneToMany(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, oneToManyTarget) {
    };
    assertNull(valueFacade.getAssociatedClass());
    oneToManyTarget.setAssociatedClass(rootClass);
    assertSame(rootClass, ((IFacade) valueFacade.getAssociatedClass()).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) OneToMany(org.hibernate.mapping.OneToMany) 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