use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeTest method testAddClass.
@Test
public void testAddClass() {
PersistentClass persistentClass = new RootClass(DummyMetadataBuildingContext.INSTANCE);
persistentClass.setEntityName("Foo");
IPersistentClass persistentClassFacade = FACADE_FACTORY.createPersistentClass(persistentClass);
assertFalse(((ConfigurationFacadeImpl) configurationFacade).addedClasses.contains(persistentClassFacade));
configurationFacade.addClass(persistentClassFacade);
assertTrue(((ConfigurationFacadeImpl) configurationFacade).addedClasses.contains(persistentClassFacade));
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeTest method testGetClassMapping.
@Test
public void testGetClassMapping() {
PersistentClass persistentClass = new RootClass(DummyMetadataBuildingContext.INSTANCE);
persistentClass.setEntityName("Foo");
IPersistentClass persistentClassFacade = FACADE_FACTORY.createPersistentClass(persistentClass);
configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
assertNull(configurationFacade.getClassMapping("Foo"));
configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
((ConfigurationFacadeImpl) configurationFacade).addedClasses.add(persistentClassFacade);
assertSame(configurationFacade.getClassMapping("Foo"), persistentClassFacade);
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateSpecialRootClass.
@Test
public void testCreateSpecialRootClass() {
Property target = new Property();
PersistentClass pc = new RootClass(DummyMetadataBuildingContext.INSTANCE);
target.setPersistentClass(pc);
IProperty property = facadeFactory.createProperty(target);
IPersistentClass specialRootClass = facadeFactory.createSpecialRootClass(property);
assertNotNull(specialRootClass);
Object object = ((IFacade) specialRootClass).getTarget();
assertTrue(specialRootClass instanceof SpecialRootClassFacadeImpl);
assertTrue(object instanceof RootClass);
assertSame(property, specialRootClass.getProperty());
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testGetOwner.
@Test
public void testGetOwner() {
RootClass rc = new RootClass(null);
Component componentTarget = new Component(DummyMetadataBuildingContext.INSTANCE, rc);
valueFacade = FACADE_FACTORY.createValue(componentTarget);
assertSame(rc, ((IFacade) valueFacade.getOwner()).getTarget());
}
use of org.hibernate.mapping.RootClass 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());
}
Aggregations