Search in sources :

Example 46 with KeyValue

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

the class ValueFacadeTest method testGetKey.

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

Example 47 with KeyValue

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

the class PersistentClassFacadeTest method testGetIdentifier.

@Test
public void testGetIdentifier() throws Exception {
    KeyValue valueTarget = createValue();
    Field field = AbstractPersistentClassFacade.class.getDeclaredField("identifier");
    field.setAccessible(true);
    assertNull(field.get(persistentClassFacade));
    assertNull(persistentClassFacade.getIdentifier());
    assertNull(field.get(persistentClassFacade));
    ((RootClass) persistentClassTarget).setIdentifier(valueTarget);
    IValue valueFacade = persistentClassFacade.getIdentifier();
    assertNotNull(valueFacade);
    assertSame(valueFacade, field.get(persistentClassFacade));
    assertSame(valueTarget, ((IFacade) valueFacade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) Field(java.lang.reflect.Field) KeyValue(org.hibernate.mapping.KeyValue) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) Test(org.junit.jupiter.api.Test)

Example 48 with KeyValue

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

the class ValueFacadeTest method testGetKey.

@Test
public void testGetKey() {
    Map valueTarget = new Map(null, null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    assertNull(valueFacade.getKey());
    KeyValue keyValue = new SimpleValue(null);
    valueTarget.setKey(keyValue);
    assertSame(keyValue, ((IFacade) valueFacade.getKey()).getTarget());
}
Also used : KeyValue(org.hibernate.mapping.KeyValue) Map(org.hibernate.mapping.Map) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 49 with KeyValue

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

the class PersistentClassFacadeTest method testGetIdentifier.

@Test
public void testGetIdentifier() throws Exception {
    KeyValue valueTarget = createValue();
    Field field = AbstractPersistentClassFacade.class.getDeclaredField("identifier");
    field.setAccessible(true);
    assertNull(field.get(persistentClassFacade));
    assertNull(persistentClassFacade.getIdentifier());
    assertNull(field.get(persistentClassFacade));
    ((RootClass) persistentClassTarget).setIdentifier(valueTarget);
    IValue valueFacade = persistentClassFacade.getIdentifier();
    assertNotNull(valueFacade);
    assertSame(valueFacade, field.get(persistentClassFacade));
    assertSame(valueTarget, ((IFacade) valueFacade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) Field(java.lang.reflect.Field) KeyValue(org.hibernate.mapping.KeyValue) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) Test(org.junit.jupiter.api.Test)

Example 50 with KeyValue

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

the class PersistentClassFacadeTest method testGetIdentifier.

@Test
public void testGetIdentifier() throws Exception {
    KeyValue valueTarget = createValue();
    Field field = AbstractPersistentClassFacade.class.getDeclaredField("identifier");
    field.setAccessible(true);
    assertNull(field.get(persistentClassFacade));
    assertNull(persistentClassFacade.getIdentifier());
    assertNull(field.get(persistentClassFacade));
    ((RootClass) persistentClassTarget).setIdentifier(valueTarget);
    IValue valueFacade = persistentClassFacade.getIdentifier();
    assertNotNull(valueFacade);
    assertSame(valueFacade, field.get(persistentClassFacade));
    assertSame(valueTarget, ((IFacade) valueFacade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) Field(java.lang.reflect.Field) KeyValue(org.hibernate.mapping.KeyValue) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) Test(org.junit.jupiter.api.Test)

Aggregations

KeyValue (org.hibernate.mapping.KeyValue)53 Test (org.junit.jupiter.api.Test)44 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)35 SimpleValue (org.hibernate.mapping.SimpleValue)33 Collection (org.hibernate.mapping.Collection)13 Bag (org.hibernate.mapping.Bag)12 IdentifierBag (org.hibernate.mapping.IdentifierBag)12 Map (org.hibernate.mapping.Map)12 Table (org.hibernate.mapping.Table)12 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)12 Field (java.lang.reflect.Field)11 RootClass (org.hibernate.mapping.RootClass)11 Iterator (java.util.Iterator)3 BasicValue (org.hibernate.mapping.BasicValue)3 Test (org.junit.Test)3 JoinColumn (javax.persistence.JoinColumn)2 Ejb3JoinColumn (org.hibernate.cfg.Ejb3JoinColumn)2 Property (org.hibernate.mapping.Property)2 AbstractValueFacade (org.jboss.tools.hibernate.runtime.common.AbstractValueFacade)2 ArrayList (java.util.ArrayList)1