Package org.switchyard.common.property

Examples of org.switchyard.common.property.PropertiesPropertyResolver


    public void testReplaceCustomProperties() {
        Properties custom = new Properties();
        custom.setProperty("foo", "bar");
        final String original = "I have a ${foo} but not a ${baz:wiz}.";
        final String expected = "I have a bar but not a wiz.";
        final String actual = Strings.replaceProperties(original, new PropertiesPropertyResolver(custom));
        Assert.assertEquals(expected, actual);
    }
View Full Code Here


        Properties custom = new Properties();
        custom.setProperty("foo", "bar");
        custom.setProperty("emotion", "loves");
        final String original = "${user.name} has a ${foo}, and he ${emotion:hates} it, unlike his ${sibling:sister}.";
        final String expected = System.getProperty("user.name") + " has a bar, and he loves it, unlike his sister.";
        final String actual = Strings.replaceProperties(original, SystemPropertyResolver.INSTANCE, new PropertiesPropertyResolver(custom));
        Assert.assertEquals(expected, actual);
    }
View Full Code Here

        custom.setProperty("foo", "${em${goto}ded}");
        custom.setProperty("embedded", "bar");
        custom.setProperty("foobar", "tub");
        final String original = "I have a ${foo} and a ${foo${foo}} but not a ${baz:wiz}.";
        final String expected = "I have a bar and a tub but not a wiz.";
        final String actual = Strings.replaceProperties(original, new PropertiesPropertyResolver(custom));
        Assert.assertEquals(expected, actual);
    }
View Full Code Here

        Properties custom = new Properties();
        custom.setProperty("foo", "bar");
        custom.setProperty("boo", "foo");
        final String original = "I have a ${foo} and a ${baz:wiz}, but not a $${foo}, a $${ba${boo}n} but not a $${ba$${boo}n}, a $${baz:wiz}, or a $${baz:$${oo}${ka}}.";
        final String expected = "I have a bar and a wiz, but not a ${foo}, a ${bafoon} but not a ${ba${boo}n}, a ${baz:wiz}, or a ${baz:${oo}${ka}}.";
        final String actual = Strings.replaceProperties(original, new PropertiesPropertyResolver(custom));
        Assert.assertEquals(expected, actual);
    }
View Full Code Here

        final String key = "VAULT::ds_ExampleDS::password::N2NhZDYzOTMtNWE0OS00ZGQ0LWE4MmEtMWNlMDMyNDdmNmI2TElORV9CUkVBS3ZhdWx0";
        final String expected = "expected";
        Properties properties = new Properties();
        properties.setProperty(key, expected);
        final String original = "${" + key + "}";
        final String actual = Strings.replaceProperties(original, new PropertiesPropertyResolver(properties));
        Assert.assertEquals(expected, actual);
    }
View Full Code Here

        final String expected = "expected";
        Properties properties = new Properties();
        properties.setProperty("attributeName", "password");
        properties.setProperty(key, expected);
        final String original = "${" + nested + "}";
        final String actual = Strings.replaceProperties(original, new PropertiesPropertyResolver(properties));
        Assert.assertEquals(expected, actual);
    }
View Full Code Here

        Properties custom = new Properties();
        custom.setProperty("foo", "bar");
        custom.setProperty("emotion", "loves");
        final String original = "${user.name} has a ${foo}, and he ${emotion:hates} it, unlike his ${sibling:sister}, who has a ${test.key}.";
        final String expected = System.getProperty("user.name") + " has a bar, and he loves it, unlike his sister, who has a testValue.";
        final String actual = Strings.replaceProperties(original, SystemAndTestPropertyResolver.INSTANCE, new PropertiesPropertyResolver(custom));
        Assert.assertEquals(expected, actual);
    }
View Full Code Here

TOP

Related Classes of org.switchyard.common.property.PropertiesPropertyResolver

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.