Package org.apache.hivemind.schema

Examples of org.apache.hivemind.schema.Translator


        // The cache is preloaded with the hardcoded translators.

        if (!_translatorsLoaded && !_translatorsCache.containsKey(constructor))
            loadTranslators();

        Translator result = (Translator) _translatorsCache.get(constructor);

        if (result == null)
        {
            result = constructTranslator(constructor);
            _translatorsCache.put(constructor, result);
View Full Code Here


                continue;
            }

            locations.put(name, c.getLocation());

            Translator t = c.getTranslator();

            if (t != null)
            {
                _translatorsCache.put(name, t);
                continue;
View Full Code Here

    {
        MockControl moduleControl = newControl(Module.class);
        Module module = (Module) moduleControl.getMock();

        MockControl translatorControl = newControl(Translator.class);
        Translator translator = (Translator) translatorControl.getMock();

        MockControl paramsControl = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters params = (ServiceImplementationFactoryParameters) paramsControl
                .getMock();

        BuilderPropertyFacet facet = new BuilderPropertyFacet();

        facet.setTranslator("foo");
        facet.setValue("bar");

        params.getInvokingModule();
        paramsControl.setDefaultReturnValue(module);

        module.getTranslator("foo");
        moduleControl.setDefaultReturnValue(translator);

        translator.translate(module, Object.class, "bar", null);
        translatorControl.setReturnValue("BAR");

        replayControls();

        facet.isAssignableToType(params, Object.class);
View Full Code Here

    {
        MockControl moduleControl = newControl(Module.class);
        Module module = (Module) moduleControl.getMock();

        MockControl translatorControl = newControl(Translator.class);
        Translator translator = (Translator) translatorControl.getMock();

        MockControl paramsControl = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters params = (ServiceImplementationFactoryParameters) paramsControl
                .getMock();

        BuilderPropertyFacet facet = new BuilderPropertyFacet();

        facet.setTranslator("foo");
        facet.setValue("bar");

        params.getInvokingModule();
        paramsControl.setDefaultReturnValue(module);

        module.getTranslator("foo");
        moduleControl.setDefaultReturnValue(translator);

        translator.translate(module, Object.class, "bar", null);
        ApplicationRuntimeException exception = new ApplicationRuntimeException("");
        translatorControl.setThrowable(exception);

        replayControls();
View Full Code Here

*/
public class TestIdTranslators extends HiveMindTestCase
{
    public void testNullId()
    {
        Translator t = new QualifiedIdTranslator();

        assertNull(t.translate(null, null, null));
    }
View Full Code Here

    {
        Module m = getModule();

        replayControls();

        Translator t = new QualifiedIdTranslator();

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

        verifyControls();
    }
View Full Code Here

        verifyControls();
    }

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

        assertEquals(null, t.translate(null, null, null));
    }
View Full Code Here

    {
        Module m = getModule();

        replayControls();

        Translator t = new IdListTranslator();

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

        verifyControls();
    }
View Full Code Here

*/
public class TestBeanTranslator extends HiveMindTestCase
{
    public void testNullInput()
    {
        Translator t = new BeanTranslator();

        assertNull(t.translate(null, null, null));
    }
View Full Code Here

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

    public void testNoServiceId()
    {
        Translator t = new BeanTranslator();

        try
        {
            t.translate(null, null, "foo");
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertEquals(
View Full Code Here

TOP

Related Classes of org.apache.hivemind.schema.Translator

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.