@Test
  public void createHelixPropertyStoreTest() throws IOException {
    Properties storeProps = new Properties();
    storeProps.setProperty("helix.property.store.root.path", "/Ambry-Test/" + ClusterMapUtils.PROPERTYSTORE_STR);
    HelixPropertyStoreConfig propertyStoreConfig = new HelixPropertyStoreConfig(new VerifiableProperties(storeProps));
    String tempDirPath = getTempDir("clusterMapUtils-");
    ZkInfo zkInfo = new ZkInfo(tempDirPath, "DC1", (byte) 0, 2200, true);

    try {
      CommonUtils.createHelixPropertyStore(null, propertyStoreConfig, Collections.emptyList());
      fail("create HelixPropertyStore with invalid arguments should fail");
    } catch (IllegalArgumentException e) {
      //expected
    }

    try {
      CommonUtils.createHelixPropertyStore("", propertyStoreConfig, Collections.emptyList());
      fail("create HelixPropertyStore with invalid arguments should fail");
    } catch (IllegalArgumentException e) {
      //expected
    }

    try {
      CommonUtils.createHelixPropertyStore("localhost:" + zkInfo.getPort(), (HelixPropertyStoreConfig) null,
          Collections.emptyList());
      fail("create HelixPropertyStore with invalid arguments should fail");
    } catch (IllegalArgumentException e) {
      //expected
    }

    HelixPropertyStore<ZNRecord> propertyStore =
        CommonUtils.createHelixPropertyStore("localhost:" + zkInfo.getPort(), propertyStoreConfig,
            Collections.singletonList(propertyStoreConfig.rootPath));
    assertNotNull(propertyStore);

    // Ensure the HelixPropertyStore works correctly
    List<String> list = Arrays.asList("first", "second", "third");
    String path = propertyStoreConfig.rootPath + ClusterMapUtils.PARTITION_OVERRIDE_ZNODE_PATH;
    ZNRecord znRecord = new ZNRecord(ClusterMapUtils.PARTITION_OVERRIDE_STR);
    znRecord.setListField("AmbryList", list);
    if (!propertyStore.set(path, znRecord, AccessOption.PERSISTENT)) {
      fail("Failed to set HelixPropertyStore");
    }
    // Verify path exists
    assertTrue("The record path doesn't exist", propertyStore.exists(path, AccessOption.PERSISTENT));
    // Verify record
    ZNRecord result = propertyStore.get(path, null, AccessOption.PERSISTENT);
    assertEquals("Mismatch in list content", new HashSet<>(list), new HashSet<>(result.getListField("AmbryList")));
    propertyStore.stop();
    zkInfo.shutdown();
  }
Tests for {@link CommonUtils#createHelixPropertyStore(String, HelixPropertyStoreConfig, List)}.
ambry-commons/src/test/java/com/github/ambry/commons/CommonUtilsTest.java