use of org.hibernate.mapping.ManyToOne 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());
}
use of org.hibernate.mapping.ManyToOne in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetReferencedEntityName.
@Test
public void testSetReferencedEntityName() {
ManyToOne valueTarget = new ManyToOne(DummyMetadataBuildingContext.INSTANCE, null);
valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
};
assertNull(valueTarget.getReferencedEntityName());
valueFacade.setReferencedEntityName("Foo");
assertEquals("Foo", valueTarget.getReferencedEntityName());
}
use of org.hibernate.mapping.ManyToOne 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());
}
use of org.hibernate.mapping.ManyToOne in project jbosstools-hibernate by jbosstools.
the class ServiceImplTest method testNewManyToOne.
@Test
public void testNewManyToOne() {
ITable table = service.newTable("foo");
IValue manyToOne = service.newManyToOne(table);
assertNotNull(manyToOne);
Object target = ((IFacade) manyToOne).getTarget();
assertNotNull(target);
assertTrue(target instanceof ManyToOne);
}
use of org.hibernate.mapping.ManyToOne in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetReferencedEntityName.
@Test
public void testSetReferencedEntityName() {
ManyToOne valueTarget = new ManyToOne(null, null);
valueFacade = FACADE_FACTORY.createValue(valueTarget);
assertNull(valueTarget.getReferencedEntityName());
valueFacade.setReferencedEntityName("Foo");
assertEquals("Foo", valueTarget.getReferencedEntityName());
}
Aggregations