Package org.openengsb.core.api.remote

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


            decryptedContent = CipherUtils.decrypt(Base64.decodeBase64(resultString), sessionKey);
        } catch (DecryptionException e) {
            System.err.println(resultString);
            throw e;
        }
        MethodResultMessage resultMessage = MAPPER.readValue(decryptedContent, MethodResultMessage.class);
        return resultMessage;
    }
View Full Code Here


        return MAPPER.writeValueAsString(methodCallRequest);
    }

    private static MethodResult convertStringToResult(String resultString) throws IOException,
        ClassNotFoundException, DecryptionException {
        MethodResultMessage resultMessage = MAPPER.readValue(resultString, MethodResultMessage.class);
        return convertResult(resultMessage);
    }
View Full Code Here

        LOGGER.info("extracted callId \"{}\" from message", callId);
        metaData.put("callId", callId);
        LOGGER.debug("converting arguments of inputmessage");
        JsonUtils.convertAllArgs(request);
        LOGGER.debug("invoking next filter: {}", next.getClass().getName());
        MethodResultMessage response = (MethodResultMessage) next.filter(request, metaData);
        LOGGER.debug("response received for callId {}: {}. serializing to json", callId, response);
        try {
            return mapper.writeValueAsBytes(response);
        } catch (IOException e) {
            throw new FilterException(e);
View Full Code Here

        try {
            call = parseMethodCall(input);
        } catch (JAXBException e) {
            throw new FilterException(e);
        }
        MethodResultMessage result = (MethodResultMessage) next.filter(call, metadata);
        return serializeResult(result);
    }
View Full Code Here

    @Test
    public void testProcessMethodCall_shouldReturnOriginalArgAsResult() throws Exception {
        MethodCallMessage secureRequest = prepareSecureRequest();

        MethodResultMessage response = processRequest(secureRequest);

        MethodResultMessage mr = response;
        assertThat((String) mr.getResult().getArg(), is(METHOD_ARG));
    }
View Full Code Here

                        try {
                            deserialize = (MethodCallMessage) SerializationUtils.deserialize(input);
                        } catch (SerializationException e) {
                            throw new FilterException(e);
                        }
                        MethodResultMessage result = (MethodResultMessage) next.filter(deserialize, metaData);
                        return SerializationUtils.serialize(result);
                    }

                    @Override
                    public void setNext(FilterAction next) throws FilterConfigurationException {
View Full Code Here

        }
        return text;
    }

    private void sendResult(MethodCallMessage request, MethodResult result) throws JMSException {
        MethodResultMessage methodResultMessage = new MethodResultMessage(result, request.getCallId());
        String resultText;
        try {
            resultText = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(methodResultMessage);
        } catch (IOException e) {
            throw Throwables.propagate(e);
View Full Code Here

            LOGGER.error("decryption failed.");
            LOGGER.error(result);
        }

        if (!result.contains("The answer to life the universe and everything")) {
            MethodResultMessage readValue = new ObjectMapper().readValue(result, MethodResultMessage.class);
            MethodResult result2 = readValue.getResult();
            if (result2.getType().equals(MethodResult.ReturnType.Exception)) {
                LOGGER.error(result2.getArg().toString());
            }
            assertThat(result, containsString("The answer to life the universe and everything"));
        }
View Full Code Here

    @Override
    public MethodResultMessage doFilter(MethodCallMessage input, Map<String, Object> metadata) throws FilterException {

        ObjectMapper objectMapper = JsonUtils.createObjectMapperWithIntroSpectors();
        MethodResultMessage resultMessage;
        try {
            String jsonString = objectMapper.writeValueAsString(input);
            String resultString = (String) next.filter(jsonString, metadata);
            if (resultString == null) {
                return null;
            }
            resultMessage = objectMapper.readValue(resultString, MethodResultMessage.class);
        } catch (IOException e) {
            throw new FilterException(e);
        }
        MethodResult result = resultMessage.getResult();

        if (result.getType().equals(ReturnType.Void)) {
            result.setArg(null);
        } else {
            Class<?> resultType;
View Full Code Here

        LOGGER.info("extracted callId \"{}\" from message", callId);
        metaData.put("callId", callId);
        LOGGER.debug("converting arguments of inputmessage");
        JsonUtils.convertAllArgs(request);
        LOGGER.debug("invoking next filter: {}", next.getClass().getName());
        MethodResultMessage response = (MethodResultMessage) next.filter(request, metaData);
        LOGGER.debug("response received for callId {}: {}. serializing to json", callId, response);
        try {
            return mapper.writeValueAsString(response);
        } catch (IOException e) {
            throw new FilterException(e);
View Full Code Here

TOP

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

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.