Package org.openengsb.core.api.remote

Examples of org.openengsb.core.api.remote.MethodCallMessage


    @Override
    public void onMessage(Message message) {
        SecureSampleConnector.LOGGER.info("recieved JMS-message");
        TextMessage content = (TextMessage) message;
        String text = getTextFromMessage(content);
        MethodCallMessage request = handler.unmarshal(text);
        MethodResult result = requestHander.process(request.getMethodCall());
        try {
            sendResult(request, result);
        } catch (JMSException e) {
            throw Throwables.propagate(e);
        }
View Full Code Here


        producer = session.createProducer(destination);
    }

    private static MethodResult call(MethodCall call) throws IOException, JMSException, InterruptedException,
        ClassNotFoundException {
        MethodCallMessage methodCallRequest = new MethodCallMessage(call);
        String requestString = MAPPER.writeValueAsString(methodCallRequest);
        sendMessage(requestString);
        String resultString = getResultFromQueue(methodCallRequest.getCallId());
        return convertStringToResult(resultString);
    }
View Full Code Here

        registerServiceViaId(mock2, "test", TestInterface.class);
        when(mock2.method(anyString(), anyInt(), any(TestClass.class))).thenReturn(new TestClass("test"));

        Map<String, String> metaData = Maps.newHashMap(ImmutableMap.of("serviceId", "test"));
        MethodCall methodCall = new MethodCall("method", new Object[]{ "123", 5, new TestClass("test"), }, metaData);
        call = new MethodCallMessage(methodCall, "123");
        call.setDestination("host?receive");

        MethodResult result = new MethodResult(new TestClass("test"));
        result.setMetaData(metaData);
        methodReturn = new MethodResultMessage(result, "123");
View Full Code Here

        when(mock2.method(Mockito.anyString(), Mockito.anyInt(), Mockito.any(TestClass.class))).thenReturn(
            new TestClass("test"));
        metaData = new HashMap<String, String>();
        metaData.put("serviceId", "test");
        MethodCall methodCall = new MethodCall("method", new Object[]{ "123", 5, new TestClass("test"), }, metaData);
        call = new MethodCallMessage(methodCall, "123");
        call.setDestination("host?receive");

        JMSOutgoingPort jmsOutgoingPort = new JMSOutgoingPort();
        jmsOutgoingPort.setFactory(jmsTemplateFactory);
View Full Code Here

     */
    private MethodCallMessage createMethodCallRequest(ServiceId serviceId, MethodId methodId)
        throws ArgumentConversionException {
        org.openengsb.core.api.remote.MethodCall realMethodCall = createRealMethodCall(methodId);
        realMethodCall.setMetaData(createMetaDataForMethodCallRequest(serviceId));
        return new MethodCallMessage(realMethodCall, "randomCallId");
    }
View Full Code Here

     * @param methodId Id of the refered Method
     * @return a SecureRequest corresponding to the given ServiceId and MethodId
     */
    private MethodCallMessage createSecureRequest(ServiceId serviceId, MethodId methodId)
        throws ArgumentConversionException {
        MethodCallMessage methodCallRequest = createMethodCallRequest(serviceId, methodId);
        BeanDescription beanDescription = BeanDescription.fromObject(new Password("yourpassword"));
        methodCallRequest.setPrincipal("yourusername");
        methodCallRequest.setCredentials(beanDescription);
        return methodCallRequest;
    }
View Full Code Here

        when(mock.filter(any(MethodCallMessage.class), any(Map.class))).thenReturn(RESULT_MESSAGE);
        when(mock.getSupportedInputType()).thenAnswer(new Returns(String.class));
        when(mock.getSupportedOutputType()).thenAnswer(new Returns(String.class));
        jsonOutgoingMethodCallMarshalFilter.setNext(mock);
        MethodResultMessage result =
            (MethodResultMessage) jsonOutgoingMethodCallMarshalFilter.filter(new MethodCallMessage(),
                new HashMap<String, Object>());
        Object arg = result.getResult().getArg();
        assertThat(arg, is(TestModel.class));
        TestModel resultModel = (TestModel) arg;
        assertThat(resultModel.getId(), is(42));
View Full Code Here

        FilterAction filterChain = filterChainFactory.create();

        ObjectMapper objectMapper = new ObjectMapper();
        MethodCall methodCall = new MethodCall("test", new Object[]{ "foo" });
        MethodCallMessage request = new MethodCallMessage(methodCall, "bar");
        String input = objectMapper.writeValueAsString(request);
        String result = (String) filterChain.filter(input, new HashMap<String, Object>());
        MethodResultMessage returnValue = objectMapper.readValue(result, MethodResultMessage.class);
        assertThat((String) returnValue.getResult().getArg(), is("foo"));
        assertThat(returnValue.getCallId(), is("bar"));
View Full Code Here

        filterChainFactory.setFilters(filters);

        FilterAction filterChain = filterChainFactory.create();

        MethodCall methodCall = new MethodCall("test", new Object[]{ "foo" }, Arrays.asList(String.class.getName()));
        MethodCallMessage request = new MethodCallMessage(methodCall, "bar");

        JAXBContext jaxbContext = JAXBContext.newInstance(MethodCallMessage.class, MethodResultMessage.class);
        final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        final Marshaller marshaller = jaxbContext.createMarshaller();
View Full Code Here

        FilterAction filterChain = filterChainFactory.create();

        ObjectMapper objectMapper = new ObjectMapper();
        MethodCall methodCall = new MethodCall("test", new Object[]{ "foo" });
        MethodCallMessage request = new MethodCallMessage(methodCall, "bar");
        String input = objectMapper.writeValueAsString(request);
        HashMap<String, Object> metaData = new HashMap<String, Object>();
        filterChain.filter(input, metaData);
        assertThat((String) metaData.get("callId"), is("bar"));
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.api.remote.MethodCallMessage

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.