Search in sources :

Example 31 with ITable

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());
}
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) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 32 with ITable

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());
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IPrimaryKey(org.jboss.tools.hibernate.runtime.spi.IPrimaryKey) PrimaryKey(org.hibernate.mapping.PrimaryKey) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) IPrimaryKey(org.jboss.tools.hibernate.runtime.spi.IPrimaryKey) Test(org.junit.Test)

Example 33 with ITable

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());
}
Also used : ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Test(org.junit.Test)

Example 34 with ITable

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);
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Test(org.junit.Test)

Example 35 with ITable

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);
}
Also used : Table(org.hibernate.mapping.Table) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) 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