diff --git ant/dependencies.xml ant/dependencies.xml new file mode 100644 index 0000000..b4d1c7e --- /dev/null +++ ant/dependencies.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git ant/deploy.xml ant/deploy.xml new file mode 100644 index 0000000..7e2934c --- /dev/null +++ ant/deploy.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git ant/test.xml ant/test.xml new file mode 100644 index 0000000..6c95ff6 --- /dev/null +++ ant/test.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tests failed! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git build-common-new.xml build-common-new.xml deleted file mode 100644 index 3c5e1a0..0000000 --- build-common-new.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_javac srcDir="${basedir}/src/main/java" - destDir="${build.classes}" - classPathRef="compile.class.path"/> - - - - - <_javac srcDir="${basedir}/src/test/java" - destDir="${test.classes}" - classPathRef="test.class.path"/> - <_junit/> - - - - - - - - - - - <_findbugs outputDir="${findbugs.out.dir}" - outputFile="${findbugs.report.xmlfile}" - excludeFilter="${findbugs.exclude.file}" - findbugsReportXmlFile="${findbugs.report.xmlfile}" - findbugsReportHtmlFile="${findbugs.report.htmlfile}" - sourceDir="${basedir}/src/main/java" - jarDir="${build.dir}" - classPathRef="findbugs.class.path"/> - - - - diff --git build-common.xml build-common.xml index 9030d28..ac9b4f5 100644 --- build-common.xml +++ build-common.xml @@ -1,51 +1,94 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_javac srcDir="${basedir}/src/main/java" + destDir="${build.classes}" + classPathRef="compile.class.path"/> + + + + + <_javac srcDir="${basedir}/src/test/java" + destDir="${test.classes}" + classPathRef="test.class.path"/> + + + + + <_junit srcDir="${basedir}/src/test/java"/> + + + + + + + + + + + + + <_findbugs outputDir="${findbugs.out.dir}" + outputFile="${findbugs.report.xmlfile}" + excludeFilter="${findbugs.exclude.file}" + findbugsReportXmlFile="${findbugs.report.xmlfile}" + findbugsReportHtmlFile="${findbugs.report.htmlfile}" + sourceDir="${basedir}/src/main/java" + jarDir="${build.dir}" + classPathRef="findbugs.class.path"/> + diff --git build.properties build.properties new file mode 100644 index 0000000..459acb7 --- /dev/null +++ build.properties @@ -0,0 +1,60 @@ +_version=0.5.0 +_vtype=-SNAPSHOT +hcatalog.version=${_version}${_vtype} +jar.name=${ant.project.name}-${hcatalog.version}.jar +hcatalog.jar=${ant.project.name}-${hcatalog.version}.jar +hcatalog.core.jar=${ant.project.name}-core-${hcatalog.version}.jar +final.name=${ant.project.name}-${hcatalog.version} +package.release=1 + +build.dir=${basedir}/build +build.classes=${build.dir}/classes +src.dir=${basedir}/src/java +package.dir=${basedir}/src/packages +docs.src=${basedir}/src/docs +build.classes=${build.dir}/classes +build.docs=${build.dir}/docs +build.javadoc=${build.docs}/api +dist.dir=${build.dir}/${final.name} + +test.dir=${build.dir}/test +test.classes=${test.dir}/classes +test.logs=${test.dir}/logs +test.timeout=2700000 +test.warehouse.dir=${test.dir}/hcat_junit_warehouse +mvnrepo=http://repo2.maven.org/maven2 +test.src.dir=${basedir}/src/test +test.junit.output.format=plain +test.all.file=${test.src.dir}/all-tests +test.exclude.file=${test.src.dir}/excluded-tests +test.output=no +test.excludes=e2e/** +clover.jar=${clover.home}/lib/clover.jar +clover.db.dir=${build.dir}/test/clover/db +clover.report.dir=${build.dir}/test/clover/reports +clover.pdf.report.dir=${build.dir}/test/clover/pdf/reports + +ivysettings.xml=${path.to.basedir}/ivy/ivysettings.xml +ivy.xml=${basedir}/ivy.xml +pom.file=${build.dir}/ivy/${ant.project.name}-${hcatalog.version}.pom + +findbugs.out.dir=${test.dir}/findbugs +findbugs.exclude.file=${basedir}/src/test/findbugsExcludeFile.xml +findbugs.report.htmlfile=${findbugs.out.dir}/hcat-findbugs-report.html +findbugs.report.xmlfile=${findbugs.out.dir}/hcat-findbugs-report.xml + +build.encoding=UTF8 +excludes= +javac.debug=on +javac.optimize=on +javac.deprecation=off +javac.version=1.6 +javac.args= + + +# hive properties +shims.name=20S +shims.20S.hive.shims.include=0.20,0.20S +shims.20S.hadoop.version=${hive.hadoop-0.20S.version} +shims.23.hive.shims.include=0.23 +shims.23.hadoop.version=${hive.hadoop-0.23.version} diff --git build.xml build.xml index 529658f..4da0cff 100644 --- build.xml +++ build.xml @@ -17,74 +17,25 @@ limitations under the License. --> + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -123,156 +74,71 @@ - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - + + + - - + + - + - - - - - - - + + + + + + - - - - + + + + + - - - - - + + - - - - - - - You need Apache Ivy 2.0 or later from http://ant.apache.org/ - It could not be loaded from ${ivy_repo_url} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - + - + - - - + + + + @@ -353,132 +226,40 @@ --> - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Tests failed! - + + <_junit srcDir="${basedir}/src/test"/> - - - - - - - - - - - - - - - - - - - - - - - - - - Clover not found. Code coverage reports disabled. - - - - - - ################################################################## - Clover not found. - Please specify -Dclover.home=<base of clover installation> - on the command line. - ################################################################## - + - - - - - - - - - - - - + + <_junit srcDir="${basedir}/src/test"/> + + + + - - - - - + - - - - <_findbugs outputDir="${findbugs.out.dir}" outputFile="${findbugs.report.xmlfile}" excludeFilter="${findbugs.exclude.file}" @@ -505,7 +282,7 @@ findbugsReportHtmlFile="${findbugs.report.htmlfile}" sourceDir="${src.dir}" jarDir="${build.dir}/${ant.project.name}" - classPathRef="findbugs.class.path"/> + classPathRef="compile.classpath"/> @@ -518,6 +295,7 @@ --> + @@ -559,15 +337,10 @@ - - - - - + + + + @@ -679,7 +452,7 @@ - + @@ -748,6 +521,9 @@ + + + diff --git hcatalog-pig-adapter/build.xml hcatalog-pig-adapter/build.xml index 8b4f6a4..8dbc319 100644 --- hcatalog-pig-adapter/build.xml +++ hcatalog-pig-adapter/build.xml @@ -19,32 +19,21 @@ - - - + - - + - - + - - - - - - + diff --git hcatalog-pig-adapter/ivy.xml hcatalog-pig-adapter/ivy.xml index 2a278f0..d7f0d30 100644 --- hcatalog-pig-adapter/ivy.xml +++ hcatalog-pig-adapter/ivy.xml @@ -26,24 +26,16 @@ - + - - - - + - - - - - - + + + diff --git ivy.xml ivy.xml index 268706c..703f6ec 100644 --- ivy.xml +++ ivy.xml @@ -15,119 +15,56 @@ limitations under the License. --> - - - - - Apache HCatalog - - + + + + Apache HCatalog + - - - - - - - - - - + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + diff --git ivy/libraries.properties ivy/libraries.properties index 74033d7..eb1f9fa 100644 --- ivy/libraries.properties +++ ivy/libraries.properties @@ -53,6 +53,7 @@ jetty.webhcat.version=7.6.0.v20120127 jms.version=1.1 junit.version=4.10 log4j.version=1.2.16 +maven-ant-tasks.version=2.1.3 oro.version=2.0.8 pig.version=0.8.0 rats-lib.version=0.5.1 diff --git src/test/all-tests src/test/all-tests deleted file mode 100644 index a945de6..0000000 --- src/test/all-tests +++ /dev/null @@ -1 +0,0 @@ -**/Test*.java diff --git src/test/excluded-tests src/test/excluded-tests deleted file mode 100644 index 645ad15..0000000 --- src/test/excluded-tests +++ /dev/null @@ -1 +0,0 @@ -**/TestEximSemanticAnalysis.java diff --git src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java deleted file mode 100644 index eedda9e..0000000 --- src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * 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.hcatalog.cli; - -import java.io.IOException; -import java.net.URI; - -import junit.framework.TestCase; - -import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.permission.FsPermission; -import org.apache.hadoop.hive.cli.CliSessionState; -import org.apache.hadoop.hive.conf.HiveConf; -import org.apache.hadoop.hive.conf.HiveConf.ConfVars; -import org.apache.hadoop.hive.metastore.Warehouse; -import org.apache.hadoop.hive.metastore.api.MetaException; -import org.apache.hadoop.hive.ql.metadata.Hive; -import org.apache.hadoop.hive.ql.metadata.HiveException; -import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse; -import org.apache.hadoop.hive.ql.session.SessionState; -import org.apache.hcatalog.MiniCluster; -import org.apache.hcatalog.cli.SemanticAnalysis.HCatSemanticAnalyzer; -import org.apache.hcatalog.common.HCatConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class TestEximSemanticAnalysis extends TestCase { - - private final MiniCluster cluster = MiniCluster.buildCluster(); - private HiveConf hcatConf; - private HCatDriver hcatDriver; - private Warehouse wh; - private static final Logger LOG = LoggerFactory.getLogger(TestEximSemanticAnalysis.class); - - @Override - protected void setUp() throws Exception { - - hcatConf = new HiveConf(this.getClass()); - hcatConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, ""); - hcatConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, ""); - hcatConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false"); - hcatConf.set(ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName()); - hcatConf.set("fs.pfile.impl", "org.apache.hadoop.fs.ProxyLocalFileSystem"); - URI fsuri = cluster.getFileSystem().getUri(); - Path whPath = new Path(fsuri.getScheme(), fsuri.getAuthority(), "/user/hive/warehouse"); - hcatConf.set(HiveConf.ConfVars.HADOOPFS.varname, fsuri.toString()); - hcatConf.set(ConfVars.METASTOREWAREHOUSE.varname, whPath.toString()); - wh = new Warehouse(hcatConf); - SessionState.start(new CliSessionState(hcatConf)); - - hcatDriver = new HCatDriver(); - } - - @Override - protected void tearDown() throws Exception { - } - - public void testExportPerms() throws IOException, MetaException, HiveException { - - hcatDriver.run("drop table junit_sem_analysis"); - CommandProcessorResponse response = hcatDriver - .run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE"); - assertEquals(0, response.getResponseCode()); - Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), "junit_sem_analysis"); - cluster.getFileSystem().setPermission(whPath, FsPermission.valueOf("-rwxrwx-wx")); - cluster.getFileSystem().setOwner(whPath, "nosuchuser", "nosuchgroup"); - - Runtime.getRuntime().exec("rm -rf /tmp/hcat"); - response = hcatDriver - .run("export table junit_sem_analysis to 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); - - assertEquals(10, response.getResponseCode()); - assertTrue("Permission denied expected : "+response.getErrorMessage(), - response.getErrorMessage().startsWith( - "FAILED: Error in semantic analysis: org.apache.hcatalog.common.HCatException : 3000 : Permission denied")); - Runtime.getRuntime().exec("rm -rf /tmp/hcat"); - response = hcatDriver.run("drop table junit_sem_analysis"); - if (response.getResponseCode() != 0) { - LOG.error(response.getErrorMessage()); - fail("Drop table failed"); - } - } - - public void testImportPerms() throws IOException, MetaException, HiveException { - - hcatDriver.run("drop table junit_sem_analysis"); - CommandProcessorResponse response = hcatDriver - .run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE"); - assertEquals(0, response.getResponseCode()); - Runtime.getRuntime().exec("rm -rf /tmp/hcat"); - response = hcatDriver - .run("export table junit_sem_analysis to 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); - assertEquals(0, response.getResponseCode()); - response = hcatDriver.run("drop table junit_sem_analysis"); - assertEquals(0, response.getResponseCode()); - response = hcatDriver - .run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE"); - assertEquals(0, response.getResponseCode()); - Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), "junit_sem_analysis"); - cluster.getFileSystem().setPermission(whPath, FsPermission.valueOf("-rwxrwxr-x")); - cluster.getFileSystem().setOwner(whPath, "nosuchuser", "nosuchgroup"); - - response = hcatDriver - .run("import table junit_sem_analysis from 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); - - assertEquals(10, response.getResponseCode()); - assertTrue( - "Permission denied expected: "+response.getErrorMessage() , - response.getErrorMessage().startsWith( - "FAILED: Error in semantic analysis: org.apache.hcatalog.common.HCatException : 3000 : Permission denied")); - Runtime.getRuntime().exec("rm -rf /tmp/hcat"); - - cluster.getFileSystem().setPermission(whPath, FsPermission.valueOf("-rwxrwxrwx")); - response = hcatDriver.run("drop table junit_sem_analysis"); - if (response.getResponseCode() != 0) { - LOG.error(response.getErrorMessage()); - fail("Drop table failed"); - } - } - - public void testImportSetPermsGroup() throws IOException, MetaException, HiveException { - - hcatDriver.run("drop table junit_sem_analysis"); - hcatDriver.run("drop table junit_sem_analysis_imported"); - CommandProcessorResponse response = hcatDriver - .run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE"); - assertEquals(0, response.getResponseCode()); - Runtime.getRuntime().exec("rm -rf /tmp/hcat"); - response = hcatDriver - .run("export table junit_sem_analysis to 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); - assertEquals(0, response.getResponseCode()); - response = hcatDriver.run("drop table junit_sem_analysis"); - assertEquals(0, response.getResponseCode()); - - hcatConf.set(HCatConstants.HCAT_PERMS, "-rwxrw-r--"); - hcatConf.set(HCatConstants.HCAT_GROUP, "nosuchgroup"); - - response = hcatDriver - .run("import table junit_sem_analysis_imported from 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); - assertEquals(0, response.getResponseCode()); - - Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), "junit_sem_analysis_imported"); - assertEquals(FsPermission.valueOf("-rwxrw-r--"), cluster.getFileSystem().getFileStatus(whPath).getPermission()); - assertEquals("nosuchgroup", cluster.getFileSystem().getFileStatus(whPath).getGroup()); - - Runtime.getRuntime().exec("rm -rf /tmp/hcat"); - - response = hcatDriver.run("drop table junit_sem_analysis_imported"); - if (response.getResponseCode() != 0) { - LOG.error(response.getErrorMessage()); - fail("Drop table failed"); - } - } - - -} - diff --git src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java.broken src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java.broken new file mode 100644 index 0000000..eedda9e --- /dev/null +++ src/test/org/apache/hcatalog/cli/TestEximSemanticAnalysis.java.broken @@ -0,0 +1,174 @@ +/** + * 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.hcatalog.cli; + +import java.io.IOException; +import java.net.URI; + +import junit.framework.TestCase; + +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsPermission; +import org.apache.hadoop.hive.cli.CliSessionState; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.conf.HiveConf.ConfVars; +import org.apache.hadoop.hive.metastore.Warehouse; +import org.apache.hadoop.hive.metastore.api.MetaException; +import org.apache.hadoop.hive.ql.metadata.Hive; +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse; +import org.apache.hadoop.hive.ql.session.SessionState; +import org.apache.hcatalog.MiniCluster; +import org.apache.hcatalog.cli.SemanticAnalysis.HCatSemanticAnalyzer; +import org.apache.hcatalog.common.HCatConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class TestEximSemanticAnalysis extends TestCase { + + private final MiniCluster cluster = MiniCluster.buildCluster(); + private HiveConf hcatConf; + private HCatDriver hcatDriver; + private Warehouse wh; + private static final Logger LOG = LoggerFactory.getLogger(TestEximSemanticAnalysis.class); + + @Override + protected void setUp() throws Exception { + + hcatConf = new HiveConf(this.getClass()); + hcatConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, ""); + hcatConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, ""); + hcatConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false"); + hcatConf.set(ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName()); + hcatConf.set("fs.pfile.impl", "org.apache.hadoop.fs.ProxyLocalFileSystem"); + URI fsuri = cluster.getFileSystem().getUri(); + Path whPath = new Path(fsuri.getScheme(), fsuri.getAuthority(), "/user/hive/warehouse"); + hcatConf.set(HiveConf.ConfVars.HADOOPFS.varname, fsuri.toString()); + hcatConf.set(ConfVars.METASTOREWAREHOUSE.varname, whPath.toString()); + wh = new Warehouse(hcatConf); + SessionState.start(new CliSessionState(hcatConf)); + + hcatDriver = new HCatDriver(); + } + + @Override + protected void tearDown() throws Exception { + } + + public void testExportPerms() throws IOException, MetaException, HiveException { + + hcatDriver.run("drop table junit_sem_analysis"); + CommandProcessorResponse response = hcatDriver + .run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE"); + assertEquals(0, response.getResponseCode()); + Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), "junit_sem_analysis"); + cluster.getFileSystem().setPermission(whPath, FsPermission.valueOf("-rwxrwx-wx")); + cluster.getFileSystem().setOwner(whPath, "nosuchuser", "nosuchgroup"); + + Runtime.getRuntime().exec("rm -rf /tmp/hcat"); + response = hcatDriver + .run("export table junit_sem_analysis to 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); + + assertEquals(10, response.getResponseCode()); + assertTrue("Permission denied expected : "+response.getErrorMessage(), + response.getErrorMessage().startsWith( + "FAILED: Error in semantic analysis: org.apache.hcatalog.common.HCatException : 3000 : Permission denied")); + Runtime.getRuntime().exec("rm -rf /tmp/hcat"); + response = hcatDriver.run("drop table junit_sem_analysis"); + if (response.getResponseCode() != 0) { + LOG.error(response.getErrorMessage()); + fail("Drop table failed"); + } + } + + public void testImportPerms() throws IOException, MetaException, HiveException { + + hcatDriver.run("drop table junit_sem_analysis"); + CommandProcessorResponse response = hcatDriver + .run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE"); + assertEquals(0, response.getResponseCode()); + Runtime.getRuntime().exec("rm -rf /tmp/hcat"); + response = hcatDriver + .run("export table junit_sem_analysis to 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); + assertEquals(0, response.getResponseCode()); + response = hcatDriver.run("drop table junit_sem_analysis"); + assertEquals(0, response.getResponseCode()); + response = hcatDriver + .run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE"); + assertEquals(0, response.getResponseCode()); + Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), "junit_sem_analysis"); + cluster.getFileSystem().setPermission(whPath, FsPermission.valueOf("-rwxrwxr-x")); + cluster.getFileSystem().setOwner(whPath, "nosuchuser", "nosuchgroup"); + + response = hcatDriver + .run("import table junit_sem_analysis from 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); + + assertEquals(10, response.getResponseCode()); + assertTrue( + "Permission denied expected: "+response.getErrorMessage() , + response.getErrorMessage().startsWith( + "FAILED: Error in semantic analysis: org.apache.hcatalog.common.HCatException : 3000 : Permission denied")); + Runtime.getRuntime().exec("rm -rf /tmp/hcat"); + + cluster.getFileSystem().setPermission(whPath, FsPermission.valueOf("-rwxrwxrwx")); + response = hcatDriver.run("drop table junit_sem_analysis"); + if (response.getResponseCode() != 0) { + LOG.error(response.getErrorMessage()); + fail("Drop table failed"); + } + } + + public void testImportSetPermsGroup() throws IOException, MetaException, HiveException { + + hcatDriver.run("drop table junit_sem_analysis"); + hcatDriver.run("drop table junit_sem_analysis_imported"); + CommandProcessorResponse response = hcatDriver + .run("create table junit_sem_analysis (a int) partitioned by (b string) stored as RCFILE"); + assertEquals(0, response.getResponseCode()); + Runtime.getRuntime().exec("rm -rf /tmp/hcat"); + response = hcatDriver + .run("export table junit_sem_analysis to 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); + assertEquals(0, response.getResponseCode()); + response = hcatDriver.run("drop table junit_sem_analysis"); + assertEquals(0, response.getResponseCode()); + + hcatConf.set(HCatConstants.HCAT_PERMS, "-rwxrw-r--"); + hcatConf.set(HCatConstants.HCAT_GROUP, "nosuchgroup"); + + response = hcatDriver + .run("import table junit_sem_analysis_imported from 'pfile://local:9080/tmp/hcat/exports/junit_sem_analysis'"); + assertEquals(0, response.getResponseCode()); + + Path whPath = wh.getTablePath(Hive.get(hcatConf).getDatabase("default"), "junit_sem_analysis_imported"); + assertEquals(FsPermission.valueOf("-rwxrw-r--"), cluster.getFileSystem().getFileStatus(whPath).getPermission()); + assertEquals("nosuchgroup", cluster.getFileSystem().getFileStatus(whPath).getGroup()); + + Runtime.getRuntime().exec("rm -rf /tmp/hcat"); + + response = hcatDriver.run("drop table junit_sem_analysis_imported"); + if (response.getResponseCode() != 0) { + LOG.error(response.getErrorMessage()); + fail("Drop table failed"); + } + } + + +} + diff --git src/test/org/apache/hcatalog/cli/TestPermsGrp.java src/test/org/apache/hcatalog/cli/TestPermsGrp.java index 506a4e2..5c094ac 100644 --- src/test/org/apache/hcatalog/cli/TestPermsGrp.java +++ src/test/org/apache/hcatalog/cli/TestPermsGrp.java @@ -81,7 +81,7 @@ public class TestPermsGrp extends TestCase { hcatConf = new HiveConf(this.getClass()); hcatConf.set("hive.metastore.local", "false"); - hcatConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + msPort); + hcatConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://127.0.0.1:" + msPort); hcatConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTRETRIES, 3); hcatConf.set(HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK.varname, HCatSemanticAnalyzer.class.getName()); diff --git storage-handlers/build.xml storage-handlers/build.xml index 6777ce8..484989a 100644 --- storage-handlers/build.xml +++ storage-handlers/build.xml @@ -28,6 +28,11 @@ + + + + + Generating all handlers diff --git storage-handlers/hbase/build.xml storage-handlers/hbase/build.xml index f8ae11a..13b7e4d 100644 --- storage-handlers/hbase/build.xml +++ storage-handlers/hbase/build.xml @@ -19,12 +19,9 @@ - - + + + @@ -90,10 +85,10 @@ value="${mvnrepo}/org/apache/maven/maven-ant-tasks/${ant-task.version}/maven-ant-tasks-${ant-task.version}.jar"/> + - - + @@ -101,92 +96,22 @@ - - - - - + + + + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - You need Apache Ivy 2.0 or later from http://ant.apache.org/ - It could not be loaded from ${ivy_repo_url} - - - - - - - - - - - - - - - - - - - - - - - - + @@ -204,7 +129,7 @@ source="${javac.version}" deprecation="${javac.deprecation}" includeantruntime="false"> - + @@ -296,15 +221,21 @@ - - - - - - - - + + + + + + + @@ -346,4 +277,7 @@ + + + diff --git storage-handlers/hbase/ivy.xml storage-handlers/hbase/ivy.xml index eaa4ed0..9fbe7e7 100644 --- storage-handlers/hbase/ivy.xml +++ storage-handlers/hbase/ivy.xml @@ -15,111 +15,38 @@ limitations under the License. --> - - - - - Apache HCatalog - - + + + + Apache HCatalog + - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git webhcat/svr/build.xml webhcat/svr/build.xml index 87d72ab..a7bc34c 100644 --- webhcat/svr/build.xml +++ webhcat/svr/build.xml @@ -17,32 +17,23 @@ --> - - - + + + - - + - + + - - - - - - - - + diff --git webhcat/svr/ivy.xml webhcat/svr/ivy.xml index 428c0ae..5fdd9bb 100644 --- webhcat/svr/ivy.xml +++ webhcat/svr/ivy.xml @@ -24,101 +24,23 @@ - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - + rev="${jetty.webhcat.version}"/> + + + + + +