Search in sources :

Example 61 with IProperty

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

the class ValueFacadeTest method testGetPropertyIterator.

@Test
public void testGetPropertyIterator() {
    Component componentTarget = new Component(new RootClass());
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    Iterator<IProperty> iter = valueFacade.getPropertyIterator();
    Assert.assertFalse(iter.hasNext());
    Property propertyTarget = new Property();
    componentTarget.addProperty(propertyTarget);
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    iter = valueFacade.getPropertyIterator();
    Assert.assertTrue(iter.hasNext());
    IProperty propertyFacade = iter.next();
    Assert.assertSame(propertyTarget, ((IFacade) propertyFacade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Component(org.hibernate.mapping.Component) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Test(org.junit.Test)

Example 62 with IProperty

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

the class Cfg2HbmToolFacadeTest method testGetPropertyTag.

public void testGetPropertyTag() throws Exception {
    RootClass rc = new RootClass();
    Property p = new Property();
    Mappings m = (Mappings) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Mappings.class }, new TestInvocationHandler());
    SimpleValue sv = new SimpleValue(m);
    sv.setTypeName("foobar");
    p.setValue(sv);
    p.setPersistentClass(rc);
    rc.setVersion(p);
    IProperty property = new AbstractPropertyFacade(FACADE_FACTORY, p) {
    };
    Assert.assertEquals("version", cfg2HbmToolFacade.getTag(property));
}
Also used : RootClass(org.hibernate.mapping.RootClass) Mappings(org.hibernate.cfg.Mappings) AbstractPropertyFacade(org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) SimpleValue(org.hibernate.mapping.SimpleValue)

Example 63 with IProperty

use of org.jboss.tools.hibernate.runtime.spi.IProperty 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 64 with IProperty

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

the class FacadeFactoryTest method testCreateProperty.

@Test
public void testCreateProperty() {
    Property property = new Property();
    IProperty facade = facadeFactory.createProperty(property);
    Assert.assertSame(property, ((IFacade) facade).getTarget());
}
Also used : IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Test(org.junit.Test)

Example 65 with IProperty

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

the class FacadeFactoryTest method testCreateProperty.

@Test
public void testCreateProperty() {
    Property property = new Property();
    IProperty facade = facadeFactory.createProperty(property);
    Assert.assertSame(property, ((IFacade) facade).getTarget());
}
Also used : IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Test(org.junit.Test)

Aggregations

IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)93 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)53 Property (org.hibernate.mapping.Property)40 Test (org.junit.Test)33 RootClass (org.hibernate.mapping.RootClass)27 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)20 PersistentClass (org.hibernate.mapping.PersistentClass)18 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)12 SimpleValue (org.hibernate.mapping.SimpleValue)12 AbstractPropertyFacade (org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade)12 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)12 FileNotFoundException (java.io.FileNotFoundException)9 IColumn (org.jboss.tools.hibernate.runtime.spi.IColumn)9 Component (org.hibernate.mapping.Component)8 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)8 IEditorPart (org.eclipse.ui.IEditorPart)7 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)7 JavaModelException (org.eclipse.jdt.core.JavaModelException)6 Mappings (org.hibernate.cfg.Mappings)6 PartInitException (org.eclipse.ui.PartInitException)5