You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2016/04/19 22:10:14 UTC

ambari git commit: AMBARI-15957: Ambari functional tests: Support auto start for service components

Repository: ambari
Updated Branches:
  refs/heads/trunk 7c6a40901 -> 3e88244a3


AMBARI-15957: Ambari functional tests: Support auto start for service components


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

Branch: refs/heads/trunk
Commit: 3e88244a35e127b1ff660691f8ad89d77331c450
Parents: 7c6a409
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Mon Apr 18 16:45:12 2016 -0700
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Tue Apr 19 13:10:03 2016 -0700

----------------------------------------------------------------------
 .../SetServiceComponentStateWebRequest.java       | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3e88244a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/servicecomponent/SetServiceComponentStateWebRequest.java
----------------------------------------------------------------------
diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/servicecomponent/SetServiceComponentStateWebRequest.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/servicecomponent/SetServiceComponentStateWebRequest.java
index f74fcea..21488a3 100644
--- a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/servicecomponent/SetServiceComponentStateWebRequest.java
+++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/servicecomponent/SetServiceComponentStateWebRequest.java
@@ -30,15 +30,18 @@ public class SetServiceComponentStateWebRequest extends AmbariHttpWebRequest {
     private String componentName;
     private State componentState;
     private String requestContext;
-    private static String pathFormat = "/api/v1/clusters/%s/services/%s";
+    private boolean recoveryEnabled;
+    private static String pathFormat = "/api/v1/clusters/%s/services/%s/components/%s";
 
     public SetServiceComponentStateWebRequest(ConnectionParams params, String clusterName, String serviceName,
-                                              String componentName, State componentState, String requestContext) {
+                                              String componentName, State componentState, boolean recoveryEnabled,
+                                              String requestContext) {
         super(params);
         this.clusterName = clusterName;
         this.serviceName = serviceName;
         this.componentName = componentName;
         this.componentState = componentState;
+        this.recoveryEnabled = recoveryEnabled;
         this.requestContext = requestContext;
     }
 
@@ -48,6 +51,10 @@ public class SetServiceComponentStateWebRequest extends AmbariHttpWebRequest {
 
     public State getComponentState() { return this.componentState; }
 
+    public boolean isRecoveryEnabled() {
+        return this.recoveryEnabled;
+    }
+
     public String getRequestContext() { return this.requestContext; }
 
     @Override
@@ -75,12 +82,15 @@ public class SetServiceComponentStateWebRequest extends AmbariHttpWebRequest {
         /**
          * {
          * "RequestInfo" : {"context" : requestContext},
-         * "Body" : {"ServiceComponentInfo" : {"state" : componentState}}
+         * "Body" : {"ServiceComponentInfo" : {"state" : componentState, "recovery_enabled": recoveryEnabled}}
          * }
          */
         JsonObject jsonObject = new JsonObject();
         jsonObject.add("RequestInfo", createJsonObject("context", requestContext));
-        jsonObject.add("Body", createJsonObject("ServiceComponentInfo", createJsonObject("state", componentState.toString())));
+        JsonObject jsonScInfoObj = new JsonObject();
+        jsonScInfoObj.addProperty("state", String.valueOf(componentState));
+        jsonScInfoObj.addProperty("recovery_enabled", String.valueOf(recoveryEnabled));
+        jsonObject.add("Body", createJsonObject("ServiceComponentInfo", jsonScInfoObj));
         Gson gson = new Gson();
         return gson.toJson(jsonObject);
     }