Search in sources :

Example 56 with IType

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

the class ClassMetadataFacadeTest method testGetIdentifierType.

@Test
public void testGetIdentifierType() {
    IType identifierType = classMetadata.getIdentifierType();
    Assert.assertNotNull(identifierType);
    Assert.assertEquals("getIdentifierType", methodName);
    Assert.assertNull(arguments);
    methodName = null;
    Assert.assertSame(identifierType, classMetadata.getIdentifierType());
    Assert.assertNull(methodName);
    Assert.assertNull(arguments);
}
Also used : IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 57 with IType

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

the class QueryFacadeTest method testSetParameterList.

@Test
public void testSetParameterList() {
    Type typeProxy = (Type) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Type.class }, new TypeInvocationHandler());
    IType typeFacade = FACADE_FACTORY.createType(typeProxy);
    List<Object> dummyList = Collections.emptyList();
    query.setParameterList("foobar", dummyList, typeFacade);
    Assert.assertEquals("setParameterList", methodName);
    Assert.assertArrayEquals(new Object[] { "foobar", dummyList, typeProxy }, arguments);
}
Also used : IType(org.jboss.tools.hibernate.runtime.spi.IType) Type(org.hibernate.type.Type) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 58 with IType

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

the class QueryFacadeTest method testSetParameter.

@Test
public void testSetParameter() {
    Type typeProxy = (Type) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Type.class }, new TypeInvocationHandler());
    IType typeFacade = FACADE_FACTORY.createType(typeProxy);
    Object object = new Object();
    query.setParameter(Integer.MAX_VALUE, object, typeFacade);
    Assert.assertEquals("setParameter", methodName);
    Assert.assertArrayEquals(new Object[] { Integer.MAX_VALUE, object, typeProxy }, arguments);
    methodName = null;
    arguments = null;
    query.setParameter("foobar", object, typeFacade);
    Assert.assertEquals("setParameter", methodName);
    Assert.assertArrayEquals(new Object[] { "foobar", object, typeProxy }, arguments);
}
Also used : IType(org.jboss.tools.hibernate.runtime.spi.IType) Type(org.hibernate.type.Type) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 59 with IType

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

the class FacadeFactoryTest method testCreateType.

@Test
public void testCreateType() {
    Type type = (Type) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Type.class }, new TestInvocationHandler());
    IType facade = facadeFactory.createType(type);
    Assert.assertSame(type, ((IFacade) facade).getTarget());
}
Also used : IType(org.jboss.tools.hibernate.runtime.spi.IType) Type(org.hibernate.type.Type) PersistentClass(org.hibernate.mapping.PersistentClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 60 with IType

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

the class QueryFacadeTest method testSetParameter.

@Test
public void testSetParameter() {
    Type typeProxy = (Type) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Type.class }, new TypeInvocationHandler());
    IType typeFacade = FACADE_FACTORY.createType(typeProxy);
    Object object = new Object();
    query.setParameter(Integer.MAX_VALUE, object, typeFacade);
    Assert.assertEquals("setParameter", methodName);
    Assert.assertArrayEquals(new Object[] { Integer.MAX_VALUE, object, typeProxy }, arguments);
    methodName = null;
    arguments = null;
    query.setParameter("foobar", object, typeFacade);
    Assert.assertEquals("setParameter", methodName);
    Assert.assertArrayEquals(new Object[] { "foobar", object, typeProxy }, arguments);
}
Also used : IType(org.jboss.tools.hibernate.runtime.spi.IType) Type(org.hibernate.type.Type) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Aggregations

IType (org.jboss.tools.hibernate.runtime.spi.IType)372 Test (org.junit.Test)360 Type (org.hibernate.type.Type)208 ClassType (org.hibernate.type.ClassType)120 ArrayType (org.hibernate.type.ArrayType)56 EntityType (org.hibernate.type.EntityType)24 IntegerType (org.hibernate.type.IntegerType)24 ManyToOneType (org.hibernate.type.ManyToOneType)24 RootClass (org.hibernate.mapping.RootClass)16 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)12 Component (org.hibernate.mapping.Component)8 PersistentClass (org.hibernate.mapping.PersistentClass)8 SimpleValue (org.hibernate.mapping.SimpleValue)8 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)8 ComponentMetamodel (org.hibernate.tuple.component.ComponentMetamodel)8 AnyType (org.hibernate.type.AnyType)8 BagType (org.hibernate.type.BagType)8 ComponentType (org.hibernate.type.ComponentType)8 OneToOneType (org.hibernate.type.OneToOneType)8 StringType (org.hibernate.type.StringType)8