Search in sources :

Example 1 with AbstractQueryFacade

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

the class QueryFacadeTest method setUp.

@Before
public void setUp() {
    Query queryProxy = (Query) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Query.class }, new InvocationHandler() {

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            methodName = method.getName();
            arguments = args;
            if ("list".equals(method.getName())) {
                return LIST;
            } else if ("getReturnAliases".equals(method.getName())) {
                return RETURN_ALIASES;
            } else if ("getReturnTypes".equals(method.getName())) {
                return RETURN_TYPES;
            } else
                return null;
        }
    });
    query = new AbstractQueryFacade(FACADE_FACTORY, queryProxy) {
    };
}
Also used : Query(org.hibernate.Query) AbstractQueryFacade(org.jboss.tools.hibernate.runtime.common.AbstractQueryFacade) Method(java.lang.reflect.Method) InvocationHandler(java.lang.reflect.InvocationHandler) Before(org.junit.Before)

Example 2 with AbstractQueryFacade

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

the class QueryFacadeTest method setUp.

@Before
public void setUp() {
    Query queryProxy = (Query) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Query.class }, new InvocationHandler() {

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            methodName = method.getName();
            arguments = args;
            if ("list".equals(method.getName())) {
                return LIST;
            } else if ("getReturnAliases".equals(method.getName())) {
                return RETURN_ALIASES;
            } else if ("getReturnTypes".equals(method.getName())) {
                return RETURN_TYPES;
            } else
                return null;
        }
    });
    query = new AbstractQueryFacade(FACADE_FACTORY, queryProxy) {
    };
}
Also used : Query(org.hibernate.Query) AbstractQueryFacade(org.jboss.tools.hibernate.runtime.common.AbstractQueryFacade) Method(java.lang.reflect.Method) InvocationHandler(java.lang.reflect.InvocationHandler) Before(org.junit.Before)

Example 3 with AbstractQueryFacade

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

the class QueryFacadeTest method setUp.

@Before
public void setUp() {
    Query queryProxy = (Query) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Query.class }, new InvocationHandler() {

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            methodName = method.getName();
            arguments = args;
            if ("list".equals(method.getName())) {
                return LIST;
            } else if ("getReturnAliases".equals(method.getName())) {
                return RETURN_ALIASES;
            } else if ("getReturnTypes".equals(method.getName())) {
                return RETURN_TYPES;
            } else
                return null;
        }
    });
    query = new AbstractQueryFacade(FACADE_FACTORY, queryProxy) {
    };
}
Also used : Query(org.hibernate.Query) AbstractQueryFacade(org.jboss.tools.hibernate.runtime.common.AbstractQueryFacade) Method(java.lang.reflect.Method) InvocationHandler(java.lang.reflect.InvocationHandler) Before(org.junit.Before)

Example 4 with AbstractQueryFacade

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

the class QueryFacadeTest method beforeEach.

@BeforeEach
public void beforeEach() {
    Query queryProxy = (Query) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Query.class }, new InvocationHandler() {

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            methodName = method.getName();
            arguments = args;
            if ("list".equals(method.getName())) {
                return LIST;
            } else if ("getReturnAliases".equals(method.getName())) {
                return RETURN_ALIASES;
            } else if ("getReturnTypes".equals(method.getName())) {
                return RETURN_TYPES;
            } else
                return null;
        }
    });
    query = new AbstractQueryFacade(FACADE_FACTORY, queryProxy) {
    };
}
Also used : Query(org.hibernate.Query) AbstractQueryFacade(org.jboss.tools.hibernate.runtime.common.AbstractQueryFacade) Method(java.lang.reflect.Method) InvocationHandler(java.lang.reflect.InvocationHandler) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with AbstractQueryFacade

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

the class QueryFacadeTest method beforeEach.

@BeforeEach
public void beforeEach() {
    Query<?> queryProxy = (Query<?>) Proxy.newProxyInstance(FACADE_FACTORY.getClassLoader(), new Class[] { Query.class }, new InvocationHandler() {

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            methodName = method.getName();
            arguments = args;
            if ("list".equals(method.getName())) {
                return LIST;
            } else if ("getReturnAliases".equals(method.getName())) {
                return RETURN_ALIASES;
            } else if ("getReturnTypes".equals(method.getName())) {
                return RETURN_TYPES;
            } else
                return null;
        }
    });
    query = new AbstractQueryFacade(FACADE_FACTORY, queryProxy) {
    };
}
Also used : Query(org.hibernate.query.Query) AbstractQueryFacade(org.jboss.tools.hibernate.runtime.common.AbstractQueryFacade) Method(java.lang.reflect.Method) InvocationHandler(java.lang.reflect.InvocationHandler) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

InvocationHandler (java.lang.reflect.InvocationHandler)18 Method (java.lang.reflect.Method)18 AbstractQueryFacade (org.jboss.tools.hibernate.runtime.common.AbstractQueryFacade)18 Query (org.hibernate.Query)11 BeforeEach (org.junit.jupiter.api.BeforeEach)10 Before (org.junit.Before)8 Query (org.hibernate.query.Query)7