Package org.impalaframework.module

Examples of org.impalaframework.module.ModuleDefinition


                if (logger.isDebugEnabled()) {
                    logger.debug("Processing module state change: " + change);
                }
               
                String transition = change.getTransition();
                ModuleDefinition currentModuleDefinition = change.getModuleDefinition();

                TransitionProcessor transitionProcessor = transitionProcessorRegistry.getTransitionProcessor(transition);
               
                TransitionResult result;
     
View Full Code Here


    super.setUp();
    reader = new ApplicationWithBeansetsModuleTypeReader();
  }

  public void testReadModuleDefinition() {
    ModuleDefinition definition = reader.readModuleDefinition(null, "mymodule", new Properties());
    SimpleBeansetModuleDefinition moduleDefinition = (SimpleBeansetModuleDefinition) definition;
    assertEquals("mymodule", moduleDefinition.getName());
    assertEquals("APPLICATION_WITH_BEANSETS", moduleDefinition.getType());
  }
View Full Code Here

  }
 
  public void testReadModuleDefinitionLocations() {
    Properties properties = new Properties();
    properties.put(ModuleElementNames.CONFIG_LOCATIONS_ELEMENT, "loc1, loc2,loc3");
    ModuleDefinition definition = reader.readModuleDefinition(null, "mymodule", properties);
    SimpleBeansetModuleDefinition moduleDefinition = (SimpleBeansetModuleDefinition) definition;
    assertEquals("mymodule", moduleDefinition.getName());
    assertEquals("APPLICATION_WITH_BEANSETS", moduleDefinition.getType());
    assertEquals(Arrays.asList(new String[]{ "loc1", "loc2", "loc3"}), moduleDefinition.getConfigLocations());
  }
View Full Code Here

  }
 
  public void testWithOverrides() {
    Properties properties = new Properties();
    properties.setProperty(ApplicationWithBeansetsModuleTypeReader.OVERRIDES_ELEMENT, "beanset: all;");
    ModuleDefinition definition = reader.readModuleDefinition(null, "mymodule", properties);
    SimpleBeansetModuleDefinition moduleDefinition = (SimpleBeansetModuleDefinition) definition;
    assertEquals("mymodule", moduleDefinition.getName());
    assertEquals("APPLICATION_WITH_BEANSETS", moduleDefinition.getType());
    assertEquals(Collections.singletonMap("beanset", Collections.singleton("all")), moduleDefinition.getOverrides());
  }
View Full Code Here

    assertEquals("APPLICATION_WITH_BEANSETS", definition.getType());
  }
 
  @SuppressWarnings("unchecked")
  public void testConstructorsWithParent() {
    ModuleDefinition parent = new SimpleModuleDefinition("bean");
    HashMap<String, Set<String>> map = new HashMap<String, Set<String>>();
    map.put("key", Collections.EMPTY_SET);
    SimpleBeansetModuleDefinition definition = new SimpleBeansetModuleDefinition(parent, "p1", map);
    assertEquals(parent, definition.getParentDefinition());
    assertEquals("p1", definition.getName());
View Full Code Here

  @SuppressWarnings("unchecked")
  public void testConstructorsWithParentAndMultiLocations() {
    String[] locations = new String[] {"location1","location2"};
    List<String> locationList = Arrays.asList(locations);
   
    ModuleDefinition parent = new SimpleModuleDefinition(null, "bean", locations);
    HashMap<String, Set<String>> map = new HashMap<String, Set<String>>();
    map.put("key", Collections.EMPTY_SET);
    SimpleBeansetModuleDefinition spec = new SimpleBeansetModuleDefinition(parent, "p1", locations, map);
    assertEquals(parent, spec.getParentDefinition());
    assertEquals("p1", spec.getName());
View Full Code Here

            Collection<ModuleDefinition> oldChildren,
            Collection<ModuleDefinition> newChildren,
            List<ModuleStateChange> transitions) {
       
        for (ModuleDefinition newChild : newChildren) {
            ModuleDefinition oldChild = ModuleDefinitionUtils.getModuleFromCollection(oldChildren, newChild.getName());

            //if new module has definition not present in old, then load this with children
            if (oldChild == null) {
                loadDefinitions(newChild, transitions);            
            }
View Full Code Here

            Collection<ModuleDefinition> oldChildren,
            Collection<ModuleDefinition> newChildren,
            List<ModuleStateChange> transitions) {
   
        for (ModuleDefinition oldChild : oldChildren) {
            ModuleDefinition newChild = ModuleDefinitionUtils.getModuleFromCollection(newChildren, oldChild.getName());

            //if old module has definition which is no longer present, then unload this
            if (newChild == null) {
                unloadDefinitions(oldChild, transitions);
            }
View Full Code Here

       
        //recursively build child definitions
        buildChildDefinitions(rootModuleDefinition, rootModuleName);
       
        for (String sibling : siblings) {
            ModuleDefinition siblingDefinition = buildModuleDefinition(null, sibling);
            buildChildDefinitions(siblingDefinition, siblingDefinition.getName());
            rootModuleDefinition.addSibling(siblingDefinition);
        }
        return rootModuleDefinition;
    }
View Full Code Here

   
    protected void buildChildDefinitions(ModuleDefinition parentDefinition, String parentModuleName) {
        Set<String> moduleChildren = children.get(parentModuleName);
        if (moduleChildren != null) {
            for (String moduleName : moduleChildren) {
                ModuleDefinition definition = buildModuleDefinition(parentDefinition, moduleName);
                buildChildDefinitions(definition, moduleName);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.impalaframework.module.ModuleDefinition

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.