use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.
the class TableFacadeTest method testGetIdentifierValue.
@Test
public void testGetIdentifierValue() {
Table table = new Table();
ITable tableFacade = FACADE_FACTORY.createTable(table);
IValue valueFacade = tableFacade.getIdentifierValue();
Assert.assertNull(valueFacade);
KeyValue value = new SimpleValue(null);
table.setIdentifierValue(value);
valueFacade = tableFacade.getIdentifierValue();
Assert.assertSame(value, ((IFacade) valueFacade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.
the class TableFacadeTest method testGetPrimaryKey.
@Test
public void testGetPrimaryKey() {
PrimaryKey primaryKey = new PrimaryKey();
Table table = new Table();
ITable tableFacade = FACADE_FACTORY.createTable(table);
Assert.assertNull(tableFacade.getPrimaryKey());
table.setPrimaryKey(primaryKey);
IPrimaryKey primaryKeyFacade = tableFacade.getPrimaryKey();
Assert.assertSame(primaryKey, ((IFacade) primaryKeyFacade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateTable.
@Test
public void testCreateTable() {
Table table = new Table();
ITable facade = facadeFactory.createTable(table);
Assert.assertSame(table, ((IFacade) facade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.
the class ForeignKeyFacadeTest method testGetReferencedTable.
@Test
public void testGetReferencedTable() {
ITable first = foreignKeyFacade.getReferencedTable();
Assert.assertEquals("getReferencedTable", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
Assert.assertNull(first);
Table table = new Table();
foreignKey.setReferencedTable(table);
reset();
ITable second = foreignKeyFacade.getReferencedTable();
Assert.assertEquals("getReferencedTable", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
Assert.assertNotNull(second);
Assert.assertSame(table, ((IFacade) second).getTarget());
reset();
ITable third = foreignKeyFacade.getReferencedTable();
Assert.assertNull(methodName);
Assert.assertNull(arguments);
Assert.assertSame(second, third);
}
use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.
the class ForeignKeyFacadeTest method testGetReferencedTable.
@Test
public void testGetReferencedTable() {
ITable first = foreignKeyFacade.getReferencedTable();
Assert.assertEquals("getReferencedTable", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
Assert.assertNull(first);
Table table = new Table();
foreignKey.setReferencedTable(table);
reset();
ITable second = foreignKeyFacade.getReferencedTable();
Assert.assertEquals("getReferencedTable", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
Assert.assertNotNull(second);
Assert.assertSame(table, ((IFacade) second).getTarget());
reset();
ITable third = foreignKeyFacade.getReferencedTable();
Assert.assertNull(methodName);
Assert.assertNull(arguments);
Assert.assertSame(second, third);
}
Aggregations