Package org.apache.hivemind.schema

Examples of org.apache.hivemind.schema.Translator.translate()


    public void testString()
    {
        Translator t = new SmartTranslator();

        Object result = t.translate(null, String.class, "Fluffy Puppies", null);

        assertEquals("Fluffy Puppies", result);
    }

    public void testStringWithNoEditor()
View Full Code Here


    public void testStringWithNoEditor()
    {
        PropertyEditorManager.setEditorSearchPath( new String[] { "bogus.package" } );
        Translator t = new SmartTranslator();
        Object result = t.translate(null, String.class, "Fluffy Puppies", null);
        assertEquals("Fluffy Puppies", result);
    }
   
    public void testNoEditor()
    {
View Full Code Here

        Translator t = new SmartTranslator();
        Location l = fabricateLocation(22);

        try
        {
            t.translate(null, Registry.class, "fred", l);

            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
View Full Code Here

{
    public void testNullId()
    {
        Translator t = new QualifiedIdTranslator();

        assertNull(t.translate(null, null, null, null));
    }

    private Module getModule()
    {
        MockControl c = newControl(Module.class);
View Full Code Here

        replayControls();

        Translator t = new QualifiedIdTranslator();

        assertEquals("foo.bar.Baz", t.translate(m, null, "Baz", null));

        verifyControls();
    }

    public void testNullList()
View Full Code Here

    public void testNullList()
    {
        Translator t = new IdListTranslator();

        assertEquals(null, t.translate(null, null, null, null));
    }

    public void testNonNullList()
    {
        Module m = getModule();
View Full Code Here

        replayControls();

        Translator t = new IdListTranslator();

        assertEquals("foo.bar.Baz,zip.Zap", t.translate(m, null, "Baz,zip.Zap", null));

        verifyControls();
    }
}
View Full Code Here

                    : processor.getTranslator(_translator);

            Class propertyType = PropertyUtils.getPropertyType(target, _propertyName);

            Object finalValue =
                t.translate(
                    processor.getContributingModule(),
                    propertyType,
                    value,
                    element.getLocation());
View Full Code Here

            Object target = processor.peek();

            Class propertyType = PropertyUtils.getPropertyType(target, _propertyName);

            Object finalValue =
                t.translate(
                    processor.getContributingModule(),
                    propertyType,
                    value,
                    element.getLocation());
View Full Code Here

     */
    public void testInt()
    {
        Translator t = new SmartTranslator();

        Object result = t.translate(null, int.class, "-37", null);

        assertEquals(new Integer(-37), result);
    }

    public void testNullInput()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.