Package com.consol.citrus.xml.namespace

Examples of com.consol.citrus.xml.namespace.NamespaceContextBuilder


     * create new one.
     *
     * @return
     */
    private NamespaceContextBuilder getNamespContextBuilder() {
        NamespaceContextBuilder nsContextBuilder;
       
        try {
            nsContextBuilder = beanFactory.getBean(NamespaceContextBuilder.class);
        } catch (NoSuchBeanDefinitionException e) {
            nsContextBuilder = new NamespaceContextBuilder();
        }
       
        return nsContextBuilder;
    }
View Full Code Here


        mappings.put("//@name", "bar");

        XpathMappingDataDictionary dictionary = new XpathMappingDataDictionary();
        dictionary.setMappings(mappings);

        NamespaceContextBuilder namespaceContextBuilder = new NamespaceContextBuilder();
        Map<String, String> namespaces = new HashMap<String, String>();
        namespaces.put("foo", "http://www.foo.bar");
        namespaceContextBuilder.setNamespaceMappings(namespaces);
        dictionary.setNamespaceContextBuilder(namespaceContextBuilder);

        Message intercepted = dictionary.interceptMessage(message, CitrusConstants.DEFAULT_MESSAGE_TYPE, context);
        Assert.assertEquals(intercepted.getPayload().toString().trim(), "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns1:TestMessage xmlns:ns1=\"http://www.foo.bar\">" + System.getProperty("line.separator") +
                "   <ns1:Text>Hello!</ns1:Text>" + System.getProperty("line.separator") +
View Full Code Here

        Assert.assertFalse(messageSelector.accept(declineMessage));
    }
   
    @Test
    public void testXPathEvaluationDelegationWithNamespaceBuilder() {
        NamespaceContextBuilder nsContextBuilder = new NamespaceContextBuilder();
        nsContextBuilder.getNamespaceMappings().put("foo", "http://citrusframework.org/foo");
       
        reset(beanFactory);
       
        expect(beanFactory.getBean(NamespaceContextBuilder.class)).andReturn(nsContextBuilder).atLeastOnce();
       
View Full Code Here

        beanDefinitionContext = createApplicationContext("context");
        Map<String, NamespaceContextBuilder> namespaceContexts = beanDefinitionContext.getBeansOfType(NamespaceContextBuilder.class);

        Assert.assertEquals(namespaceContexts.size(), 1L);

        NamespaceContextBuilder namespaceContextBean = namespaceContexts.values().iterator().next();
        Assert.assertEquals(namespaceContextBean.getNamespaceMappings().size(), 3L);
        Assert.assertEquals(namespaceContextBean.getNamespaceMappings().get("ns0"), "http://citrusframework.org/schemas/1");
        Assert.assertEquals(namespaceContextBean.getNamespaceMappings().get("ns1"), "http://citrusframework.org/schemas/2");
        Assert.assertEquals(namespaceContextBean.getNamespaceMappings().get("ns2"), "http://citrusframework.org/schemas/3");
    }
View Full Code Here

TOP

Related Classes of com.consol.citrus.xml.namespace.NamespaceContextBuilder

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.