Package org.mule.common.config

Examples of org.mule.common.config.XmlConfigurationCallback


        return w3cElement;
    }

    private XmlConfigurationCallback getXmlConfigurationCallbackMock()
    {
        XmlConfigurationCallback callback = Mockito.mock(XmlConfigurationCallback.class);
        HashMap<String, String> map = new HashMap<String, String>();
        Mockito.when(callback.getEnvironmentProperties()).thenReturn(map);
        Mockito.when(callback.getSchemaLocation("http://www.mulesoft.org/schema/mule/core")).thenReturn("http://www.mulesoft.org/schema/mule/core/current/mule.xsd");
        Mockito.when(callback.getSchemaLocation("http://www.springframework.org/schema/beans")).thenReturn("http://www.springframework.org/schema/beans/spring-beans-3.0.xsd");
        Mockito.when(callback.getSchemaLocation("http://www.springframework.org/schema/context")).thenReturn("http://www.springframework.org/schema/context/spring-context-3.0.xsd");
        Mockito.when(callback.getSchemaLocation("http://www.mulesoft.org/schema/mule/secure-property-placeholder")).thenReturn("http://www.mulesoft.org/schema/mule/secure-property-placeholder/1.0/mule-secure-property-placeholder.xsd");


        return callback;
    }
View Full Code Here


    public void whenCallingGetArtifactForMessageProcessorSystemPropertiesShouldRemain() throws MuleArtifactFactoryException, DocumentException
    {
        Properties properties = System.getProperties();

        SpringXmlConfigurationMuleArtifactFactory factoryTest = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = Mockito.mock(XmlConfigurationCallback.class);
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("test", "test1");
        Mockito.when(callback.getEnvironmentProperties()).thenReturn(map);
        Mockito.when(callback.getPropertyPlaceholders()).thenReturn(new Element[] {});
        Element element = createElement("logger", "http://www.mulesoft.org/schema/mule/core");

        factoryTest.getArtifactForMessageProcessor(element, callback);

        Assert.assertThat("System properties where modified", properties, CoreMatchers.is(System.getProperties()));
View Full Code Here

    @Test
    public void whenMultiplePropertyPlaceholdersWithIgnoreUnresolvableInAllExceptOneDoNotFail() throws MuleArtifactFactoryException, DocumentException
    {
        SpringXmlConfigurationMuleArtifactFactory factoryTest = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = getXmlConfigurationCallbackMock();
        Element[] propertyPlaceholders = new Element[3];
        propertyPlaceholders[0] = createPropertyPlaceholder("test1.properties", null);
        propertyPlaceholders[1] = createPropertyPlaceholder("test2.properties", "true");
        propertyPlaceholders[2] = createPropertyPlaceholder("test3.properties", "true");

        Mockito.when(callback.getPropertyPlaceholders()).thenReturn(propertyPlaceholders);
        Element element = createElement("logger", "http://www.mulesoft.org/schema/mule/core");

        String muleConfigTxt = factoryTest.getArtifactMuleConfig("test-flow", element, callback, false);
        Document muleConfig = DocumentHelper.parseText(muleConfigTxt);
View Full Code Here

    @Test
    public void whenOnePropertyPlaceholdersWithoutIgnoreUnresolvableDoNotFail() throws MuleArtifactFactoryException, DocumentException
    {
        SpringXmlConfigurationMuleArtifactFactory factoryTest = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = getXmlConfigurationCallbackMock();
        Element[] propertyPlaceholders = new Element[1];
        propertyPlaceholders[0] = createPropertyPlaceholder("test1.properties", null);

        Mockito.when(callback.getPropertyPlaceholders()).thenReturn(propertyPlaceholders);
        Element element = createElement("logger", "http://www.mulesoft.org/schema/mule/core");

        String muleConfigTxt = factoryTest.getArtifactMuleConfig("test-flow", element, callback, false);
        Document muleConfig = DocumentHelper.parseText(muleConfigTxt);
View Full Code Here

    @Test
    public void whenOnePropertyPlaceholdersWithIgnoreUnresolvableTrueDoNotFail() throws MuleArtifactFactoryException, DocumentException
    {
        SpringXmlConfigurationMuleArtifactFactory factoryTest = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = getXmlConfigurationCallbackMock();
        Element[] propertyPlaceholders = new Element[1];
        propertyPlaceholders[0] = createPropertyPlaceholder("test1.properties", "true");

        Mockito.when(callback.getPropertyPlaceholders()).thenReturn(propertyPlaceholders);
        Element element = createElement("logger", "http://www.mulesoft.org/schema/mule/core");

        String muleConfigTxt = factoryTest.getArtifactMuleConfig("test-flow", element, callback, false);
        Document muleConfig = DocumentHelper.parseText(muleConfigTxt);
View Full Code Here

    @Test
    public void whenOnePropertyPlaceholdersWithIgnoreUnresolvableFalseDoNotFail() throws MuleArtifactFactoryException, DocumentException
    {
        SpringXmlConfigurationMuleArtifactFactory factoryTest = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = getXmlConfigurationCallbackMock();
        Element[] propertyPlaceholders = new Element[1];
        propertyPlaceholders[0] = createPropertyPlaceholder("test1.properties", "false");

        Mockito.when(callback.getPropertyPlaceholders()).thenReturn(propertyPlaceholders);
        Element element = createElement("logger", "http://www.mulesoft.org/schema/mule/core");

        String muleConfigTxt = factoryTest.getArtifactMuleConfig("test-flow", element, callback, false);
        Document muleConfig = DocumentHelper.parseText(muleConfigTxt);
View Full Code Here

    @Test
    public void whenOneBeanPropertyPlaceholdersWithIgnoreUnresolvableFalseDoNotFail() throws MuleArtifactFactoryException, DocumentException
    {
        SpringXmlConfigurationMuleArtifactFactory factoryTest = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = getXmlConfigurationCallbackMock();
        Element[] propertyPlaceholders = new Element[1];
        propertyPlaceholders[0] = createBeanPropertyPlaceholder("test1.properties", "false");
        Mockito.when(callback.getPropertyPlaceholders()).thenReturn(propertyPlaceholders);

        Element element = createElement("logger", "http://www.mulesoft.org/schema/mule/core");

        String muleConfigTxt = factoryTest.getArtifactMuleConfig("test-flow", element, callback, false);
        Document muleConfig = DocumentHelper.parseText(muleConfigTxt);
View Full Code Here

    @Test
    public void whenOneBeanPropertyPlaceholdersAndOnePropertyPlaceholderWithIgnoreUnresolvableFalseDoNotFail() throws MuleArtifactFactoryException, DocumentException
    {
        SpringXmlConfigurationMuleArtifactFactory factoryTest = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = getXmlConfigurationCallbackMock();
        Element[] propertyPlaceholders = new Element[2];
        propertyPlaceholders[0] = createBeanPropertyPlaceholder("test1.properties", "true");
        propertyPlaceholders[1] = createPropertyPlaceholder("test2.properties", "true");
        Mockito.when(callback.getPropertyPlaceholders()).thenReturn(propertyPlaceholders);

        Element element = createElement("logger", "http://www.mulesoft.org/schema/mule/core");

        String muleConfigTxt = factoryTest.getArtifactMuleConfig("test-flow", element, callback, false);
        Document muleConfig = DocumentHelper.parseText(muleConfigTxt);
View Full Code Here

    @Test
    public void whenOneSecurePropertyPlaceholderDoNotFail() throws MuleArtifactFactoryException, DocumentException
    {
        SpringXmlConfigurationMuleArtifactFactory factoryTest = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = getXmlConfigurationCallbackMock();
        Element[] propertyPlaceholders = new Element[1];
        propertyPlaceholders[0] = createSecurePropertyPlaceholder("test1.properties", "secretKey");
        Mockito.when(callback.getPropertyPlaceholders()).thenReturn(propertyPlaceholders);

        Element element = createElement("logger", "http://www.mulesoft.org/schema/mule/core");

        String muleConfigTxt = factoryTest.getArtifactMuleConfig("test-flow", element, callback, false);
        Document muleConfig = DocumentHelper.parseText(muleConfigTxt);
View Full Code Here

    @Test
    public void createsMessageSourceArtifact() throws MuleArtifactFactoryException, DocumentException
    {
        SpringXmlConfigurationMuleArtifactFactory factory = new SpringXmlConfigurationMuleArtifactFactory();
        XmlConfigurationCallback callback = mock(XmlConfigurationCallback.class);
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("test", "test1");
        when(callback.getEnvironmentProperties()).thenReturn(map);
        when(callback.getPropertyPlaceholders()).thenReturn(new Element[] {});
        when(callback.getSchemaLocation(VM_SCHEMA_URL)).thenReturn("http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd");
        Element element = createElement("inbound-endpoint", VM_SCHEMA_URL, "vm");
        element.setAttribute("path", "/test");

        MuleArtifact artifact = factory.getArtifactForMessageProcessor(element, callback);
View Full Code Here

TOP

Related Classes of org.mule.common.config.XmlConfigurationCallback

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.