Search in sources :

Example 36 with BasicValue

use of org.hibernate.mapping.BasicValue 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 37 with BasicValue

use of org.hibernate.mapping.BasicValue 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 38 with BasicValue

use of org.hibernate.mapping.BasicValue 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 39 with BasicValue

use of org.hibernate.mapping.BasicValue 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)

Example 40 with BasicValue

use of org.hibernate.mapping.BasicValue in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testIsOneToMany.

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

Aggregations

BasicValue (org.hibernate.mapping.BasicValue)40 Test (org.junit.jupiter.api.Test)39 AbstractValueFacade (org.jboss.tools.hibernate.runtime.common.AbstractValueFacade)36 SimpleValue (org.hibernate.mapping.SimpleValue)22 RootClass (org.hibernate.mapping.RootClass)7 Table (org.hibernate.mapping.Table)6 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)6 IdentifierBag (org.hibernate.mapping.IdentifierBag)5 Set (org.hibernate.mapping.Set)5 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)5 Bag (org.hibernate.mapping.Bag)4 Column (org.hibernate.mapping.Column)3 KeyValue (org.hibernate.mapping.KeyValue)3 List (org.hibernate.mapping.List)3 ManyToOne (org.hibernate.mapping.ManyToOne)3 OneToOne (org.hibernate.mapping.OneToOne)3 Collection (org.hibernate.mapping.Collection)2 Component (org.hibernate.mapping.Component)2 Map (org.hibernate.mapping.Map)2 PrimitiveArray (org.hibernate.mapping.PrimitiveArray)2