Search in sources :

Example 16 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 17 with OneToOne

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

the class ValueFacadeTest method testIsOneToOne.

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

Example 18 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 BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, simpleValueTarget) {
    };
    assertNull(valueFacade.getEntityName());
    RootClass pc = new RootClass(DummyMetadataBuildingContext.INSTANCE);
    pc.setEntityName("foobar");
    OneToOne oneToOneTarget = new OneToOne(DummyMetadataBuildingContext.INSTANCE, null, pc);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, oneToOneTarget) {
    };
    assertEquals("foobar", valueFacade.getEntityName());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) SimpleValue(org.hibernate.mapping.SimpleValue) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 19 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 BasicValue(DummyMetadataBuildingContext.INSTANCE);
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
    };
    assertFalse(valueFacade.isToOne());
    ToOne toOne = new OneToOne(DummyMetadataBuildingContext.INSTANCE, null, new RootClass(DummyMetadataBuildingContext.INSTANCE));
    valueFacade = new AbstractValueFacade(FACADE_FACTORY, toOne) {
    };
    assertTrue(valueFacade.isToOne());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToOne(org.hibernate.mapping.OneToOne) AbstractValueFacade(org.jboss.tools.hibernate.runtime.common.AbstractValueFacade) ToOne(org.hibernate.mapping.ToOne) ManyToOne(org.hibernate.mapping.ManyToOne) OneToOne(org.hibernate.mapping.OneToOne) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 20 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)

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