incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject svn commit: r1465682 - in /incubator/ambari/trunk: ./ ambari-server/src/main/java/org/apache/ambari/server/agent/ ambari-server/src/main/java/org/apache/ambari/server/controller/ ambari-server/src/main/java/org/apache/ambari/server/state/ ambari-server...
Date Mon, 08 Apr 2013 16:56:33 GMT
Author: smohanty
Date: Mon Apr  8 16:56:32 2013
New Revision: 1465682

URL: http://svn.apache.org/r1465682
Log:
AMBARI-1834. Reduce the number of states that a host component can be in. (smohanty)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1465682&r1=1465681&r2=1465682&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Apr  8 16:56:32 2013
@@ -656,6 +656,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1834. Reduce the number of states that a host component can be in.
+ (smohanty)
+
  AMBARI-1789. Stopping and then Starting all services doesn't start 
  NameNode. (smohanty)
 

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java?rev=1465682&r1=1465681&r2=1465682&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
Mon Apr  8 16:56:32 2013
@@ -261,11 +261,9 @@ public class HeartBeatHandler {
               State prevState = scHost.getState();
               State liveState = State.valueOf(State.class, status.getStatus());
               if (prevState.equals(State.INSTALLED)
-                  || prevState.equals(State.START_FAILED)
                   || prevState.equals(State.STARTED)
                   || prevState.equals(State.STARTING)
-                  || prevState.equals(State.STOPPING)
-                  || prevState.equals(State.STOP_FAILED)) {
+                  || prevState.equals(State.STOPPING)) {
                 scHost.setState(liveState);
                 if (!prevState.equals(liveState)) {
                   LOG.info("State of service component " + componentName

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=1465682&r1=1465681&r2=1465682&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
Mon Apr  8 16:56:32 2013
@@ -1778,8 +1778,7 @@ public class AmbariManagementControllerI
           continue;
         }
         for (ServiceComponentHost sch : entry.getValue()) {
-          if (State.START_FAILED != sch.getState()
-            && State.INSTALLED != sch.getState()) {
+          if (State.INSTALLED != sch.getState()) {
             continue;
           }
           if (!changedComponentCount.containsKey(sch.getServiceName())) {
@@ -1967,16 +1966,13 @@ public class AmbariManagementControllerI
                       nowTimestamp,
                       scHost.getDesiredStackVersion().getStackId());
                 } else if (oldSchState == State.STARTED
-                    || oldSchState == State.START_FAILED
                     || oldSchState == State.INSTALLED
-                    || oldSchState == State.STOP_FAILED
                     || oldSchState == State.STOPPING) {
                   roleCommand = RoleCommand.STOP;
                   event = new ServiceComponentHostStopEvent(
                       scHost.getServiceComponentName(), scHost.getHostName(),
                       nowTimestamp);
-                } else if (oldSchState == State.UPGRADE_FAILED
-                    || oldSchState == State.UPGRADING) {
+                } else if (oldSchState == State.UPGRADING) {
                   roleCommand = RoleCommand.UPGRADE;
                   event = new ServiceComponentHostUpgradeEvent(
                       scHost.getServiceComponentName(), scHost.getHostName(),
@@ -1999,7 +1995,7 @@ public class AmbariManagementControllerI
                     stackId.getStackName(), stackId.getStackVersion(), scHost.getServiceName(),
                     scHost.getServiceComponentName());
                 if (oldSchState == State.INSTALLED
-                    || oldSchState == State.START_FAILED || oldSchState == State.STARTING)
{
+                    || oldSchState == State.STARTING) {
                   roleCommand = RoleCommand.START;
                   event = new ServiceComponentHostStartEvent(
                       scHost.getServiceComponentName(), scHost.getHostName(),
@@ -2024,7 +2020,7 @@ public class AmbariManagementControllerI
                 break;
               case UNINSTALLED:
                 if (oldSchState == State.INSTALLED
-                    || oldSchState == State.UNINSTALL_FAILED) {
+                    || oldSchState == State.UNINSTALLING) {
                   roleCommand = RoleCommand.UNINSTALL;
                   event = new ServiceComponentHostStartEvent(
                       scHost.getServiceComponentName(), scHost.getHostName(),
@@ -2238,10 +2234,7 @@ public class AmbariManagementControllerI
             || oldState == State.INSTALLED
             || oldState == State.INSTALLING
             || oldState == State.STARTED
-            || oldState == State.START_FAILED
             || oldState == State.INSTALL_FAILED
-            || oldState == State.STOP_FAILED
-            || oldState == State.UPGRADE_FAILED
             || oldState == State.UPGRADING
             || oldState == State.STOPPING
             || oldState == State.MAINTENANCE) {
@@ -2251,21 +2244,20 @@ public class AmbariManagementControllerI
       case STARTED:
         if (oldState == State.INSTALLED
             || oldState == State.STARTING
-            || oldState == State.STARTED
-            || oldState == State.START_FAILED) {
+            || oldState == State.STARTED) {
           return true;
         }
         break;
       case UNINSTALLED:
         if (oldState == State.INSTALLED
             || oldState == State.UNINSTALLED
-            || oldState == State.UNINSTALL_FAILED) {
+            || oldState == State.UNINSTALLING) {
           return true;
         }
       case INIT:
         if (oldState == State.UNINSTALLED
             || oldState == State.INIT
-            || oldState == State.WIPEOUT_FAILED) {
+            || oldState == State.WIPING_OUT) {
           return true;
         }
       case MAINTENANCE:
@@ -3371,8 +3363,7 @@ public class AmbariManagementControllerI
             "Component host can only be upgraded to the same version as the cluster");
       } else if (requestedStackId.compareTo(currentSchStackId) > 0) {
         isUpgradeRequest = true;
-        if (sch.getState() != State.INSTALLED && sch.getState() != State.UPGRADING
-            && sch.getState() != State.UPGRADE_FAILED) {
+        if (sch.getState() != State.INSTALLED && sch.getState() != State.UPGRADING)
{
           throw getHostComponentUpgradeException(request, cluster, s, sc, sch,
               "Component host is in an invalid state for upgrade");
         }

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/State.java?rev=1465682&r1=1465681&r2=1465682&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
Mon Apr  8 16:56:32 2013
@@ -40,53 +40,33 @@ public enum State {
    */
   STARTING(4),
   /**
-   * Start failed.
-   */
-  START_FAILED(5),
-  /**
    * State when start completed successfully.
    */
-  STARTED(6),
+  STARTED(5),
   /**
    * In the process of stopping.
    */
-  STOPPING(7),
-  /**
-   * Stop failed.
-   */
-  STOP_FAILED(8),
+  STOPPING(6),
   /**
    * In the process of uninstalling.
    */
-  UNINSTALLING(9),
-  /**
-   * Uninstall failed.
-   */
-  UNINSTALL_FAILED(10),
+  UNINSTALLING(7),
   /**
    * State when uninstall completed successfully.
    */
-  UNINSTALLED(11),
+  UNINSTALLED(8),
   /**
    * In the process of wiping out the install.
    */
-  WIPING_OUT(12),
-  /**
-   * State when wipeout fails.
-   */
-  WIPEOUT_FAILED(13),
+  WIPING_OUT(9),
   /**
    * In the process of upgrading the deployed bits.
    */
-  UPGRADING(14),
-  /**
-   * Upgrade has failed.
-   */
-  UPGRADE_FAILED(15),
+  UPGRADING(10),
   /**
    * Disabled master's backup state
    */
-  MAINTENANCE(16);
+  MAINTENANCE(11);
 
   private final int state;
 
@@ -140,8 +120,6 @@ public enum State {
     switch (State.values()[this.state]) {
       case STARTING:
       case STARTED:
-      case START_FAILED:
-      case STOP_FAILED:
       case STOPPING:
         return false;
       default:
@@ -160,7 +138,6 @@ public enum State {
       case INSTALLING:
       case INSTALLED:
       case INSTALL_FAILED:
-      case UPGRADE_FAILED:
       case UNINSTALLED:
       case MAINTENANCE:
         return true;
@@ -168,4 +145,4 @@ public enum State {
         return false;
     }
   }
-}
\ No newline at end of file
+}

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java?rev=1465682&r1=1465681&r2=1465682&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
Mon Apr  8 16:56:32 2013
@@ -199,22 +199,14 @@ public class ServiceComponentHostImpl im
          new ServiceComponentHostOpCompletedTransition())
          
      .addTransition(State.STARTING,
-         State.START_FAILED,
+         State.INSTALLED,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
 
-     .addTransition(State.START_FAILED,
+     .addTransition(State.INSTALLED,
          State.STARTING,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
          new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.START_FAILED,
-         State.STARTING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_START,
-         new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.START_FAILED,
-         State.STOPPING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
-         new ServiceComponentHostOpStartedTransition())
 
      .addTransition(State.STARTED,
           State.STARTED,
@@ -242,18 +234,14 @@ public class ServiceComponentHostImpl im
          ServiceComponentHostEventType.HOST_SVCCOMP_STOPPED,
          new ServiceComponentHostOpCompletedTransition())
      .addTransition(State.STOPPING,
-         State.STOP_FAILED,
+         State.STARTED,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
 
-     .addTransition(State.STOP_FAILED,
+     .addTransition(State.STARTED,
          State.STOPPING,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
          new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.STOP_FAILED,
-         State.STOPPING,
-         ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
-         new ServiceComponentHostOpStartedTransition())
 
      .addTransition(State.UNINSTALLING,
          State.UNINSTALLING,
@@ -264,7 +252,7 @@ public class ServiceComponentHostImpl im
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
          new ServiceComponentHostOpCompletedTransition())
      .addTransition(State.UNINSTALLING,
-         State.UNINSTALL_FAILED,
+         State.UNINSTALLING,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
 
@@ -277,10 +265,10 @@ public class ServiceComponentHostImpl im
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
          new ServiceComponentHostOpCompletedTransition())
      .addTransition(State.UPGRADING,
-         State.UPGRADE_FAILED,
+         State.UPGRADING,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.UPGRADE_FAILED,
+     .addTransition(State.UPGRADING,
          State.UPGRADING,
          ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
          new ServiceComponentHostOpStartedTransition())
@@ -289,11 +277,11 @@ public class ServiceComponentHostImpl im
          ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
          new ServiceComponentHostOpInProgressTransition())
 
-     .addTransition(State.UNINSTALL_FAILED,
+     .addTransition(State.UNINSTALLING,
          State.UNINSTALLING,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
          new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.UNINSTALL_FAILED,
+     .addTransition(State.UNINSTALLING,
          State.UNINSTALLING,
          ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
          new ServiceComponentHostOpStartedTransition())
@@ -317,15 +305,15 @@ public class ServiceComponentHostImpl im
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
          new ServiceComponentHostOpCompletedTransition())
      .addTransition(State.WIPING_OUT,
-         State.WIPEOUT_FAILED,
+         State.WIPING_OUT,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
 
-     .addTransition(State.WIPEOUT_FAILED,
+     .addTransition(State.WIPING_OUT,
          State.WIPING_OUT,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
          new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.WIPEOUT_FAILED,
+     .addTransition(State.WIPING_OUT,
          State.WIPING_OUT,
          ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
          new ServiceComponentHostOpStartedTransition())
@@ -418,10 +406,10 @@ public class ServiceComponentHostImpl im
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
          new ServiceComponentHostOpCompletedTransition())
      .addTransition(State.UPGRADING,
-         State.UPGRADE_FAILED,
+         State.UPGRADING,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
-     .addTransition(State.UPGRADE_FAILED,
+     .addTransition(State.UPGRADING,
          State.UPGRADING,
          ServiceComponentHostEventType.HOST_SVCCOMP_UPGRADE,
          new ServiceComponentHostOpStartedTransition())
@@ -439,15 +427,15 @@ public class ServiceComponentHostImpl im
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
          new ServiceComponentHostOpCompletedTransition())
      .addTransition(State.UNINSTALLING,
-         State.UNINSTALL_FAILED,
+         State.UNINSTALLING,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
 
-     .addTransition(State.UNINSTALL_FAILED,
+     .addTransition(State.UNINSTALLING,
          State.UNINSTALLING,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
          new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.UNINSTALL_FAILED,
+     .addTransition(State.UNINSTALLING,
          State.UNINSTALLING,
          ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
          new ServiceComponentHostOpStartedTransition())
@@ -471,15 +459,15 @@ public class ServiceComponentHostImpl im
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
          new ServiceComponentHostOpCompletedTransition())
      .addTransition(State.WIPING_OUT,
-         State.WIPEOUT_FAILED,
+         State.WIPING_OUT,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
 
-     .addTransition(State.WIPEOUT_FAILED,
+     .addTransition(State.WIPING_OUT,
          State.WIPING_OUT,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
          new ServiceComponentHostOpStartedTransition())
-     .addTransition(State.WIPEOUT_FAILED,
+     .addTransition(State.WIPING_OUT,
          State.WIPING_OUT,
          ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
          new ServiceComponentHostOpStartedTransition())

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java?rev=1465682&r1=1465681&r2=1465682&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
Mon Apr  8 16:56:32 2013
@@ -315,8 +315,8 @@ public class TestHeartbeatHandler {
             getCluster(DummyCluster).getService(HDFS).
             getServiceComponent(NAMENODE).
             getServiceComponentHost(DummyHostname1);
-    serviceComponentHost1.setState(State.STOP_FAILED);
-    serviceComponentHost2.setState(State.STOP_FAILED);
+    serviceComponentHost1.setState(State.STARTED);
+    serviceComponentHost2.setState(State.STARTED);
 
     HeartBeat hb = new HeartBeat();
     hb.setTimestamp(System.currentTimeMillis());
@@ -876,8 +876,8 @@ public class TestHeartbeatHandler {
     cr.setExitCode(3);
 
     handler.handleHeartBeat(hb);
-    assertEquals("Host state should be " + State.UPGRADE_FAILED,
-        State.UPGRADE_FAILED, serviceComponentHost1.getState());
+    assertEquals("Host state should be " + State.UPGRADING,
+        State.UPGRADING, serviceComponentHost1.getState());
 
     // TODO What happens when there is a TIMEDOUT
 
@@ -1200,7 +1200,7 @@ public class TestHeartbeatHandler {
     HeartBeatHandler handler = getHeartBeatHandler(am, aq);
     handler.handleHeartBeat(hb);
     assertEquals("State of SCH should change after fail report",
-            State.UPGRADE_FAILED, serviceComponentHost1.getState());
+        State.UPGRADING, serviceComponentHost1.getState());
     assertEquals("State of SCH should change after fail report",
             State.INSTALL_FAILED, serviceComponentHost2.getState());
     assertEquals("Stack version of SCH should not change after fail report",

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=1465682&r1=1465681&r2=1465682&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
Mon Apr  8 16:56:32 2013
@@ -1577,7 +1577,6 @@ public class AmbariManagementControllerT
     statusResponses = controller.getRequestStatus(statusRequest);
     Assert.assertEquals(2, statusResponses.size());
 
-    int counter = 0;
     for (ServiceComponent sc :
       clusters.getCluster(clusterName).getService(serviceName)
       .getServiceComponents().values()) {
@@ -1585,18 +1584,7 @@ public class AmbariManagementControllerT
         if (sc.isClientComponent()) {
           sch.setState(State.INSTALLED);
         } else {
-          ++counter;
-          switch (counter%1) {
-            case 0:
-              sch.setState(State.START_FAILED);
-              break;
-            case 1:
-              sch.setState(State.STOP_FAILED);
-              break;
-            case 2:
-              sch.setState(State.STARTED);
-              break;
-          }
+          sch.setState(State.INSTALL_FAILED);
         }
       }
     }
@@ -2537,7 +2525,7 @@ public class AmbariManagementControllerT
     sch4.setDesiredState(State.STARTED);
     sch5.setDesiredState(State.STARTED);
     sch1.setState(State.INSTALLED);
-    sch2.setState(State.START_FAILED);
+    sch2.setState(State.INSTALLED);
     sch3.setState(State.INSTALLED);
     sch4.setState(State.STARTED);
     sch5.setState(State.INSTALLED);
@@ -2564,7 +2552,7 @@ public class AmbariManagementControllerT
     Assert.assertEquals(State.STARTED, sch5.getDesiredState());
     Assert.assertEquals(State.INSTALLED, sch6.getDesiredState());
     Assert.assertEquals(State.INSTALLED, sch1.getState());
-    Assert.assertEquals(State.START_FAILED, sch2.getState());
+    Assert.assertEquals(State.INSTALLED, sch2.getState());
     Assert.assertEquals(State.INSTALLED, sch3.getState());
     Assert.assertEquals(State.STARTED, sch4.getState());
     Assert.assertEquals(State.INSTALLED, sch5.getState());
@@ -2753,7 +2741,7 @@ public class AmbariManagementControllerT
     sch1.setState(State.STARTED);
     sch2.setState(State.INIT);
     sch3.setState(State.INSTALLED);
-    sch4.setState(State.STOP_FAILED);
+    sch4.setState(State.STARTED);
     sch5.setState(State.INIT);
 
     reqs.clear();
@@ -2780,7 +2768,7 @@ public class AmbariManagementControllerT
     Assert.assertEquals(State.STARTED, sch1.getState());
     Assert.assertEquals(State.INIT, sch2.getState());
     Assert.assertEquals(State.INSTALLED, sch3.getState());
-    Assert.assertEquals(State.STOP_FAILED, sch4.getState());
+    Assert.assertEquals(State.STARTED, sch4.getState());
     Assert.assertEquals(State.INIT, sch5.getState());
 
     long requestId = trackAction.getRequestId();
@@ -3057,7 +3045,7 @@ public class AmbariManagementControllerT
     c1.setCurrentStackVersion(newStack);
     c1.setDesiredStackVersion(newStack);
     sch1.setState(State.INSTALLED);
-    sch2.setState(State.UPGRADE_FAILED);
+    sch2.setState(State.UPGRADING);
     sch1.setDesiredState(State.INSTALLED);
     sch2.setDesiredState(State.INSTALLED);
 
@@ -3100,9 +3088,9 @@ public class AmbariManagementControllerT
 
     sch1.setState(State.INSTALLED);
     sch1.setDesiredState(State.INSTALLED);
-    sch2.setState(State.UPGRADE_FAILED);
+    sch2.setState(State.UPGRADING);
     sch2.setDesiredState(State.INSTALLED);
-    sch3.setState(State.UPGRADE_FAILED);
+    sch3.setState(State.UPGRADING);
     sch3.setDesiredState(State.INSTALLED);
 
     sch3.setStackVersion(oldStack);
@@ -3245,7 +3233,7 @@ public class AmbariManagementControllerT
     updateHostAndCompareExpectedFailure(reqs, "Component host is in an invalid state for
upgrade");
 
     c1.setCurrentStackVersion(new StackId("HDP-0.2"));
-    sch1.setState(State.UPGRADE_FAILED);
+    sch1.setState(State.UPGRADING);
     reqs.clear();
     req1 = new ServiceComponentHostRequest(clusterName, serviceName1,
         componentName1, host1,
@@ -5091,9 +5079,9 @@ public class AmbariManagementControllerT
     validateGeneratedStages(stages, 5, expectedTasks);
 
     c.getService(mrServiceName).getServiceComponent(mrJobTrackerComp).getServiceComponentHost(host1)
-        .setState(State.UPGRADE_FAILED);
+        .setState(State.UPGRADING);
     c.getService(mrServiceName).getServiceComponent(mrTaskTrackerComp).getServiceComponentHost(host2)
-        .setState(State.UPGRADE_FAILED);
+        .setState(State.UPGRADING);
     actionDB.abortOperation(trackAction.getRequestId());
     trackAction = controller.updateCluster(r, mapRequestProps);
     stages = actionDB.getAllStages(trackAction.getRequestId());

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java?rev=1465682&r1=1465681&r2=1465682&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
Mon Apr  8 16:56:32 2013
@@ -251,9 +251,13 @@ public class ServiceComponentHostTest {
     } catch (Exception e) {
       exceptionThrown = true;
     }
-    if (impl.getState() == State.INSTALLING || impl.getState() == State.STARTING) {
+    if (impl.getState() == State.INSTALLING || impl.getState() == State.STARTING
+      || impl.getState() == State.UNINSTALLING
+        || impl.getState() == State.WIPING_OUT
+        || impl.getState() == State.STARTED
+        ) {
       startTime = timestamp;
-    // We need to allow install on a install.
+    // Exception is not expected on valid event
       Assert.assertTrue("Exception not thrown on invalid event", !exceptionThrown);
     }
     else {
@@ -387,7 +391,7 @@ public class ServiceComponentHostTest {
       runStateChanges(impl, ServiceComponentHostEventType.HOST_SVCCOMP_START,
         State.INSTALLED,
         State.STARTING,
-        State.START_FAILED,
+        State.INSTALLED,
         State.STARTED);
     }
     catch (Exception e) {
@@ -398,13 +402,13 @@ public class ServiceComponentHostTest {
     runStateChanges(impl, ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
         State.INSTALLED,
         State.UNINSTALLING,
-        State.UNINSTALL_FAILED,
+        State.UNINSTALLING,
         State.UNINSTALLED);
 
     runStateChanges(impl, ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
         State.UNINSTALLED,
         State.WIPING_OUT,
-        State.WIPEOUT_FAILED,
+        State.WIPING_OUT,
         State.INIT);
 
   }
@@ -423,25 +427,25 @@ public class ServiceComponentHostTest {
     runStateChanges(impl, ServiceComponentHostEventType.HOST_SVCCOMP_START,
       State.INSTALLED,
       State.STARTING,
-      State.START_FAILED,
+      State.INSTALLED,
       State.STARTED);
 
     runStateChanges(impl, ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
       State.STARTED,
       State.STOPPING,
-      State.STOP_FAILED,
+      State.STARTED,
       State.INSTALLED);
 
     runStateChanges(impl, ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
         State.INSTALLED,
         State.UNINSTALLING,
-        State.UNINSTALL_FAILED,
+        State.UNINSTALLING,
         State.UNINSTALLED);
 
     runStateChanges(impl, ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
         State.UNINSTALLED,
         State.WIPING_OUT,
-        State.WIPEOUT_FAILED,
+        State.WIPING_OUT,
         State.INIT);
   }
 
@@ -537,7 +541,7 @@ public class ServiceComponentHostTest {
     ServiceComponentHostImpl impl =  (ServiceComponentHostImpl) sch;
 
     sch.setDesiredState(State.STARTED);
-    sch.setState(State.START_FAILED);
+    sch.setState(State.INSTALLED);
 
     long timestamp = 0;
 



Mime
View raw message