Search in sources :

Example 21 with IColumn

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

the class TableFacadeTest method testGetColumnIterator.

@Test
public void testGetColumnIterator() {
    Table table = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(table);
    Iterator<IColumn> columnIterator = tableFacade.getColumnIterator();
    Assert.assertFalse(columnIterator.hasNext());
    Column column = new Column("foo");
    table.addColumn(column);
    tableFacade = FACADE_FACTORY.createTable(table);
    columnIterator = tableFacade.getColumnIterator();
    IColumn columnFacade = columnIterator.next();
    Assert.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) Test(org.junit.Test)

Example 22 with IColumn

use of org.jboss.tools.hibernate.runtime.spi.IColumn 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 23 with IColumn

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

the class ServiceImplTest method testNewColumn.

@Test
public void testNewColumn() {
    IColumn column = service.newColumn("foo");
    Assert.assertNotNull(column);
    Object target = ((IFacade) column).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof Column);
    Assert.assertEquals("foo", ((Column) target).getName());
}
Also used : IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Column(org.hibernate.mapping.Column) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) Test(org.junit.Test)

Example 24 with IColumn

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

the class TableFacadeTest method testGetColumnIterator.

@Test
public void testGetColumnIterator() {
    Table table = new Table();
    ITable tableFacade = FACADE_FACTORY.createTable(table);
    Iterator<IColumn> columnIterator = tableFacade.getColumnIterator();
    Assert.assertFalse(columnIterator.hasNext());
    Column column = new Column("foo");
    table.addColumn(column);
    tableFacade = FACADE_FACTORY.createTable(table);
    columnIterator = tableFacade.getColumnIterator();
    IColumn columnFacade = columnIterator.next();
    Assert.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) Test(org.junit.Test)

Example 25 with IColumn

use of org.jboss.tools.hibernate.runtime.spi.IColumn 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)

Aggregations

IColumn (org.jboss.tools.hibernate.runtime.spi.IColumn)86 Test (org.junit.Test)69 Column (org.hibernate.mapping.Column)68 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)26 SimpleValue (org.hibernate.mapping.SimpleValue)16 Table (org.hibernate.mapping.Table)16 ArrayList (java.util.ArrayList)12 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)9 AbstractForeignKeyFacade (org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade)7 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)7 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)7 Iterator (java.util.Iterator)5 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)4 IPrimaryKey (org.jboss.tools.hibernate.runtime.spi.IPrimaryKey)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)3 Shape (org.jboss.tools.hibernate.ui.diagram.editors.model.Shape)3 FileNotFoundException (java.io.FileNotFoundException)2 HashMap (java.util.HashMap)2 List (java.util.List)2