Search in sources :

Example 1 with AbstractTableFacade

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

the class TableFacadeTest method testIsAbstract.

@Test
public void testIsAbstract() {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    table.setAbstract(true);
    assertTrue(tableFacade.isAbstract());
    table.setAbstract(false);
    assertFalse(tableFacade.isAbstract());
}
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 2 with AbstractTableFacade

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

the class TableFacadeTest method testGetComment.

@Test
public void testGetComment() {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    assertNull(tableFacade.getComment());
    table.setComment("foo");
    assertEquals("foo", tableFacade.getComment());
}
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 3 with AbstractTableFacade

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

the class TableFacadeTest method testGetIdentifierValue.

@Test
public void testGetIdentifierValue() {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    IValue valueFacade = tableFacade.getIdentifierValue();
    assertNull(valueFacade);
    KeyValue value = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
    table.setIdentifierValue(value);
    valueFacade = tableFacade.getIdentifierValue();
    assertSame(value, ((IFacade) valueFacade).getTarget());
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IValue(org.jboss.tools.hibernate.runtime.spi.IValue) KeyValue(org.hibernate.mapping.KeyValue) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) AbstractTableFacade(org.jboss.tools.hibernate.runtime.common.AbstractTableFacade) BasicValue(org.hibernate.mapping.BasicValue) Test(org.junit.jupiter.api.Test)

Example 4 with AbstractTableFacade

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

the class TableFacadeTest method testGetColumnIterator.

@Test
public void testGetColumnIterator() {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    Iterator<IColumn> columnIterator = tableFacade.getColumnIterator();
    assertFalse(columnIterator.hasNext());
    Column column = new Column("foo");
    table.addColumn(column);
    tableFacade = FACADE_FACTORY.createTable(table);
    columnIterator = tableFacade.getColumnIterator();
    IColumn columnFacade = columnIterator.next();
    assertSame(column, ((IFacade) columnFacade).getTarget());
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Column(org.hibernate.mapping.Column) 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 5 with AbstractTableFacade

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

the class TableFacadeTest method testGetName.

@Test
public void testGetName() {
    Table table = new Table();
    ITable tableFacade = new AbstractTableFacade(FACADE_FACTORY, table) {
    };
    assertNull(tableFacade.getName());
    table.setName("foo");
    assertEquals("foo", tableFacade.getName());
}
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)

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