Package org.switchyard.config.model.selector.v1

Examples of org.switchyard.config.model.selector.v1.V1XPathOperationSelectorModel


            } else if (name.endsWith(XPathOperationSelectorModel.XPATH)) {
                return new V1XPathOperationSelectorModel(config, desc);
            } else if (name.endsWith(RegexOperationSelectorModel.REGEX)) {
                return new V1RegexOperationSelectorModel(config, desc);
            } else if (name.endsWith(JavaOperationSelectorModel.JAVA)) {
                return new V1JavaOperationSelectorModel(config, desc);
            }
        }
        return null;
    }
View Full Code Here


    @Test
    public void testRegex() throws Exception {
        String expression = "[a-zA-Z]*Operation";
        String content = "xxx yyy zzz regexOperation aaa bbb ccc";

        RegexOperationSelectorModel model = new V1RegexOperationSelectorModel(SwitchYardNamespace.DEFAULT.uri());
        model.setExpression(expression);
        OperationSelector<String> selector = new MyOperationSelector(model);
        QName operationQName = selector.selectOperation(content);
        Assert.assertEquals("regexOperation", operationQName.getLocalPart());
    }
View Full Code Here

            if (name.equals(OperationSelectorModel.OPERATION_SELECTOR)) {
                return new V1StaticOperationSelectorModel(config, desc);
            } else if (name.endsWith(XPathOperationSelectorModel.XPATH)) {
                return new V1XPathOperationSelectorModel(config, desc);
            } else if (name.endsWith(RegexOperationSelectorModel.REGEX)) {
                return new V1RegexOperationSelectorModel(config, desc);
            } else if (name.endsWith(JavaOperationSelectorModel.JAVA)) {
                return new V1JavaOperationSelectorModel(config, desc);
            }
        }
        return null;
View Full Code Here

        String namespace = "urn:operation-selector-test:1.0";
        String namespace2 = "urn:operation-selector-test:2.0";
        String operation = "invoke";
        String fullname = "{" + namespace2 + "}" + operation;

        StaticOperationSelectorModel model = new V1StaticOperationSelectorModel(SwitchYardNamespace.DEFAULT.uri());
        model.setOperationName(operation);
        OperationSelector<String> selector = new MyOperationSelector(model);
       
        QName operationQName = selector.selectOperation(null);
        Assert.assertEquals(XMLConstants.NULL_NS_URI, operationQName.getNamespaceURI());
        Assert.assertEquals(operation, operationQName.getLocalPart());
       
        selector.setDefaultNamespace(namespace);
        operationQName = selector.selectOperation(null);
        Assert.assertEquals(namespace, operationQName.getNamespaceURI());
        Assert.assertEquals(operation, operationQName.getLocalPart());
       
        model.setOperationName(fullname);
        selector = new MyOperationSelector(model);
        selector.setDefaultNamespace(namespace);
        operationQName = selector.selectOperation(null);
        Assert.assertEquals(namespace2, operationQName.getNamespaceURI());
        Assert.assertEquals(operation, operationQName.getLocalPart());
View Full Code Here

    }

    @Test
    public void operationSelectorProcessor() throws Exception {
        ProducerTemplate producer = _camelContext.createProducerTemplate();
        InboundHandler<?> handler1 = createInboundHandler("direct://foo", "foo", new V1StaticOperationSelectorModel(SwitchYardNamespace.DEFAULT.uri()).setOperationName("foo"));
        InboundHandler<?> handler2 = createInboundHandler("direct://bar", "bar", new V1StaticOperationSelectorModel(SwitchYardNamespace.DEFAULT.uri()).setOperationName("bar"));

        handler1.start();
        handler2.start();

        MockEndpoint mockEndpoint = _camelContext.getEndpoint("switchyard://dummyService", MockEndpoint.class);
View Full Code Here

    public void operationSelectorTest() {
        MockHandler mock = new MockHandler().forwardInToOut();
        _serviceDomain.registerService(_serviceName, _metadata, mock);
        _serviceDomain.registerServiceReference(_serviceName, _metadata);
        InboundHandler<?> handler = createInboundHandler(_serviceName, "direct:input", "input",
                new V1StaticOperationSelectorModel(SwitchYardNamespace.DEFAULT.uri()).setOperationName(OPERATION_NAME));
        handler.start();

        sendBody("direct:input", PAYLOAD);
        mock.waitForOKMessage();
        List<Exchange> exchanges = new ArrayList<Exchange>();
View Full Code Here

        MockHandler mock = new MockHandler().forwardInToOut();
        JavaService metadata = JavaService.fromClass(TestService.class);
        _serviceDomain.registerService(_serviceName, metadata, mock);
        _serviceDomain.registerServiceReference(_serviceName, metadata);
        InboundHandler<?> handler = createInboundHandler(_serviceName, "direct:input", "input",
                new V1StaticOperationSelectorModel(SwitchYardNamespace.DEFAULT.uri()).setOperationName("missing"));
        handler.start();

        sendBody("direct:input", PAYLOAD);
        assertTrue(mock.getMessages().isEmpty());
        handler.stop();
View Full Code Here

            return new V1ThrottlingModel(config, desc);
        } else if (name.equals(INTERFACE_ESB)) {
            return new V1EsbInterfaceModel(config, desc);
        } else if (name.startsWith(OperationSelectorModel.OPERATION_SELECTOR)) {
            if (name.equals(OperationSelectorModel.OPERATION_SELECTOR)) {
                return new V1StaticOperationSelectorModel(config, desc);
            } else if (name.endsWith(XPathOperationSelectorModel.XPATH)) {
                return new V1XPathOperationSelectorModel(config, desc);
            } else if (name.endsWith(RegexOperationSelectorModel.REGEX)) {
                return new V1RegexOperationSelectorModel(config, desc);
            } else if (name.endsWith(JavaOperationSelectorModel.JAVA)) {
View Full Code Here

    public void testXPath() throws Exception {
        String expression = "/Message/Operation";
        String expressionAttribute = "/Message/Operation/@name";
        String content = "<Message><Operation name=\"xpathOperationFromAttribute\">xpathOperation</Operation></Message>";

        XPathOperationSelectorModel model = new V1XPathOperationSelectorModel(SwitchYardNamespace.DEFAULT.uri());
        model.setExpression(expression);
        OperationSelector<String> selector = new MyOperationSelector(model);
        QName operationQName = selector.selectOperation(content);
        Assert.assertEquals("xpathOperation", operationQName.getLocalPart());
       
        model.setExpression(expressionAttribute);
        selector = new MyOperationSelector(model);
        operationQName = selector.selectOperation(content);
        Assert.assertEquals("xpathOperationFromAttribute", operationQName.getLocalPart());
    }
View Full Code Here

    @Test
    public void testOperationSelectorOnNettyChannelBuffer() throws Exception {
        String payload = "<body><operation>greet</operation><name>Tomas</name></body>";
        ProducerTemplate producer = _camelContext.createProducerTemplate();
        XPathOperationSelectorModel operationSelectorModel = new V1XPathOperationSelectorModel(SwitchYardNamespace.DEFAULT.uri());
        operationSelectorModel.setExpression("//body/operation");
        InboundHandler<?> handler = createInboundHandler("direct://xpath", "xpath", operationSelectorModel);
        handler.start();
       
        try {
            // BigEndianHeapChannelBuffer->String converter is provided by camel-netty component
View Full Code Here

TOP

Related Classes of org.switchyard.config.model.selector.v1.V1XPathOperationSelectorModel

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.