Package org.apache.hivemind.schema.rules

Examples of org.apache.hivemind.schema.rules.InstanceTranslator


        // processing of the hivemind.Translators configuration point.

        _translatorsCache.put("class", new ClassTranslator());
        _translatorsCache.put("service", new ServiceTranslator());
        _translatorsCache.put("smart", new SmartTranslator());
        _translatorsCache.put("instance", new InstanceTranslator());

        // smart may take an initializer, so we need to put it into the classes as
        // well.

        _translatorClasses.put("smart", SmartTranslator.class);
View Full Code Here


public class TestInstanceTranslator extends XmlTestCase
{

    public void testNull()
    {
        InstanceTranslator t = new InstanceTranslator();

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

        return (Module) newMock(Module.class);
    }

    public void testBadClass() throws Exception
    {
        InstanceTranslator t = new InstanceTranslator();
        ElementImpl e = new ElementImpl();
        Location l = new LocationImpl(getResource("TestInstanceTranslator.class"), 50);
        e.setLocation(l);

        Module m = newModule();

        m.resolveType("bad.class.Name");
        ApplicationRuntimeException cause = new ApplicationRuntimeException("failure");
        setThrowable(m, cause);

        replayControls();

        try
        {
            t.translate(m, null, "bad.class.Name", null);
        }
        catch (ApplicationRuntimeException ex)
        {
            assertSame(cause, ex);
        }
View Full Code Here

        verifyControls();
    }

    public void testInitializer() throws Exception
    {
        InstanceTranslator t = new InstanceTranslator();

        Module m = newModule();

        m.resolveType("Bean");
        setReturnValue(m, IntHolder.class);

        replayControls();

        IntHolder ih = (IntHolder) t.translate(m, Object.class, "Bean,value=37", null);

        assertEquals(37, ih.getValue());

        verifyControls();
    }
View Full Code Here

        verifyControls();
    }

    public void testPrivateObject() throws Exception
    {
        InstanceTranslator t = new InstanceTranslator();
        ElementImpl e = new ElementImpl();
        Location l = new LocationImpl(getResource("TestInstanceTranslator.class"), 50);
        e.setLocation(l);

        ModuleImpl m = new ModuleImpl();
        m.setClassResolver(getClassResolver());

        replayControls();

        try
        {
            t.translate(m, null, PrivateObject.class.getName(), null);
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertExceptionSubstring(
View Full Code Here

public class TestInstanceTranslator extends FrameworkTestCase
{

    public void testNull()
    {
        InstanceTranslator t = new InstanceTranslator();

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

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

    public void testBadClass() throws Exception
    {
        InstanceTranslator t = new InstanceTranslator();
        ElementImpl e = new ElementImpl();
        Location l = new LocationImpl(getResource("TestInstanceTranslator.class"), 50);
        e.setLocation(l);

        MockControl c = newControl(Module.class);
        Module m = (Module) c.getMock();

        m.resolveType("bad.class.Name");
        ApplicationRuntimeException cause = new ApplicationRuntimeException("failure");
        c.setThrowable(cause);

        replayControls();

        try
        {
            t.translate(m, null, "bad.class.Name", null);
        }
        catch (ApplicationRuntimeException ex)
        {
            assertSame(cause, ex);
        }
View Full Code Here

        verifyControls();
    }

    public void testInitializer() throws Exception
    {
        InstanceTranslator t = new InstanceTranslator();

        MockControl c = newControl(Module.class);
        Module m = (Module) c.getMock();

        m.resolveType("Bean");
        c.setReturnValue(IntHolder.class);

        replayControls();

        IntHolder ih = (IntHolder) t.translate(m, Object.class, "Bean,value=37", null);

        assertEquals(37, ih.getValue());

        verifyControls();
    }
View Full Code Here

        verifyControls();
    }

    public void testPrivateObject() throws Exception
    {
        InstanceTranslator t = new InstanceTranslator();
        ElementImpl e = new ElementImpl();
        Location l = new LocationImpl(getResource("TestInstanceTranslator.class"), 50);
        e.setLocation(l);

        ModuleImpl m = new ModuleImpl();
        m.setClassResolver(getClassResolver());

        replayControls();

        try
        {
            t.translate(m, null, PrivateObject.class.getName(), null);
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertExceptionSubstring(
View Full Code Here

        // processing of the hivemind.Translators configuration point.

        _translatorsCache.put("class", new ClassTranslator());
        _translatorsCache.put("service", new ServiceTranslator());
        _translatorsCache.put("smart", new SmartTranslator());
        _translatorsCache.put("instance", new InstanceTranslator());

        // smart may take an initializer, so we need to put it into the classes as
        // well.

        _translatorClasses.put("smart", SmartTranslator.class);
View Full Code Here

TOP

Related Classes of org.apache.hivemind.schema.rules.InstanceTranslator

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.