Search in sources :

Example 16 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() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(ArtifactCollector.class);
    Class<?> proxyClass = proxyFactory.createClass();
    ProxyObject proxy = (ProxyObject) proxyClass.newInstance();
    proxy.setHandler(new MethodHandler() {

        @Override
        public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable {
            if (methodName == null) {
                methodName = m.getName();
            }
            if (arguments == null) {
                arguments = args;
            }
            return proceed.invoke(self, args);
        }
    });
    artifactCollector = new AbstractArtifactCollectorFacade(FACADE_FACTORY, (ArtifactCollector) proxy) {
    };
    reset();
}
Also used : ProxyObject(javassist.util.proxy.ProxyObject) MethodHandler(javassist.util.proxy.MethodHandler) AbstractArtifactCollectorFacade(org.jboss.tools.hibernate.runtime.common.AbstractArtifactCollectorFacade) ProxyFactory(javassist.util.proxy.ProxyFactory) ArtifactCollector(org.hibernate.tool.hbm2x.ArtifactCollector) IArtifactCollector(org.jboss.tools.hibernate.runtime.spi.IArtifactCollector) ProxyObject(javassist.util.proxy.ProxyObject) Method(java.lang.reflect.Method) Before(org.junit.Before)

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