Search in sources :

Example 11 with AbstractTableFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractTableFacade in project jbosstools-hibernate by jbosstools.

the class TableFacadeTest method testIsPhysicalTable.

@Test
public void testIsPhysicalTable() {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    table.setSubselect("foo");
    assertFalse(tableFacade.isPhysicalTable());
    table.setSubselect(null);
    assertTrue(tableFacade.isPhysicalTable());
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) AbstractTableFacade(org.jboss.tools.hibernate.runtime.common.AbstractTableFacade) Test(org.junit.jupiter.api.Test)

Example 12 with AbstractTableFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractTableFacade in project jbosstools-hibernate by jbosstools.

the class TableFacadeTest method testAddColumn.

@Test
public void testAddColumn() {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    Column column = new Column("foo");
    IColumn columnFacade = FACADE_FACTORY.createColumn(column);
    assertNull(table.getColumn(column));
    tableFacade.addColumn(columnFacade);
    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) AbstractTableFacade(org.jboss.tools.hibernate.runtime.common.AbstractTableFacade) Test(org.junit.jupiter.api.Test)

Example 13 with AbstractTableFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractTableFacade in project jbosstools-hibernate by jbosstools.

the class TableFacadeTest method testGetCatalog.

@Test
public void testGetCatalog() {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    assertNull(tableFacade.getCatalog());
    table.setCatalog("foo");
    assertEquals("foo", tableFacade.getCatalog());
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) AbstractTableFacade(org.jboss.tools.hibernate.runtime.common.AbstractTableFacade) Test(org.junit.jupiter.api.Test)

Example 14 with AbstractTableFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractTableFacade in project jbosstools-hibernate by jbosstools.

the class TableFacadeTest method testIsAbstractUnionTable.

@Test
public void testIsAbstractUnionTable() throws Exception {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    table.setAbstract(false);
    assertFalse(tableFacade.isAbstractUnionTable());
    table.setAbstract(true);
    assertFalse(tableFacade.isAbstractUnionTable());
    Method method = Table.class.getDeclaredMethod("setHasDenormalizedTables", new Class[] {});
    method.setAccessible(true);
    method.invoke(table, new Object[] {});
    assertTrue(tableFacade.isAbstractUnionTable());
}
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) AbstractTableFacade(org.jboss.tools.hibernate.runtime.common.AbstractTableFacade) Test(org.junit.jupiter.api.Test)

Aggregations

Table (org.hibernate.mapping.Table)14 AbstractTableFacade (org.jboss.tools.hibernate.runtime.common.AbstractTableFacade)14 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)14 Test (org.junit.jupiter.api.Test)14 Method (java.lang.reflect.Method)2 Column (org.hibernate.mapping.Column)2 IColumn (org.jboss.tools.hibernate.runtime.spi.IColumn)2 BasicValue (org.hibernate.mapping.BasicValue)1 KeyValue (org.hibernate.mapping.KeyValue)1 PrimaryKey (org.hibernate.mapping.PrimaryKey)1 IPrimaryKey (org.jboss.tools.hibernate.runtime.spi.IPrimaryKey)1 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)1