ferdelyi commented on code in PR #5638:
URL: https://github.com/apache/hadoop/pull/5638#discussion_r1193974492


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/curator/TestSecureZKCuratorManager.java:
##########
@@ -0,0 +1,157 @@
+/**
+ * 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.hadoop.util.curator;
+
+import org.apache.curator.test.InstanceSpec;
+import org.apache.curator.test.TestingServer;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.client.ZKClientConfig;
+import org.apache.zookeeper.common.ClientX509Util;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.apache.hadoop.fs.FileContext.LOG;
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Test the manager for ZooKeeper Curator when SSL/TLS is enabled for the ZK 
server-client connection.
+ */
+public class TestSecureZKCuratorManager {
+
+  private TestingServer server;
+  private ZKCuratorManager curator;
+  private Configuration hadoopConf;
+  private Integer secureClientPort = 2281;
+  private File zkDataDir = new File("testZkSSLClientConnectionDataDir");
+
+  @Before
+  public void setup() throws Exception {
+    //set zkServer
+    this.hadoopConf = setUpSecure();
+    Map<String, Object> customConfiguration = new HashMap<>();
+    
customConfiguration.put("secureClientPort",this.secureClientPort.toString());
+    customConfiguration.put("audit.enable",true);
+
+    InstanceSpec spec = new InstanceSpec(
+            this.zkDataDir,
+            this.secureClientPort,
+            -1,
+            -1,
+            true,
+            1,
+            100,
+            10,
+            customConfiguration);
+    this.server = new TestingServer(spec, true);
+    hadoopConf.set(CommonConfigurationKeys.ZK_ADDRESS, 
this.server.getConnectString());
+    this.curator = new ZKCuratorManager(hadoopConf);
+    this.curator.start(new ArrayList<>(), true);
+  }
+
+  public Configuration setUpSecure() throws Exception {
+    Configuration hadoopConf = new Configuration();
+    String testDataPath = 
"src/test/java/org/apache/hadoop/util/curator/resources/data";
+    System.setProperty("zookeeper.serverCnxnFactory", 
"org.apache.zookeeper.server.NettyServerCnxnFactory");
+    //System.setProperty("zookeeper.client.secure", "true");
+
+
+    System.setProperty("zookeeper.ssl.keyStore.location", testDataPath + 
"/ssl/keystore.jks");
+    System.setProperty("zookeeper.ssl.keyStore.password", "password");
+    System.setProperty("zookeeper.ssl.trustStore.location", testDataPath + 
"/ssl/truststore.jks");
+    System.setProperty("zookeeper.ssl.trustStore.password", "password");
+    System.setProperty("zookeeper.request.timeout", "12345");
+
+    System.setProperty("jute.maxbuffer", "469296129");

Review Comment:
   It can't be calculated, this value is tuned based on the use case. The 
encrypted channell has some additional payload, hence the default 
jute.maxbuffer is not satisfactory. Established this number by defining a 
larger number than 369296129, which was reported as an exception when running 
the unit test with default values. Modified it to 400000000, so it is easier on 
the eyes.
   
   Let me save it to a static final int.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to