Package org.impalaframework.module

Examples of org.impalaframework.module.RootModuleDefinition


        calculator.getTransitions(application, newRoot, parentSpec2);
    }  
   
   
    public final void testCheckOriginal() {
        RootModuleDefinition parentSpec1 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2, plugin3");
        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");

        ModuleDefinition plugin2 = parentSpec2.findChildDefinition("plugin2", true);
        ModuleDefinition plugin4 = new SimpleModuleDefinition(plugin2, "plugin4");
        new SimpleModuleDefinition(plugin4, "plugin5");
        new SimpleModuleDefinition(plugin4, "plugin6");

        ModificationExtractor calculator = new StrictModificationExtractor();
View Full Code Here


        TransitionSet stickyTransitions = stickyCalculator.getTransitions(application, parentSpec1, parentSpec2);
        doAssertions(stickyTransitions, 3);
    }
   
    public final void testAddParentLocations() {
        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"));
        assertNotNull(newSpec.getChildModuleDefinition("plugin4"));
    }
View Full Code Here

    public void testHasModule() {
        SimpleModuleDefinitionSource definition = new SimpleModuleDefinitionSource("impala-core", new String[] { "l0", "l1", "l2" }, new String[] { "p1", "p2" });
       
        assertNotNull(definition);
        final RootModuleDefinition root = definition.getModuleDefinition();
        assertEquals(3, root.getConfigLocations().size());
       
        assertTrue(root.hasChildModuleDefinition("p1"));
        assertTrue(root.hasChildModuleDefinition("p2"));
        assertFalse(root.hasChildModuleDefinition("p3"));
       
        assertEquals(2, root.getChildModuleNames().size());
    }
View Full Code Here

        expect(moduleDefinitionSource.getModuleDefinition()).andReturn(newDefinition);
       
        ModificationExtractor modificationExtractor = getModificationExtractor();
        expect(modificationExtractor.getTransitions(application, null, newDefinition)).andReturn(transitionSet);
       
        RootModuleDefinition existingDefinition = getExistingDefinition();
        if (existingDefinition != null) {
          expect(existingDefinition.isReloadable()).andReturn(true);
        }
       
        expect(strictModificationExtractor.getTransitions(application, existingDefinition, newDefinition)).andReturn(transitionSet);
        expect(transitionManager.processTransitions(moduleStateHolder, application, transitionSet)).andReturn(new TransitionResultSet());
       
View Full Code Here

            assertEquals("Either originalDefinition or newDefinition must be non-null", e.getMessage());
        }
    }

    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

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

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

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());

        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
View Full Code Here

        assertEquals("plugin2", change6.getModuleDefinition().getName());
        assertEquals(Transition.UNLOADED_TO_LOADED, change6.getTransition());
    }

    public void testReloadSame() {
        RootModuleDefinition parentSpec1 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");
        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");
        parentSpec2.findChildDefinition("plugin1", true).setState(ModuleState.STALE);

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());

        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
View Full Code Here

        assertEquals("plugin1", change2.getModuleDefinition().getName());
        assertEquals(Transition.UNLOADED_TO_LOADED, change2.getTransition());
    }

    public void testReloadChanged() {
        RootModuleDefinition parentSpec1 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2, plugin3");
        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");
        parentSpec2.findChildDefinition("plugin1", true).setState(ModuleState.STALE);

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());

        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
View Full Code Here

        ModuleDefinition moduleDefinition3Unloaded = change3.getModuleDefinition();
        assertEquals("plugin3", moduleDefinition3Unloaded.getName());
    }

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

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());

        Collection<? extends ModuleStateChange> pluginTransitions = transitions.getModuleTransitions();
View Full Code Here

        assertEquals("plugin4", change2.getModuleDefinition().getName());
        assertEquals(Transition.UNLOADED_TO_LOADED, change2.getTransition());
    }

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

        ModuleDefinition plugin2 = parentSpec2.findChildDefinition("plugin2", true);
        new SimpleModuleDefinition(plugin2, "plugin4");

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());
View Full Code Here

TOP

Related Classes of org.impalaframework.module.RootModuleDefinition

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.