Package org.openengsb.core.api.remote

Examples of org.openengsb.core.api.remote.FilterAction.filter()


    @Test
    public void testMethodCallMarashalFilter_shouldMarshalOutgoingMessage() throws Exception {
        JsonOutgoingMethodCallMarshalFilter jsonOutgoingMethodCallMarshalFilter =
            new JsonOutgoingMethodCallMarshalFilter();
        FilterAction mock = mock(FilterAction.class);
        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(),
View Full Code Here


        TestModel testResult = new TestModel();
        testResult.setId(42);
        testResult.setName("bar");
        MethodResultMessage testResultMessage =
            new MethodResultMessage(new MethodResult(testResult), "foo");
        when(mock.filter(any(MethodCallMessage.class), any(Map.class))).thenReturn(testResultMessage);
        when(mock.getSupportedInputType()).thenAnswer(new Returns(MethodCallMessage.class));
        when(mock.getSupportedOutputType()).thenAnswer(new Returns(MethodResultMessage.class));
        jsonMethodCallMarshalFilter.setNext(mock);
        jsonMethodCallMarshalFilter.filter(CALL_MESSAGE, new HashMap<String, Object>());
    }
View Full Code Here

        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

        DOMResult domResult = new DOMResult();
        marshaller.marshal(new JAXBElement<MethodCallMessage>(new QName(MethodCallMessage.class.getSimpleName()),
            MethodCallMessage.class, request), domResult);
        String input = XmlDecoderFilter.writeDocument(domResult.getNode());
        String result = (String) filterChain.filter(input, new HashMap<String, Object>());

        Document parseDocument = XmlDecoderFilter.parseDocument(result);
        MethodResultMessage value = unmarshaller.unmarshal(parseDocument, MethodResultMessage.class).getValue();
        String value2 = unmarshaller.unmarshal((Node) value.getResult().getArg(), String.class).getValue();
        value.getResult().setArg(value2);
View Full Code Here

        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"));
    }

    @Test(expected = FilterConfigurationException.class)
    public void testCreateFilterWithIncompatibleFirst_shouldThrowFilterConfigurationException() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.