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 2013/04/27 18:20:02 UTC

svn commit: r1476611 - in /incubator/ambari/trunk: ./ ambari-server/src/main/java/org/apache/ambari/server/controller/ ambari-server/src/test/java/org/apache/ambari/server/controller/

Author: smohanty
Date: Sat Apr 27 16:20:02 2013
New Revision: 1476611

URL: http://svn.apache.org/r1476611
Log:
AMBARI-2039. Service check should be scheduled on a client that is on a host in HEALTHY state. (smohanty)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1476611&r1=1476610&r2=1476611&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Sat Apr 27 16:20:02 2013
@@ -802,6 +802,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2039. Service check should be scheduled on a client that is on
+ a host in HEALTHY state - use correct state enum. (smohanty)
+
  AMBARI-2035. "Add local user" button is enabled but nothing happens upon
  clicking it under certain conditions. (yusaku)
 

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java?rev=1476611&r1=1476610&r2=1476611&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java (original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java Sat Apr 27 16:20:02 2013
@@ -65,7 +65,7 @@ import org.apache.ambari.server.state.Co
 import org.apache.ambari.server.state.ConfigFactory;
 import org.apache.ambari.server.state.DesiredConfig;
 import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.state.HostHealthStatus;
+import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.OperatingSystemInfo;
 import org.apache.ambari.server.state.PropertyInfo;
 import org.apache.ambari.server.state.RepositoryInfo;
@@ -3952,8 +3952,7 @@ public class AmbariManagementControllerI
     for (String candidateHostName : hostList) {
       hostName = candidateHostName;
       Host candidateHost = clusters.getHost(hostName);
-      if (candidateHost.getHealthStatus().getHealthStatus()
-          == HostHealthStatus.HealthStatus.HEALTHY) {
+      if (candidateHost.getState() == HostState.HEALTHY) {
         break;
       }
     }

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java?rev=1476611&r1=1476610&r2=1476611&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java Sat Apr 27 16:20:02 2013
@@ -60,7 +60,7 @@ import org.apache.ambari.server.state.Co
 import org.apache.ambari.server.state.ConfigFactory;
 import org.apache.ambari.server.state.ConfigImpl;
 import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.state.HostHealthStatus;
+import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentFactory;
@@ -4656,11 +4656,9 @@ public class AmbariManagementControllerT
         host3, null);
 
     // Install
-    HostHealthStatus healthy = new HostHealthStatus(HostHealthStatus.HealthStatus.HEALTHY, "");
-    HostHealthStatus unhealthy = new HostHealthStatus(HostHealthStatus.HealthStatus.UNHEALTHY, "");
     installService(clusterName, serviceName, false, false);
-    clusters.getHost("h3").setHealthStatus(unhealthy);
-    clusters.getHost("h2").setHealthStatus(healthy);
+    clusters.getHost("h3").setState(HostState.UNHEALTHY);
+    clusters.getHost("h2").setState(HostState.HEALTHY);
 
     // Start
     long requestId = startService(clusterName, serviceName, true, false);
@@ -4677,8 +4675,8 @@ public class AmbariManagementControllerT
 
     stopService(clusterName, serviceName, false, false);
 
-    clusters.getHost("h3").setHealthStatus(healthy);
-    clusters.getHost("h2").setHealthStatus(unhealthy);
+    clusters.getHost("h3").setState(HostState.HEALTHY);
+    clusters.getHost("h2").setState(HostState.HEARTBEAT_LOST);
 
     requestId = startService(clusterName, serviceName, true, false);
     commands = actionDB.getRequestTasks(requestId);
@@ -4710,8 +4708,8 @@ public class AmbariManagementControllerT
     Assert.assertEquals("Expect only one service check.", 1, commandCount);
 
     // When both are unhealthy then just pick one
-    clusters.getHost("h3").setHealthStatus(unhealthy);
-    clusters.getHost("h2").setHealthStatus(unhealthy);
+    clusters.getHost("h3").setState(HostState.WAITING_FOR_HOST_STATUS_UPDATES);
+    clusters.getHost("h2").setState(HostState.INIT);
     response = controller.createActions(actionRequests, requestProperties);
     commands = actionDB.getRequestTasks(response.getRequestId());
     commandCount = 0;