Package org.apache.hivemind

Examples of org.apache.hivemind.ServiceImplementationFactoryParameters


     * Test that BuilderFactory will invoke the named initializer.
     */
    public void testInitializer()
    {
        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

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

        Log log = (Log) newMock(Log.class);

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo");

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.resolveType("hivemind.test.services.InitializeFixture");
        c.setReturnValue(InitializeFixture.class);

View Full Code Here


    }

    public void testAutowireServices()
    {
        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

        MockControl mc = newControl(Module.class);
        Module module = (Module) mc.getMock();

        MockControl lc = newControl(Log.class);
        Log log = (Log) lc.getMock();

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo");

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.resolveType("hivemind.test.services.ServiceAutowireTarget");
        mc.setReturnValue(ServiceAutowireTarget.class);
View Full Code Here

    }

    public void testAutowireServicesFailure()
    {
        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

        MockControl mc = newControl(Module.class);
        Module module = (Module) mc.getMock();

        MockControl ehc = newControl(ErrorHandler.class);
        ErrorHandler eh = (ErrorHandler) ehc.getMock();

        Log log = (Log) newMock(Log.class);

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo.bar");

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.resolveType("hivemind.test.services.ServiceAutowireTarget");
        mc.setReturnValue(ServiceAutowireTarget.class);
View Full Code Here

    }

    public void testAutowireConstructor() throws Exception
    {
        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

        MockControl mc = newControl(Module.class);
        Module module = (Module) mc.getMock();

        MockControl lc = newControl(Log.class);
        Log log = (Log) lc.getMock();

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo");

        fp.getInvokingModule();
        fpc.setReturnValue(module, MockControl.ONE_OR_MORE);

        ClassResolver classResolver = new DefaultClassResolver();

        module.resolveType("hivemind.test.services.ConstructorAutowireTarget");
View Full Code Here

    }

    public void testAutowireConstructorFailure() throws Exception
    {
        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

        MockControl mc = newControl(Module.class);
        Module module = (Module) mc.getMock();

        MockControl lc = newControl(Log.class);
        Log log = (Log) lc.getMock();

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo");

        fp.getInvokingModule();
        fpc.setReturnValue(module, MockControl.ONE_OR_MORE);

        module.resolveType("hivemind.test.services.ConstructorAutowireTarget");
        mc.setReturnValue(ConstructorAutowireTarget.class);
View Full Code Here

    public void testErrorInInitializer() throws Exception
    {
        Location l = fabricateLocation(17);

        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

        Log log = (Log) newMock(Log.class);

        MockControl mc = newControl(Module.class);
        Module module = (Module) mc.getMock();

        MockControl errorLogc = newControl(ErrorLog.class);
        ErrorLog errorLog = (ErrorLog) errorLogc.getMock();

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo.Bar");

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.resolveType("org.apache.hivemind.service.impl.InitializerErrorRunnable");
        mc.setReturnValue(InitializerErrorRunnable.class);

        fp.getErrorLog();
        fpc.setReturnValue(errorLog);

        Throwable cause = new ApplicationRuntimeException("Failure in initializeService().");

        String message = ServiceMessages.unableToInitializeService(
View Full Code Here

        Module m = (Module) c.getMock();

        ErrorHandler eh = (ErrorHandler) newMock(ErrorHandler.class);

        MockControl pc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters p = (ServiceImplementationFactoryParameters) pc
                .getMock();

        p.getInvokingModule();
        pc.setReturnValue(m);

        m.getErrorHandler();
        c.setReturnValue(eh);
View Full Code Here

    public void testBuilderClassResolverFacet()
    {
        ClassResolver cr = (ClassResolver) newMock(ClassResolver.class);

        MockControl pc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters p = (ServiceImplementationFactoryParameters) pc
                .getMock();

        MockControl control = newControl(Module.class);
        Module module = (Module) control.getMock();

        p.getInvokingModule();
        pc.setReturnValue(module);

        module.getClassResolver();
        control.setReturnValue(cr);
View Full Code Here

    }

    public void testAutowire()
    {
        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

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

        ErrorHandler eh = (ErrorHandler) newMock(ErrorHandler.class);
        ClassResolver cr = new DefaultClassResolver();

        MockControl logc = newControl(Log.class);
        Log log = (Log) logc.getMock();

        MockControl messagesControl = newControl(Messages.class);
        Messages messages = (Messages) messagesControl.getMock();

        ErrorLog errorLog = (ErrorLog) newMock(ErrorLog.class);

        // Normally I try and get all the invocations into chronological
        // order ... but with this refactoring, that's painful; these
        // are in an order that appeases junit.

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo.bar.Baz");

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.resolveType("hivemind.test.services.AutowireTarget");
        c.setReturnValue(AutowireTarget.class);

        fp.getLog();
        fpc.setReturnValue(log);

        debug(fpc, fp, logc, log, "Autowired property log to " + log);

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.getClassResolver();
        c.setReturnValue(cr);

        debug(fpc, fp, logc, log, "Autowired property classResolver to " + cr);

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.getMessages();
        c.setReturnValue(messages);

        debug(fpc, fp, logc, log, "Autowired property messages to " + messages);

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.getErrorHandler();
        c.setReturnValue(eh);

        debug(fpc, fp, logc, log, "Autowired property errorHandler to " + eh);

        fp.getServiceId();
        fpc.setReturnValue("foo.bar.Baz");

        debug(fpc, fp, logc, log, "Autowired property serviceId to foo.bar.Baz");

        fp.getErrorLog();
        fpc.setReturnValue(errorLog);

        debug(fpc, fp, logc, log, "Autowired property errorLog to " + errorLog);

        replayControls();
View Full Code Here

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

        MockControl fpc = newControl(ServiceImplementationFactoryParameters.class);
        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) fpc
                .getMock();

        Log log = (Log) newMock(Log.class);

        fp.getLog();
        fpc.setReturnValue(log);

        fp.getServiceId();
        fpc.setReturnValue("foo");

        fp.getInvokingModule();
        fpc.setReturnValue(module);

        module.resolveType("hivemind.test.services.InitializeFixture");
        c.setReturnValue(InitializeFixture.class);
View Full Code Here

TOP

Related Classes of org.apache.hivemind.ServiceImplementationFactoryParameters

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.