mikewalch commented on a change in pull request #899: fixes #893 added ability 
to secure zookeeper
URL: https://github.com/apache/fluo/pull/899#discussion_r132257442
 
 

 ##########
 File path: 
modules/integration/src/test/java/org/apache/fluo/integration/impl/ZKSecretIT.java
 ##########
 @@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+package org.apache.fluo.integration.impl;
+
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.concurrent.TimeUnit;
+
+import com.google.common.util.concurrent.Uninterruptibles;
+import org.apache.fluo.accumulo.util.ZookeeperPath;
+import org.apache.fluo.api.client.FluoClient;
+import org.apache.fluo.api.client.FluoFactory;
+import org.apache.fluo.api.client.Snapshot;
+import org.apache.fluo.api.client.Transaction;
+import org.apache.fluo.api.config.FluoConfiguration;
+import org.apache.fluo.api.data.Column;
+import org.apache.fluo.api.observer.ObserverProvider;
+import org.apache.fluo.integration.ITBaseMini;
+import org.apache.zookeeper.KeeperException.NoAuthException;
+import org.apache.zookeeper.ZooKeeper;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.apache.fluo.api.observer.Observer.NotificationType.STRONG;
+
+public class ZKSecretIT extends ITBaseMini {
+
+  public static class MyObserverProvider implements ObserverProvider {
+
+    @Override
+    public void provide(Registry or, Context ctx) {
+      or.forColumn(new Column("edge", "forward"), STRONG).useObserver((tx, 
row, col) -> {
+        tx.set(tx.get(row, col), new Column("edge", "reverese"), row);
+      });
+    }
+
+  }
+
+  @Override
+  protected void setConfig(FluoConfiguration config) {
+    config.setZookeeperSecret("are3");
+    config.setObserverProvider(MyObserverProvider.class);
+  }
+
+  private ZooKeeper getZookeeper() throws IOException {
+    ZooKeeper zk = new ZooKeeper(config.getAppZookeepers(), 30000, null);
+
+    long start = System.currentTimeMillis();
+    while (!zk.getState().isConnected() && System.currentTimeMillis() - start 
< 30000) {
+      Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MILLISECONDS);
+    }
+
+    return zk;
+  }
+
+  @Test
+  public void testZKAcls() throws Exception {
+
+    // verify basic functionality works when password is set in ZK
+    try (FluoClient client = 
FluoFactory.newClient(miniFluo.getClientConfiguration())) {
 
 Review comment:
   What happens if a user a passes in an incorrect Zookeeper secret?  It would 
be good to make sure there is a good exception or error message for this case.  
A unit test could also be written to verify this behavior.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to