Package org.impalaframework.module.spi

Examples of org.impalaframework.module.spi.ModuleStateChange


       
        ModuleStateChangeListener listener = creator.newModuleStateChangeListener("myServlet");

        replayMocks();
       
        ModuleStateChange moduleStateChange = new ModuleStateChange(Transition.UNLOADED_TO_LOADED, new SimpleModuleDefinition("myModule"));
        TransitionResult transitionResult = new TransitionResult(moduleStateChange);
       
        try {
            listener.moduleStateChanged(createMock(ModuleStateHolder.class),transitionResult);
            fail();
View Full Code Here


       
        ModuleStateChangeListener listener = creator.newModuleStateChangeListener("myServlet");

        replayMocks();
       
        ModuleStateChange moduleStateChange = new ModuleStateChange(Transition.UNLOADED_TO_LOADED, new SimpleModuleDefinition("myModule"));
        TransitionResult transitionResult = new TransitionResult(moduleStateChange, new RuntimeException());
       
        listener.moduleStateChanged(createMock(ModuleStateHolder.class),transitionResult);
       
        verifyMocks();
View Full Code Here

    public void testLoadRoot() {
       
        RootModuleDefinition rootModuleDefinition = newTest1().getModuleDefinition();
        rootModuleDefinition.freeze();
       
        ModuleStateChange moduleStateChange = new ModuleStateChange(Transition.UNLOADED_TO_LOADED, rootModuleDefinition);
       
        //expectations (round 1 - loading of parent)
        expect(moduleRuntimeManager.initModule(application, rootModuleDefinition)).andReturn(true);
       
        replayMocks();
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        notifier = new DefaultModuleStateChangeNotifier();
        change = new ModuleStateChange(Transition.UNLOADED_TO_LOADED, new SimpleModuleDefinition("myModule"));
        List<ModuleStateChangeListener> listeners = new ArrayList<ModuleStateChangeListener>();
        listener1 = createMock(ModuleStateChangeListener.class);
        listener2 = createMock(ModuleStateChangeListener.class);
        listener3 = createMock(ModuleStateChangeListener.class);
        listener4 = createMock(ModuleStateChangeListener.class);
View Full Code Here

        transitionManager.processTransitions(moduleStateHolder, application, transitionSet);
    }
   
    private TransitionResultSet newTransitionResultSet() {
        TransitionResultSet result = new TransitionResultSet();
        ModuleStateChange stateChange = new ModuleStateChange(Transition.LOADED_TO_UNLOADED, new SimpleModuleDefinition("myModule"));
        result.addResult(new TransitionResult(stateChange));
        return result;
    }
View Full Code Here

        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

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

    private Iterator<? extends ModuleStateChange> doAssertions(TransitionSet transitions, int expectedSize) {
        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
        assertEquals(expectedSize, moduleTransitions.size());
        Iterator<? extends ModuleStateChange> iterator = moduleTransitions.iterator();

        ModuleStateChange change1 = iterator.next();
        assertEquals("plugin4", change1.getModuleDefinition().getName());
        assertEquals(Transition.UNLOADED_TO_LOADED, change1.getTransition());
       
        ModuleStateChange change4 = iterator.next();
        assertEquals("plugin5", change4.getModuleDefinition().getName());
        assertEquals(Transition.UNLOADED_TO_LOADED, change4.getTransition());
       
        ModuleStateChange change5 = iterator.next();
        assertEquals("plugin6", change5.getModuleDefinition().getName());
        assertEquals(Transition.UNLOADED_TO_LOADED, change5.getTransition());
       
        return iterator;
    }
View Full Code Here

        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
        assertEquals(6, moduleTransitions.size());

        Iterator<? extends ModuleStateChange> iterator = moduleTransitions.iterator();
        ModuleStateChange change1 = iterator.next();
        ModuleStateChange change2 = iterator.next();
        ModuleStateChange change3 = iterator.next();
        ModuleStateChange change4 = iterator.next();
        ModuleStateChange change5 = iterator.next();
        ModuleStateChange change6 = iterator.next();

        assertEquals("plugin1", change1.getModuleDefinition().getName());
        assertEquals(Transition.LOADED_TO_UNLOADED, change1.getTransition());
        assertEquals("plugin2", change2.getModuleDefinition().getName());
        assertEquals("project1", change3.getModuleDefinition().getName());
        assertEquals(Transition.LOADED_TO_UNLOADED, change3.getTransition());

        assertEquals(Transition.UNLOADED_TO_LOADED, change4.getTransition());
        assertEquals("project1", change4.getModuleDefinition().getName());
        assertEquals("plugin1", change5.getModuleDefinition().getName());
        assertEquals("plugin2", change6.getModuleDefinition().getName());
        assertEquals(Transition.UNLOADED_TO_LOADED, change6.getTransition());
    }
View Full Code Here

        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
        assertEquals(2, moduleTransitions.size());

        Iterator<? extends ModuleStateChange> iterator = moduleTransitions.iterator();
        ModuleStateChange change1 = iterator.next();
        ModuleStateChange change2 = iterator.next();

        assertEquals("plugin1", change1.getModuleDefinition().getName());
        assertEquals(Transition.LOADED_TO_UNLOADED, change1.getTransition());
        assertEquals("plugin1", change2.getModuleDefinition().getName());
        assertEquals(Transition.UNLOADED_TO_LOADED, change2.getTransition());
    }
View Full Code Here

TOP

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

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.