narendly commented on a change in pull request #757: Add write REST endpoints 
to helix rest for metadata store directory
URL: https://github.com/apache/helix/pull/757#discussion_r379121949
 
 

 ##########
 File path: 
helix-rest/src/test/java/org/apache/helix/rest/server/resources/zookeeper/TestMetadataStoreDirectoryAccessor.java
 ##########
 @@ -27,38 +27,60 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.rest.metadatastore.MetadataStoreDirectory;
+import org.apache.helix.rest.metadatastore.ZkMetadataStoreDirectory;
 import 
org.apache.helix.rest.metadatastore.constant.MetadataStoreRoutingConstants;
+import 
org.apache.helix.rest.metadatastore.exceptions.InvalidRoutingDataException;
 import org.apache.helix.rest.server.AbstractTestClass;
 import org.apache.helix.rest.server.util.JerseyUriRequestBuilder;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.helix.zookeeper.datamodel.serializer.ZNRecordSerializer;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import static 
org.apache.helix.rest.common.HelixRestNamespace.DEFAULT_NAMESPACE_NAME;
+
 
 public class TestMetadataStoreDirectoryAccessor extends AbstractTestClass {
   /*
    * The following are constants to be used for testing.
    */
+  private static final String TEST_NAMESPACE_URI_PREFIX = "/namespaces/" + 
TEST_NAMESPACE;
+  private static final String NON_EXISTING_NAMESPACE_URI_PREFIX =
+      "/namespaces/not-existed-namespace/metadata-store-realms/";
   private static final String TEST_REALM_1 = "testRealm1";
   private static final List<String> TEST_SHARDING_KEYS_1 =
       Arrays.asList("/sharding/key/1/a", "/sharding/key/1/b", 
"/sharding/key/1/c");
   private static final String TEST_REALM_2 = "testRealm2";
   private static final List<String> TEST_SHARDING_KEYS_2 =
       Arrays.asList("/sharding/key/1/d", "/sharding/key/1/e", 
"/sharding/key/1/f");
+  private static final String TEST_REALM_3 = "testRealm3";
+  private static final String TEST_SHARDING_KEY = "/sharding/key/1/x";
 
   // List of all ZK addresses, each of which corresponds to a 
namespace/routing ZK
   private List<String> _zkList;
+  private MetadataStoreDirectory _metadataStoreDirectory;
 
   @BeforeClass
-  public void beforeClass() {
+  public void beforeClass() throws InvalidRoutingDataException {
     _zkList = new ArrayList<>(ZK_SERVER_MAP.keySet());
 
+    _zkList.forEach(zk -> ZK_SERVER_MAP.get(zk).getZkClient()
+        .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH));
 
 Review comment:
   Could add TestHelper.verify for making the test stable.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org
For additional commands, e-mail: reviews-h...@helix.apache.org

Reply via email to