Exemple #1
0
 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
   if (args.length == 0) {
     throw new DefaultMuleException(ClientMessages.noArgsForProxy());
   }
   MuleMessage message = eventTransformer.transform(args[0], method);
   if (!"void".equals(method.getReturnType().getName())) {
     MuleMessage result = client.sendDirect(componentName, null, message);
     if (MuleMessage.class.equals(method.getReturnType())) {
       return result;
     } else {
       return (result == null ? null : result.getPayload());
     }
   } else {
     client.dispatchDirect(componentName, message);
     return null;
   }
 }
Exemple #2
0
 public void testCreateMuleClient() throws MuleException {
   MuleClient muleClient = new MuleClient();
   assertNotSame(muleContext, muleClient.getMuleContext());
   assertTrue(muleClient.getMuleContext().isInitialised());
   assertTrue(muleClient.getMuleContext().isStarted());
   muleClient.dispatch("test://test", "message", null);
   muleClient.send("test://test", "message", null);
   muleClient.dispose();
   // TODO MULE-2847
   // assertFalse(muleClient.getMuleContext().isInitialised());
   // assertFalse(muleClient.getMuleContext().isStarted());
 }