Package org.richfaces.application

Examples of org.richfaces.application.ServicesFactoryImpl


        EasyMock.expect(mockedCodec.decodeResource(EasyMock.<FacesContext>notNull(), EasyMock.eq("StateHolderResource")))
            .andReturn(resourceCodecData);
        EasyMock.replay(mockedCodec, resourceCodecData, mockCache);

        ServicesFactoryImpl injector = new ServicesFactoryImpl();
        injector.init(Collections.<Module>singletonList(new Module() {
            public void configure(ServicesFactory injector) {
                injector.setInstance(ResourceCodec.class, mockedCodec);
                injector.setInstance(org.richfaces.cache.Cache.class, mockCache);
                injector.setInstance(Uptime.class, new Uptime());
                injector.setInstance(DependencyInjector.class, new DependencyInjectorImpl());
                injector.setInstance(ConfigurationService.class, new ConfigurationServiceImpl());
            }
        }));
        ServiceTracker.setFactory(injector);

        WebRequest webRequest = new WebRequest(new URL("http://localhost/rfRes/StateHolderResource.jsf?db=1"));
View Full Code Here


        EasyMock.expect(resourceCodec.encodeJSFMapping(EasyMock.same(facesContext), EasyMock.eq("/rfRes/Resource2/4_0_alpha")))
            .andReturn("/rfRes/Resource2/4_0_alpha.jsf");

        EasyMock.replay(resourceCodec);
        ServicesFactoryImpl injector = new ServicesFactoryImpl();
        injector.init(Collections.<Module>singletonList(new Module() {
            public void configure(ServicesFactory injector) {
                injector.setInstance(ResourceCodec.class, resourceCodec);
                injector.setInstance(Uptime.class, new Uptime());
            }
        }));
        ServiceTracker.setFactory(injector);

        MockStateAwareResourceImpl stateAwareResourceImpl = new MockStateAwareResourceImpl();
View Full Code Here

        this.resourceHandler = resourceHandler;
    }

    public void start() {

        final ServicesFactoryImpl serviceFactory = new ServicesFactoryImpl();
        Module module = new Module() {
            public void configure(ServicesFactory factory) {
                factory.setInstance(ConfigurationService.class, new ConfigurationServiceImpl());
                factory.setInstance(SkinFactory.class, new SkinFactoryImpl());
                factory.setInstance(FileNameMapper.class, fileNameMapper);
                factory.setInstance(DependencyInjector.class, new DependencyInjectorImpl());
                factory.setInstance(ResourceHandler.class, resourceHandler);
                factory.setInstance(ResourceTracker.class, new ResourceTrackerImpl());
                factory.setInstance(MappedResourceFactory.class, new NullMappedResourceFactory());
            }
        };

        ServiceTracker.setFactory(serviceFactory);

        // initialization with FacesContext available
        startRequest();
        serviceFactory.init(Collections.singleton(module));
        stopRequest();
    }
View Full Code Here

     * Fake {@link ServiceFactoryModule} is used for this purpose.
     *
     * @throws IllegalStateException when initialization fails
     */
    private void initializeServiceTracker() {
        ServicesFactoryImpl servicesFactory = new ServicesFactoryImpl();
        ServiceTracker.setFactory(servicesFactory);

        ArrayList<Module> modules = new ArrayList<Module>();
        modules.add(new ServiceFactoryModule());
//        try {
//            modules.addAll(ServiceLoader.loadServices(Module.class));
//        } catch (ServiceException e) {
//            throw new IllegalStateException(e);
//        }
        servicesFactory.init(modules);
    }
View Full Code Here

     * Fake {@link ServiceFactoryModule} is used for this purpose.
     *
     * @throws IllegalStateException when initialization fails
     */
    private void initializeServiceTracker() {
        ServicesFactoryImpl servicesFactory = new ServicesFactoryImpl();
        ServiceTracker.setFactory(servicesFactory);

        ArrayList<Module> modules = new ArrayList<Module>();
        modules.add(new ServiceFactoryModule());
        // try {
        // modules.addAll(ServiceLoader.loadServices(Module.class));
        // } catch (ServiceException e) {
        // throw new IllegalStateException(e);
        // }
        servicesFactory.init(modules);
    }
View Full Code Here

public abstract class AbstractServicesTest {

    @Before
    public void setupServiceTracker() {
        ServicesFactoryImpl injector = new ServicesFactoryImpl();
        ServiceTracker.setFactory(injector);
        injector.init(Collections.<Module>singletonList(new Module() {
            public void configure(ServicesFactory injector) {
                configureServices(injector);
            }
        }));
    }
View Full Code Here

TOP

Related Classes of org.richfaces.application.ServicesFactoryImpl

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.