Search in sources :

Example 1 with MetadataInvocationHandler

use of org.mule.runtime.container.internal.MetadataInvocationHandler in project mule by mulesoft.

the class InjectParamsFromContextServiceProxyTestCase method throughProxyAugmentedInvocation.

@Test
public void throughProxyAugmentedInvocation() throws Exception {
    BaseService service = new AugmentedMethodService();
    final MetadataInvocationHandler noOpHandler = new MetadataInvocationHandler(service) {

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            return method.invoke(service, args);
        }
    };
    final BaseService innerProxy = (BaseService) newProxyInstance(service.getClass().getClassLoader(), new Class<?>[] { BaseService.class }, noOpHandler);
    final BaseService serviceProxy = (BaseService) createInjectProviderParamsServiceProxy(innerProxy, registry);
    serviceProxy.augmented();
    assertThat(augmentedParam, sameInstance(muleContext));
}
Also used : MetadataInvocationHandler(org.mule.runtime.container.internal.MetadataInvocationHandler) LegacyRegistryUtils.registerObject(org.mule.runtime.core.privileged.registry.LegacyRegistryUtils.registerObject) Method(java.lang.reflect.Method) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 Test (org.junit.Test)1 MetadataInvocationHandler (org.mule.runtime.container.internal.MetadataInvocationHandler)1 LegacyRegistryUtils.registerObject (org.mule.runtime.core.privileged.registry.LegacyRegistryUtils.registerObject)1 SmallTest (org.mule.tck.size.SmallTest)1