Package org.impalaframework.module.spi

Examples of org.impalaframework.module.spi.TransitionSet


        definition.findChildDefinition("plugin3", true).setState(ModuleState.DEPENDENCY_FAILED);
        definition.findChildDefinition("plugin4", true).setState(ModuleState.DEPENDENCY_FAILED);
       
        Application application = TestApplicationManager.newApplicationManager().getCurrentApplication();
       
        TransitionSet transitions = new RepairModificationExtractor().getTransitions(application, definition, null);
        assertEquals(definition, transitions.getNewRootModuleDefinition());
       
        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
        assertEquals(3, moduleTransitions.size());
    }
View Full Code Here


    public void testGetTransitions() {
        GraphModificationExtractorDelegate delegate = new GraphModificationExtractorDelegate();
        SimpleRootModuleDefinition rootDefinitionOld = rootDefinition("orig");
        SimpleRootModuleDefinition rootDefinitionNew = rootDefinition("new");
        TransitionSet transitions = delegate.getTransitions(application, rootDefinitionOld, rootDefinitionNew);
        assertEquals(2, transitions.getModuleTransitions().size());
       
        assertNotNull(delegate.getNewDependencyManager());
        assertNotNull(delegate.getOldDependencyManager());
    }
View Full Code Here

        expect(moduleRuntimeManager.initModule(application, rootModuleDefinition)).andReturn(true);
       
        replayMocks();
       
        Set<ModuleStateChange> singleton = Collections.singleton(moduleStateChange);
        TransitionSet transitionSet = new TransitionSet(singleton, rootModuleDefinition);
        transitionManager.processTransitions(moduleStateHolder, application, transitionSet);
        verifyMocks();
    }
View Full Code Here

        ApplicationManager applicationManager = TestApplicationManager.newApplicationManager(new ModuleClassLoaderRegistry(), moduleStateHolder, new DelegatingServiceRegistry());
        Application application = applicationManager.getCurrentApplication();
       
        RootModuleDefinition test1Definition = newTest1().getModuleDefinition();
        ModificationExtractor calculator = new StrictModificationExtractor();
        TransitionSet transitions = calculator.getTransitions(application, null, test1Definition);
       
        transitionManager.processTransitions(moduleStateHolder, application, transitions);

        ConfigurableApplicationContext context = SpringModuleUtils.getRootSpringContext(moduleStateHolder);
        service((FileMonitor) context.getBean("bean1"));
View Full Code Here

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

        expect(moduleDefinitionSource.getModuleDefinition()).andReturn(originalDefinition);
       
        SimpleRootModuleDefinition definition = new SimpleRootModuleDefinition("root", "config");
        definition.freeze();
       
        TransitionSet set = new TransitionSet(new ArrayList<ModuleStateChange>(), definition);
        expect(moduleStateHolder.cloneRootModuleDefinition()).andReturn(definition);
       
        expect(repairModificationExtractor.getTransitions(application, isA(RootModuleDefinition.class), isA(RootModuleDefinition.class))).andReturn(set);
   
        transitionManager.processTransitions(eq(moduleStateHolder), application, isA(TransitionSet.class));
View Full Code Here

    public final void testCheckFreezeUnfreeze() {
        RootModuleDefinition parentSpec1 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2, plugin3");
        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");

        ModificationExtractor calculator = new StrictModificationExtractor();
        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        RootModuleDefinition newRoot = transitions.getNewRootModuleDefinition();
       
        ModuleDefinitionWalker.walkRootDefinition(newRoot, new ModuleDefinitionCallback(){

            public boolean matches(ModuleDefinition moduleDefinition) {
                assertTrue(moduleDefinition.isFrozen());
View Full Code Here

        ModuleDefinition plugin4 = new SimpleModuleDefinition(plugin2, "plugin4");
        new SimpleModuleDefinition(plugin4, "plugin5");
        new SimpleModuleDefinition(plugin4, "plugin6");

        ModificationExtractor calculator = new StrictModificationExtractor();
        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
       
        Iterator<? extends ModuleStateChange> iterator = doAssertions(transitions, 4);
       
        ModuleStateChange change3 = iterator.next();
        assertEquals("plugin3", change3.getModuleDefinition().getName());
        assertEquals(Transition.LOADED_TO_UNLOADED, change3.getTransition());
       
        //now show that the sticky calculator has the same set of changes, but omits the last one
        ModificationExtractor stickyCalculator = new StickyModificationExtractor();
        TransitionSet stickyTransitions = stickyCalculator.getTransitions(application, parentSpec1, parentSpec2);
        doAssertions(stickyTransitions, 3);
    }
View Full Code Here

        RootModuleDefinition parentSpec1 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2, plugin4");
        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2, plugin3");

        //now show that the sticky calculator has the same set of changes, but omits the last one
        ModificationExtractor stickyCalculator = new StickyModificationExtractor();
        TransitionSet stickyTransitions = stickyCalculator.getTransitions(application, parentSpec1, parentSpec2);
       
        Collection<? extends ModuleStateChange> moduleTransitions = stickyTransitions.getModuleTransitions();
        assertEquals(1, moduleTransitions.size());
       
        Iterator<? extends ModuleStateChange> iterator = moduleTransitions.iterator();

        ModuleStateChange first = iterator.next();
        assertEquals(Transition.UNLOADED_TO_LOADED, first.getTransition());
        assertEquals("plugin3", first.getModuleDefinition().getName());
       
        RootModuleDefinition newSpec = stickyTransitions.getNewRootModuleDefinition();
        Collection<String> moduleNames = newSpec.getChildModuleNames();
        assertEquals(4, moduleNames.size());
        assertNotNull(newSpec.getChildModuleDefinition("plugin1"));
        assertNotNull(newSpec.getChildModuleDefinition("plugin2"));
        assertNotNull(newSpec.getChildModuleDefinition("plugin3"));
View Full Code Here

        }
    }

    public void testGetSimpleTransitions() {
        RootModuleDefinition rootModuleDefinition = ModificationTestUtils.spec("app-context.xml", "plugin1, plugin2");
        TransitionSet transitionsFromOriginal = calculator.getTransitions(application, rootModuleDefinition, null);
        assertEquals(null, transitionsFromOriginal.getNewRootModuleDefinition());

        TransitionSet transitionsToNew = calculator.getTransitions(application, null, rootModuleDefinition);
        assertEquals(rootModuleDefinition, transitionsToNew.getNewRootModuleDefinition());
    }
View Full Code Here

TOP

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

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.