saihemanth-cloudera commented on code in PR #4428:
URL: https://github.com/apache/hive/pull/4428#discussion_r1258595727


##########
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestCSRFFilter.java:
##########
@@ -0,0 +1,171 @@
+/*
+ * 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 test.java.org.apache.hive.jdbc;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
+import org.apache.hive.jdbc.CsrfHttpRequestInterceptor;
+import org.apache.hive.jdbc.miniHS2.MiniHS2;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.IOException;
+import java.sql.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * TestCSRFFilter test.
+ */
+@RunWith(Parameterized.class)
+public class TestCSRFFilter {
+
+  private static MiniHS2 miniHS2 = null;
+  private static String dataFileDir;
+  private static Path kvDataFilePath;
+  private static final String tmpDir = System.getProperty("test.tmp.dir");
+
+  private Connection hs2Conn = null;
+
+  @Parameterized.Parameter
+  public String transportMode =  null;
+
+  @Parameterized.Parameters(name = "{index}: tranportMode={0}")
+  public static Collection<Object[]> transportModes() {
+    return Arrays.asList(new Object[][]{{MiniHS2.HS2_ALL_MODE}, 
{MiniHS2.HS2_HTTP_MODE}});
+  }
+
+
+  @BeforeClass
+  public static void beforeClass() throws IOException {
+    MiniHS2.cleanupLocalDir();
+  }
+
+  @AfterClass
+  public static void afterClass() throws IOException {
+    MiniHS2.cleanupLocalDir();
+  }
+
+  // This is not modeled as a @Before, because it needs to be parameterized 
per-test.
+  // If there is a better way to do this, we should do it.
+  private void initHS2(boolean enableCSRFFilter) throws Exception {
+    Class.forName(MiniHS2.getJdbcDriverName());
+    HiveConf conf = new HiveConf();
+    conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
+    miniHS2 = new 
MiniHS2.Builder().withConf(conf).cleanupLocalDirOnStartup(false).build();
+    dataFileDir = conf.get("test.data.files").replace('\\', '/').replace("c:", 
"");
+    kvDataFilePath = new Path(dataFileDir, "kv1.txt");
+    Map<String,String> confOverlay = new HashMap<String, String>();
+    confOverlay.put(ConfVars.HIVE_SERVER2_CSRF_FILTER_ENABLED.varname, 
String.valueOf(enableCSRFFilter));
+    confOverlay.put(ConfVars.HIVE_SERVER2_TRANSPORT_MODE.varname, 
transportMode);

Review Comment:
   'transportMode' variable is never set.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to