@Test public void testMissingName() { final DefaultModuleDefinition def = createDef("missingname"); try { def.init(); fail(); } catch (final IOException e) { assertTrue(e.getMessage().contains("Missing name property")); } }
public void init() throws IOException { if (!moduleProperties.exists()) { return; } resolveNameAndParent(); contextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getContextLocation(baseDir, name))); configLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getDefaultsLocation(baseDir, name))); inheritableContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getInheritableContextLocation(baseDir, name))); overrideContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getOverrideContextLocation(baseDir, name))); valid = true; }
DefaultModuleDefinition implements ModuleDefinition { public void init() throws IOException { if (!moduleProperties.exists()) { return; } resolveNameAndParent(); contextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getContextLocation(baseDir, name))); configLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getDefaultsLocation(baseDir, name))); inheritableContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getInheritableContextLocation(baseDir, name))); overrideContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getOverrideContextLocation(baseDir, name))); valid = true; } }
DefaultModuleDefinition implements ModuleDefinition { public void init() throws IOException { if (!moduleProperties.exists()) { return; } resolveNameAndParent(); contextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getContextLocation(baseDir, name))); configLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getDefaultsLocation(baseDir, name))); inheritableContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getInheritableContextLocation(baseDir, name))); overrideContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getOverrideContextLocation(baseDir, name))); valid = true; } DefaultModuleDefinition(final String baseDir, final Resource moduleProperties, final ResourcePatternResolver resolver); }
DefaultModuleDefinition implements ModuleDefinition { public void init() throws IOException { if (!moduleProperties.exists()) { return; } resolveNameAndParent(); contextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getContextLocation(baseDir, name))); configLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getDefaultsLocation(baseDir, name))); inheritableContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getInheritableContextLocation(baseDir, name))); overrideContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getOverrideContextLocation(baseDir, name))); valid = true; } DefaultModuleDefinition(final String baseDir, final Resource moduleProperties, final ResourcePatternResolver resolver); void init(); @Override ClassLoader getClassLoader(); @Override String getName(); @Override String getParentName(); @Override List<Resource> getConfigLocations(); @Override List<Resource> getContextLocations(); @Override List<Resource> getInheritableContextLocations(); @Override List<Resource> getOverrideContextLocations(); @Override boolean isValid(); @Override Collection<ModuleDefinition> getChildren(); @Override void addChild(final ModuleDefinition def); }
DefaultModuleDefinition implements ModuleDefinition { public void init() throws IOException { if (!moduleProperties.exists()) { return; } resolveNameAndParent(); contextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getContextLocation(baseDir, name))); configLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getDefaultsLocation(baseDir, name))); inheritableContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getInheritableContextLocation(baseDir, name))); overrideContextLocations = Arrays.asList(resolver.getResources(ModuleLocationUtils.getOverrideContextLocation(baseDir, name))); valid = true; } DefaultModuleDefinition(final String baseDir, final Resource moduleProperties, final ResourcePatternResolver resolver); void init(); @Override ClassLoader getClassLoader(); @Override String getName(); @Override String getParentName(); @Override List<Resource> getConfigLocations(); @Override List<Resource> getContextLocations(); @Override List<Resource> getInheritableContextLocations(); @Override List<Resource> getOverrideContextLocations(); @Override boolean isValid(); @Override Collection<ModuleDefinition> getChildren(); @Override void addChild(final ModuleDefinition def); static final String NAME; static final String PARENT; }