You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by va...@apache.org on 2018/10/19 09:22:15 UTC
sqoop git commit: SQOOP-3394: External Hive table tests should use
unique external dir names
Repository: sqoop
Updated Branches:
refs/heads/trunk 1f7b0bf84 -> 15097756c
SQOOP-3394: External Hive table tests should use unique external dir names
(Boglarka Egyed via Szabolcs Vasas)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/15097756
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/15097756
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/15097756
Branch: refs/heads/trunk
Commit: 15097756c7fc694ec86d003843f40a793bcd9633
Parents: 1f7b0bf
Author: Szabolcs Vasas <va...@apache.org>
Authored: Fri Oct 19 11:20:44 2018 +0200
Committer: Szabolcs Vasas <va...@apache.org>
Committed: Fri Oct 19 11:20:44 2018 +0200
----------------------------------------------------------------------
.../org/apache/sqoop/testutil/S3TestUtils.java | 26 ++++++++++++++------
1 file changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/15097756/src/test/org/apache/sqoop/testutil/S3TestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/org/apache/sqoop/testutil/S3TestUtils.java b/src/test/org/apache/sqoop/testutil/S3TestUtils.java
index 97d53bb..2fc6061 100644
--- a/src/test/org/apache/sqoop/testutil/S3TestUtils.java
+++ b/src/test/org/apache/sqoop/testutil/S3TestUtils.java
@@ -48,15 +48,15 @@ public class S3TestUtils {
private static final String BUCKET_TEMP_DIR = "/tmp/";
- private static final String EXTERNAL_TABLE_DIR = "/externaldir";
-
private static final String TARGET_DIR_NAME_PREFIX = "/testdir";
+ private static final String HIVE_EXTERNAL_DIR_NAME_PREFIX = "/externaldir";
private static final String TEMPORARY_ROOTDIR_SUFFIX = "_temprootdir";
public static final String HIVE_EXTERNAL_TABLE_NAME = "test_external_table";
- private static String targetDirName = TARGET_DIR_NAME_PREFIX;
+ private static String targetDirName;
+ private static String hiveExternalTableDirName;
private static final String[] COLUMN_NAMES = {"ID", "SUPERHERO", "COMICS", "DEBUT"};
private static final String[] COLUMN_TYPES = { "INT", "VARCHAR(25)", "VARCHAR(25)", "INT"};
@@ -87,19 +87,27 @@ public class S3TestUtils {
return TEMPORARY_CREDENTIALS_PROVIDER_CLASS;
}
- private static void setUniqueTargetDirName() {
+ private static String generateUniqueDirName(String dirPrefix) {
String uuid = UUID.randomUUID().toString();
- targetDirName = targetDirName + "-" + uuid;
+ return dirPrefix + "-" + uuid;
}
private static void resetTargetDirName() {
- targetDirName = TARGET_DIR_NAME_PREFIX;
+ targetDirName = null;
+ }
+
+ private static void resetHiveExternalDirName() {
+ hiveExternalTableDirName = null;
}
private static String getTargetDirName() {
return targetDirName;
}
+ private static String getHiveExternalTableDirName() {
+ return hiveExternalTableDirName;
+ }
+
public static Path getTargetDirPath() {
String targetPathString = getBucketTempDirPath() + getTargetDirName();
return new Path(targetPathString);
@@ -111,7 +119,7 @@ public class S3TestUtils {
}
public static Path getExternalTableDirPath() {
- String externalTableDir = getBucketTempDirPath() + EXTERNAL_TABLE_DIR;
+ String externalTableDir = getBucketTempDirPath() + getHiveExternalTableDirName();
return new Path(externalTableDir);
}
@@ -128,7 +136,7 @@ public class S3TestUtils {
FileSystem s3Client = FileSystem.get(hadoopConf);
- setUniqueTargetDirName();
+ targetDirName = generateUniqueDirName(TARGET_DIR_NAME_PREFIX);
cleanUpDirectory(s3Client, getTargetDirPath());
@@ -157,6 +165,7 @@ public class S3TestUtils {
}
public static HiveMiniCluster setupS3ExternalHiveTableImportTestCase(S3CredentialGenerator s3CredentialGenerator) {
+ hiveExternalTableDirName = generateUniqueDirName(HIVE_EXTERNAL_DIR_NAME_PREFIX);
HiveMiniCluster hiveMiniCluster = new HiveMiniCluster(new NoAuthenticationConfiguration());
hiveMiniCluster.start();
S3TestUtils.setS3CredentialsInConf(hiveMiniCluster.getConfig(), s3CredentialGenerator);
@@ -425,5 +434,6 @@ public class S3TestUtils {
public static void tearDownS3ExternalHiveTableImportTestCase(FileSystem s3Client) {
cleanUpTargetDir(s3Client);
cleanUpDirectory(s3Client, getExternalTableDirPath());
+ resetHiveExternalDirName();
}
}