use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class PersistentClassFacadeTest method testIsRootClass.
@Test
public void testIsRootClass() {
persistentClassTarget = new SingleTableSubclass(new RootClass(null), null);
persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, persistentClassTarget);
assertFalse(persistentClassFacade.isRootClass());
persistentClassTarget = new RootClass(null);
persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, persistentClassTarget);
assertTrue(persistentClassFacade.isRootClass());
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class PersistentClassFacadeTest method testGetJoinIterator.
@Test
public void testGetJoinIterator() throws Exception {
Join join = new Join();
Field field = AbstractPersistentClassFacade.class.getDeclaredField("joins");
field.setAccessible(true);
assertNull(field.get(persistentClassFacade));
Iterator<IJoin> joinIterator = persistentClassFacade.getJoinIterator();
assertNotNull(field.get(persistentClassFacade));
assertTrue(((HashSet<?>) field.get(persistentClassFacade)).isEmpty());
assertFalse(joinIterator.hasNext());
field.set(persistentClassFacade, null);
((RootClass) persistentClassTarget).addJoin(join);
joinIterator = persistentClassFacade.getJoinIterator();
assertTrue(joinIterator.hasNext());
assertSame(join, ((IFacade) joinIterator.next()).getTarget());
assertFalse(joinIterator.hasNext());
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class PersistentClassFacadeTest method testGetRootTable.
@Test
public void testGetRootTable() throws Exception {
Field field = AbstractPersistentClassFacade.class.getDeclaredField("rootTable");
field.setAccessible(true);
assertNull(field.get(persistentClassFacade));
Table tableTarget = new Table();
((RootClass) persistentClassTarget).setTable(tableTarget);
ITable tableFacade = persistentClassFacade.getRootTable();
assertSame(tableTarget, ((IFacade) tableFacade).getTarget());
assertSame(tableFacade, field.get(persistentClassFacade));
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class PersistentClassFacadeTest method beforeEach.
@BeforeEach
public void beforeEach() {
persistentClassTarget = new RootClass(null);
persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, persistentClassTarget);
}
use of org.hibernate.mapping.RootClass in project jbosstools-hibernate by jbosstools.
the class PersistentClassFacadeTest method testGetDiscriminator.
@Test
public void testGetDiscriminator() throws Exception {
Value valueTarget = createValue();
Field field = AbstractPersistentClassFacade.class.getDeclaredField("discriminator");
field.setAccessible(true);
assertNull(field.get(persistentClassFacade));
assertNull(persistentClassFacade.getDiscriminator());
assertNull(field.get(persistentClassFacade));
((RootClass) persistentClassTarget).setDiscriminator(valueTarget);
IValue valueFacade = persistentClassFacade.getDiscriminator();
assertNotNull(valueFacade);
assertSame(valueFacade, field.get(persistentClassFacade));
assertSame(valueTarget, ((IFacade) valueFacade).getTarget());
}
Aggregations