Package org.apache.hivemind

Examples of org.apache.hivemind.ServiceImplementationFactoryParameters


    {
        setupFactoryAndParameters(context.getServicePoint(), context.getDefiningModule());

        try
        {
            ServiceImplementationFactoryParameters factoryParameters = new ServiceImplementationFactoryParametersImpl(
                    context.getServicePoint(), context.getDefiningModule(), _convertedParameters);

            return _factory.createCoreServiceImplementation(factoryParameters);
        }
        catch (Exception ex)
View Full Code Here


    {
        SpringLookupFactory lf = new SpringLookupFactory();

        BeanFactory beanFactory = (BeanFactory) newMock(BeanFactory.class);

        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) newMock(ServiceImplementationFactoryParameters.class);

        lf.setDefaultBeanFactory(beanFactory);

        SpringBeanParameter param = buildParameter("fred", null);

        Object fred = new Object();

        beanFactory.getBean("fred", List.class);
        setReturnValue(beanFactory, fred);

        fp.getFirstParameter();
        setReturnValue(fp, param);

        fp.getServiceInterface();
        setReturnValue(fp, List.class);

        replayControls();

        Object actual = lf.createCoreServiceImplementation(fp);
View Full Code Here

    public void testBeanSpecificFactory()
    {
        SpringLookupFactory lf = new SpringLookupFactory();
        BeanFactory beanFactory = (BeanFactory) newMock(BeanFactory.class);

        ServiceImplementationFactoryParameters fp = (ServiceImplementationFactoryParameters) newMock(ServiceImplementationFactoryParameters.class);

        SpringBeanParameter param = buildParameter("fred", beanFactory);

        Object fred = new Object();

        beanFactory.getBean("fred", List.class);
        setReturnValue(beanFactory, fred);

        fp.getFirstParameter();
        setReturnValue(fp, param);

        fp.getServiceInterface();
        setReturnValue(fp, List.class);

        replayControls();

        Object actual = lf.createCoreServiceImplementation(fp);
View Full Code Here

    }

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

        PlaceholderFactory db = new PlaceholderFactory();

        db.setBuilder(_builder);

        fp.getServiceInterface();
        fpc.setReturnValue(Runnable.class);

        replayControls();

        Runnable r = (Runnable) db.createCoreServiceImplementation(fp);
View Full Code Here

    }

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

        ClassFactory cf = new ClassFactoryImpl();
        DefaultImplementationBuilderImpl dib = new DefaultImplementationBuilderImpl();

        dib.setClassFactory(cf);

        PipelineFactory factory = new PipelineFactory();
        factory.setClassFactory(cf);
        factory.setDefaultImplementationBuilder(dib);
        factory.setErrorLog(newErrorLog());

        PipelineParameters pp = new PipelineParameters();
        pp.setFilterInterface(StandardFilter.class);
        pp.setTerminator(new StandardInner("terminator"));

        List l = new ArrayList();

        FilterContribution fc = new FilterContribution();
        fc.setFilter(new StandardFilterImpl());
        fc.setName("multiplier-filter");

        l.add(fc);

        pp.setPipelineConfiguration(l);

        fp.getParameters();
        fpc.setReturnValue(Collections.singletonList(pp));

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

        fp.getServiceInterface();
        fpc.setReturnValue(StandardService.class);

        replayControls();

        StandardService s = (StandardService) factory.createCoreServiceImplementation(fp);
View Full Code Here

    }

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

        ClassFactory cf = new ClassFactoryImpl();
        DefaultImplementationBuilderImpl dib = new DefaultImplementationBuilderImpl();

        dib.setClassFactory(cf);

        PipelineFactory factory = new PipelineFactory();
        factory.setClassFactory(cf);
        factory.setDefaultImplementationBuilder(dib);
        factory.setErrorLog(newErrorLog());

        PipelineParameters pp = new PipelineParameters();
        pp.setFilterInterface(StandardFilter.class);

        List l = new ArrayList();

        FilterContribution fc = new FilterContribution();
        fc.setFilter(new StandardFilterImpl());
        fc.setName("multiplier-filter");

        l.add(fc);

        TerminatorContribution tc = new TerminatorContribution();
        tc.setTerminator(new StandardServiceImpl());

        l.add(tc);

        pp.setPipelineConfiguration(l);

        fp.getParameters();
        fpc.setReturnValue(Collections.singletonList(pp));

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

        fp.getServiceInterface();
        fpc.setReturnValue(StandardService.class);

        replayControls();

        StandardService s = (StandardService) factory.createCoreServiceImplementation(fp);
View Full Code Here

        List l = Collections.singletonList(build("integer", Integer.class));

        p.setContributions(l);

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

        fp.getParameters();
        fpc.setReturnValue(Collections.singletonList(p));

        fp.getErrorLog();
        fpc.setReturnValue(newMock(ErrorLog.class));

        replayControls();

        BeanFactoryBuilder b = new BeanFactoryBuilder();
View Full Code Here

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

        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

        List l = Collections.singletonList(build("integer", Integer.class));

        p.setContributionsList(l);

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

        fp.getFirstParameter();
        fpc.setReturnValue(p);

        fp.getErrorLog();
        fpc.setReturnValue(newMock(ErrorLog.class));

        replayControls();

        BeanFactoryBuilder b = new BeanFactoryBuilder();
View Full Code Here

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

        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

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.