pkuwm commented on a change in pull request #1098:
URL: https://github.com/apache/helix/pull/1098#discussion_r441326905



##########
File path: 
helix-core/src/test/java/org/apache/helix/controller/rebalancer/TestAbstractRebalancer.java
##########
@@ -56,11 +56,11 @@ public void testComputeBestPossibleState(String comment, 
String stateModelName,
             new IdealState("test"), new ClusterConfig("TestCluster"), 
partition,
             MonitoredAbnormalResolver.DUMMY_STATE_RESOLVER);
 
-    Assert.assertEquals(bestPossibleMap, expectedBestPossibleMap);
+    Assert.assertTrue(bestPossibleMap.equals(expectedBestPossibleMap));
   }
 
   @DataProvider(name = "TestComputeBestPossibleStateInput")
-  public Object[][] loadTestComputeBestPossibleStateInput() {
+  public Object[][] loadTestComputeBestPossiblqeStateInput() {

Review comment:
       Accident typo?

##########
File path: 
helix-core/src/test/java/org/apache/helix/controller/rebalancer/TestAbstractRebalancer.java
##########
@@ -56,11 +56,11 @@ public void testComputeBestPossibleState(String comment, 
String stateModelName,
             new IdealState("test"), new ClusterConfig("TestCluster"), 
partition,
             MonitoredAbnormalResolver.DUMMY_STATE_RESOLVER);
 
-    Assert.assertEquals(bestPossibleMap, expectedBestPossibleMap);
+    Assert.assertTrue(bestPossibleMap.equals(expectedBestPossibleMap));

Review comment:
       Just curious: what's your thought of changing to `equals` style? I think 
`Assert.assertEquals()` works fine, even `Assert.assertEquals(map, null)` or 
`Assert.assertEquals(null, map)` still works. But 
`Assert.assertTrue(null.equals(expectedBestPossibleMap))` won't work. (though 
in this test bestPossibleMap won't be null).

##########
File path: 
helix-core/src/main/java/org/apache/helix/model/OnlineOfflineWithBootstrapSMD.java
##########
@@ -0,0 +1,74 @@
+package org.apache.helix.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.helix.HelixDefinedState;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+
+/**
+ * Helix built-in state model definition based on Online-Offline but with the 
additional bootstrap
+ * state.
+ */
+public final class OnlineOfflineWithBootstrapSMD extends StateModelDefinition {
+  public static final String name = "OnlineOfflineWithBootstrap";
+
+  /**
+   * Instantiate from a pre-populated record
+   *
+   * @param record ZNRecord representing a state model definition
+   */
+  private OnlineOfflineWithBootstrapSMD(ZNRecord record) {
+    super(record);
+  }
+
+  public enum States {
+    ONLINE, BOOTSTRAP, OFFLINE
+  }
+
+  /**
+   * Build OnlineOfflineWithBootstrap state model definition
+   *
+   * @return
+   */
+  public static OnlineOfflineWithBootstrapSMD build() {
+    Builder builder = new Builder(name);
+    // init state
+    builder.initialState(States.OFFLINE.name());
+
+    // add states
+    builder.addState(States.ONLINE.name(), 0);
+    builder.addState(States.BOOTSTRAP.name(), 1);
+    builder.addState(States.OFFLINE.name(), 2);
+    for (HelixDefinedState state : HelixDefinedState.values()) {
+    builder.addState(state.name());
+  }

Review comment:
       Indent/format.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to