Search in sources :

Example 1 with AbstractArtifactCollectorFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method testSetArtifactCollector.

@Test
public void testSetArtifactCollector() {
    ArtifactCollector ac = new ArtifactCollector();
    IArtifactCollector artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, ac) {
    };
    exporterFacade.setArtifactCollector(artifactCollector);
    Assert.assertEquals("setArtifactCollector", methodName);
    Assert.assertArrayEquals(new Object[] { ac }, arguments);
}
Also used : AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) Test(org.junit.Test)

Example 2 with AbstractArtifactCollectorFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method testSetArtifactCollector.

@Test
public void testSetArtifactCollector() {
    ArtifactCollector ac = new ArtifactCollector();
    IArtifactCollector artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, ac) {
    };
    exporterFacade.setArtifactCollector(artifactCollector);
    Assert.assertEquals("setArtifactCollector", methodName);
    Assert.assertArrayEquals(new Object[] { ac }, arguments);
}
Also used : AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) Test(org.junit.Test)

Example 3 with AbstractArtifactCollectorFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade in project jbosstools-hibernate by jbosstools.

the class ArtifactCollectorFacadeTest method setUp.

@Before
public void setUp() {
    Enhancer enhancer = new Enhancer();
    enhancer.setSuperclass(ArtifactCollector.class);
    enhancer.setCallback(new MethodInterceptor() {

        @Override
        public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
            if (methodName == null) {
                methodName = method.getName();
            }
            if (arguments == null) {
                arguments = args;
            }
            return proxy.invokeSuper(obj, args);
        }
    });
    artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, enhancer.create()) {
    };
    reset();
}
Also used : MethodInterceptor(net.sf.cglib.proxy.MethodInterceptor) AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) Enhancer(net.sf.cglib.proxy.Enhancer) MethodProxy(net.sf.cglib.proxy.MethodProxy) Method(java.lang.reflect.Method) Before(org.junit.Before)

Example 4 with AbstractArtifactCollectorFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade in project jbosstools-hibernate by jbosstools.

the class ArtifactCollectorFacadeTest method setUp.

@Before
public void setUp() {
    Enhancer enhancer = new Enhancer();
    enhancer.setSuperclass(ArtifactCollector.class);
    enhancer.setCallback(new MethodInterceptor() {

        @Override
        public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
            if (methodName == null) {
                methodName = method.getName();
            }
            if (arguments == null) {
                arguments = args;
            }
            return proxy.invokeSuper(obj, args);
        }
    });
    artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, enhancer.create()) {
    };
    reset();
}
Also used : MethodInterceptor(net.sf.cglib.proxy.MethodInterceptor) AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) Enhancer(net.sf.cglib.proxy.Enhancer) MethodProxy(net.sf.cglib.proxy.MethodProxy) Method(java.lang.reflect.Method) Before(org.junit.Before)

Example 5 with AbstractArtifactCollectorFacade

use of org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade in project jbosstools-hibernate by jbosstools.

the class ExporterFacadeTest method testSetArtifactCollector.

@Test
public void testSetArtifactCollector() {
    ArtifactCollector ac = new ArtifactCollector();
    IArtifactCollector artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, ac) {
    };
    exporterFacade.setArtifactCollector(artifactCollector);
    Assert.assertEquals("setArtifactCollector", methodName);
    Assert.assertArrayEquals(new Object[] { ac }, arguments);
}
Also used : AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) Test(org.junit.Test)

Aggregations

AbstractArtifactCollectorFacade (org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade)16 ArtifactCollector (org.hibernate.tool.hbm2x.ArtifactCollector)14 IArtifactCollector (org.jboss.tools.hibernate.runtime.spi.IArtifactCollector)14 Method (java.lang.reflect.Method)8 Before (org.junit.Before)8 Test (org.junit.Test)8 MethodHandler (javassist.util.proxy.MethodHandler)6 ProxyFactory (javassist.util.proxy.ProxyFactory)6 ProxyObject (javassist.util.proxy.ProxyObject)6 Enhancer (net.sf.cglib.proxy.Enhancer)2 MethodInterceptor (net.sf.cglib.proxy.MethodInterceptor)2 MethodProxy (net.sf.cglib.proxy.MethodProxy)2