use of org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade in project jbosstools-hibernate by jbosstools.
the class ForeignKeyFacadeTest method testGetReferencedColumns.
@Test
public void testGetReferencedColumns() {
List<IColumn> list = foreignKeyFacade.getReferencedColumns();
Assert.assertTrue(list.isEmpty());
Assert.assertEquals("getReferencedColumns", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
// recreate facade to reinitialize the instance variables
foreignKeyFacade = new AbstractForeignKeyFacade(FACADE_FACTORY, foreignKey) {
};
Column column = new Column();
ArrayList<Column> columns = new ArrayList<Column>();
columns.add(column);
foreignKey.addReferencedColumns(columns.iterator());
reset();
list = foreignKeyFacade.getReferencedColumns();
Assert.assertFalse(list.isEmpty());
Assert.assertEquals("getReferencedColumns", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
}
use of org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade in project jbosstools-hibernate by jbosstools.
the class ForeignKeyFacadeTest method setUp.
@Before
public void setUp() throws Exception {
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(ForeignKey.class);
enhancer.setCallback(new MethodInterceptor() {
@Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
if (methodName == null) {
methodName = method.getName();
}
if (arguments == null) {
arguments = args;
}
return proxy.invokeSuper(obj, args);
}
});
foreignKey = (ForeignKey) enhancer.create();
foreignKeyFacade = new AbstractForeignKeyFacade(FACADE_FACTORY, foreignKey) {
};
reset();
}
use of org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade in project jbosstools-hibernate by jbosstools.
the class ForeignKeyFacadeTest method testGetReferencedColumns.
@Test
public void testGetReferencedColumns() {
List<IColumn> list = foreignKeyFacade.getReferencedColumns();
Assert.assertTrue(list.isEmpty());
Assert.assertEquals("getReferencedColumns", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
// recreate facade to reinitialize the instance variables
foreignKeyFacade = new AbstractForeignKeyFacade(FACADE_FACTORY, foreignKey) {
};
Column column = new Column();
ArrayList<Column> columns = new ArrayList<Column>();
columns.add(column);
foreignKey.addReferencedColumns(columns.iterator());
reset();
list = foreignKeyFacade.getReferencedColumns();
Assert.assertFalse(list.isEmpty());
Assert.assertEquals("getReferencedColumns", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
}
use of org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade in project jbosstools-hibernate by jbosstools.
the class ForeignKeyFacadeTest method setUp.
@Before
public void setUp() throws Exception {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setSuperclass(ForeignKey.class);
Class<?> proxyClass = proxyFactory.createClass();
foreignKey = (ForeignKey) proxyClass.newInstance();
((ProxyObject) foreignKey).setHandler(new MethodHandler() {
@Override
public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable {
if (methodName == null) {
methodName = m.getName();
}
if (arguments == null) {
arguments = args;
}
return proceed.invoke(self, args);
}
});
foreignKeyFacade = new AbstractForeignKeyFacade(FACADE_FACTORY, foreignKey) {
};
reset();
}
use of org.jboss.tools.hibernate.runtime.common.AbstractForeignKeyFacade in project jbosstools-hibernate by jbosstools.
the class ForeignKeyFacadeTest method testGetReferencedColumns.
@Test
public void testGetReferencedColumns() {
List<IColumn> list = foreignKeyFacade.getReferencedColumns();
Assert.assertTrue(list.isEmpty());
Assert.assertEquals("getReferencedColumns", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
// recreate facade to reinitialize the instance variables
foreignKeyFacade = new AbstractForeignKeyFacade(FACADE_FACTORY, foreignKey) {
};
Column column = new Column();
ArrayList<Column> columns = new ArrayList<Column>();
columns.add(column);
foreignKey.addReferencedColumns(columns.iterator());
reset();
list = foreignKeyFacade.getReferencedColumns();
Assert.assertFalse(list.isEmpty());
Assert.assertEquals("getReferencedColumns", methodName);
Assert.assertArrayEquals(new Object[] {}, arguments);
}
Aggregations