Search in sources :

Example 66 with IColumn

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

the class ValueFacadeTest method testGetColumnIterator.

@Test
public void testGetColumnIterator() {
    SimpleValue valueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    Iterator<IColumn> columnIterator = valueFacade.getColumnIterator();
    Assert.assertFalse(columnIterator.hasNext());
    Column columnTarget = new Column();
    valueTarget.addColumn(columnTarget);
    valueFacade = FACADE_FACTORY.createValue(valueTarget);
    columnIterator = valueFacade.getColumnIterator();
    Assert.assertTrue(columnIterator.hasNext());
    Assert.assertSame(columnTarget, ((IFacade) columnIterator.next()).getTarget());
}
Also used : IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Column(org.hibernate.mapping.Column) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 67 with IColumn

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

the class ValueFacadeTest method testAddColumn.

@Test
public void testAddColumn() {
    SimpleValue simpleValueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(simpleValueTarget);
    Iterator<?> columnIterator = simpleValueTarget.getColumnIterator();
    Assert.assertFalse(columnIterator.hasNext());
    Column columnTarget = new Column();
    IColumn columnFacade = FACADE_FACTORY.createColumn(columnTarget);
    valueFacade.addColumn(columnFacade);
    columnIterator = simpleValueTarget.getColumnIterator();
    Assert.assertTrue(columnIterator.hasNext());
    Assert.assertSame(columnTarget, columnIterator.next());
}
Also used : IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Column(org.hibernate.mapping.Column) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 68 with IColumn

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

the class ValueFacadeTest method testAddColumn.

@Test
public void testAddColumn() {
    SimpleValue simpleValueTarget = new SimpleValue(null);
    valueFacade = FACADE_FACTORY.createValue(simpleValueTarget);
    Iterator<?> columnIterator = simpleValueTarget.getColumnIterator();
    Assert.assertFalse(columnIterator.hasNext());
    Column columnTarget = new Column();
    IColumn columnFacade = FACADE_FACTORY.createColumn(columnTarget);
    valueFacade.addColumn(columnFacade);
    columnIterator = simpleValueTarget.getColumnIterator();
    Assert.assertTrue(columnIterator.hasNext());
    Assert.assertSame(columnTarget, columnIterator.next());
}
Also used : IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Column(org.hibernate.mapping.Column) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 69 with IColumn

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

the class ForeignKeyFacadeTest method testContainsColumn.

@Test
public void testContainsColumn() {
    Column column = new Column();
    IColumn columnFacade = FACADE_FACTORY.createColumn(column);
    Assert.assertFalse(foreignKeyFacade.containsColumn(columnFacade));
    Assert.assertEquals("containsColumn", methodName);
    Assert.assertArrayEquals(new Object[] { column }, arguments);
    foreignKey.addColumn(column);
    reset();
    Assert.assertTrue(foreignKeyFacade.containsColumn(columnFacade));
    Assert.assertEquals("containsColumn", methodName);
    Assert.assertArrayEquals(new Object[] { column }, arguments);
}
Also used : Column(org.hibernate.mapping.Column) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Test(org.junit.Test)

Example 70 with IColumn

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

the class FacadeFactoryTest method testCreateColumn.

@Test
public void testCreateColumn() {
    Column column = new Column();
    IColumn facade = facadeFactory.createColumn(column);
    Assert.assertSame(column, ((IFacade) facade).getTarget());
}
Also used : IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) Column(org.hibernate.mapping.Column) IColumn(org.jboss.tools.hibernate.runtime.spi.IColumn) 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