Search in sources :

Example 11 with AbstractValueFacade

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

the class ValueFacadeTest method testSetElementClassName.

@Test
public void testSetElementClassName() {
    Array arrayTarget = new Array(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, arrayTarget) {
    };
    assertNull(arrayTarget.getElementClassName());
    valueFacade.setElementClassName("foobar");
    assertEquals("foobar", arrayTarget.getElementClassName());
}
Also used : Array(org.hibernate.mapping.Array) PrimitiveArray(org.hibernate.mapping.PrimitiveArray) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Test(org.junit.jupiter.api.Test)

Example 12 with AbstractValueFacade

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

the class ValueFacadeTest method testGetTypeParameters.

@Test
public void testGetTypeParameters() {
    SimpleValue simpleValueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    assertNull(simpleValueTarget.getTypeParameters());
    Properties properties = new Properties();
    valueFacade.setTypeParameters(properties);
    assertSame(properties, simpleValueTarget.getTypeParameters());
}
Also used : AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Properties(java.util.Properties) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 13 with AbstractValueFacade

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

the class ValueFacadeTest method testGetReferencedEntityName.

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

Example 14 with AbstractValueFacade

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

the class ValueFacadeTest method testGetColumnIterator.

@Test
public void testGetColumnIterator() {
    SimpleValue valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueTarget.setTable(new Table());
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    Iterator<IColumn> columnIterator = valueFacade.getColumnIterator();
    assertFalse(columnIterator.hasNext());
    Column columnTarget = new Column();
    valueTarget.addColumn(columnTarget);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    columnIterator = valueFacade.getColumnIterator();
    assertTrue(columnIterator.hasNext());
    assertSame(columnTarget, ((IFacade) columnIterator.next()).getTarget());
}
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) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Column(org.hibernate.mapping.Column) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 15 with AbstractValueFacade

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

the class ValueFacadeTest method testIsEmbedded.

@Test
public void testIsEmbedded() {
    valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertNull(valueFacade.isEmbedded());
    Component component = new Component(DummyMetadataBuildingContext.INSTANCE, new RootClass(DummyMetadataBuildingContext.INSTANCE));
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, component) {
    };
    component.setEmbedded(true);
    assertTrue(valueFacade.isEmbedded());
    component.setEmbedded(false);
    assertFalse(valueFacade.isEmbedded());
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) Component(org.hibernate.mapping.Component) 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