Package org.springframework.remoting.support

Examples of org.springframework.remoting.support.RemoteInvocation


            }
        }

        RemoteInvocation createRemoteInvocation(String methodName) {
            if (returnValue instanceof Throwable) {
                return new RemoteInvocation(methodName, new Class[]{Object.class}, new Object[]{Void.class});
            } else {
                return new RemoteInvocation(methodName, new Class[]{returnValue.getClass()}, new Object[]{returnValue});
            }
        }
View Full Code Here


        }
    }

    @Test
    public void testSimpleHttpInvokerRequestExecutor() throws Exception {
        RemoteInvocation invocation =
                new RemoteInvocation("testSimpleHttpInvokerRequestExecutor", new Class[]{Long.class}, new Object[]{Long.valueOf(System.nanoTime())});
        TestingSimpleHttpInvokerRequestExecutor executor = new TestingSimpleHttpInvokerRequestExecutor(invocation.getMethodName());
        HttpInvokerClientConfiguration config = createMockConfiguration(executor.getColor(), ArrayUtil.EMPTY_STRINGS);
        RemoteInvocationResult result = executor.executeRequest(config, invocation);
        Object value = result.getValue();
        assertNotNull("No result value", value);
        assertTrue("Bad result value type: " + value.getClass().getSimpleName(), value instanceof RemoteInvocation);

        RemoteInvocation resultValue = (RemoteInvocation) value;
        assertEquals("Mismatched result method", invocation.getMethodName(), resultValue.getMethodName());
        assertArrayEquals("Mismatched result signature", invocation.getParameterTypes(), resultValue.getParameterTypes());
        assertArrayEquals("Mismatched result arguments", invocation.getArguments(), resultValue.getArguments());

        Operation op = assertRemotingOperation(config);
        assertEquals("Mismatched request method", executor.getMethod(), op.get("method", String.class));

        ExternalResourceDescriptor desc = assertExternalResource(op);
View Full Code Here

            {
                throw new TransformerException(this, e);
            }
        }

        RemoteInvocation ri = (RemoteInvocation) o;
        if (logger.isDebugEnabled())
        {
            logger.debug("request to execute " + ri.getMethodName());
            for (int i = 0; i < ri.getArguments().length; i++)
            {
                Object currentArgument = ri.getArguments()[i];
               
                StringBuilder buf = new StringBuilder(64);
                buf.append("with argument (");
                buf.append(currentArgument == null ? "<null>" : currentArgument.toString());
                buf.append(")");
View Full Code Here

    }

    public Object onCall(MuleEventContext eventContext) throws Exception
    {
        Object payload = eventContext.getMessage().getPayload();
        RemoteInvocation ri = (RemoteInvocation) payload;
        Object rval = delegate.execute(ri);
        return rval;
    }
View Full Code Here

                log.trace("No 'shiro.session.id' system property found.  Heuristics have been exhausted; " +
                        "RemoteInvocation will not contain a sessionId.");
            }
        }

        RemoteInvocation ri = new RemoteInvocation(mi);
        if (sessionId != null) {
            ri.addAttribute(SESSION_ID_KEY, sessionId);
        }
        if (host != null) {
            ri.addAttribute(HOST_KEY, host);
        }

        return ri;
    }
View Full Code Here

        Object[] args = {"localhost"};
        expect(mi.getArguments()).andReturn(args).anyTimes();

        replay(mi);

        RemoteInvocation ri = factory.createRemoteInvocation(mi);

        verify(mi);

        assertNull(ri.getAttribute(SecureRemoteInvocationFactory.SESSION_ID_KEY));
    }
View Full Code Here

        Object[] args = {sessionKey};
        expect(mi.getArguments()).andReturn(args).anyTimes();

        replay(mi);

        RemoteInvocation ri = factory.createRemoteInvocation(mi);

        verify(mi);

        assertEquals(dummySessionId, ri.getAttribute(SecureRemoteInvocationFactory.SESSION_ID_KEY));
    }
View Full Code Here

  public Object invoke(MethodInvocation methodInvocation) throws Throwable {
    if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
      return "HTTP invoker proxy for service URL [" + getServiceUrl() + "]";
    }

    RemoteInvocation invocation = createRemoteInvocation(methodInvocation);
    RemoteInvocationResult result;
    try {
      result = executeRequest(invocation, methodInvocation);
    }
    catch (Throwable ex) {
View Full Code Here

   * @see #writeRemoteInvocationResult(com.sun.net.httpserver.HttpExchange, org.springframework.remoting.support.RemoteInvocationResult)
   */
  @Override
  public void handle(HttpExchange exchange) throws IOException {
    try {
      RemoteInvocation invocation = readRemoteInvocation(exchange);
      RemoteInvocationResult result = invokeAndCreateResult(invocation, getProxy());
      writeRemoteInvocationResult(exchange, result);
      exchange.close();
    }
    catch (ClassNotFoundException ex) {
View Full Code Here

      public AccessibleObject getStaticPart() {
        return setNameMethod;
      }
    };

    RemoteInvocation inv = new RemoteInvocation(mi);

    assertEquals("setName", inv.getMethodName());
    assertEquals("bla", inv.getArguments()[0]);
    assertEquals(String.class, inv.getParameterTypes()[0]);

    // this is a bit BS, but we need to test it
    inv = new RemoteInvocation();
    inv.setArguments(new Object[] { "bla" });
    assertEquals("bla", inv.getArguments()[0]);
    inv.setMethodName("setName");
    assertEquals("setName", inv.getMethodName());
    inv.setParameterTypes(new Class<?>[] {String.class});
    assertEquals(String.class, inv.getParameterTypes()[0]);

    inv = new RemoteInvocation("setName", new Class<?>[] {String.class}, new Object[] {"bla"});
    assertEquals("bla", inv.getArguments()[0]);
    assertEquals("setName", inv.getMethodName());
    assertEquals(String.class, inv.getParameterTypes()[0]);
  }
View Full Code Here

TOP

Related Classes of org.springframework.remoting.support.RemoteInvocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.