narendly commented on a change in pull request #796: WIP: Add 
SharedZkClient/InnerSharedZkClient implementation
URL: https://github.com/apache/helix/pull/796#discussion_r384146027
 
 

 ##########
 File path: 
zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestSharedZkClient.java
 ##########
 @@ -0,0 +1,47 @@
+package org.apache.helix.zookeeper.impl.client;
+
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.helix.zookeeper.datamodel.serializer.ZNRecordSerializer;
+import org.apache.helix.zookeeper.impl.factory.DedicatedZkClientFactory;
+import org.apache.helix.zookeeper.impl.factory.SharedZkClientFactory;
+import org.apache.zookeeper.CreateMode;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+
+public class TestSharedZkClient extends RealmAwareZkClientTestBase {
+  @BeforeClass
+  public void beforeClass()
+      throws Exception {
+    super.beforeClass();
+    // Set the factory to SharedZkClientFactory
+    _realmAwareZkClientFactory = SharedZkClientFactory.getInstance();
+  }
+
+  @Test
+  public void testCreateEphemeralFailure() {
+    _realmAwareZkClient.setZkSerializer(new ZNRecordSerializer());
+
+    // Create a dummy ZNRecord
+    ZNRecord znRecord = new ZNRecord("DummyRecord");
+    znRecord.setSimpleField("Dummy", "Value");
+
+    // test createEphemeral should fail
+    try {
+      _realmAwareZkClient.createEphemeral(TEST_VALID_PATH);
+      Assert.fail("sharedReamlAwareZkClient is not expected to be able to 
create ephemeral node via createEphemeral");
+    } catch (UnsupportedOperationException e){
+      // this is expected
+    }
+
+    // test creating Ephemeral via creat would also fail
+    try {
+      _realmAwareZkClient.create(TEST_VALID_PATH, znRecord, 
CreateMode.EPHEMERAL);
+      Assert.fail("sharedRealmAwareZkClient is not expected to be able to 
create ephmeral node via create");
+    } catch (UnsupportedOperationException e) {
+      // this is expected.
+    }
+  }
+
 
 Review comment:
   Remove empty line here?

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

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

Reply via email to