AmbariMetaInfo { public List<ComponentInfo> getComponentsByService(String stackName, String version, String serviceName) throws AmbariException { ServiceInfo service; try { service = getService(stackName, version, serviceName); } catch (StackAccessException e) { throw new ParentObjectNotFoundException("Parent Service resource doesn't exist. stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName); } return service.getComponents(); } @Inject  AmbariMetaInfo(Configuration conf); @Inject void init(); StackManager getStackManager(); List<ComponentInfo> getComponentsByService(String stackName, String version, String serviceName); ComponentInfo getComponent(String stackName, String version, String serviceName,
                                    String componentName); List<DependencyInfo> getComponentDependencies(String stackName, String version,
                                                       String service, String component); DependencyInfo getComponentDependency(String stackName, String version, String service,
                                               String component, String dependencyName); Map<String, List<RepositoryInfo>> getRepository(String stackName,
                                                         String version); List<RepositoryInfo> getRepositories(String stackName,
                                              String version, String osType); RepositoryInfo getRepository(String stackName,
                                      String version, String osType, String repoId); boolean isSupportedStack(String stackName, String version); boolean isValidService(String stackName, String version, String serviceName); boolean isValidServiceComponent(String stackName, String version,
                                         String serviceName, String componentName); String getComponentToService(String stackName, String version,
                                      String componentName); Map<String, ServiceInfo> getServices(String stackName, String version); ServiceInfo getService(String stackName, String version, String serviceName); boolean isServiceRemovedInStack(String stackName, String version, String serviceName); Collection<String> getMonitoringServiceNames(String stackName, String version); Set<String> getRestartRequiredServicesNames(String stackName, String version); Set<String> getRackSensitiveServicesNames(String stackName, String version); Collection<StackInfo> getStacks(); Collection<StackInfo> getStacks(String stackName); StackInfo getStack(String stackName, String version); List<String> getStackParentVersions(String stackName, String version); Collection<ExtensionInfo> getExtensions(); Collection<ExtensionInfo> getExtensions(String extensionName); ExtensionInfo getExtension(String extensionName, String version); Set<PropertyInfo> getServiceProperties(String stackName, String version, String serviceName); Set<PropertyInfo> getStackProperties(String stackName, String version); Set<PropertyInfo> getPropertiesByName(String stackName, String version, String serviceName, String propertyName); Set<PropertyInfo> getStackPropertiesByName(String stackName, String version, String propertyName); Set<OperatingSystemInfo> getOperatingSystems(String stackName, String version); OperatingSystemInfo getOperatingSystem(String stackName, String version, String osType); List<ActionDefinition> getAllActionDefinition(); ActionDefinition getActionDefinition(String name); void addActionDefinition(ActionDefinition ad); String getServerVersion(); boolean isOsSupported(String osType); static String generateRepoMetaKey(String stackName, String stackVersion,
      String osType, String repoId, String field); void updateRepo(String stackName,
                         String stackVersion, String osType, String repoId, String newBaseUrl, String newMirrorsList); File getStackRoot(); File getExtensionsRoot(); Map<String, Map<String, List<MetricDefinition>>> getServiceMetrics(String stackName,
            String stackVersion, String serviceName); List<MetricDefinition> getMetrics(String stackName, String stackVersion,
      String serviceName, String componentName, String metricType); Set<AlertDefinition> getAlertDefinitions(String stackName, String stackVersion,
                                                  String serviceName); Set<AlertDefinition> getAlertDefinitions(ServiceInfo service); void reconcileAlertDefinitions(Clusters clusters); Map<String, UpgradePack> getUpgradePacks(String stackName, String stackVersion); ConfigUpgradePack getConfigUpgradePack(String stackName, String stackVersion); KerberosDescriptor getKerberosDescriptor(String stackName, String stackVersion); KerberosServiceDescriptor[] getKerberosDescriptor(ServiceInfo serviceInfo); Map<String, String> getAmbariServerProperties(); VersionDefinitionXml getVersionDefinition(String versionDefinitionId); Map<String, VersionDefinitionXml> getVersionDefinitions(); static final String SERVICE_CONFIG_FOLDER_NAME; static final String SERVICE_PROPERTIES_FOLDER_NAME; static final String SERVICE_THEMES_FOLDER_NAME; static final String SERVICE_QUICKLINKS_CONFIGURATIONS_FOLDER_NAME; static final String SERVICE_CONFIG_FILE_NAME_POSTFIX; static final String RCO_FILE_NAME; static final String SERVICE_METRIC_FILE_NAME; static final String SERVICE_ALERT_FILE_NAME; static final String SERVICE_ADVISOR_FILE_NAME; static final String KERBEROS_DESCRIPTOR_FILE_NAME; static final String WIDGETS_DESCRIPTOR_FILE_NAME; static final String SERVICE_THEME_FILE_NAME; static final String ANY_OS; static final String SCHEMA_VERSION_2; static final FilenameFilter FILENAME_FILTER; static final String REPOSITORY_XML_PROPERTY_BASEURL; static final String REPOSITORY_XML_PROPERTY_MIRRORSLIST; }
@Test public void getComponentsByService() throws AmbariException { List<ComponentInfo> components = metaInfo.getComponentsByService( STACK_NAME_HDP, STACK_VERSION_HDP, SERVICE_NAME_HDFS); assertNotNull(components); assertTrue(components.size() > 0); }