diff --git a/hcatalog/hcatalog-pig-adapter/pom.xml b/hcatalog/hcatalog-pig-adapter/pom.xml
index 229fda2..3c300da 100644
--- a/hcatalog/hcatalog-pig-adapter/pom.xml
+++ b/hcatalog/hcatalog-pig-adapter/pom.xml
@@ -68,7 +68,6 @@
-
hadoop-1
@@ -79,6 +78,12 @@
${hadoop-20S.version}
+ org.apache.hadoop
+ hadoop-test
+ ${hadoop-20S.version}
+ test
+
+
org.apache.pig
pig
${pig.version}
@@ -102,6 +107,11 @@
org.apache.hadoop
+ hadoop-mapreduce-client-jobclient
+ ${hadoop-23.version}
+
+
+ org.apache.hadoop
hadoop-mapreduce-client-core
${hadoop-23.version}
@@ -112,6 +122,12 @@
h2
+ org.apache.hadoop
+ hadoop-hdfs
+ ${hadoop-23.version}
+ test
+
+
joda-time
@@ -121,11 +137,30 @@
org.apache.hadoop
+ hadoop-hdfs
+ ${hadoop-23.version}
+ tests
+ test
+
+
+ org.apache.hadoop
hadoop-mapreduce-client-common
${hadoop-23.version}
true
test
+
+ org.apache.hadoop
+ hadoop-common
+ ${hadoop-23.version}
+ tests
+ test
+
+
+ com.sun.jersey
+ jersey-servlet
+ test
+
diff --git a/hcatalog/hcatalog-pig-adapter/src/test/java/org/apache/hive/hcatalog/pig/TestHCatLoaderEncryption.java b/hcatalog/hcatalog-pig-adapter/src/test/java/org/apache/hive/hcatalog/pig/TestHCatLoaderEncryption.java
new file mode 100644
index 0000000..4661397
--- /dev/null
+++ b/hcatalog/hcatalog-pig-adapter/src/test/java/org/apache/hive/hcatalog/pig/TestHCatLoaderEncryption.java
@@ -0,0 +1,343 @@
+/**
+ * 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.hive.hcatalog.pig;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FileUtil;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.cli.CliSessionState;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.ql.CommandNeedRetryException;
+import org.apache.hadoop.hive.ql.Driver;
+import org.apache.hadoop.hive.ql.io.IOConstants;
+import org.apache.hadoop.hive.ql.io.StorageFormats;
+import org.apache.hadoop.hive.ql.processors.CommandProcessor;
+import org.apache.hadoop.hive.ql.processors.CommandProcessorFactory;
+import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse;
+import org.apache.hadoop.hive.ql.processors.HiveCommand;
+import org.apache.hadoop.hive.ql.session.SessionState;
+import org.apache.hadoop.hive.shims.HadoopShims;
+import org.apache.hadoop.hive.shims.ShimLoader;
+
+import org.apache.hive.hcatalog.HcatTestUtils;
+import org.apache.hive.hcatalog.common.HCatUtil;
+import org.apache.hive.hcatalog.data.Pair;
+
+import org.apache.pig.ExecType;
+import org.apache.pig.PigServer;
+import org.apache.pig.data.Tuple;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.Assert.*;
+import static org.junit.Assume.assumeTrue;
+
+@RunWith(Parameterized.class)
+public class TestHCatLoaderEncryption {
+ private static final Logger LOG = LoggerFactory.getLogger(TestHCatLoader.class);
+ private static final String TEST_DATA_DIR = HCatUtil.makePathASafeFileName(System.getProperty
+ ("java.io.tmpdir") + File.separator + TestHCatLoader.class.getCanonicalName() + "-" +
+ System.currentTimeMillis());
+ private static final String TEST_WAREHOUSE_DIR = TEST_DATA_DIR + "/warehouse";
+ private static final String BASIC_FILE_NAME = TEST_DATA_DIR + "/basic.input.data";
+ private static final String BASIC_TABLE = "junit_unparted_basic";
+ private static final String ENCRYPTED_TABLE = "encrypted_table";
+ private static final String SECURITY_KEY_PROVIDER_URI_NAME = "dfs.encryption.key.provider.uri";
+
+ private HadoopShims.MiniDFSShim dfs = null;
+ private HadoopShims.HdfsEncryptionShim hes = null;
+ private final String[] testOnlyCommands = new String[]{"crypto"};
+ private final String[] encryptionUnsupportedHadoopVersion = new String[]{ShimLoader
+ .HADOOP20SVERSIONNAME};
+ private boolean isEncryptionTestEnabled = true;
+ private Driver driver;
+ private Map> basicInputData;
+
+ private static final Map> DISABLED_STORAGE_FORMATS =
+ new HashMap>() {{
+ put(IOConstants.PARQUETFILE, new HashSet() {{
+ add("testReadDataBasic");
+ add("testReadPartitionedBasic");
+ add("testProjectionsBasic");
+ add("testReadDataFromEncryptedHiveTable");
+ }});
+ }};
+
+ private String storageFormat;
+
+ @Parameterized.Parameters
+ public static Collection