Search in sources :

Example 26 with ITable

use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.

the class TableFacadeTest method testAddColumn.

@Test
public void testAddColumn() {
    Table table = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(table);
    Column column = new Column("foo");
    IColumn columnFacade = FACADE_FACTORY.createColumn(column);
    Assert.assertNull(table.getColumn(column));
    tableFacade.addColumn(columnFacade);
    Assert.assertSame(column, table.getColumn(column));
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Column(org.hibernate.mapping.Column) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Test(org.junit.Test)

Example 27 with ITable

use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.

the class TableFacadeTest method testHasDenormalizedTables.

@Test
public void testHasDenormalizedTables() throws Exception {
    Table table = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(table);
    Assert.assertFalse(tableFacade.hasDenormalizedTables());
    Method method = Table.class.getDeclaredMethod("setHasDenormalizedTables", new Class[] {});
    method.setAccessible(true);
    method.invoke(table, new Object[] {});
    Assert.assertTrue(tableFacade.hasDenormalizedTables());
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 28 with ITable

use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testSetCollectionTable.

@Test
public void testSetCollectionTable() {
    Table tableTarget = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(tableTarget);
    Collection valueTarget = new Set(null, null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    Assert.assertNull(valueTarget.getCollectionTable());
    valueFacade.setCollectionTable(tableFacade);
    Assert.assertSame(tableTarget, valueTarget.getCollectionTable());
}
Also used : ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) Set(org.hibernate.mapping.Set) Collection(org.hibernate.mapping.Collection) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Test(org.junit.Test)

Example 29 with ITable

use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testGetTable.

@Test
public void testGetTable() {
    Table tableTarget = new Table();
    valueTarget = new SimpleValue(null, tableTarget);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    ITable tableFacade = valueFacade.getTable();
    Assert.assertSame(tableTarget, ((IFacade) tableFacade).getTarget());
}
Also used : ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 30 with ITable

use of org.jboss.tools.hibernate.runtime.spi.ITable in project jbosstools-hibernate by jbosstools.

the class ValueFacadeTest method testSetCollectionTable.

@Test
public void testSetCollectionTable() {
    Table tableTarget = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(tableTarget);
    Collection valueTarget = new Set(null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    Assert.assertNull(valueTarget.getCollectionTable());
    valueFacade.setCollectionTable(tableFacade);
    Assert.assertSame(tableTarget, valueTarget.getCollectionTable());
}
Also used : ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) Set(org.hibernate.mapping.Set) Collection(org.hibernate.mapping.Collection) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Test(org.junit.Test)

Aggregations

ITable (org.jboss.tools.hibernate.runtime.spi.ITable)209 Table (org.hibernate.mapping.Table)180 Test (org.junit.Test)173 IColumn (org.jboss.tools.hibernate.runtime.spi.IColumn)26 SimpleValue (org.hibernate.mapping.SimpleValue)24 Method (java.lang.reflect.Method)17 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)17 Column (org.hibernate.mapping.Column)16 PrimaryKey (org.hibernate.mapping.PrimaryKey)16 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)14 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)12 IPrimaryKey (org.jboss.tools.hibernate.runtime.spi.IPrimaryKey)11 Connection (java.sql.Connection)8 Statement (java.sql.Statement)8 Collection (org.hibernate.mapping.Collection)8 KeyValue (org.hibernate.mapping.KeyValue)8 Set (org.hibernate.mapping.Set)8 ArrayList (java.util.ArrayList)7 JDBCMetaDataConfiguration (org.hibernate.cfg.JDBCMetaDataConfiguration)7 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)7