Package org.impalaframework.module.spi

Examples of org.impalaframework.module.spi.Application


    public void testGetCurrentApplication() throws Exception {
        SimpleApplicationManager manager = new SimpleApplicationManager();
        ApplicationFactory applicationFactory = createMock(ApplicationFactory.class);
        manager.setApplicationFactory(applicationFactory);
       
        Application application = createMock(Application.class);
        expect(applicationFactory.newApplication(null)).andReturn(application);
       
        replay(applicationFactory);
       
        assertNull(manager.getCurrentApplication());
View Full Code Here


       
        assertNotNull(registry.getModuleLoader("spring-"+ModuleTypes.ROOT));
        assertNotNull(registry.getModuleLoader("spring-"+ModuleTypes.APPLICATION));

        ApplicationManager applicationManager = (ApplicationManager) context.getBean("applicationManager");
        Application application = applicationManager.getCurrentApplication();
       
        RootModuleDefinition definition = new Provider().getModuleDefinition();
        TransitionSet transitions = calculatorRegistry.getModificationExtractor(ModificationExtractorType.STRICT).getTransitions(application, null, definition);
        TransitionManager transitionManager = (TransitionManager) context.getBean("transitionManager");
       
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
        transitionManager.processTransitions(moduleStateHolder, application, transitions);

        ConfigurableApplicationContext parentContext = SpringModuleUtils.getRootSpringContext(moduleStateHolder);
        FileMonitor bean = (FileMonitor) parentContext.getBean("bean1");
        bean.lastModified((File) null);
View Full Code Here

    }

    public void testGraph() throws Exception {
   
        Impala.init(this);
        Application application = Impala.getCurrentApplication();
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
        Map<String, RuntimeModule> moduleContexts = moduleStateHolder.getRuntimeModules();
        System.out.println(moduleContexts);
        assertEquals(5, moduleContexts.size());
        assertNotNull(moduleContexts.get("impala-core"));
        assertNotNull(moduleContexts.get("sample-module2"));
View Full Code Here

    public void testInit() {

        final Test1 test1 = new Test1();
        Impala.init(test1);
       
        final Application currentApplication = Impala.getCurrentApplication();
        ModuleMetadataHelper helper = new ModuleMetadataHelper();
        helper.setApplication(currentApplication);
       
        assertTrue(helper.isModuleDefinitionPresent("impala-core"));
        assertTrue(helper.isModuleDefinitionPresent(plugin1));
View Full Code Here

                "sample-module4" };
        InternalModuleDefinitionSource moduleDefinitionSource = new InternalModuleDefinitionSource(typeReaderRegistry, resolver, moduleNames , true);

        Impala.init(moduleDefinitionSource);
       
        final Application currentApplication = Impala.getCurrentApplication();
        ModuleMetadataHelper helper = new ModuleMetadataHelper();
        helper.setApplication(currentApplication);
       
        Collection<String> capabilities = helper.getCapabilities();
        System.out.println(capabilities);
View Full Code Here

        frameworkLockHolder.writeUnlock();
       
        replay(frameworkLockHolder);
       
        ModuleStateHolder moduleStateHolder = createMock(ModuleStateHolder.class);
        Application application = TestApplicationManager.newApplicationManager(null, moduleStateHolder, null).getCurrentApplication();
        operation.execute(application, null);
       
        verify(frameworkLockHolder);
    }
View Full Code Here

        SimpleApplicationFactory factory = new SimpleApplicationFactory();
        factory.setClassLoaderRegistryFactory(new SimpleClassLoaderRegistryFactory());
        factory.setServiceRegistryFactory(new SimpleServiceRegistryFactory());
        factory.setModuleStateHolderFactory(new SimpleModuleStateHolderFactory());  

        Application application = factory.newApplication(null);
        assertTrue(application instanceof ImpalaApplication);
       
        assertNotNull(application.getClassLoaderRegistry());
        assertNotNull(application.getModuleStateHolder());
        assertNotNull(application.getClassLoaderRegistry());
    }
View Full Code Here

        if (!modified.isEmpty()) {
           
            ModuleManagementFacade factory = WebServletUtils.getModuleManagementFacade(servletContext);               
            ApplicationManager applicationManager = factory.getApplicationManager();
            Application application = applicationManager.getCurrentApplication();

            for (String moduleName : modified) {

                logger.info("Processing modified module " + moduleName);
View Full Code Here

    // the superclass closes the modules
    final ServletContext servletContext = servlet.getServletContext();
    ModuleManagementFacade facade = ImpalaServletUtils.getModuleManagementFacade(servletContext);

    final String servletName = servlet.getServletName();
    Application application = facade.getApplicationManager().getCurrentApplication();
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
   
    if (!initialized) {
     
      ModuleStateChangeNotifier moduleStateChangeNotifier = facade.getModuleStateChangeNotifier();
      ModuleStateChangeListener listener = newModuleStateChangeListener(servletName);
View Full Code Here

        // add items to servlet context
        servletContext.setAttribute(WebConstants.MODULE_DEFINITION_SOURCE_ATTRIBUTE, moduleDefinitionSource);
        servletContext.setAttribute(WebConstants.IMPALA_FACTORY_ATTRIBUTE, facade);

        ApplicationManager applicationManager = facade.getApplicationManager();
        Application application = applicationManager.getCurrentApplication();
       
        ModuleOperationInput input = new ModuleOperationInput(moduleDefinitionSource, null, null);
        ModuleOperation operation = facade.getModuleOperationRegistry().getOperation(ModuleOperationConstants.UpdateRootModuleOperation);      
        operation.execute(application, input);

        ConfigurableApplicationContext context = SpringModuleUtils.getRootSpringContext(application.getModuleStateHolder());

        if (context == null) {
            throw new InvalidStateException("Root application context is null");
        }
       
View Full Code Here

TOP

Related Classes of org.impalaframework.module.spi.Application

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.