Search in sources :

Example 11 with OneToOne

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

the class ValueFacadeTest method testIsToOne.

@Test
public void testIsToOne() {
    valueTarget = new SimpleValue(DummyMetadataBuildingContext.INSTANCE, null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    assertFalse(valueFacade.isToOne());
    ToOne toOne = new OneToOne(DummyMetadataBuildingContext.INSTANCE, null, new RootClass(null));
    valueFacade = FACADE_FACTORY.createValue(toOne);
    assertTrue(valueFacade.isToOne());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) ToOne(org.hibernate.mapping.ToOne) ManyToOne(org.hibernate.mapping.ManyToOne) OneToOne(org.hibernate.mapping.OneToOne) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 12 with OneToOne

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

the class ValueFacadeTest method testIsToOne.

@Test
public void testIsToOne() {
    valueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    assertFalse(valueFacade.isToOne());
    ToOne toOne = new OneToOne(null, null, new RootClass(null));
    valueFacade = FACADE_FACTORY.createValue(toOne);
    assertTrue(valueFacade.isToOne());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) ToOne(org.hibernate.mapping.ToOne) ManyToOne(org.hibernate.mapping.ManyToOne) OneToOne(org.hibernate.mapping.OneToOne) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 13 with OneToOne

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

the class ValueFacadeTest method testGetEntityName.

@Test
public void testGetEntityName() {
    SimpleValue simpleValueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(simpleValueTarget);
    assertNull(valueFacade.getEntityName());
    RootClass pc = new RootClass(null);
    pc.setEntityName("foobar");
    OneToOne oneToOneTarget = new OneToOne(null, null, pc);
    valueFacade = FACADE_FACTORY.createValue(oneToOneTarget);
    assertEquals("foobar", valueFacade.getEntityName());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Example 14 with OneToOne

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

the class ServiceImplTest method testNewOneToOne.

@Test
public void testNewOneToOne() {
    IPersistentClass persistentClass = service.newRootClass();
    IValue oneToOne = service.newOneToOne(persistentClass);
    assertNotNull(oneToOne);
    Object target = ((IFacade) oneToOne).getTarget();
    assertNotNull(target);
    assertTrue(target instanceof OneToOne);
}
Also used : OneToOne(org.hibernate.mapping.OneToOne) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.jupiter.api.Test)

Example 15 with OneToOne

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

the class ValueFacadeTest method testIsToOne.

@Test
public void testIsToOne() {
    valueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    assertFalse(valueFacade.isToOne());
    ToOne toOne = new OneToOne(null, null, new RootClass(null));
    valueFacade = FACADE_FACTORY.createValue(toOne);
    assertTrue(valueFacade.isToOne());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) ToOne(org.hibernate.mapping.ToOne) ManyToOne(org.hibernate.mapping.ManyToOne) OneToOne(org.hibernate.mapping.OneToOne) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.jupiter.api.Test)

Aggregations

OneToOne (org.hibernate.mapping.OneToOne)54 Test (org.junit.jupiter.api.Test)44 RootClass (org.hibernate.mapping.RootClass)37 SimpleValue (org.hibernate.mapping.SimpleValue)37 ManyToOne (org.hibernate.mapping.ManyToOne)17 ToOne (org.hibernate.mapping.ToOne)12 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)11 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)11 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)11 Component (org.hibernate.mapping.Component)4 Test (org.junit.Test)4 AssertionFailure (org.hibernate.AssertionFailure)3 Any (org.hibernate.mapping.Any)3 BasicValue (org.hibernate.mapping.BasicValue)3 Property (org.hibernate.mapping.Property)3 AbstractValueFacade (org.jboss.tools.hibernate.runtime.common.AbstractValueFacade)3 AnnotationException (org.hibernate.AnnotationException)2 MappingException (org.hibernate.MappingException)2 AttributeSource (org.hibernate.boot.model.source.spi.AttributeSource)2 PluralAttributeElementSourceManyToAny (org.hibernate.boot.model.source.spi.PluralAttributeElementSourceManyToAny)2