Пример #1
0
  /** Parse and populate child configuration modules. */
  private void populateConfigurationModules() {
    ConfigurationDirectory configDirectory =
        serviceDirectory.getConfigurationDirectory(serviceInfo.getConfigDir());

    if (configDirectory != null) {
      for (ConfigurationModule config : configDirectory.getConfigurationModules()) {
        ConfigurationInfo info = config.getModuleInfo();
        if (isValid()) {
          setValid(config.isValid() && info.isValid());
          if (!isValid()) {
            setErrors(config.getErrors());
            setErrors(info.getErrors());
          }
        }
        serviceInfo.getProperties().addAll(info.getProperties());
        serviceInfo.setTypeAttributes(config.getConfigType(), info.getAttributes());
        configurationModules.put(config.getConfigType(), config);
      }

      for (String excludedType : serviceInfo.getExcludedConfigTypes()) {
        if (!configurationModules.containsKey(excludedType)) {
          ConfigurationInfo configInfo =
              new ConfigurationInfo(
                  Collections.<PropertyInfo>emptyList(), Collections.<String, String>emptyMap());
          ConfigurationModule config = new ConfigurationModule(excludedType, configInfo);

          config.setDeleted(true);
          configurationModules.put(excludedType, config);
        }
      }
    }
  }
Пример #2
0
  private ConfigurationDirectory createConfigurationDirectory(
      Collection<ConfigurationModule> modules) {
    ConfigurationDirectory configDir = createNiceMock(ConfigurationDirectory.class);

    expect(configDir.getConfigurationModules()).andReturn(modules).anyTimes();
    replay(configDir);

    return configDir;
  }