Search in sources :

Example 11 with IType

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

the class TypeFacadeTest method testGetName.

@Test
public void testGetName() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertEquals("class", typeFacade.getName());
    ArrayType arrayType = new ArrayType("foo", "bar", String.class, false);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertEquals("[Ljava.lang.String;(foo)", typeFacade.getName());
}
Also used : ArrayType(org.hibernate.type.ArrayType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 12 with IType

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

the class TypeFacadeTest method testGetPrimitiveClass.

@Test
public void testGetPrimitiveClass() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertNull(typeFacade.getPrimitiveClass());
    IntegerType integerType = new IntegerType();
    typeFacade = FACADE_FACTORY.createType(integerType);
    Assert.assertEquals(int.class, typeFacade.getPrimitiveClass());
}
Also used : IntegerType(org.hibernate.type.IntegerType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 13 with IType

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

the class TypeFacadeTest method testIsComponentType.

@Test
public void testIsComponentType() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertFalse(typeFacade.isComponentType());
    ComponentType componentType = new ComponentType(new ComponentMetamodel(new Component(new RootClass())));
    typeFacade = FACADE_FACTORY.createType(componentType);
    Assert.assertTrue(typeFacade.isComponentType());
}
Also used : RootClass(org.hibernate.mapping.RootClass) ComponentType(org.hibernate.type.ComponentType) ComponentMetamodel(org.hibernate.tuple.component.ComponentMetamodel) ClassType(org.hibernate.type.ClassType) Component(org.hibernate.mapping.Component) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 14 with IType

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

the class TypeFacadeTest method testGetReturnedClass.

@Test
public void testGetReturnedClass() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertEquals(Class.class, typeFacade.getReturnedClass());
    ArrayType arrayType = new ArrayType(null, null, String.class, false);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertEquals(String[].class, typeFacade.getReturnedClass());
}
Also used : ArrayType(org.hibernate.type.ArrayType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 15 with IType

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

the class TypeFacadeTest method testIsOneToOne.

@Test
public void testIsOneToOne() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertFalse(typeFacade.isOneToOne());
    EntityType entityType = new ManyToOneType(null);
    typeFacade = FACADE_FACTORY.createType(entityType);
    Assert.assertFalse(entityType.isOneToOne());
    OneToOneType oneToOneType = new OneToOneType(null, null, null, false, false, false, null, null);
    typeFacade = FACADE_FACTORY.createType(oneToOneType);
    Assert.assertTrue(oneToOneType.isOneToOne());
}
Also used : EntityType(org.hibernate.type.EntityType) ManyToOneType(org.hibernate.type.ManyToOneType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) OneToOneType(org.hibernate.type.OneToOneType) 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