ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject git commit: AMBARI-5861. Service checks should not be hardcoded on the serverside (aonishuk)
Date Fri, 23 May 2014 15:06:22 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 2b235e353 -> 76be68182


AMBARI-5861. Service checks should not be hardcoded on the serverside (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/76be6818
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/76be6818
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/76be6818

Branch: refs/heads/trunk
Commit: 76be68182b3665c63157d182d0c880fa5cd5724e
Parents: 2b235e3
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri May 23 18:06:08 2014 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri May 23 18:06:08 2014 +0300

----------------------------------------------------------------------
 .../server/api/services/AmbariMetaInfo.java     |  9 ++-
 .../server/api/util/StackExtensionHelper.java   | 17 ++++-
 .../ambari/server/metadata/ActionMetadata.java  | 72 +++++++-------------
 .../apache/ambari/server/state/ServiceInfo.java |  1 +
 .../stacks/HDP/2.1/services/TEZ/metainfo.xml    |  6 --
 .../server/api/services/AmbariMetaInfoTest.java | 31 ++++++++-
 .../api/util/StackExtensionHelperTest.java      | 21 +++++-
 .../AmbariManagementControllerTest.java         |  5 +-
 8 files changed, 99 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/76be6818/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index b595064..fc113f4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -69,6 +69,7 @@ import org.slf4j.LoggerFactory;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.google.inject.Inject;
+import com.google.inject.Injector;
 import com.google.inject.Singleton;
 
 
@@ -126,6 +127,10 @@ public class AmbariMetaInfo {
   private File customActionRoot;
   @Inject
   private MetainfoDAO metainfoDAO;
+  @Inject
+  Injector injector;
+  
+  
   // Required properties by stack version
   private final Map<StackId, Map<String, Map<String, PropertyInfo>>> requiredProperties
=
     new HashMap<StackId, Map<String, Map<String, PropertyInfo>>>();
@@ -144,7 +149,7 @@ public class AmbariMetaInfo {
     this.serverVersionFile = new File(serverVersionFilePath);
     this.customActionRoot = new File(conf.getCustomActionDefinitionPath());
   }
-
+  
   public AmbariMetaInfo(File stackRoot, File serverVersionFile) throws Exception {
     this.stackRoot = stackRoot;
     this.serverVersionFile = serverVersionFile;
@@ -777,7 +782,7 @@ public class AmbariMetaInfo {
         + " should be a directory with stack"
         + ", stackRoot = " + stackRootAbsPath);
 
-    StackExtensionHelper stackExtensionHelper = new StackExtensionHelper(stackRoot);
+    StackExtensionHelper stackExtensionHelper = new StackExtensionHelper(injector, stackRoot);
     stackExtensionHelper.fillInfo();
 
     List<StackInfo> stacks = stackExtensionHelper.getAllAvailableStacks();

http://git-wip-us.apache.org/repos/asf/ambari/blob/76be6818/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
index 8608f5b..910de1d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
@@ -40,6 +40,7 @@ import javax.xml.xpath.XPathFactory;
 
 import org.apache.ambari.server.AmbariException;
 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.*;
 import org.slf4j.Logger;
@@ -47,6 +48,8 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
+import com.google.inject.Injector;
+
 /**
  * Helper methods for providing stack extension behavior -
  * Apache Jira: AMBARI-2819
@@ -60,6 +63,8 @@ import org.xml.sax.SAXException;
  * properties are populated).
  */
 public class StackExtensionHelper {
+  private ActionMetadata actionMetadata;
+  
   private File stackRoot;
   private final static Logger LOG = LoggerFactory.getLogger(StackExtensionHelper.class);
   private final Map<String, StackInfo> stackVersionMap = new HashMap<String,
@@ -88,8 +93,9 @@ public class StackExtensionHelper {
    * Note: constructor does not perform inialisation now. After instance
    * creation, you have to call fillInfo() manually
    */
-  public StackExtensionHelper(File stackRoot) {
+  public StackExtensionHelper(Injector injector, File stackRoot) {
     this.stackRoot = stackRoot;
+    this.actionMetadata = injector.getInstance(ActionMetadata.class);
   }
 
 
@@ -148,7 +154,7 @@ public class StackExtensionHelper {
     } else {
       mergedServiceInfo.setCommandScript(parentService.getCommandScript());
     }
-
+    
     String servicePackageFolder = childService.getServicePackageFolder();
     if (servicePackageFolder != null) {
       mergedServiceInfo.setServicePackageFolder(servicePackageFolder);
@@ -316,6 +322,13 @@ public class StackExtensionHelper {
           ServiceInfo newServiceInfo = mergeServices(existingService, service);
           serviceInfoMap.put(service.getName(), newServiceInfo);
         }
+        
+        // add action for service check
+        ServiceInfo serviceInfo = serviceInfoMap.get(service.getName());
+        if(serviceInfo.getCommandScript() != null) {
+          actionMetadata.addServiceCheckAction(serviceInfo.getName());
+        }
+        
       }
     }
     return new ArrayList<ServiceInfo>(serviceInfoMap.values());

http://git-wip-us.apache.org/repos/asf/ambari/blob/76be6818/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
b/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
index 41e5034..ae13bf3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
@@ -19,7 +19,9 @@
 package org.apache.ambari.server.metadata;
 
 import com.google.inject.Singleton;
+
 import org.apache.ambari.server.Role;
+import org.apache.ambari.server.state.Service;
 
 import java.util.*;
 
@@ -33,11 +35,20 @@ public class ActionMetadata {
   private final Map<String, String> serviceCheckActions =
       new HashMap<String, String>();
   private final List<String> defaultHostComponentCommands = new ArrayList<String>();
+  public final static String SERVICE_CHECK_POSTFIX = "_SERVICE_CHECK";
+  
+  private static final Map<String, String> SERVICE_CHECKS;
+  static {
+      Map<String, String> serviceChecks = new HashMap<String, String>();
+      
+      serviceChecks.put(Service.Type.ZOOKEEPER.toString(), "ZOOKEEPER_QUORUM_SERVICE_CHECK");
+      serviceChecks.put(Service.Type.HCATALOG.toString(), "HCAT_SERVICE_CHECK");
+      
+      SERVICE_CHECKS = Collections.unmodifiableMap(serviceChecks);
+  }
 
   public ActionMetadata() {
-    fillServiceActions();
     fillServiceClients();
-    fillServiceCheckActions();
     fillHostComponentCommands();
   }
 
@@ -62,52 +73,6 @@ public class ActionMetadata {
     serviceClients.put("yarn"       , Role.YARN_CLIENT.toString());
   }
 
-  private void fillServiceActions() {
-    serviceActions.put("hdfs"       , Arrays.asList(Role.HDFS_SERVICE_CHECK.toString()));
-    serviceActions.put("glusterfs"  , Arrays.asList(Role.GLUSTERFS_SERVICE_CHECK.toString()));
-    serviceActions.put("hbase"      , Arrays.asList(Role.HBASE_SERVICE_CHECK.toString()));
-    serviceActions.put("mapreduce"  , Arrays.asList(Role.MAPREDUCE_SERVICE_CHECK.toString()));
-    serviceActions.put("mapreduce2" , Arrays.asList(Role.MAPREDUCE2_SERVICE_CHECK.toString()));
-    serviceActions.put("yarn"       , Arrays.asList(Role.YARN_SERVICE_CHECK.toString()));
-    serviceActions.put("zookeeper"  , Arrays.asList(Role.ZOOKEEPER_QUORUM_SERVICE_CHECK.toString()));
-    serviceActions.put("hive"       , Arrays.asList(Role.HIVE_SERVICE_CHECK.toString()));
-    serviceActions.put("hcat"       , Arrays.asList(Role.HCAT_SERVICE_CHECK.toString()));
-    serviceActions.put("oozie"      , Arrays.asList(Role.OOZIE_SERVICE_CHECK.toString()));
-    serviceActions.put("pig"        , Arrays.asList(Role.PIG_SERVICE_CHECK.toString()));
-    serviceActions.put("sqoop"      , Arrays.asList(Role.SQOOP_SERVICE_CHECK.toString()));
-    serviceActions.put("webhcat"    , Arrays.asList(Role.WEBHCAT_SERVICE_CHECK.toString()));
-    serviceActions.put("storm"      , Arrays.asList(Role.STORM_SERVICE_CHECK.toString()));
-    serviceActions.put("falcon"     , Arrays.asList(Role.FALCON_SERVICE_CHECK.toString()));
-    serviceActions.put("flume"      , Arrays.asList(Role.FLUME_SERVICE_CHECK.toString()));
-  }
-
-  private void fillServiceCheckActions() {
-    serviceCheckActions.put("hdfs", Role.HDFS_SERVICE_CHECK.toString());
-    serviceCheckActions.put("glusterfs", Role.GLUSTERFS_SERVICE_CHECK.toString());
-    serviceCheckActions.put("hbase", Role.HBASE_SERVICE_CHECK.toString());
-    serviceCheckActions.put("mapreduce",
-        Role.MAPREDUCE_SERVICE_CHECK.toString());
-    serviceCheckActions.put("mapreduce2",
-        Role.MAPREDUCE2_SERVICE_CHECK.toString());
-    serviceCheckActions.put("yarn",
-        Role.YARN_SERVICE_CHECK.toString());
-    serviceCheckActions.put("zookeeper",
-        Role.ZOOKEEPER_QUORUM_SERVICE_CHECK.toString());
-    serviceCheckActions.put("hive", Role.HIVE_SERVICE_CHECK.toString());
-    serviceCheckActions.put("hcat", Role.HCAT_SERVICE_CHECK.toString());
-    serviceCheckActions.put("oozie", Role.OOZIE_SERVICE_CHECK.toString());
-    serviceCheckActions.put("pig", Role.PIG_SERVICE_CHECK.toString());
-    serviceCheckActions.put("sqoop", Role.SQOOP_SERVICE_CHECK.toString());
-    serviceCheckActions.put("webhcat",
-        Role.WEBHCAT_SERVICE_CHECK.toString());
-    serviceCheckActions.put("storm",
-        Role.STORM_SERVICE_CHECK.toString());
-    serviceCheckActions.put("falcon",
-        Role.FALCON_SERVICE_CHECK.toString());
-    serviceCheckActions.put("flume",
-        Role.FLUME_SERVICE_CHECK.toString());
-  }
-
   public List<String> getActions(String serviceName) {
     List<String> result = serviceActions.get(serviceName.toLowerCase());
     if (result != null) {
@@ -124,6 +89,17 @@ public class ActionMetadata {
   public String getServiceCheckAction(String serviceName) {
     return serviceCheckActions.get(serviceName.toLowerCase());
   }
+  
+  public void addServiceCheckAction(String serviceName) {
+    String actionName = serviceName + SERVICE_CHECK_POSTFIX;
+    
+    if(SERVICE_CHECKS.containsKey(serviceName)) {
+      actionName = SERVICE_CHECKS.get(serviceName);
+    }
+    
+    serviceCheckActions.put(serviceName.toLowerCase(), actionName);
+    serviceActions.put(serviceName.toLowerCase(), Arrays.asList(actionName));
+  }
 
   public boolean isDefaultHostComponentCommand(String command) {
     if (command != null && defaultHostComponentCommands.contains(command)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/76be6818/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
index 7ab384c..2a6de41 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
@@ -101,6 +101,7 @@ public class ServiceInfo {
   private volatile Map<String, ServiceOsSpecific> serviceOsSpecificsMap;
 
   /**
+   * This is used to add service check actions for services.
    * Added at schema ver 2
    */
   private CommandScriptDefinition commandScript;

http://git-wip-us.apache.org/repos/asf/ambari/blob/76be6818/ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/metainfo.xml
index 0fe986b..71c7837 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/TEZ/metainfo.xml
@@ -44,12 +44,6 @@
         </osSpecific>
       </osSpecifics>
 
-      <commandScript>
-        <script>scripts/service_check.py</script>
-        <scriptType>PYTHON</scriptType>
-        <timeout>300</timeout>
-      </commandScript>
-
       <configuration-dependencies>
         <config-type>global</config-type>
         <config-type>tez-site</config-type>

http://git-wip-us.apache.org/repos/asf/ambari/blob/76be6818/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 1abe4ea..d806869 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -24,6 +24,9 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import java.io.File;
 import java.lang.reflect.Method;
@@ -41,7 +44,13 @@ import junit.framework.Assert;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.StackAccessException;
+import org.apache.ambari.server.api.rest.BootStrapResource;
 import org.apache.ambari.server.api.util.StackExtensionHelper;
+import org.apache.ambari.server.bootstrap.BootStrapImpl;
+import org.apache.ambari.server.bootstrap.SshHostInfo;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.metadata.ActionMetadata;
+import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.state.AutoDeployInfo;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.CustomCommandDefinition;
@@ -61,6 +70,11 @@ import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Singleton;
+
 public class AmbariMetaInfoTest {
 
   private static final String STACK_NAME_HDP = "HDP";
@@ -86,6 +100,8 @@ public class AmbariMetaInfoTest {
   private final static Logger LOG =
       LoggerFactory.getLogger(AmbariMetaInfoTest.class);
   private static final String FILE_NAME = "hbase-site.xml";
+  
+  private Injector injector;
 
 
   @Rule
@@ -93,15 +109,24 @@ public class AmbariMetaInfoTest {
 
   @Before
   public void before() throws Exception {
+    injector = Guice.createInjector(new MockModule());
     File stackRoot = new File("src/test/resources/stacks");
     LOG.info("Stacks file " + stackRoot.getAbsolutePath());
     metaInfo = new AmbariMetaInfo(stackRoot, new File("target/version"));
+    metaInfo.injector = injector;
     try {
       metaInfo.init();
     } catch(Exception e) {
       LOG.info("Error in initializing ", e);
     }
   }
+  
+  public class MockModule extends AbstractModule {
+    @Override
+    protected void configure() {
+      bind(ActionMetadata.class);
+    }
+  }
 
   @Test
   public void getComponentCategory() throws AmbariException {
@@ -313,6 +338,7 @@ public class AmbariMetaInfoTest {
     File stackRootTmp = new File(buildDir + "/ambari-metaInfo"); stackRootTmp.mkdir();
     FileUtils.copyDirectory(stackRoot, stackRootTmp);
     AmbariMetaInfo ambariMetaInfo = new AmbariMetaInfo(stackRootTmp, new File("target/version"));
+    ambariMetaInfo.injector = this.injector;
     File f1, f2, f3;
     f1 = new File(stackRootTmp.getAbsolutePath() + "/001.svn"); f1.createNewFile();
     f2 = new File(stackRootTmp.getAbsolutePath() + "/abcd.svn/001.svn"); f2.mkdirs(); f2.createNewFile();
@@ -562,7 +588,7 @@ public class AmbariMetaInfoTest {
     Method method = StackExtensionHelper.class.getDeclaredMethod
       ("getParentStacksInOrder", Collection.class);
     method.setAccessible(true);
-    StackExtensionHelper helper = new StackExtensionHelper(metaInfo.getStackRoot());
+    StackExtensionHelper helper = new StackExtensionHelper(injector, metaInfo.getStackRoot());
     helper.fillInfo();
     Map<String, List<StackInfo>> stacks =
       (Map<String, List<StackInfo>>) method.invoke(helper, allStacks);
@@ -587,7 +613,7 @@ public class AmbariMetaInfoTest {
 
   @Test
   public void testGetApplicableServices() throws Exception {
-    StackExtensionHelper helper = new StackExtensionHelper(
+    StackExtensionHelper helper = new StackExtensionHelper(injector, 
       metaInfo.getStackRoot());
     helper.fillInfo();
     List<ServiceInfo> allServices = helper.getAllApplicableServices(metaInfo
@@ -637,6 +663,7 @@ public class AmbariMetaInfoTest {
     File stackRoot = new File("src/test/resources/bad-stacks");
     LOG.info("Stacks file " + stackRoot.getAbsolutePath());
     AmbariMetaInfo mi = new AmbariMetaInfo(stackRoot, new File("target/version"));
+    mi.injector = this.injector;
     try {
       mi.init();
     } catch(Exception e) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/76be6818/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
index 919c32f..cedcb11 100644
--- 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
@@ -19,6 +19,8 @@
 package org.apache.ambari.server.api.util;
 
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.api.services.AmbariMetaInfoTest.MockModule;
+import org.apache.ambari.server.metadata.ActionMetadata;
 import org.apache.ambari.server.state.*;
 
 import java.io.File;
@@ -28,8 +30,13 @@ import java.util.Map;
 
 import static org.junit.Assert.*;
 
+import org.junit.Before;
 import org.junit.Test;
 
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
 public class StackExtensionHelperTest {
 
   private final String stackRootStr = "./src/test/resources/stacks/".
@@ -38,6 +45,16 @@ public class StackExtensionHelperTest {
           replaceAll("/", File.separator);
   private final String yarnDirStr = stackRootStr + "services/YARN/".
           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
@@ -49,7 +66,7 @@ public class StackExtensionHelperTest {
     StackInfo stackInfo = new StackInfo();
     stackInfo.setName("HDP");
     stackInfo.setVersion("2.0.7");
-    StackExtensionHelper helper = new StackExtensionHelper(stackRoot);
+    StackExtensionHelper helper = new StackExtensionHelper(injector, stackRoot);
     helper.populateServicesForStack(stackInfo);
     List<ServiceInfo> services =  stackInfo.getServices();
     assertEquals(7, services.size());
@@ -196,7 +213,7 @@ public class StackExtensionHelperTest {
   @Test
   public void getSchemaVersion() throws Exception {
     File stackRoot = new File(stackRootStr);
-    StackExtensionHelper helper = new StackExtensionHelper(stackRoot);
+    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);

http://git-wip-us.apache.org/repos/asf/ambari/blob/76be6818/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 ceda98c..d4d2f5b 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
@@ -76,6 +76,7 @@ import org.apache.ambari.server.controller.internal.HostResourceProviderTest;
 import org.apache.ambari.server.controller.internal.RequestResourceFilter;
 import org.apache.ambari.server.controller.internal.ServiceResourceProviderTest;
 import org.apache.ambari.server.customactions.ActionDefinition;
+import org.apache.ambari.server.metadata.ActionMetadata;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.dao.ExecutionCommandDAO;
@@ -4427,6 +4428,7 @@ public class AmbariManagementControllerTest {
     resourceFilter = new RequestResourceFilter("MAPREDUCE", null, null);
     actionRequest.getResourceFilters().add(resourceFilter);
 
+    this.injector.getInstance(ActionMetadata.class).addServiceCheckAction("MAPREDUCE");
     response = controller.createAction(actionRequest, requestProperties);
 
     assertEquals(1, response.getTasks().size());
@@ -5365,7 +5367,7 @@ public class AmbariManagementControllerTest {
     String componentName1 = "PIG";
     createServiceComponent(clusterName, serviceName, componentName1,
         State.INIT);
-
+    
     String host1 = "h1";
     String host2 = "h2";
     
@@ -5419,6 +5421,7 @@ public class AmbariManagementControllerTest {
     requests.clear();
     requests.add(r);
 
+    this.injector.getInstance(ActionMetadata.class).addServiceCheckAction("PIG");
     trackAction = ServiceResourceProviderTest.updateServices(controller, requests, mapRequestProps,
true, false);
     Assert.assertNotNull(trackAction);
     Assert.assertEquals(State.INSTALLED,


Mime
View raw message