Package org.apache.hivemind.internal

Examples of org.apache.hivemind.internal.Module


    /**
     * Test that BuilderFactory will invoke the "initializeService" method by default.
     */
    public void testAutowireInitializer()
    {
        Module module = newModule();
        ServiceImplementationFactoryParameters fp = newParameters();
        Log log = newLog();

        trainGetLog(fp, log);
        trainGetServiceId(fp, "foo");
View Full Code Here


     * Test that BuilderFactory will invoke the named initializer.
     */
    public void testInitializer()
    {
        ServiceImplementationFactoryParameters fp = newParameters();
        Module module = newModule();
        Log log = newLog();

        trainGetLog(fp, log);
        trainGetServiceId(fp, "foo");
        trainGetInvokingModule(fp, module);
View Full Code Here

    }

    public void testAutowireServices()
    {
        ServiceImplementationFactoryParameters fp = newParameters();
        Module module = newModule();
        Log log = newLog();

        trainGetLog(fp, log);
        trainGetServiceId(fp, "foo");
        trainGetInvokingModule(fp, module);
        trainResolveType(
                module,
                "hivemind.test.services.ServiceAutowireTarget",
                ServiceAutowireTarget.class);

        final StringHolder h = new StringHolderImpl();
       
        Autowiring autowiring = new Autowiring() {

            public Object autowireProperties(Object target, String[] propertyNames)
            {
                return null;
            }

            public Object autowireProperties(Object target)
            {
                return null;
            }

            public Object autowireProperties(String strategy, Object target, String[] propertyNames)
            {
                ((ServiceAutowireTarget) target).setStringHolder(h);
                return target;
            }

            public Object autowireProperties(String strategy, Object target)
            {
                return null;
            }};

        module.getService(HiveMind.AUTOWIRING_SERVICE, Autowiring.class);
        setReturnValue(module, autowiring);

        replayControls();

        BuilderParameter parameter = new BuilderParameter();
View Full Code Here

    }

    public void testAutowireConstructor() throws Exception
    {
        ServiceImplementationFactoryParameters fp = newParameters();
        Module module = newModule();
        Log log = newLog();

        trainGetLog(fp, log);
        trainGetServiceId(fp, "foo");
View Full Code Here

    }

    public void testAutowireConstructorFailure() throws Exception
    {
        ServiceImplementationFactoryParameters fp = newParameters();
        Module module = newModule();
        Log log = newLog();

        trainGetLog(fp, log);
        trainGetServiceId(fp, "foo");
View Full Code Here

public class TestConfigurationTranslator extends XmlTestCase
{

    public void testNull()
    {
        Module m = (Module) newMock(Module.class);

        replayControls();
        ConfigurationTranslator t = new ConfigurationTranslator();

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

    }

    private Module getModule()
    {
        MockControl c = newControl(Module.class);
        Module result = (Module) c.getMock();

        result.getModuleId();
        c.setReturnValue("foo.bar");

        return result;
    }
View Full Code Here

        return result;
    }

    public void testNonNullId()
    {
        Module m = getModule();

        replayControls();

        Translator t = new QualifiedIdTranslator();
View Full Code Here

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

    public void testNonNullList()
    {
        Module m = getModule();

        replayControls();

        Translator t = new IdListTranslator();
View Full Code Here

        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();
View Full Code Here

TOP

Related Classes of org.apache.hivemind.internal.Module

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.