Search in sources :

Example 61 with ClassType

use of org.hibernate.type.ClassType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testIsInstanceOfPrimitiveType.

@Test
public void testIsInstanceOfPrimitiveType() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertFalse(typeFacade.isInstanceOfPrimitiveType());
    StringType stringType = new StringType();
    typeFacade = FACADE_FACTORY.createType(stringType);
    Assert.assertFalse(typeFacade.isInstanceOfPrimitiveType());
    IntegerType integerType = new IntegerType();
    typeFacade = FACADE_FACTORY.createType(integerType);
    Assert.assertTrue(typeFacade.isInstanceOfPrimitiveType());
}
Also used : IntegerType(org.hibernate.type.IntegerType) StringType(org.hibernate.type.StringType) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.Test)

Example 62 with ClassType

use of org.hibernate.type.ClassType 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());
    MetadataBuildingOptions mdbo = new MetadataBuilderImpl.MetadataBuildingOptionsImpl(new StandardServiceRegistryBuilder().build());
    MetadataImplementor mdi = (MetadataImplementor) new MetadataBuilderImpl(new MetadataSources()).build();
    ComponentType componentType = new ComponentType(null, new ComponentMetamodel(new Component(mdi, new RootClass(null)), mdbo));
    typeFacade = FACADE_FACTORY.createType(componentType);
    Assert.assertTrue(typeFacade.isComponentType());
}
Also used : RootClass(org.hibernate.mapping.RootClass) ComponentType(org.hibernate.type.ComponentType) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) ComponentMetamodel(org.hibernate.tuple.component.ComponentMetamodel) MetadataSources(org.hibernate.boot.MetadataSources) MetadataImplementor(org.hibernate.boot.spi.MetadataImplementor) ClassType(org.hibernate.type.ClassType) Component(org.hibernate.mapping.Component) MetadataBuilderImpl(org.hibernate.boot.internal.MetadataBuilderImpl) IType(org.jboss.tools.hibernate.runtime.spi.IType) MetadataBuildingOptions(org.hibernate.boot.spi.MetadataBuildingOptions) Test(org.junit.Test)

Example 63 with ClassType

use of org.hibernate.type.ClassType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testFromStringValue.

@Test
public void testFromStringValue() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertEquals(TypeFacadeTest.class, typeFacade.fromStringValue(TypeFacadeTest.class.getName()));
    ArrayType arrayType = new ArrayType(null, "foo", "bar", String.class);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertNull(typeFacade.fromStringValue("just a random string"));
}
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 64 with ClassType

use of org.hibernate.type.ClassType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testGetRole.

@Test
public void testGetRole() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertNull(typeFacade.getRole());
    ArrayType arrayType = new ArrayType(null, "foo", null, String.class);
    typeFacade = FACADE_FACTORY.createType(arrayType);
    Assert.assertEquals("foo", typeFacade.getRole());
}
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 65 with ClassType

use of org.hibernate.type.ClassType in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testGetAssociatedEntityName.

@Test
public void testGetAssociatedEntityName() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    Assert.assertNull(typeFacade.getAssociatedEntityName());
    EntityType entityType = new ManyToOneType(null, "foo");
    typeFacade = FACADE_FACTORY.createType(entityType);
    Assert.assertEquals("foo", typeFacade.getAssociatedEntityName());
}
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) Test(org.junit.Test)

Aggregations

ClassType (org.hibernate.type.ClassType)120 IType (org.jboss.tools.hibernate.runtime.spi.IType)120 Test (org.junit.Test)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 Component (org.hibernate.mapping.Component)8 RootClass (org.hibernate.mapping.RootClass)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 MetadataSources (org.hibernate.boot.MetadataSources)4 MetadataBuilderImpl (org.hibernate.boot.internal.MetadataBuilderImpl)4 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)4 MetadataBuildingOptions (org.hibernate.boot.spi.MetadataBuildingOptions)4 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)4