コード例 #1
0
  private ServiceDirectory createServiceDirectory(String dir, ConfigurationDirectory configDir) {

    ServiceDirectory serviceDirectory = createNiceMock(ServiceDirectory.class);

    expect(serviceDirectory.getConfigurationDirectory(dir)).andReturn(configDir).anyTimes();
    expect(serviceDirectory.getMetricsFile()).andReturn(new File("testMetricsFile")).anyTimes();
    expect(serviceDirectory.getAlertsFile()).andReturn(new File("testAlertsFile")).anyTimes();
    expect(serviceDirectory.getKerberosDescriptorFile())
        .andReturn(new File("testKerberosDescriptorFile"))
        .anyTimes();
    expect(serviceDirectory.getPackageDir()).andReturn("packageDir").anyTimes();
    replay(serviceDirectory);

    return serviceDirectory;
  }
コード例 #2
0
  /**
   * Constructor.
   *
   * @param stackContext stack context which provides module access to external functionality
   * @param serviceInfo associated service info
   * @param serviceDirectory used for all IO interaction with service directory in stack definition
   * @param isCommonService flag to mark a service as a common service
   */
  public ServiceModule(
      StackContext stackContext,
      ServiceInfo serviceInfo,
      ServiceDirectory serviceDirectory,
      boolean isCommonService) {
    this.serviceInfo = serviceInfo;
    this.stackContext = stackContext;
    this.serviceDirectory = serviceDirectory;
    this.isCommonService = isCommonService;

    serviceInfo.setMetricsFile(serviceDirectory.getMetricsFile(serviceInfo.getName()));
    serviceInfo.setAlertsFile(serviceDirectory.getAlertsFile());
    serviceInfo.setKerberosDescriptorFile(serviceDirectory.getKerberosDescriptorFile());
    serviceInfo.setWidgetsDescriptorFile(
        serviceDirectory.getWidgetsDescriptorFile(serviceInfo.getName()));
    serviceInfo.setSchemaVersion(AmbariMetaInfo.SCHEMA_VERSION_2);
    serviceInfo.setServicePackageFolder(serviceDirectory.getPackageDir());

    populateComponentModules();
    populateConfigurationModules();
    populateThemeModules();

    validateServiceInfo();
  }