Package org.geotools.util

Examples of org.geotools.util.InterpolationProperties


    public void testInterpolate() {
        Properties properties = new Properties();
        properties.put("foo.x", "123");
        properties.put("foo.y", "abc");
        properties.put("foo.z", "bar");
        InterpolationProperties props = new InterpolationProperties(properties);
        String result = props.interpolate(
                "123ajh${foo.z} akl ${foo.y}${foo.y} laskj ${foo.x}\n"
                        + "foo.x${foo.x}${foo.x} ${foo.z}${foo.y}");
        assertEquals("123ajhbar akl abcabc laskj 123\nfoo.x123123 barabc", result);
    }
View Full Code Here


     */
    @Test
    public void testInterpolateNonexistent() {
        boolean interpolatedNonexistentProperty = false;
        try {
            InterpolationProperties props = new InterpolationProperties(new Properties());
            props.interpolate("123 ${does.not.exist} 456");
            interpolatedNonexistentProperty = true;
        } catch (Exception e) {
            // success
        }
        assertFalse(interpolatedNonexistentProperty);
View Full Code Here

     * Test that {@link PropertyInterpolationUtils#loadProperties(String)} can load properties from
     * the classpath.
     */
    @Test
    public void testLoadPropertiesFromClasspath() {
        InterpolationProperties props = new InterpolationProperties(IDENTIFIER);
        assertEquals("found-on-classpath", props.getProperty(TEST_PROPERTY));
        checkSystemProperties(props);
    }
View Full Code Here

     * Test that in {@link PropertyInterpolationUtils#loadProperties(String)} only system properties
     * are loaded when the properties files does not exist.
     */
    @Test
    public void testLoadPropertiesDoesNotExist() {
        InterpolationProperties props = new InterpolationProperties(IDENTIFIER+ ".does-not-exist");
        assertNull(props.getProperty(TEST_PROPERTY));
        checkSystemProperties(props);
    }
View Full Code Here

     * the a file specified in a system property.
     */
    @Test
    public void testLoadPropertiesFromFile() {
        // note that the identifier does *not* match the filename
        InterpolationProperties props = new InterpolationProperties(TEST_FILE_SYSTEM_PROPERTY
                .replace(".properties", ""));
        assertEquals("found-in-file", props.getProperty(TEST_PROPERTY));
        checkSystemProperties(props);
    }
View Full Code Here

     *
     * @return properties
     */
    public synchronized InterpolationProperties getProperties() {
        if (properties == null) {
            properties = new InterpolationProperties(AppSchemaDataAccessFactory.DBTYPE_STRING);
        }
        return properties;
    }
View Full Code Here

TOP

Related Classes of org.geotools.util.InterpolationProperties

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.