i3wangyi commented on a change in pull request #348: Adding the configuration 
items of the WAGED rebalancer.
URL: https://github.com/apache/helix/pull/348#discussion_r307458476
 
 

 ##########
 File path: 
helix-core/src/test/java/org/apache/helix/model/TestInstanceConfig.java
 ##########
 @@ -58,4 +59,70 @@ public void testGetParsedDomain_emptyDomain() {
     Map<String, String> parsedDomain = instanceConfig.getDomainAsMap();
     Assert.assertTrue(parsedDomain.isEmpty());
   }
+
+  @Test
+  public void testGetInstanceCapacityMap() {
+    Map<String, Integer> capacityDataMap = new HashMap<>();
+    capacityDataMap.put("item1", 1);
+    capacityDataMap.put("item2", 2);
+    capacityDataMap.put("item3", 3);
+
+    Map<String, String> capacityDataMapString = new HashMap<>();
+    capacityDataMapString.put("item1", "1");
+    capacityDataMapString.put("item2", "2");
+    capacityDataMapString.put("item3", "3");
+
+
+    ZNRecord rec = new ZNRecord("testId");
+    
rec.setMapField(InstanceConfig.InstanceConfigProperty.INSTANCE_CAPACITY_MAP.name(),
 capacityDataMapString);
+    InstanceConfig testConfig = new InstanceConfig(rec);
+
+    
Assert.assertTrue(testConfig.getInstanceCapacityMap().equals(capacityDataMap));
+  }
+
+  @Test
+  public void testGetInstanceCapacityMapEmpty() {
+    InstanceConfig testConfig = new InstanceConfig("testId");
+
+    
Assert.assertTrue(testConfig.getInstanceCapacityMap().equals(Collections.emptyMap()));
+  }
+
+  @Test
+  public void testSetInstanceCapacityMap() {
+    Map<String, Integer> capacityDataMap = new HashMap<>();
 
 Review comment:
   I would prefer to use 
   ```
   Map<String, Integer> capacityDataMap = ImmutableMap.of("item1", 1, 
   "item2", 2,
   "item3", 3);
   ```
   Just shorter

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to