Browse Source

AMBARI-751. Re-structure servicecomponenthost fsm layout. (Contributed by hitesh)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1387276 13f79535-47bb-0310-9956-ffa450edef68
Hitesh Shah 12 years ago
parent
commit
e8a6f4108d
24 changed files with 178 additions and 23 deletions
  1. 2 0
      AMBARI-666-CHANGES.txt
  2. 19 0
      ambari-server/src/main/java/org/apache/ambari/server/state/ConfigVersion.java
  3. 19 0
      ambari-server/src/main/java/org/apache/ambari/server/state/StackVersion.java
  4. 19 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/AgentVersion.java
  5. 2 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java
  6. 4 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterImpl.java
  7. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHost.java
  8. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostEvent.java
  9. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostEventType.java
  10. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostImpl.java
  11. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostInstallEvent.java
  12. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostLiveState.java
  13. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostOpFailedEvent.java
  14. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostOpInProgressEvent.java
  15. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostOpRestartedEvent.java
  16. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostOpSucceededEvent.java
  17. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostStartEvent.java
  18. 40 7
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostState.java
  19. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostStopEvent.java
  20. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostUninstallEvent.java
  21. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostWipeoutEvent.java
  22. 4 0
      ambari-server/src/test/java/org/apache/ambari/server/state/live/TestClusterImpl.java
  23. 10 2
      ambari-server/src/test/java/org/apache/ambari/server/state/live/svccomphost/TestServiceComponentHostImpl.java
  24. 45 0
      ambari-server/src/test/java/org/apache/ambari/server/state/live/svccomphost/TestServiceComponentHostState.java

+ 2 - 0
AMBARI-666-CHANGES.txt

@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
 
 
   NEW FEATURES
   NEW FEATURES
 
 
+  AMBARI-751. Re-structure servicecomponenthost fsm layout. (hitesh)
+
   AMBARI-747. Add unit tests for step2 (Install option page) of installer.
   AMBARI-747. Add unit tests for step2 (Install option page) of installer.
   (Jaimin Jetly via yusaku)
   (Jaimin Jetly via yusaku)
 
 

+ 19 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/ConfigVersion.java

@@ -19,6 +19,7 @@
 package org.apache.ambari.server.state;
 package org.apache.ambari.server.state;
 
 
 public class ConfigVersion {
 public class ConfigVersion {
+
   private String configVersion;
   private String configVersion;
 
 
   public ConfigVersion(String configVersion) {
   public ConfigVersion(String configVersion) {
@@ -40,4 +41,22 @@ public class ConfigVersion {
     this.configVersion = configVersion;
     this.configVersion = configVersion;
   }
   }
 
 
+  @Override
+  public boolean equals(Object object) {
+    if (!(object instanceof ConfigVersion)) {
+      return false;
+    }
+    if (this == object) {
+      return true;
+    }
+    ConfigVersion c = (ConfigVersion) object;
+    return c.equals(this.configVersion);
+  }
+
+  @Override
+  public int hashCode() {
+    int result = configVersion != null ? configVersion.hashCode() : 0;
+    return result;
+  }
+
 }
 }

+ 19 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/StackVersion.java

@@ -39,4 +39,23 @@ public class StackVersion {
   public void setStackVersion(String stackVersion) {
   public void setStackVersion(String stackVersion) {
     this.stackVersion = stackVersion;
     this.stackVersion = stackVersion;
   }
   }
+
+  @Override
+  public boolean equals(Object object) {
+    if (!(object instanceof StackVersion)) {
+      return false;
+    }
+    if (this == object) {
+      return true;
+    }
+    StackVersion s = (StackVersion) object;
+    return s.equals(this.stackVersion);
+  }
+
+  @Override
+  public int hashCode() {
+    int result = stackVersion != null ? stackVersion.hashCode() : 0;
+    return result;
+  }
+
 }
 }

+ 19 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/AgentVersion.java

@@ -36,4 +36,23 @@ public class AgentVersion {
     return version;
     return version;
   }
   }
 
 
+  @Override
+  public boolean equals(Object object) {
+    if (!(object instanceof AgentVersion)) {
+      return false;
+    }
+    if (this == object) {
+      return true;
+    }
+    AgentVersion a = (AgentVersion) object;
+    return a.equals(this.version);
+  }
+
+  @Override
+  public int hashCode() {
+    int result = version != null ? version.hashCode() : 0;
+    return result;
+  }
+
+
 }
 }

+ 2 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java

@@ -22,6 +22,8 @@ import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
 import org.apache.ambari.server.state.live.host.HostEvent;
 import org.apache.ambari.server.state.live.host.HostEvent;
 import org.apache.ambari.server.state.live.host.HostState;
 import org.apache.ambari.server.state.live.host.HostState;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEvent;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostState;
 
 
 public interface Cluster {
 public interface Cluster {
 
 

+ 4 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterImpl.java

@@ -29,6 +29,10 @@ import org.apache.ambari.server.state.live.host.Host;
 import org.apache.ambari.server.state.live.host.HostEvent;
 import org.apache.ambari.server.state.live.host.HostEvent;
 import org.apache.ambari.server.state.live.host.HostImpl;
 import org.apache.ambari.server.state.live.host.HostImpl;
 import org.apache.ambari.server.state.live.host.HostState;
 import org.apache.ambari.server.state.live.host.HostState;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHost;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEvent;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostImpl;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostState;
 
 
 public class ClusterImpl implements Cluster {
 public class ClusterImpl implements Cluster {
 
 

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHost.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHost.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 import java.util.List;
 import java.util.List;
 
 

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 import org.apache.ambari.server.state.fsm.event.AbstractEvent;
 import org.apache.ambari.server.state.fsm.event.AbstractEvent;
 
 

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEventType.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostEventType.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public enum ServiceComponentHostEventType {
 public enum ServiceComponentHostEventType {
   /**
   /**

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostImpl.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostImpl.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.Lock;

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostInstallEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostInstallEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostInstallEvent extends
 public class ServiceComponentHostInstallEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostLiveState.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostLiveState.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public enum ServiceComponentHostLiveState {
 public enum ServiceComponentHostLiveState {
   /**
   /**

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpFailedEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostOpFailedEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostOpFailedEvent extends
 public class ServiceComponentHostOpFailedEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpInProgressEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostOpInProgressEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostOpInProgressEvent extends
 public class ServiceComponentHostOpInProgressEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpRestartedEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostOpRestartedEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostOpRestartedEvent extends
 public class ServiceComponentHostOpRestartedEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpSucceededEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostOpSucceededEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostOpSucceededEvent extends
 public class ServiceComponentHostOpSucceededEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStartEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostStartEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostStartEvent extends
 public class ServiceComponentHostStartEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 40 - 7
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostState.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostState.java

@@ -16,30 +16,32 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 import org.apache.ambari.server.state.ConfigVersion;
 import org.apache.ambari.server.state.ConfigVersion;
 import org.apache.ambari.server.state.StackVersion;
 import org.apache.ambari.server.state.StackVersion;
 
 
 public class ServiceComponentHostState {
 public class ServiceComponentHostState {
 
 
+  private final int hashCodePrime = 131;
+
   private ConfigVersion configVersion;
   private ConfigVersion configVersion;
   private StackVersion stackVersion;
   private StackVersion stackVersion;
-  private ServiceComponentHostLiveState state;
+  private ServiceComponentHostLiveState liveState;
 
 
   public ServiceComponentHostState(ConfigVersion configVersion,
   public ServiceComponentHostState(ConfigVersion configVersion,
       StackVersion stackVersion, ServiceComponentHostLiveState state) {
       StackVersion stackVersion, ServiceComponentHostLiveState state) {
     super();
     super();
     this.configVersion = configVersion;
     this.configVersion = configVersion;
     this.stackVersion = stackVersion;
     this.stackVersion = stackVersion;
-    this.state = state;
+    this.liveState = state;
   }
   }
 
 
   public ServiceComponentHostState() {
   public ServiceComponentHostState() {
     super();
     super();
     this.configVersion = null;
     this.configVersion = null;
     this.stackVersion = null;
     this.stackVersion = null;
-    this.state = ServiceComponentHostLiveState.INIT;
+    this.liveState = ServiceComponentHostLiveState.INIT;
   }
   }
 
 
 
 
@@ -71,13 +73,13 @@ public class ServiceComponentHostState {
    * @return the state
    * @return the state
    */
    */
   public ServiceComponentHostLiveState getLiveState() {
   public ServiceComponentHostLiveState getLiveState() {
-    return state;
+    return liveState;
   }
   }
   /**
   /**
    * @param state the state to set
    * @param state the state to set
    */
    */
   public void setState(ServiceComponentHostLiveState state) {
   public void setState(ServiceComponentHostLiveState state) {
-    this.state = state;
+    this.liveState = state;
   }
   }
 
 
 
 
@@ -95,7 +97,38 @@ public class ServiceComponentHostState {
     } else {
     } else {
       out += "null";
       out += "null";
     }
     }
-    out += ", state=" + state;
+    out += ", state=" + liveState;
     return out;
     return out;
   }
   }
+
+  @Override
+  public boolean equals(Object object) {
+    if (!(object instanceof ServiceComponentHostState)) {
+      return false;
+    }
+    if (this == object) {
+      return true;
+    }
+    ServiceComponentHostState s = (ServiceComponentHostState) object;
+
+    if (configVersion != null ?
+        !configVersion.equals(s.configVersion) : s.configVersion != null) {
+      return false;
+    }
+    if (stackVersion != null ?
+        !stackVersion.equals(s.stackVersion) : s.stackVersion != null) {
+      return false;
+    }
+    return liveState.equals(s.liveState);
+  }
+
+  @Override
+  public int hashCode() {
+    int result = configVersion != null ? configVersion.hashCode() : 0;
+    result += hashCodePrime * result +
+        ( stackVersion != null ? stackVersion.hashCode() : 0 );
+    result += liveState.hashCode();
+    return result;
+  }
+
 }
 }

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStopEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostStopEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostStopEvent extends
 public class ServiceComponentHostStopEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostUninstallEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostUninstallEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostUninstallEvent extends
 public class ServiceComponentHostUninstallEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostWipeoutEvent.java → ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostWipeoutEvent.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state.live.svccomphost;
 
 
 public class ServiceComponentHostWipeoutEvent extends
 public class ServiceComponentHostWipeoutEvent extends
     ServiceComponentHostEvent {
     ServiceComponentHostEvent {

+ 4 - 0
ambari-server/src/test/java/org/apache/ambari/server/state/live/TestClusterImpl.java

@@ -33,6 +33,10 @@ import org.apache.ambari.server.state.StackVersion;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
 import org.apache.ambari.server.state.live.host.HostRegistrationRequestEvent;
 import org.apache.ambari.server.state.live.host.HostRegistrationRequestEvent;
 import org.apache.ambari.server.state.live.host.HostState;
 import org.apache.ambari.server.state.live.host.HostState;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostInstallEvent;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostLiveState;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostOpRestartedEvent;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostState;
 import org.junit.After;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Test;

+ 10 - 2
ambari-server/src/test/java/org/apache/ambari/server/state/live/TestServiceComponentHostImpl.java → ambari-server/src/test/java/org/apache/ambari/server/state/live/svccomphost/TestServiceComponentHostImpl.java

@@ -16,8 +16,16 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
-
+package org.apache.ambari.server.state.live.svccomphost;
+
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEvent;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEventType;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostImpl;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostLiveState;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostOpFailedEvent;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostOpInProgressEvent;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostOpRestartedEvent;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostOpSucceededEvent;
 import org.junit.Assert;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.Test;
 
 

+ 45 - 0
ambari-server/src/test/java/org/apache/ambari/server/state/live/svccomphost/TestServiceComponentHostState.java

@@ -0,0 +1,45 @@
+package org.apache.ambari.server.state.live.svccomphost;
+
+import junit.framework.Assert;
+
+import org.apache.ambari.server.state.ConfigVersion;
+import org.apache.ambari.server.state.StackVersion;
+import org.junit.Test;
+
+public class TestServiceComponentHostState {
+
+  @Test
+  public void testEquals() {
+    ServiceComponentHostState s1 = new ServiceComponentHostState();
+    ServiceComponentHostState s2 = new ServiceComponentHostState();
+
+    Assert.assertTrue(s1.equals(s2));
+
+    s1.setConfigVersion(new ConfigVersion("x.y.z"));
+    Assert.assertFalse(s1.equals(s2));
+    Assert.assertFalse(s2.equals(s1));
+
+    s2.setConfigVersion(new ConfigVersion("x.y.foo"));
+    Assert.assertFalse(s1.equals(s2));
+    Assert.assertFalse(s2.equals(s1));
+
+    s2.setConfigVersion(new ConfigVersion("x.y.z"));
+    Assert.assertTrue(s1.equals(s2));
+
+    s2.setStackVersion(new StackVersion("1.x"));
+    Assert.assertFalse(s1.equals(s2));
+    Assert.assertFalse(s2.equals(s1));
+
+    s1.setStackVersion(new StackVersion("1.x"));
+    Assert.assertTrue(s1.equals(s2));
+
+    s1.setStackVersion(new StackVersion("2.x"));
+    Assert.assertFalse(s1.equals(s2));
+    Assert.assertFalse(s2.equals(s1));
+
+    s1.setState(ServiceComponentHostLiveState.INSTALLED);
+    Assert.assertFalse(s1.equals(s2));
+
+  }
+
+}