Package org.apache.velocity.tools.generic

Examples of org.apache.velocity.tools.generic.ResourceTool


        assertNotNull(numberTool);
//        assertEquals()
    }

    public @Test void testResourceTool() {
        ResourceTool textTool = (ResourceTool)toolbox.get("text");
        assertNotNull(textTool);

        ResourceTool.Key foo = textTool.get("foo");
        assertStringEquals("bar", foo);

        ResourceTool.Key frenchFoo = foo.locale(Locale.FRENCH);
        assertStringEquals("barre", frenchFoo);

        ResourceTool.Key otherFoo = foo.bundle("resources2");
        assertStringEquals("woogie", otherFoo);

        ResourceTool.Key helloWhoever = textTool.get("hello").get("whoever");
        assertStringEquals("Hello {0}!", helloWhoever);

        ResourceTool.Key helloWorld = helloWhoever.insert(textTool.get("world"));
        assertStringEquals("Hello World!", helloWorld);

        ResourceTool.Key halfFrenchHelloWorld = helloWorld.locale(Locale.FRENCH);
        assertStringEquals("Bonjour World!", halfFrenchHelloWorld);

        ResourceTool.Key frenchTool = textTool.locale(Locale.FRENCH);
        ResourceTool.Key frenchHelloWorld =
            frenchTool.get("hello.whoever").insert(frenchTool.get("world"));
        assertStringEquals("Bonjour Monde!", frenchHelloWorld);
    }
View Full Code Here


        assertNotNull(numberTool);
//        assertEquals()
    }

    public @Test void testResourceTool() {
        ResourceTool textTool = (ResourceTool)toolbox.get("text");
        assertNotNull(textTool);

        ResourceTool.Key foo = textTool.get("foo");
        assertStringEquals("bar", foo);

        ResourceTool.Key frenchFoo = foo.locale(Locale.FRENCH);
        assertStringEquals("barre", frenchFoo);

        ResourceTool.Key otherFoo = foo.bundle("resources2");
        assertStringEquals("woogie", otherFoo);

        ResourceTool.Key helloWhoever = textTool.get("hello").get("whoever");
        assertStringEquals("Hello {0}!", helloWhoever);

        ResourceTool.Key helloWorld = helloWhoever.insert(textTool.get("world"));
        assertStringEquals("Hello World!", helloWorld);

        ResourceTool.Key halfFrenchHelloWorld = helloWorld.locale(Locale.FRENCH);
        assertStringEquals("Bonjour World!", halfFrenchHelloWorld);

        ResourceTool.Key frenchTool = textTool.locale(Locale.FRENCH);
        ResourceTool.Key frenchHelloWorld =
            frenchTool.get("hello.whoever").insert(frenchTool.get("world"));
        assertStringEquals("Bonjour Monde!", frenchHelloWorld);
    }
View Full Code Here

        assertNotNull(numberTool);
//        assertEquals()
    }

    public @Test void testResourceTool() {
        ResourceTool textTool = (ResourceTool)toolbox.get("text");
        assertNotNull(textTool);

        ResourceTool.Key foo = textTool.get("foo");
        assertEquals("bar", foo.toString());

        ResourceTool.Key frenchFoo = foo.locale(Locale.FRENCH);
        assertEquals("barre", frenchFoo.toString());

        ResourceTool.Key otherFoo = foo.bundle("resources2");
        assertEquals("woogie", otherFoo.toString());

        ResourceTool.Key helloWhoever = textTool.get("hello").get("whoever");
        assertEquals("Hello {0}!", helloWhoever.toString());

        ResourceTool.Key helloWorld = helloWhoever.insert(textTool.get("world"));
        assertEquals("Hello World!", helloWorld.toString());

        ResourceTool.Key halfFrenchHelloWorld = helloWorld.locale(Locale.FRENCH);
        assertEquals("Bonjour World!", halfFrenchHelloWorld.toString());

        ResourceTool.Key frenchTool = textTool.locale(Locale.FRENCH);
        ResourceTool.Key frenchHelloWorld =
            frenchTool.get("hello.whoever").insert(frenchTool.get("world"));
        assertEquals("Bonjour Monde!", frenchHelloWorld.toString());
    }
View Full Code Here

        assertNotNull(numberTool);
//        assertEquals()
    }

    public @Test void testResourceTool() {
        ResourceTool textTool = (ResourceTool)toolbox.get("text");
        assertNotNull(textTool);

        ResourceTool.Key foo = textTool.get("foo");
        assertStringEquals("bar", foo);

        ResourceTool.Key frenchFoo = foo.locale(Locale.FRENCH);
        assertStringEquals("barre", frenchFoo);

        ResourceTool.Key otherFoo = foo.bundle("resources2");
        assertStringEquals("woogie", otherFoo);

        ResourceTool.Key helloWhoever = textTool.get("hello").get("whoever");
        assertStringEquals("Hello {0}!", helloWhoever);

        ResourceTool.Key helloWorld = helloWhoever.insert(textTool.get("world"));
        assertStringEquals("Hello World!", helloWorld);

        ResourceTool.Key halfFrenchHelloWorld = helloWorld.locale(Locale.FRENCH);
        assertStringEquals("Bonjour World!", halfFrenchHelloWorld);

        ResourceTool.Key frenchTool = textTool.locale(Locale.FRENCH);
        ResourceTool.Key frenchHelloWorld =
            frenchTool.get("hello.whoever").insert(frenchTool.get("world"));
        assertStringEquals("Bonjour Monde!", frenchHelloWorld);
    }
View Full Code Here

        assertNotNull(numberTool);
//        assertEquals()
    }

    public @Test void testResourceTool() {
        ResourceTool textTool = (ResourceTool)toolbox.get("text");
        assertNotNull(textTool);

        ResourceTool.Key foo = textTool.get("foo");
        assertStringEquals("bar", foo);

        ResourceTool.Key frenchFoo = foo.locale(Locale.FRENCH);
        assertStringEquals("barre", frenchFoo);

        ResourceTool.Key otherFoo = foo.bundle("resources2");
        assertStringEquals("woogie", otherFoo);

        ResourceTool.Key helloWhoever = textTool.get("hello").get("whoever");
        assertStringEquals("Hello {0}!", helloWhoever);

        ResourceTool.Key helloWorld = helloWhoever.insert(textTool.get("world"));
        assertStringEquals("Hello World!", helloWorld);

        ResourceTool.Key halfFrenchHelloWorld = helloWorld.locale(Locale.FRENCH);
        assertStringEquals("Bonjour World!", halfFrenchHelloWorld);

        ResourceTool.Key frenchTool = textTool.locale("fr");
        ResourceTool.Key frenchHelloWorld =
            frenchTool.get("hello.whoever").insert(frenchTool.get("world"));
        assertStringEquals("Bonjour Monde!", frenchHelloWorld);
    }
View Full Code Here

        assertNotNull(numberTool);
//        assertEquals()
    }

    public @Test void testResourceTool() {
        ResourceTool textTool = (ResourceTool)toolbox.get("text");
        assertNotNull(textTool);

        List<String> keys = textTool.getKeys();
        assertTrue(keys.contains("foo"));
        assertTrue(keys.contains("hello.whoever"));
        assertTrue(keys.contains("world"));

        keys = textTool.get("hello").getKeys();
        assertTrue(keys.contains("whoever"));
        assertFalse(keys.contains("foo"));

        ResourceTool.Key foo = textTool.get("foo");
        assertStringEquals("bar", foo);

        ResourceTool.Key frenchFoo = foo.locale(Locale.FRENCH);
        assertStringEquals("barre", frenchFoo);

        ResourceTool.Key otherFoo = foo.bundle("resources2");
        assertStringEquals("woogie", otherFoo);

        ResourceTool.Key helloWhoever = textTool.get("hello").get("whoever");
        assertStringEquals("Hello {0}!", helloWhoever);

        ResourceTool.Key helloWorld = helloWhoever.insert(textTool.get("world"));
        assertStringEquals("Hello World!", helloWorld);

        ResourceTool.Key halfFrenchHelloWorld = helloWorld.locale(Locale.FRENCH);
        assertStringEquals("Bonjour World!", halfFrenchHelloWorld);

        ResourceTool.Key frenchTool = textTool.locale("fr");
        ResourceTool.Key frenchHelloWorld =
            frenchTool.get("hello.whoever").insert(frenchTool.get("world"));
        assertStringEquals("Bonjour Monde!", frenchHelloWorld);
    }
View Full Code Here

TOP

Related Classes of org.apache.velocity.tools.generic.ResourceTool

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.