ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jspei...@apache.org
Subject [07/11] ambari git commit: AMBARI-7175. Add explicit stack service inheritance
Date Mon, 10 Nov 2014 21:32:06 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java
deleted file mode 100644
index f05aab5..0000000
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java
+++ /dev/null
@@ -1,792 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.server.api.util;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import org.apache.ambari.server.api.services.AmbariMetaInfo;
-import org.apache.ambari.server.metadata.ActionMetadata;
-import org.apache.ambari.server.state.*;
-import org.apache.ambari.server.state.stack.ConfigurationXml;
-import org.junit.Test;
-import org.xml.sax.SAXException;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPathExpressionException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-public class StackExtensionHelperTest {
-
-  private final String stackRootStr = "./src/test/resources/stacks/".
-      replaceAll("/", File.separator);
-
-  private Injector injector = Guice.createInjector(new MockModule());
-  
-  
-  public class MockModule extends AbstractModule {
-    @Override
-    protected void configure() {
-      bind(ActionMetadata.class);
-    }
-  }
-
-  /**
-  * Checks than service metainfo is parsed correctly both for ver 1 services
-  * and for ver 2 services
-  */
-  @Test
-  public void testPopulateServicesForStack() throws Exception {
-    File stackRoot = new File(stackRootStr);
-    StackInfo stackInfo = new StackInfo();
-    stackInfo.setName("HDP");
-    stackInfo.setVersion("2.0.7");
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    helper.populateServicesForStack(stackInfo);
-    List<ServiceInfo> services =  stackInfo.getServices();
-    assertEquals(8, services.size());
-    for (ServiceInfo serviceInfo : services) {
-      if (serviceInfo.getName().equals("HIVE")) {
-        // Check old-style service
-        assertEquals("HIVE", serviceInfo.getName());
-        assertEquals("Hive", serviceInfo.getDisplayName());
-        assertEquals("2.0", serviceInfo.getSchemaVersion());
-        assertTrue(serviceInfo.getComment().startsWith("Data warehouse system"));
-        assertEquals("0.11.0.2.0.5.0", serviceInfo.getVersion());
-        // Check some component definitions
-        List<ComponentInfo> components = serviceInfo.getComponents();
-        assertEquals("HIVE_METASTORE", components.get(0).getName());
-        assertEquals("Hive Metastore", components.get(0).getDisplayName());
-        assertEquals("MASTER", components.get(0).getCategory());
-        List<PropertyInfo> properties = serviceInfo.getProperties();
-        // Check some property
-        assertEquals(37, properties.size());
-        boolean found = false;
-        for (PropertyInfo property : properties) {
-          if (property.getName().equals("javax.jdo.option.ConnectionDriverName")) {
-            assertEquals("com.mysql.jdbc.Driver", property.getValue());
-            assertEquals("hive-site.xml",
-                    property.getFilename());
-            assertEquals(false, property.isDeleted());
-            found = true;
-          }
-        }
-        assertTrue("Property not found in a list of properties", found);
-        // Check config dependencies
-        List<String> configDependencies = serviceInfo.getConfigDependencies();
-        assertEquals(2, configDependencies.size());
-        assertEquals("hive-site", configDependencies.get(1));
-      } else if (serviceInfo.getName().equals("HBASE")) {
-        assertEquals("HBASE", serviceInfo.getName());
-        assertEquals("HDP/2.0.7/services/HBASE/package",
-                serviceInfo.getServicePackageFolder());
-        assertEquals("2.0", serviceInfo.getSchemaVersion());
-        assertTrue(serviceInfo.getComment().startsWith("Non-relational distr"));
-        assertEquals("0.96.0.2.0.6.0", serviceInfo.getVersion());
-        // Check some component definitions
-        List<ComponentInfo> components = serviceInfo.getComponents();
-        assertTrue(components.size() == 3);
-        ComponentInfo firstComponent = components.get(0);
-        assertEquals("HBASE_MASTER", firstComponent.getName());
-        assertEquals("MASTER", firstComponent.getCategory());
-        // Check command script for component
-        assertEquals("scripts/hbase_master.py",
-                firstComponent.getCommandScript().getScript());
-        assertEquals(CommandScriptDefinition.Type.PYTHON,
-                firstComponent.getCommandScript().getScriptType());
-        assertEquals(777,
-                firstComponent.getCommandScript().getTimeout());
-        // Check custom commands for component
-        List<CustomCommandDefinition> customCommands =
-                firstComponent.getCustomCommands();
-        assertEquals(2, customCommands.size());
-        assertEquals("RESTART", customCommands.get(0).getName());
-        assertTrue(firstComponent.isCustomCommand("RESTART"));
-        assertEquals("scripts/hbase_master_restart.py",
-                customCommands.get(0).getCommandScript().getScript());
-        assertEquals(CommandScriptDefinition.Type.PYTHON,
-                customCommands.get(0).getCommandScript().getScriptType());
-        assertEquals(888,
-                customCommands.get(0).getCommandScript().getTimeout());
-        // Check all parsed os specifics
-        Map<String,ServiceOsSpecific> specifics = serviceInfo.getOsSpecifics();
-        assertTrue(specifics.size() == 2);
-        ServiceOsSpecific anyOs = specifics.get(AmbariMetaInfo.ANY_OS);
-        assertEquals(AmbariMetaInfo.ANY_OS, anyOs.getOsFamily());
-        assertEquals("wget", anyOs.getPackages().get(0).getName());
-
-        // Test default timeout value
-        ComponentInfo secondComponent = components.get(1);
-        assertEquals("HBASE_REGIONSERVER", secondComponent.getName());
-        assertEquals(0,
-                secondComponent.getCommandScript().getTimeout());
-
-        ServiceOsSpecific c6Os = specifics.get("centos6");
-        assertEquals("centos6", c6Os.getOsFamily());
-        assertEquals("hbase", c6Os.getPackages().get(0).getName());
-        assertEquals("http://something.com/centos6/2.x/updates/1",
-                c6Os.getRepo().getBaseUrl());
-        assertEquals("Custom-repo-1",
-                c6Os.getRepo().getRepoId());
-        assertEquals("Custom-repo",
-                c6Os.getRepo().getRepoName());
-        // Check custom commands for service
-        assertTrue(serviceInfo.getCustomCommands().size() == 1);
-        CustomCommandDefinition customCommand =
-                serviceInfo.getCustomCommands().get(0);
-        assertEquals("SERVICE_VALIDATION", customCommand.getName());
-        assertEquals("scripts/hbase_validation.py",
-                customCommand.getCommandScript().getScript());
-        assertEquals(CommandScriptDefinition.Type.PYTHON,
-                customCommand.getCommandScript().getScriptType());
-        assertEquals(300, customCommand.getCommandScript().getTimeout());
-        // Check command script for service
-        CommandScriptDefinition serviceScriptDefinition = serviceInfo.getCommandScript();
-        assertEquals("scripts/service_check.py", serviceScriptDefinition.getScript());
-        assertEquals(CommandScriptDefinition.Type.PYTHON,
-                serviceScriptDefinition.getScriptType());
-        assertEquals(50, serviceScriptDefinition.getTimeout());
-        // Check some property
-        List<PropertyInfo> properties = serviceInfo.getProperties();
-        List<PropertyInfo> emptyValueProperties = new ArrayList<PropertyInfo>();
-        for (PropertyInfo propertyInfo : properties) {
-          if (propertyInfo.getValue().isEmpty()) {
-            emptyValueProperties.add(propertyInfo);
-          }
-        }
-        assertEquals(28, emptyValueProperties.size());
-        assertEquals(68, properties.size());
-        boolean foundHBaseClusterDistributed = false;
-        boolean foundHBaseRegionServerXmnMax = false;
-        boolean foundHBaseRegionServerXmnRatio = false;
-        for (PropertyInfo property : properties) {
-          if (property.getName().equals("hbase.cluster.distributed")) {
-            assertEquals("true",
-                    property.getValue());
-            assertTrue(property.getDescription().startsWith("The mode the"));
-            assertEquals("hbase-site.xml",
-                    property.getFilename());
-            foundHBaseClusterDistributed = true;
-          } else if (property.getName().equals("hbase_regionserver_xmn_max")) {
-            assertEquals("512", property.getValue());
-            assertEquals("global.xml",
-                property.getFilename());
-            foundHBaseRegionServerXmnMax = true;
-          } else if (property.getName().equals("hbase_regionserver_xmn_ratio")) {
-            assertEquals("global.xml",
-                property.getFilename());
-            assertEquals("0.2", property.getValue());
-            foundHBaseRegionServerXmnRatio = true;
-          }
-        }
-
-        assertTrue("Property hbase.cluster.distributed not found in a list of properties",
-            foundHBaseClusterDistributed);
-        assertTrue("Property hbase_regionserver_xmn_max not found in a list of properties",
-            foundHBaseRegionServerXmnMax);
-        assertTrue("Property hbase_regionserver_xmn_ratio not found in a list of properties",
-            foundHBaseRegionServerXmnRatio);
-
-        List<String> configDependencies = serviceInfo.getConfigDependencies();
-        assertEquals(3, configDependencies.size());
-        assertEquals("global", configDependencies.get(0));
-        assertEquals("hbase-policy", configDependencies.get(1));
-        assertEquals("hbase-site", configDependencies.get(2));
-      } else if(serviceInfo.getName().equals("ZOOKEEPER")) {
-        assertTrue(serviceInfo.isRestartRequiredAfterChange());
-      } else {
-        if (!serviceInfo.getName().equals("YARN") &&
-            !serviceInfo.getName().equals("HDFS") &&
-            !serviceInfo.getName().equals("MAPREDUCE2") &&
-            !serviceInfo.getName().equals("NAGIOS") &&
-            !serviceInfo.getName().equals("SQOOP")) {
-          fail("Unknown service");
-        }
-      }
-    }
-  }
-
-  @Test
-  public void testConfigDependenciesInheritance() throws Exception{
-    File stackRoot = new File(stackRootStr);
-    StackInfo stackInfo = new StackInfo();
-    stackInfo.setName("HDP");
-    stackInfo.setVersion("2.0.6");
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    helper.populateServicesForStack(stackInfo);
-    helper.fillInfo();
-    List<ServiceInfo> allServices = helper.getAllApplicableServices(stackInfo);
-    for (ServiceInfo serviceInfo : allServices) {
-      if (serviceInfo.getName().equals("HDFS")) {
-        assertEquals(5, serviceInfo.getConfigDependencies().size());
-        assertEquals(4, serviceInfo.getConfigTypes().size());
-        assertTrue(serviceInfo.getConfigDependencies().contains("core-site"));
-        assertTrue(serviceInfo.getConfigDependencies().contains("global"));
-        assertTrue(serviceInfo.getConfigDependencies().contains("hdfs-site"));
-        assertTrue(serviceInfo.getConfigDependencies().contains("hdfs-log4j"));
-        assertTrue(serviceInfo.getConfigDependencies().contains("hadoop-policy"));
-        assertTrue(Boolean.valueOf(serviceInfo.getConfigTypes().get("core-site").get("supports").get("final")));
-        assertFalse(Boolean.valueOf(serviceInfo.getConfigTypes().get("global").get("supports").get("final")));
-      } else if (serviceInfo.getName().equals("WEBHCAT")) {
-        assertEquals(1, serviceInfo.getConfigDependencies().size());
-        assertEquals(1, serviceInfo.getConfigTypes().size());
-        assertTrue(serviceInfo.getConfigDependencies().contains("webhcat-site"));
-        assertTrue(Boolean.valueOf(serviceInfo.getConfigTypes().get("webhcat-site").get("supports").get("final")));
-      }
-    }
-  }
-
-  @Test
-  public void testClientConfigFilesInheritance() throws Exception{
-    File stackRoot = new File(stackRootStr);
-    StackInfo stackInfo = new StackInfo();
-    stackInfo.setName("HDP");
-    stackInfo.setVersion("2.0.6");
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    helper.populateServicesForStack(stackInfo);
-    helper.fillInfo();
-    List<ServiceInfo> allServices = helper.getAllApplicableServices(stackInfo);
-    for (ServiceInfo serviceInfo : allServices) {
-      if (serviceInfo.getName().equals("ZOOKEEPER")) {
-        List<ComponentInfo> components = serviceInfo.getComponents();
-        assertTrue(components.size() == 2);
-        ComponentInfo componentInfo = components.get(1);
-        List<ClientConfigFileDefinition> clientConfigs = componentInfo.getClientConfigFiles();
-        assertEquals(2,clientConfigs.size());
-        assertEquals("zookeeper-env",clientConfigs.get(0).getDictionaryName());
-        assertEquals("zookeeper-env.sh",clientConfigs.get(0).getFileName());
-        assertEquals("env",clientConfigs.get(0).getType());
-        assertEquals("zookeeper-log4j",clientConfigs.get(1).getDictionaryName());
-        assertEquals("log4j.properties",clientConfigs.get(1).getFileName());
-        assertEquals("env",clientConfigs.get(1).getType());
-      }
-    }
-  }
-
-  @Test
-  public void testMonitoringServicePropertyInheritance() throws Exception{
-    File stackRoot = new File(stackRootStr);
-    StackInfo stackInfo = new StackInfo();
-    stackInfo.setName("HDP");
-    stackInfo.setVersion("2.0.7");
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    helper.populateServicesForStack(stackInfo);
-    helper.fillInfo();
-    List<ServiceInfo> allServices = helper.getAllApplicableServices(stackInfo);
-    assertEquals(13, allServices.size());
-    for (ServiceInfo serviceInfo : allServices) {
-      if (serviceInfo.getName().equals("NAGIOS")) {
-        assertTrue(serviceInfo.isMonitoringService());
-      } else {
-        assertNull(serviceInfo.isMonitoringService());
-      }
-    }
-  }
-
-  @Test
-  public void getSchemaVersion() throws Exception {
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    File legacyMetaInfoFile = new File("./src/test/resources/stacks/HDP/2.0.7/" +
-            "services/HIVE/metainfo.xml".replaceAll("/", File.separator));
-    String version = helper.getSchemaVersion(legacyMetaInfoFile);
-    assertEquals("2.0", version);
-
-    File v2MetaInfoFile = new File("./src/test/resources/stacks/HDP/2.0.7/" +
-            "services/HBASE/metainfo.xml".replaceAll("/", File.separator));
-    version = helper.getSchemaVersion(v2MetaInfoFile);
-    assertEquals("2.0", version);
-  }
-  
-  public StackExtensionHelper getStackExtensionHelper() {
-    File stackRoot = new File(stackRootStr);    
-    return new StackExtensionHelper(injector, stackRoot);
-  }
-  
-  public ServiceInfo getServiceFromStack(StackExtensionHelper helper, String stackName, String stackVersion, String serviceName) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException, JAXBException {
-    StackInfo stackInfo = new StackInfo();
-    stackInfo.setName(stackName);
-    stackInfo.setVersion(stackVersion);
-    
-    helper.populateServicesForStack(stackInfo);
-    
-    for(ServiceInfo service:stackInfo.getServices()) {
-      if(service.getName().equals(serviceName)) {
-        return service;
-      }
-    }
-    return null;
-  }
-
-  private void addToPropertyMap(Map<String, Map<String, Map<String, String>>> configTypes,String configType,
-      String keyword, String attributeName, String value) {
-    if(!configTypes.containsKey(configType)) {
-      configTypes.put(configType, new HashMap<String, Map<String, String>>()); 
-    }
-    Map<String, Map<String, String>> config = configTypes.get(configType);
-    if(!config.containsKey(keyword)) {
-      config.put(keyword, new HashMap<String, String>());
-    }
-    Map<String, String> supports = config.get(keyword);
-    supports.put(attributeName, value);    
-  }
-
-  /**
-   * This test ensures the service status check is added into the action metadata when
-   * the stack has no parent and is the only stack in the stack family
-   * @throws Exception
-   */
-  @Test
-  public void testGetServiceInfoFromSingleStack() throws Exception {
-    File stackRoot = new File("./src/test/resources/single_stack".replace("/", File.separator));
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    helper.fillInfo();
-    List<StackInfo> stackInfoList = helper.getAllAvailableStacks();
-    assertEquals(1, stackInfoList.size());
-
-    List<ServiceInfo> serviceInfoList = helper.getAllApplicableServices(stackInfoList.get(0));
-    for(ServiceInfo serviceInfo: serviceInfoList) {
-      if ("HDFS".equalsIgnoreCase(serviceInfo.getName())) {
-        ActionMetadata actionMetadata = injector.getInstance(ActionMetadata.class);
-        String hdfsStatusCheckCmd = actionMetadata.getServiceCheckAction("HDFS");
-        assertEquals("HDFS_SERVICE_CHECK", hdfsStatusCheckCmd);
-        break;
-      }
-    }
-  }
-
-  @Test
-  public void testPopulateConfigTypes() throws XPathExpressionException, ParserConfigurationException, SAXException, IOException, JAXBException {
-    StackExtensionHelper helper = getStackExtensionHelper();
-    ServiceInfo serviceInfo = getServiceFromStack(helper, "HDP", "2.0.7", "HDFS");
-    
-    
-    Map<String, Map<String, Map<String, String>>> expectedConfigTypes = new HashMap<String, Map<String, Map<String, String>>>();
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "true");
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    
-    Map<String, Map<String, Map<String, String>>> configTypes = serviceInfo.getConfigTypes();
-    assertEquals(4, configTypes.size());
-    assertEquals(expectedConfigTypes, configTypes);
-  }
-
-  @Test
-  public void testAddConfigTypeProperty_configTypesIsNull() {
-    // init
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    ServiceInfo serviceInfo = createMock(ServiceInfo.class);
-
-    // expectations
-    expect(serviceInfo.getConfigTypes()).andReturn(null);
-    replay(serviceInfo);
-
-    // eval
-    helper.addConfigTypeProperty(serviceInfo.getConfigTypes(), "dep", "group", "key", "value");
-
-    // verification
-    verify(serviceInfo);
-  }
-
-  @Test
-  public void testAddConfigTypeProperty_groupDoesNotExist() {
-    // init
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    ServiceInfo serviceInfo = new ServiceInfo();
-    Map<String, Map<String, Map<String, String>>> configTypes = new HashMap<String, Map<String, Map<String, String>>>();
-    Map<String, Map<String, String>> groupMap = new HashMap<String, Map<String, String>>();
-    configTypes.put("dep", groupMap);
-    serviceInfo.setConfigTypes(configTypes);
-
-    // eval
-    helper.addConfigTypeProperty(serviceInfo.getConfigTypes(), "dep", "group", "key", "value");
-
-    // assert
-    configTypes = serviceInfo.getConfigTypes();
-    assertEquals(1, configTypes.size());
-    assertTrue(configTypes.containsKey("dep"));
-    Map<String, Map<String, String>> configType = configTypes.get("dep");
-    assertTrue(configType.containsKey("group"));
-    Map<String, String> group = configType.get("group");
-    assertEquals(1, group.size());
-    assertTrue(group.containsKey("key"));
-    assertEquals("value", group.get("key"));
-  }
-
-  @Test
-  public void testAddConfigTypeProperty_typeDoesNotExist() {
-    // init
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    ServiceInfo serviceInfo = new ServiceInfo();
-    Map<String, Map<String, Map<String, String>>> configTypes = new HashMap<String, Map<String, Map<String, String>>>();
-    Map<String, Map<String, String>> groupMap = new HashMap<String, Map<String, String>>();
-    configTypes.put("dep", groupMap);
-    serviceInfo.setConfigTypes(configTypes);
-
-    // eval
-    helper.addConfigTypeProperty(serviceInfo.getConfigTypes(), "no_such_dep", "group", "key", "value");
-
-    // assert
-    configTypes = serviceInfo.getConfigTypes();
-    assertEquals(1, configTypes.size());
-    assertFalse(configTypes.containsKey("no_such_dep"));
-    assertTrue(configTypes.containsKey("dep"));
-    Map<String, Map<String, String>> configType = configTypes.get("dep");
-    assertEquals(0, configType.size());
-  }
-
-  @Test
-  public void testAddConfigTypeProperty_groupExist() {
-    // init
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    ServiceInfo serviceInfo = new ServiceInfo();
-    Map<String, Map<String, Map<String, String>>> configTypes = new HashMap<String, Map<String, Map<String, String>>>();
-    Map<String, Map<String, String>> groupMap = new HashMap<String, Map<String, String>>();
-    Map<String, String> propertiesMap = new HashMap<String, String>();
-    groupMap.put("group", propertiesMap);
-    configTypes.put("dep", groupMap);
-    serviceInfo.setConfigTypes(configTypes);
-
-    // eval
-    helper.addConfigTypeProperty(serviceInfo.getConfigTypes(), "dep", "group", "key", "value");
-
-    // assert
-    configTypes = serviceInfo.getConfigTypes();
-    assertEquals(1, configTypes.size());
-    assertTrue(configTypes.containsKey("dep"));
-    Map<String, Map<String, String>> configType = configTypes.get("dep");
-    assertTrue(configType.containsKey("group"));
-    Map<String, String> group = configType.get("group");
-    assertTrue(group.containsKey("key"));
-    assertEquals("value", group.get("key"));
-  }
-
-  @Test
-  public void testPopulateServiceProperties_noSupportsFinalFlag() throws Exception {
-    StackExtensionHelper helper = getStackExtensionHelper();
-    ServiceInfo serviceInfo = getServiceFromStack(helper, "HDP", "2.0.7", "YARN");
-    
-    File configFile = new File(stackRootStr
-        + "HDP/2.0.7/services/YARN/configuration/yarn-site.xml".replaceAll("/", File.separator));
-    
-    helper.populateServiceProperties(configFile, serviceInfo);
-    
-    Map<String, Map<String, Map<String, String>>> expectedConfigTypes = new HashMap<String, Map<String, Map<String, String>>>();
-    addToPropertyMap(expectedConfigTypes, "yarn-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "yarn-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "true");
-    addToPropertyMap(expectedConfigTypes, "yarn-site", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "true");
-    
-    assertEquals(expectedConfigTypes, serviceInfo.getConfigTypes());
-  }
-
-  @Test
-  public void testPopulateServiceProperties_supportsFinalTrue() throws Exception {
-    StackExtensionHelper helper = getStackExtensionHelper();
-    ServiceInfo serviceInfo = getServiceFromStack(helper, "HDP", "2.0.7", "HDFS");
-    
-    File configFile = new File(stackRootStr
-        + "HDP/2.0.7/services/HDFS/configuration/global.xml".replaceAll("/", File.separator));
-    helper.populateServiceProperties(configFile, serviceInfo);
-    
-    Map<String, Map<String, Map<String, String>>> expectedConfigTypes = new HashMap<String, Map<String, Map<String, String>>>();
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "true");
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    
-    assertEquals(expectedConfigTypes, serviceInfo.getConfigTypes());
-  }
-
-  @Test
-  public void testPopulateServiceProperties_supportsFinalFalse() throws Exception {
-    StackExtensionHelper helper = getStackExtensionHelper();
-    ServiceInfo serviceInfo = getServiceFromStack(helper, "HDP", "2.0.7", "HDFS");
-    File configFile = new File(stackRootStr
-        + "HDP/2.0.7/services/YARN/configuration/yarn-site.xml".replaceAll("/", File.separator));
-    helper.populateServiceProperties(configFile, serviceInfo);
-    
-    Map<String, Map<String, Map<String, String>>> expectedConfigTypes = new HashMap<String, Map<String, Map<String, String>>>();
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "true");
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "global", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hdfs-site", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "hadoop-policy", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "core-site", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "yarn-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.FINAL.getPropertyName(), "false");
-    addToPropertyMap(expectedConfigTypes, "yarn-site", StackExtensionHelper.Supports.KEYWORD, 
-        StackExtensionHelper.Supports.ADDING_FORBIDDEN.getPropertyName(), "true");
-    addToPropertyMap(expectedConfigTypes, "yarn-site", StackExtensionHelper.Supports.KEYWORD,
-        StackExtensionHelper.Supports.DO_NOT_EXTEND.getPropertyName(), "true");
-    
-    assertEquals(expectedConfigTypes, serviceInfo.getConfigTypes());
-  }
-
-  @Test
-  public void testPopulateServiceProperties_supportsFinalWrongType() throws Exception {
-    // init
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = createMockBuilder(StackExtensionHelper.class).addMockedMethod("addConfigTypeProperty")
-        .withConstructor(injector, stackRoot).createMock();
-    File config = new File("./src/test/resources/bad-stacks/HDP/0.1/services/YARN/configuration/yarn-site.xml"
-        .replaceAll("/", File.separator));
-    ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class);
-    List<PropertyInfo> properties = createNiceMock(List.class);
-
-    // expectations
-    expect(serviceInfo.getConfigTypes()).andReturn(new HashMap<String, Map<String, Map<String, String>>>()).times(2);
-    expect(serviceInfo.getProperties()).andReturn(properties).times(1);
-    expect(properties.addAll((Collection) anyObject())).andReturn(true).times(1);    
-    replay(properties, serviceInfo);
-
-    // eval
-    helper.populateServiceProperties(config, serviceInfo);
-
-    // verification
-    verify(properties, serviceInfo);
-  }
-
-  @Test
-  public void testPopulateServiceProperties_configTypesIsNull() throws Exception {
-    // init
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    File config = new File(stackRootStr
-        + "HDP/2.1.1/services/PIG/configuration/pig-properties.xml".replaceAll("/", File.separator));
-    ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class);
-    List<PropertyInfo> properties = createMock(List.class);
-
-    // expectations
-    expect(serviceInfo.getConfigTypes()).andReturn(new HashMap<String, Map<String, Map<String, String>>>()).times(2);
-    expect(serviceInfo.getProperties()).andReturn(properties).times(1);
-    expect(properties.addAll((Collection) anyObject())).andReturn(true).times(1);
-    replay(properties);
-    replay(serviceInfo);
-
-    // eval
-    helper.populateServiceProperties(config, serviceInfo);
-
-    // verification
-    verify(properties, serviceInfo);
-  }
-
-  @Test
-  public void testUnmarshallConfigurationXml() throws Exception {
-    File configFile = new File("./src/test/resources/bad-stacks/HDP/0.1/services/YARN/configuration/capacity-scheduler.xml");
-    ConfigurationXml config = StackExtensionHelper.unmarshal(ConfigurationXml.class, configFile);
-    Map<QName, String> attributes = config.getAttributes();
-    List<PropertyInfo> properties = config.getProperties();
-
-    // attributes verification
-    assertEquals(2, attributes.size());
-    QName supportsFinal = new QName("", "supports_final");
-    assertTrue(attributes.containsKey(supportsFinal));
-    assertEquals("false", attributes.get(supportsFinal));
-    QName supportsDeletable = new QName("", "supports_deletable");
-    assertTrue(attributes.containsKey(supportsDeletable));
-    assertEquals("false", attributes.get(supportsDeletable));
-
-    // properties verification
-    assertEquals(3, properties.size());
-
-    PropertyInfo propertyInfo;
-    propertyInfo = properties.get(0);
-    assertEquals("yarn.scheduler.capacity.maximum-applications", propertyInfo.getName());
-    assertEquals("Maximum number of applications that can be pending and running.", propertyInfo.getDescription());
-    assertEquals("10000", propertyInfo.getValue());
-    assertEquals(1, propertyInfo.getAttributesMap().size());
-    assertEquals("true", propertyInfo.getAttributesMap().get("final"));
-    assertEquals(null, propertyInfo.getFilename());
-    assertEquals(false, propertyInfo.isDeleted());
-    assertEquals(false, propertyInfo.isRequireInput());
-    assertTrue(propertyInfo.getPropertyTypes().isEmpty());
-
-    propertyInfo = properties.get(1);
-    assertEquals("yarn.scheduler.capacity.maximum-am-resource-percent", propertyInfo.getName());
-    assertEquals("Maximum percent of resources in the cluster.", propertyInfo.getDescription());
-    assertEquals("0.2", propertyInfo.getValue());
-    assertEquals(1, propertyInfo.getAttributesMap().size());
-    assertEquals("false", propertyInfo.getAttributesMap().get("final"));
-    assertEquals(null, propertyInfo.getFilename());
-    assertEquals(true, propertyInfo.isDeleted());
-    assertEquals(false, propertyInfo.isRequireInput());
-    assertTrue(propertyInfo.getPropertyTypes().isEmpty());
-
-    propertyInfo = properties.get(2);
-    assertEquals("yarn.scheduler.capacity.root.queues", propertyInfo.getName());
-    assertEquals("The queues at the this level (root is the root queue).", propertyInfo.getDescription());
-    assertEquals("default", propertyInfo.getValue());
-    assertEquals(0, propertyInfo.getAttributesMap().size());
-    assertEquals(null, propertyInfo.getFilename());
-    assertEquals(false, propertyInfo.isDeleted());
-    assertEquals(true, propertyInfo.isRequireInput());
-    assertTrue(propertyInfo.getPropertyTypes().isEmpty());
-  }
-
-  @Test
-  public void testMergeServices_BothConfigTypesAreNull() throws Exception {
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    ServiceInfo child = new ServiceInfo();
-    ServiceInfo parent = new ServiceInfo();
-
-    child.setConfigTypes(null);
-    child.setConfigDependencies(null);
-
-    parent.setConfigTypes(null);
-    parent.setConfigDependencies(null);
-
-    ServiceInfo merged = helper.mergeServices(parent, child);
-
-    assertNotNull(merged.getConfigDependencies());
-    assertEquals(0, merged.getConfigDependencies().size());
-    assertNotNull(merged.getConfigTypes());
-    assertEquals(0, merged.getConfigTypes().size());
-  }
-
-  @Test
-  public void testServiceInheritance() throws Exception {
-    File stackRoot = new File(stackRootStr);
-    StackInfo stackInfo = new StackInfo();
-    stackInfo.setName("HDP");
-    stackInfo.setVersion("2.0.6");
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    helper.populateServicesForStack(stackInfo);
-    helper.fillInfo();
-    List<ServiceInfo> allServices = helper.getAllApplicableServices(stackInfo);
-    for (ServiceInfo serviceInfo : allServices) {
-      if (serviceInfo.getName().equals("HDFS")){
-        assertEquals("HDFS", serviceInfo.getName());
-        assertNotNull(serviceInfo.getMetricsFile()); 
-      } 
-    }
-    
-  }
-  
-  
-  @Test
-  public void testMergeComponentInfo() throws Exception {
-    File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
-    ComponentInfo child = new ComponentInfo();
-    ComponentInfo parent = new ComponentInfo();
-    DependencyInfo a = new DependencyInfo();
-    a.setName("serviceName/A");
-    DependencyInfo b = new DependencyInfo();
-    b.setName("serviceName/B");
-    List<DependencyInfo> parentDependencies = new ArrayList<DependencyInfo>();
-    parentDependencies.add(a);
-    parentDependencies.add(b);
-    parent.setDependencies(parentDependencies);
-
-    DependencyInfo c = new DependencyInfo();
-    c.setName("serviceName/C");
-    List<DependencyInfo> childDependencies = new ArrayList<DependencyInfo>();
-    childDependencies.add(c);
-    child.setDependencies(childDependencies);
-
-    child.setCardinality("1");
-    parent.setCardinality("1+");
-
-    child.setCategory("CLIENT");
-    parent.setCategory("MASTER");
-
-    ComponentInfo result = helper.mergeComponents(parent, child);
-
-    assertEquals(result.getCardinality(),"1");
-    assertEquals(result.getCategory(), "CLIENT");
-    assertEquals(result.getDependencies().size(), 3);
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
index 5c8b4ad..e068508 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
@@ -299,7 +299,7 @@ public class AmbariManagementControllerImplTest {
     expect(serviceInfo.getClientComponent()).andReturn(compInfo);
     expect(compInfo.getName()).andReturn("component");
     expect(component.getServiceComponentHosts()).andReturn(Collections.<String, ServiceComponentHost>singletonMap("host", null));
-    expect(ambariMetaInfo.getServiceInfo("stack", "1.0", "service")).andReturn(serviceInfo);
+    expect(ambariMetaInfo.getService("stack", "1.0", "service")).andReturn(serviceInfo);
 
     replay(injector, cluster, service, component, serviceInfo, compInfo, ambariMetaInfo, stackId);
 
@@ -339,7 +339,7 @@ public class AmbariManagementControllerImplTest {
     ComponentInfo compInfo = createNiceMock(ComponentInfo.class);
     expect(serviceInfo.getClientComponent()).andReturn(compInfo);
     expect(compInfo.getName()).andReturn("component");
-    expect(ambariMetaInfo.getServiceInfo("stack", "1.0", "service")).andReturn(serviceInfo);
+    expect(ambariMetaInfo.getService("stack", "1.0", "service")).andReturn(serviceInfo);
 
     replay(injector, cluster, service, component1, component2, serviceInfo, compInfo, ambariMetaInfo, stackId);
 
@@ -375,7 +375,7 @@ public class AmbariManagementControllerImplTest {
 
     ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class);
     expect(serviceInfo.getClientComponent()).andReturn(null);
-    expect(ambariMetaInfo.getServiceInfo("stack", "1.0", "service")).andReturn(serviceInfo);
+    expect(ambariMetaInfo.getService("stack", "1.0", "service")).andReturn(serviceInfo);
 
     replay(injector, cluster, service, component1, component2, serviceInfo, ambariMetaInfo, stackId);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index b2c023f..2a0ebc5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -156,7 +156,7 @@ public class AmbariManagementControllerTest {
   private static final String NAGIOS_SERVICE_NAME = "NAGIOS";
   private static final int STACK_VERSIONS_CNT = 12;
   private static final int REPOS_CNT = 3;
-  private static final int STACKS_CNT = 2;
+  private static final int STACKS_CNT = 3;
   private static final int STACK_PROPERTIES_CNT = 103;
   private static final int STACK_COMPONENTS_CNT = 4;
   private static final int OS_CNT = 2;
@@ -1718,12 +1718,6 @@ public class AmbariManagementControllerTest {
         for (ExecutionCommandWrapper ecw : stage.getExecutionCommands(host)) {
           Assert.assertFalse(
               ecw.getExecutionCommand().getHostLevelParams().get("repo_info").isEmpty());
-
-          LOG.info("Dumping host action details"
-              + ", stageId=" + stage.getStageId()
-              + ", actionId=" + stage.getActionId()
-              + ", commandDetails="
-              + StageUtils.jaxbToString(ecw.getExecutionCommand()));
         }
       }
     }
@@ -1786,20 +1780,6 @@ public class AmbariManagementControllerTest {
     stages = actionDB.getAllStages(trackAction.getRequestId());
     Assert.assertEquals(2, stages.size());
 
-    for (Stage stage : stages) {
-      LOG.info("Stage Details for Start Service"
-          + ", stageId="+ stage.getStageId()
-          + ", actionId=" + stage.getActionId());
-
-      for (String host : stage.getHosts()) {
-        LOG.info("Dumping host action details"
-            + ", stageId=" + stage.getStageId()
-            + ", actionId=" + stage.getActionId()
-            + ", commandDetails="
-            + StageUtils.jaxbToString(stage.getExecutionCommands(host).get(0)));
-      }
-    }
-
     StringBuilder sb = new StringBuilder();
     clusters.debugDump(sb);
     LOG.info("Cluster Dump: " + sb.toString());
@@ -1837,9 +1817,6 @@ public class AmbariManagementControllerTest {
     // TODO validate stages?
     stages = actionDB.getAllStages(trackAction.getRequestId());
 
-    for (Stage stage : stages) {
-      LOG.info("Stage Details for Stop Service : " + stage.toString());
-    }
     Assert.assertEquals(1, stages.size());
 
   }
@@ -7071,7 +7048,7 @@ public class AmbariManagementControllerTest {
   @Test
   public void testGetStackVersionActiveAttr() throws Exception {
 
-    for (StackInfo stackInfo: ambariMetaInfo.getStackInfos(STACK_NAME)) {
+    for (StackInfo stackInfo: ambariMetaInfo.getStacks(STACK_NAME)) {
       if (stackInfo.getVersion().equalsIgnoreCase(STACK_VERSION)) {
         stackInfo.setActive(true);
       }
@@ -8172,7 +8149,7 @@ public class AmbariManagementControllerTest {
   @Test
   public void testUpdateStacks() throws Exception {
 
-    StackInfo stackInfo = ambariMetaInfo.getStackInfo(STACK_NAME, STACK_VERSION);
+    StackInfo stackInfo = ambariMetaInfo.getStack(STACK_NAME, STACK_VERSION);
 
     for (RepositoryInfo repositoryInfo: stackInfo.getRepositories()) {
       assertFalse(INCORRECT_BASE_URL.equals(repositoryInfo.getBaseUrl()));
@@ -8182,7 +8159,7 @@ public class AmbariManagementControllerTest {
 
     controller.updateStacks();
 
-    stackInfo = ambariMetaInfo.getStackInfo(STACK_NAME, STACK_VERSION);
+    stackInfo = ambariMetaInfo.getStack(STACK_NAME, STACK_VERSION);
 
     for (RepositoryInfo repositoryInfo: stackInfo.getRepositories()) {
       assertFalse(INCORRECT_BASE_URL.equals(repositoryInfo.getBaseUrl()));

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
index 5438654..9514b21 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
@@ -156,8 +156,7 @@ public class BlueprintResourceProviderTest {
         andReturn("test-service").anyTimes();
     expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component2")).
         andReturn("test-service").anyTimes();
-    expect(metaInfo.getRequiredProperties("test-stack-name", "test-stack-version", "test-service")).andReturn(
-        Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes();
+    expect(metaInfo.getService("test-stack-name", "test-stack-version", "test-service")).andReturn(service).anyTimes();
     dao.create(capture(entityCapture));
 
     replay(dao, metaInfo, request, managementController);
@@ -222,8 +221,7 @@ public class BlueprintResourceProviderTest {
         andReturn("test-service").anyTimes();
     expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component2")).
         andReturn("test-service").anyTimes();
-    expect(metaInfo.getRequiredProperties("test-stack-name", "test-stack-version", "test-service")).andReturn(
-        Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes();
+    expect(metaInfo.getService("test-stack-name", "test-stack-version", "test-service")).andReturn(service).anyTimes();
     dao.create(capture(entityCapture));
 
     replay(dao, metaInfo, request, managementController);
@@ -290,8 +288,7 @@ public class BlueprintResourceProviderTest {
         andReturn("test-service").anyTimes();
     expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component2")).
         andReturn("test-service").anyTimes();
-    expect(metaInfo.getRequiredProperties("test-stack-name", "test-stack-version", "test-service")).andReturn(
-        Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes();
+    expect(metaInfo.getService("test-stack-name", "test-stack-version", "test-service")).andReturn(service).anyTimes();
     dao.create(capture(entityCapture));
 
     replay(dao, metaInfo, request, managementController);
@@ -381,7 +378,7 @@ public class BlueprintResourceProviderTest {
         BlueprintResourceProvider.BLUEPRINT_NAME_PROPERTY_ID, BLUEPRINT_NAME);
 
     AbstractResourceProviderTest.TestObserver observer = new AbstractResourceProviderTest.TestObserver();
-    ((ObservableResourceProvider)provider).addObserver(observer);
+    provider.addObserver(observer);
 
     provider.deleteResources(predicate);
 
@@ -639,7 +636,6 @@ public class BlueprintResourceProviderTest {
     expect(stackServiceResponse.getServiceName()).andReturn("test-service").anyTimes();
     expect(stackServiceResponse.getStackName()).andReturn("test-stack-name").anyTimes();
     expect(stackServiceResponse.getStackVersion()).andReturn("test-stack-version").anyTimes();
-    expect(stackServiceResponse.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet());
 
     expect(managementController.getStackComponents(capture(serviceComponentRequestCapture))).andReturn(setServiceComponents).anyTimes();
     expect(stackServiceComponentResponse.getCardinality()).andReturn("2").anyTimes();
@@ -673,8 +669,7 @@ public class BlueprintResourceProviderTest {
         andReturn("test-service").anyTimes();
     expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component2")).
         andReturn("test-service").anyTimes();
-    expect(metaInfo.getRequiredProperties("test-stack-name", "test-stack-version", "test-service")).andReturn(
-        Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes();
+    expect(metaInfo.getService("test-stack-name", "test-stack-version", "test-service")).andReturn(service).anyTimes();
     dao.create(capture(entityCapture));
 
     replay(dao, metaInfo, request, managementController, stackServiceResponse,
@@ -751,7 +746,6 @@ public class BlueprintResourceProviderTest {
     expect(stackServiceResponse.getServiceName()).andReturn("test-service").anyTimes();
     expect(stackServiceResponse.getStackName()).andReturn("test-stack-name").anyTimes();
     expect(stackServiceResponse.getStackVersion()).andReturn("test-stack-version").anyTimes();
-    expect(stackServiceResponse.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet());
 
     expect(managementController.getStackComponents(capture(serviceComponentRequestCapture))).andReturn(setServiceComponents).anyTimes();
     expect(stackServiceComponentResponse.getCardinality()).andReturn("2").anyTimes();
@@ -785,8 +779,7 @@ public class BlueprintResourceProviderTest {
         andReturn("test-service").anyTimes();
     expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component2")).
         andReturn("test-service").anyTimes();
-    expect(metaInfo.getRequiredProperties("test-stack-name", "test-stack-version", "test-service")).andReturn(
-        Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes();
+    expect(metaInfo.getService("test-stack-name", "test-stack-version", "test-service")).andReturn(service).anyTimes();
     dao.create(capture(entityCapture));
 
     replay(dao, metaInfo, request, managementController, stackServiceResponse,
@@ -870,8 +863,7 @@ public class BlueprintResourceProviderTest {
         Collections.<StackServiceResponse>singleton(stackServiceResponse));
     expect(stackServiceResponse.getServiceName()).andReturn("test-service").anyTimes();
     expect(stackServiceResponse.getStackName()).andReturn("test-stack-name").anyTimes();
-    expect(stackServiceResponse.getStackVersion()).andReturn("test-stack-version").anyTimes();
-    expect(stackServiceResponse.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet());
+    expect(stackServiceResponse.getStackVersion()).andReturn("test-stack-version").anyTimes();;
 
     expect(managementController.getStackComponents(capture(serviceComponentRequestCapture))).andReturn(setServiceComponents).anyTimes();
     expect(stackServiceComponentResponse.getCardinality()).andReturn("2").anyTimes();
@@ -905,8 +897,7 @@ public class BlueprintResourceProviderTest {
         andReturn("test-service").anyTimes();
     expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component2")).
         andReturn("test-service").anyTimes();
-    expect(metaInfo.getRequiredProperties("test-stack-name", "test-stack-version", "test-service")).andReturn(
-        Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes();
+    expect(metaInfo.getService("test-stack-name", "test-stack-version", "test-service")).andReturn(service).anyTimes();
     dao.create(capture(entityCapture));
 
     replay(dao, metaInfo, request, managementController, stackServiceResponse,
@@ -980,7 +971,6 @@ public class BlueprintResourceProviderTest {
     expect(stackServiceResponse.getServiceName()).andReturn("test-service").anyTimes();
     expect(stackServiceResponse.getStackName()).andReturn("test-stack-name").anyTimes();
     expect(stackServiceResponse.getStackVersion()).andReturn("test-stack-version").anyTimes();
-    expect(stackServiceResponse.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet());
 
     expect(managementController.getStackComponents(capture(serviceComponentRequestCapture))).andReturn(setServiceComponents).anyTimes();
     expect(stackServiceComponentResponse.getCardinality()).andReturn("2").anyTimes();
@@ -1014,8 +1004,7 @@ public class BlueprintResourceProviderTest {
         andReturn("test-service").anyTimes();
     expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component2")).
         andReturn("test-service").anyTimes();
-    expect(metaInfo.getRequiredProperties("test-stack-name", "test-stack-version", "test-service")).andReturn(
-        Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes();
+    expect(metaInfo.getService("test-stack-name", "test-stack-version", "test-service")).andReturn(service).anyTimes();
 
     replay(dao, metaInfo, request, managementController, stackServiceResponse,
         stackServiceComponentResponse, stackServiceComponentResponse2);
@@ -1062,6 +1051,7 @@ public class BlueprintResourceProviderTest {
     serviceComponents.add(component1);
     serviceComponents.add(component2);
 
+
     Set<Map<String, Object>> setProperties = getTestProperties();
     ((HashSet<Map<String, String>>) ((HashSet<Map<String, Object>>) setProperties.iterator().next().get(
         BlueprintResourceProvider.HOST_GROUP_PROPERTY_ID)).iterator().next().get("components")).
@@ -1080,8 +1070,7 @@ public class BlueprintResourceProviderTest {
         andReturn(serviceComponents).anyTimes();
     expect(metaInfo.getComponentToService("test-stack-name", "test-stack-version", "component1")).
         andReturn("test-service").anyTimes();
-    expect(metaInfo.getRequiredProperties("test-stack-name", "test-stack-version", "test-service")).andReturn(
-        Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes();
+    expect(metaInfo.getService("test-stack-name", "test-stack-version", "test-service")).andReturn(service).anyTimes();
 
     dao.create(capture(entityCapture));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
index d73eea4..0d3b00f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
@@ -256,9 +256,9 @@ public class ClientConfigResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn(stackVersion).anyTimes();
 
     expect(ambariMetaInfo.getComponent(stackName, stackVersion, serviceName, componentName)).andReturn(componentInfo);
-    expect(ambariMetaInfo.getServiceInfo(stackName, stackVersion, serviceName)).andReturn(serviceInfo);
+    expect(ambariMetaInfo.getService(stackName, stackVersion, serviceName)).andReturn(serviceInfo);
     expect(serviceInfo.getServicePackageFolder()).andReturn(packageFolder);
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
             (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
     expect(componentInfo.getCommandScript()).andReturn(commandScriptDefinition);
     expect(componentInfo.getClientConfigFiles()).andReturn(clientConfigFileDefinitionList);
@@ -271,7 +271,7 @@ public class ClientConfigResourceProviderTest {
     HashMap<String, String> rcaParams = new HashMap<String, String>();
     rcaParams.put("key","value");
     expect(managementController.getRcaParameters()).andReturn(rcaParams).anyTimes();
-    expect(ambariMetaInfo.getServiceInfo(stackName, stackVersion, serviceName)).andReturn(serviceInfo);
+    expect(ambariMetaInfo.getService(stackName, stackVersion, serviceName)).andReturn(serviceInfo);
     expect(serviceInfo.getOsSpecifics()).andReturn(new HashMap<String, ServiceOsSpecific>()).anyTimes();
     Set<String> userSet = new HashSet<String>();
     userSet.add("hdfs");

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
index 98bd017..f7149a8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
@@ -96,7 +96,6 @@ public class ClusterResourceProviderTest {
     BaseBlueprintProcessor.stackInfo = null;
   }
 
-
   @Test
   public void testCreateResources() throws Exception{
     Resource.Type type = Resource.Type.Cluster;
@@ -2961,7 +2960,6 @@ public class ClusterResourceProviderTest {
 
 
     expect(mockStackServiceResponseOne.getServiceName()).andReturn("OOZIE").atLeastOnce();
-    expect(mockStackServiceResponseOne.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet()).atLeastOnce();
     expect(mockManagementController.getStackServices(isA(Set.class))).andReturn(Collections.singleton(mockStackServiceResponseOne));
     expect(mockManagementController.getStackComponents(isA(Set.class))).andReturn(Collections.singleton(mockStackComponentResponse));
     expect(mockManagementController.getStackConfigurations(isA(Set.class))).andReturn(Collections.<StackConfigurationResponse>emptySet());
@@ -3045,7 +3043,6 @@ public class ClusterResourceProviderTest {
 
 
     expect(mockStackServiceResponseOne.getServiceName()).andReturn("FALCON").atLeastOnce();
-    expect(mockStackServiceResponseOne.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet()).atLeastOnce();
     expect(mockManagementController.getStackServices(isA(Set.class))).andReturn(Collections.singleton(mockStackServiceResponseOne));
     expect(mockManagementController.getStackComponents(isA(Set.class))).andReturn(Collections.singleton(mockStackComponentResponse));
     expect(mockManagementController.getStackConfigurations(isA(Set.class))).andReturn(Collections.<StackConfigurationResponse>emptySet());
@@ -3127,7 +3124,6 @@ public class ClusterResourceProviderTest {
 
 
     expect(mockStackServiceResponseOne.getServiceName()).andReturn("OOZIE").atLeastOnce();
-    expect(mockStackServiceResponseOne.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet()).atLeastOnce();
     expect(mockManagementController.getStackServices(isA(Set.class))).andReturn(Collections.singleton(mockStackServiceResponseOne));
     expect(mockManagementController.getStackComponents(isA(Set.class))).andReturn(Collections.singleton(mockStackComponentResponse));
     expect(mockManagementController.getStackConfigurations(isA(Set.class))).andReturn(Collections.<StackConfigurationResponse>emptySet());
@@ -3203,9 +3199,7 @@ public class ClusterResourceProviderTest {
     expect(mockStackComponentResponse.getCardinality()).andReturn("1");
     expect(mockStackComponentResponse.getAutoDeploy()).andReturn(new AutoDeployInfo());
 
-
     expect(mockStackServiceResponseOne.getServiceName()).andReturn("FALCON").atLeastOnce();
-    expect(mockStackServiceResponseOne.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet()).atLeastOnce();
 
     expect(mockManagementController.getStackServices(isA(Set.class))).andReturn(Collections.singleton(mockStackServiceResponseOne));
     expect(mockManagementController.getStackComponents(isA(Set.class))).andReturn(Collections.singleton(mockStackComponentResponse));
@@ -3283,7 +3277,6 @@ public class ClusterResourceProviderTest {
     expect(mockStackComponentResponse.getAutoDeploy()).andReturn(new AutoDeployInfo());
 
     expect(mockStackServiceResponseOne.getServiceName()).andReturn("HIVE").atLeastOnce();
-    expect(mockStackServiceResponseOne.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet()).atLeastOnce();
     expect(mockManagementController.getStackServices(isA(Set.class))).andReturn(Collections.singleton(mockStackServiceResponseOne));
     expect(mockManagementController.getStackComponents(isA(Set.class))).andReturn(Collections.singleton(mockStackComponentResponse));
     expect(mockManagementController.getStackConfigurations(isA(Set.class))).andReturn(Collections.<StackConfigurationResponse>emptySet());
@@ -3360,7 +3353,6 @@ public class ClusterResourceProviderTest {
     expect(mockStackComponentResponse.getAutoDeploy()).andReturn(new AutoDeployInfo());
 
     expect(mockStackServiceResponseOne.getServiceName()).andReturn("HBASE").atLeastOnce();
-    expect(mockStackServiceResponseOne.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet()).atLeastOnce();
 
     expect(mockManagementController.getStackServices(isA(Set.class))).andReturn(Collections.singleton(mockStackServiceResponseOne));
     expect(mockManagementController.getStackComponents(isA(Set.class))).andReturn(Collections.singleton(mockStackComponentResponse));

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
index 1455c52..a66add3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
@@ -49,6 +49,7 @@ import java.util.Set;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ObjectNotFoundException;
 import org.apache.ambari.server.ServiceComponentNotFoundException;
+import org.apache.ambari.server.StackAccessException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.AmbariManagementControllerImpl;
@@ -187,8 +188,8 @@ public class ComponentResourceProviderTest {
     expect(serviceComponent3.convertToResponse()).andReturn(
       new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", null, "", 1, 1, 0));
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(),
-      (String) anyObject(), (String) anyObject(), (String) anyObject()))
+    expect(ambariMetaInfo.getComponent((String) anyObject(),
+        (String) anyObject(), (String) anyObject(), (String) anyObject()))
         .andReturn(componentInfo1).times(2).andReturn(componentInfo2);
 
     expect(componentInfo1.getCategory()).andReturn("MASTER").anyTimes();
@@ -254,6 +255,10 @@ public class ComponentResourceProviderTest {
     Cluster cluster = createNiceMock(Cluster.class);
     AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
     Service service = createNiceMock(Service.class);
+    ComponentInfo component1Info = createNiceMock(ComponentInfo.class);
+    ComponentInfo component2Info = createNiceMock(ComponentInfo.class);
+    ComponentInfo component3Info = createNiceMock(ComponentInfo.class);
+
     ServiceComponent serviceComponent1 = createNiceMock(ServiceComponent.class);
     ServiceComponent serviceComponent2 = createNiceMock(ServiceComponent.class);
     ServiceComponent serviceComponent3 = createNiceMock(ServiceComponent.class);
@@ -271,20 +276,33 @@ public class ComponentResourceProviderTest {
     expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
     expect(managementController.getEffectiveMaintenanceState(
         capture(new Capture<ServiceComponentHost>()))).andReturn(MaintenanceState.OFF).anyTimes();
-    
+
+    expect(stackId.getStackName()).andReturn("stackName").anyTimes();
+    expect(stackId.getStackVersion()).andReturn("1").anyTimes();
     expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
     expect(cluster.getDesiredStackVersion()).andReturn(stackId);
 
     expect(cluster.getService("Service100")).andReturn(service).anyTimes();
+    expect(service.getName()).andReturn("Service100").anyTimes();
     expect(service.getServiceComponent("Component101")).andReturn(serviceComponent1).anyTimes();
     expect(service.getServiceComponent("Component102")).andReturn(serviceComponent1).anyTimes();
     expect(service.getServiceComponent("Component103")).andReturn(serviceComponent2).anyTimes();
 
+    expect(serviceComponent1.getName()).andReturn("Component101").anyTimes();
+    expect(serviceComponent2.getName()).andReturn("Component102").anyTimes();
+    expect(serviceComponent3.getName()).andReturn("Component103").anyTimes();
 
     expect(cluster.getServices()).andReturn(Collections.singletonMap("Service100", service)).anyTimes();
 
     expect(service.getServiceComponents()).andReturn(serviceComponentMap).anyTimes();
 
+    expect(ambariMetaInfo.getComponent("stackName", "1", "Service100", "Component101")).andReturn(component1Info).atLeastOnce();
+    expect(ambariMetaInfo.getComponent("stackName", "1", "Service100", "Component102")).andReturn(component2Info).atLeastOnce();
+    expect(ambariMetaInfo.getComponent("stackName", "1", "Service100", "Component103")).andReturn(component3Info).atLeastOnce();
+    expect(component1Info.getCategory()).andReturn(null);
+    expect(component2Info.getCategory()).andReturn(null);
+    expect(component3Info.getCategory()).andReturn(null);
+
     expect(serviceComponent1.convertToResponse()).andReturn(
       new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", null, "", 1, 0, 1));
     expect(serviceComponent2.convertToResponse()).andReturn(
@@ -316,16 +334,14 @@ public class ComponentResourceProviderTest {
     expect(managementController.createAndPersistStages(capture(clusterCapture), capture(requestPropertiesCapture), capture(requestParametersCapture), capture(changedServicesCapture), capture(changedCompsCapture), capture(changedScHostsCapture), capture(ignoredScHostsCapture), anyBoolean(), anyBoolean()
     )).andReturn(requestStatusResponse);
 
-
-
     Map<String, String> mapRequestProps = new HashMap<String, String>();
     mapRequestProps.put("context", "Called from a test");
 
 
     // replay
-    replay(managementController, clusters, cluster, ambariMetaInfo, service,
-        serviceComponent1, serviceComponent2, serviceComponent3, serviceComponentHost,
-        requestStatusResponse, stackId, maintenanceStateHelper);
+    replay(managementController, clusters, cluster, ambariMetaInfo, service, component1Info,
+        component2Info, component3Info, serviceComponent1, serviceComponent2, serviceComponent3,
+        serviceComponentHost, requestStatusResponse, stackId, maintenanceStateHelper);
 
     ResourceProvider provider = new ComponentResourceProvider(
         PropertyHelper.getPropertyIds(type),
@@ -340,15 +356,15 @@ public class ComponentResourceProviderTest {
     // create the request
     Request request = PropertyHelper.getUpdateRequest(properties, mapRequestProps);
 
-    // update the cluster named Cluster102
+    // update the cluster named Cluster100
     Predicate predicate = new PredicateBuilder().property(ComponentResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID).
         equals("Cluster100").toPredicate();
     provider.updateResources(request, predicate);
 
     // verify
-    verify(managementController, clusters, cluster, ambariMetaInfo, service,
-        serviceComponent1, serviceComponent2, serviceComponent3, serviceComponentHost,
-        requestStatusResponse, stackId, maintenanceStateHelper);
+    verify(managementController, clusters, cluster, ambariMetaInfo, service, component1Info,
+        component2Info, component3Info, serviceComponent1, serviceComponent2, serviceComponent3,
+        serviceComponentHost, requestStatusResponse, stackId, maintenanceStateHelper);
   }
 
   public void testSuccessDeleteResources() throws Exception {
@@ -615,6 +631,7 @@ public class ComponentResourceProviderTest {
 
     Cluster cluster = createNiceMock(Cluster.class);
     Service service = createNiceMock(Service.class);
+    ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);
     ServiceComponent component = createNiceMock(ServiceComponent.class);
     ServiceComponentResponse response = createNiceMock(ServiceComponentResponse.class);
 
@@ -630,25 +647,31 @@ public class ComponentResourceProviderTest {
     expect(managementController.getClusters()).andReturn(clusters).anyTimes();
     expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
 
+    expect(stackId.getStackName()).andReturn("stackName").anyTimes();
+    expect(stackId.getStackVersion()).andReturn("1").anyTimes();
+
     // getComponents
     expect(clusters.getCluster("cluster1")).andReturn(cluster);
     expect(cluster.getService("service1")).andReturn(service);
     expect(cluster.getDesiredStackVersion()).andReturn(stackId).anyTimes();
+    expect(service.getName()).andReturn("service1").anyTimes();
     expect(service.getServiceComponent("component1")).andReturn(component);
 
+    expect(ambariMetaInfo.getComponent("stackName", "1", "service1", "component1")).andReturn(componentInfo);
+    expect(componentInfo.getCategory()).andReturn(null);
+
     expect(component.convertToResponse()).andReturn(response);
     // replay mocks
-    replay(clusters, cluster, service, component, response, ambariMetaInfo, stackId, managementController);
+    replay(clusters, cluster, service, componentInfo, component, response, ambariMetaInfo, stackId, managementController);
 
     //test
-//    AmbariManagementController controller = new AmbariManagementControllerImpl(null, clusters, injector);
     Set<ServiceComponentResponse> setResponses = getComponentResourceProvider(managementController).getComponents(setRequests);
 
     // assert and verify
     assertEquals(1, setResponses.size());
     assertTrue(setResponses.contains(response));
 
-    verify(clusters, cluster, service, component, response, ambariMetaInfo, stackId, managementController);
+    verify(clusters, cluster, service, componentInfo, component, response, ambariMetaInfo, stackId, managementController);
   }
 
   /**
@@ -665,6 +688,8 @@ public class ComponentResourceProviderTest {
 
     Cluster cluster = createNiceMock(Cluster.class);
     Service service = createNiceMock(Service.class);
+    ComponentInfo component3Info = createNiceMock(ComponentInfo.class);
+    ComponentInfo component4Info = createNiceMock(ComponentInfo.class);
     ServiceComponent component1 = createNiceMock(ServiceComponent.class);
     ServiceComponent component2 = createNiceMock(ServiceComponent.class);
     ServiceComponentResponse response1 = createNiceMock(ServiceComponentResponse.class);
@@ -693,12 +718,22 @@ public class ComponentResourceProviderTest {
     expect(managementController.getClusters()).andReturn(clusters).anyTimes();
     expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
 
+    expect(stackId.getStackName()).andReturn("stackName").anyTimes();
+    expect(stackId.getStackVersion()).andReturn("1").anyTimes();
+
     // getComponents
-    expect(clusters.getCluster("cluster1")).andReturn(cluster).times(5);
+    expect(clusters.getCluster("cluster1")).andReturn(cluster).anyTimes();
     expect(cluster.getDesiredStackVersion()).andReturn(stackId).anyTimes();
-    expect(cluster.getService("service1")).andReturn(service).times(4);
+    expect(cluster.getService("service1")).andReturn(service).anyTimes();
     expect(cluster.getService("service2")).andThrow(new ObjectNotFoundException("service2"));
 
+    expect(ambariMetaInfo.getComponent("stackName", "1", "service1", "component3")).andReturn(component3Info);
+    expect(ambariMetaInfo.getComponent("stackName", "1", "service1", "component4")).andReturn(component4Info);
+
+    expect(component3Info.getCategory()).andReturn(null);
+    expect(component4Info.getCategory()).andReturn(null);
+
+    expect(service.getName()).andReturn("service1").anyTimes();
     expect(service.getServiceComponent("component1")).andThrow(new ServiceComponentNotFoundException("cluster1", "service1", "component1"));
     expect(service.getServiceComponent("component2")).andThrow(new ServiceComponentNotFoundException("cluster1", "service1", "component2"));
     expect(service.getServiceComponent("component3")).andReturn(component1);
@@ -707,7 +742,8 @@ public class ComponentResourceProviderTest {
     expect(component1.convertToResponse()).andReturn(response1);
     expect(component2.convertToResponse()).andReturn(response2);
     // replay mocks
-    replay(clusters, cluster, service, component1,  component2, response1, response2, ambariMetaInfo, stackId, managementController);
+    replay(clusters, cluster, service, component3Info, component4Info, component1,  component2, response1,
+        response2, ambariMetaInfo, stackId, managementController);
 
     //test
     Set<ServiceComponentResponse> setResponses = getComponentResourceProvider(managementController).getComponents(setRequests);
@@ -717,7 +753,8 @@ public class ComponentResourceProviderTest {
     assertTrue(setResponses.contains(response1));
     assertTrue(setResponses.contains(response2));
 
-    verify(clusters, cluster, service, component1,  component2, response1, response2, ambariMetaInfo, stackId, managementController);
+    verify(clusters, cluster, service, component3Info, component4Info, component1, component2, response1,
+        response2, ambariMetaInfo, stackId, managementController);
   }
 
   public static ComponentResourceProvider getComponentResourceProvider(AmbariManagementController managementController)

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
index 2879094..cab75ee 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
@@ -282,7 +282,7 @@ public class HostResourceProviderTest {
     expect(healthStatus.getHealthReport()).andReturn("HEALTHY").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.getCategory()).andReturn("MASTER").anyTimes();
@@ -391,7 +391,7 @@ public class HostResourceProviderTest {
     expect(healthStatus.getHealthReport()).andReturn("HEALTHY").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.getCategory()).andReturn("MASTER").anyTimes();
@@ -499,7 +499,7 @@ public class HostResourceProviderTest {
     expect(healthStatus.getHealthReport()).andReturn("HEALTHY").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.getCategory()).andReturn("MASTER").anyTimes();
@@ -684,7 +684,7 @@ public class HostResourceProviderTest {
     expect(hostResponse1.getStatus()).andReturn(HealthStatus.ALERT.name()).anyTimes();
     expect(healthStatus.getHealthStatus()).andReturn(HostHealthStatus.HealthStatus.HEALTHY).anyTimes();
     expect(healthStatus.getHealthReport()).andReturn("HEALTHY").anyTimes();
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
     expect(componentInfo.getCategory()).andReturn("SLAVE").anyTimes();
     expect(resourceProviderFactory.getHostResourceProvider(anyObject(Set.class), anyObject(Map.class),

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fc7adec/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
index 05f2e01..5003c16 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
@@ -648,7 +648,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(true);
@@ -699,7 +699,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(true);
@@ -748,7 +748,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(true);
@@ -797,7 +797,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(true);
@@ -843,7 +843,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(false);
@@ -890,7 +890,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(true);
@@ -938,7 +938,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(true);
@@ -986,7 +986,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(true);
@@ -1032,7 +1032,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(true);
@@ -1075,7 +1075,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(false);
@@ -1125,7 +1125,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
             (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     // replay
@@ -1166,7 +1166,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isClient()).andReturn(true);
@@ -1209,7 +1209,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
         (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isClient()).andReturn(true);
@@ -1316,7 +1316,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
             (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isClient()).andReturn(false).anyTimes();
@@ -1372,7 +1372,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
             (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isMaster()).andReturn(false).anyTimes();
@@ -1436,7 +1436,7 @@ public class ServiceResourceProviderTest {
     expect(stackId.getStackVersion()).andReturn("V1").anyTimes();
 
 
-    expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
+    expect(ambariMetaInfo.getComponent((String) anyObject(), (String) anyObject(),
             (String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
 
     expect(componentInfo.isClient()).andReturn(false);


Mime
View raw message