Examples of ModuleDefinition


Examples of org.impalaframework.module.ModuleDefinition

    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

Examples of org.impalaframework.module.ModuleDefinition

  }
 
  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

Examples of org.impalaframework.module.ModuleDefinition

  }
 
  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

Examples of org.impalaframework.module.ModuleDefinition

    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

Examples of org.impalaframework.module.ModuleDefinition

  @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

Examples of org.impalaframework.module.ModuleDefinition

            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

Examples of org.impalaframework.module.ModuleDefinition

            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

Examples of org.impalaframework.module.ModuleDefinition

       
        //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

Examples of org.impalaframework.module.ModuleDefinition

   
    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

Examples of org.impalaframework.module.ModuleDefinition

        }
    }
   
    private RootModuleDefinition readRootModuleDefinition(Properties rootModuleProperties,
            TypeReader typeReader) {
        ModuleDefinition moduleDefinition = typeReader.readModuleDefinition(null, rootModuleName, rootModuleProperties);
        if (!(moduleDefinition instanceof RootModuleDefinition)) {
            throw new IllegalStateException("Type reader " + typeReader + " produced " + ModuleDefinition.class.getSimpleName() + " which is not an instance of " + RootModuleDefinition.class.getName());
        }
        RootModuleDefinition rootDefinition = (RootModuleDefinition) moduleDefinition;
        return rootDefinition;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.