Search in sources :

Example 31 with IPersistentClass

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

the class FacadeFactoryTest method testCreatePersistentClass.

@Test
public void testCreatePersistentClass() {
    PersistentClass persistentClass = new RootClass(null);
    IPersistentClass facade = facadeFactory.createPersistentClass(persistentClass);
    Assert.assertSame(persistentClass, ((IFacade) facade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Example 32 with IPersistentClass

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

the class FacadeFactoryTest method testCreateSpecialRootClass.

@Test
public void testCreateSpecialRootClass() {
    Property property = new Property();
    Mappings m = (Mappings) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { Mappings.class }, new TestInvocationHandler());
    property.setValue(new SimpleValue(m));
    IProperty propertyFacade = new AbstractPropertyFacade(facadeFactory, property) {
    };
    IPersistentClass specialRootClass = facadeFactory.createSpecialRootClass(propertyFacade);
    Assert.assertSame(property, ((IFacade) specialRootClass.getProperty()).getTarget());
}
Also used : Mappings(org.hibernate.cfg.Mappings) AbstractPropertyFacade(org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) POJOClass(org.hibernate.tool.hbm2x.pojo.POJOClass) IPOJOClass(org.jboss.tools.hibernate.runtime.spi.IPOJOClass) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) SimpleValue(org.hibernate.mapping.SimpleValue) Test(org.junit.Test)

Example 33 with IPersistentClass

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

the class FacadeFactoryTest method testCreatePersistentClass.

@Test
public void testCreatePersistentClass() {
    PersistentClass persistentClass = new RootClass();
    IPersistentClass facade = facadeFactory.createPersistentClass(persistentClass);
    Assert.assertSame(persistentClass, ((IFacade) facade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Example 34 with IPersistentClass

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

the class Cfg2HbmToolFacadeTest method testGetPersistentClassTag.

@Test
public void testGetPersistentClassTag() {
    PersistentClass target = new RootClass();
    IPersistentClass persistentClass = new AbstractPersistentClassFacade(FACADE_FACTORY, target) {
    };
    Assert.assertEquals("class", cfg2HbmToolFacade.getTag(persistentClass));
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractPersistentClassFacade(org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) Test(org.junit.Test)

Example 35 with IPersistentClass

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

the class ConfigurationFacadeTest method testGetClassMappings.

@Test
public void testGetClassMappings() {
    configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
    Iterator<IPersistentClass> iterator = configurationFacade.getClassMappings();
    Assert.assertFalse(iterator.hasNext());
    configuration.configure();
    configuration.buildMappings();
    configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
    iterator = configurationFacade.getClassMappings();
    IPersistentClass persistentClassFacade = iterator.next();
    Assert.assertEquals("org.jboss.tools.hibernate.runtime.v_4_0.internal.test.Foo", persistentClassFacade.getClassName());
}
Also used : IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Aggregations

IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)175 Test (org.junit.Test)97 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)60 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)51 RootClass (org.hibernate.mapping.RootClass)47 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)46 PersistentClass (org.hibernate.mapping.PersistentClass)43 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)19 AbstractPersistentClassFacade (org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade)16 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)16 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)14 OneToMany (org.hibernate.mapping.OneToMany)12 HashMap (java.util.HashMap)8 Iterator (java.util.Iterator)8 JoinedSubclass (org.hibernate.mapping.JoinedSubclass)8 PrimitiveArray (org.hibernate.mapping.PrimitiveArray)8 Property (org.hibernate.mapping.Property)8 SingleTableSubclass (org.hibernate.mapping.SingleTableSubclass)8 IEditorPart (org.eclipse.ui.IEditorPart)7 PartInitException (org.eclipse.ui.PartInitException)7