You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemall.apache.org by my...@apache.org on 2016/12/02 07:04:44 UTC
[42/50] [abbrv] incubator-hivemall git commit: Refine access
modifiers/calls
Refine access modifiers/calls
Project: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/commit/ddd8dc2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/tree/ddd8dc2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/diff/ddd8dc2d
Branch: refs/heads/JIRA-22/pr-336
Commit: ddd8dc2dbf8222c9d9d84b038dbdcd9aef1f1a87
Parents: 7447dde
Author: amaya <gi...@sapphire.in.net>
Authored: Fri Nov 18 04:22:51 2016 +0900
Committer: amaya <gi...@sapphire.in.net>
Committed: Fri Nov 18 04:22:51 2016 +0900
----------------------------------------------------------------------
.../systemtest/runner/HiveSystemTestRunner.java | 4 +-
.../systemtest/runner/SystemTestRunner.java | 40 +++++++++++---------
.../systemtest/runner/SystemTestTeam.java | 8 +---
.../systemtest/runner/TDSystemTestRunner.java | 24 ++++++------
4 files changed, 36 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/ddd8dc2d/systemtest/src/main/java/hivemall/systemtest/runner/HiveSystemTestRunner.java
----------------------------------------------------------------------
diff --git a/systemtest/src/main/java/hivemall/systemtest/runner/HiveSystemTestRunner.java b/systemtest/src/main/java/hivemall/systemtest/runner/HiveSystemTestRunner.java
index 25a2125..db1edc7 100644
--- a/systemtest/src/main/java/hivemall/systemtest/runner/HiveSystemTestRunner.java
+++ b/systemtest/src/main/java/hivemall/systemtest/runner/HiveSystemTestRunner.java
@@ -101,7 +101,7 @@ public class HiveSystemTestRunner extends SystemTestRunner {
}
@Override
- protected void finRunner() {
+ void finRunner() {
if (container != null) {
container.tearDown();
}
@@ -111,7 +111,7 @@ public class HiveSystemTestRunner extends SystemTestRunner {
}
@Override
- protected List<String> exec(@Nonnull final RawHQ hq) {
+ public List<String> exec(@Nonnull final RawHQ hq) {
logger.info("executing: `" + hq.query + "`");
return hShell.executeQuery(hq.query);
http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/ddd8dc2d/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestRunner.java
----------------------------------------------------------------------
diff --git a/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestRunner.java b/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestRunner.java
index f16da90..e142174 100644
--- a/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestRunner.java
+++ b/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestRunner.java
@@ -45,7 +45,6 @@ import javax.annotation.Nullable;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -55,9 +54,9 @@ import java.util.Set;
public abstract class SystemTestRunner extends ExternalResource {
static final Logger logger = LoggerFactory.getLogger(SystemTestRunner.class);
@Nonnull
- final List<HQBase> classInitHqs;
+ private final List<HQBase> classInitHqs;
@Nonnull
- final Set<String> immutableTables;
+ private final Set<String> immutableTables;
@Nonnull
final String dbName;
@Nonnull
@@ -98,7 +97,7 @@ public abstract class SystemTestRunner extends ExternalResource {
@Override
protected void after() {
try {
- resetDB(); // clean up database
+ cleanDB(); // clean up database
} catch (Exception ex) {
throw new QueryExecutionException("Failed to clean up temporary database. "
+ ex.getMessage());
@@ -111,16 +110,16 @@ public abstract class SystemTestRunner extends ExternalResource {
abstract void finRunner();
- public void initBy(@Nonnull final HQBase hq) {
+ protected void initBy(@Nonnull final HQBase hq) {
classInitHqs.add(hq);
}
- public void initBy(@Nonnull final List<? extends HQBase> hqs) {
+ protected void initBy(@Nonnull final List<? extends HQBase> hqs) {
classInitHqs.addAll(hqs);
}
// fix to temporary database and user-defined init (should be called per Test class)
- void prepareDB() throws Exception {
+ private void prepareDB() throws Exception {
createDB(dbName);
use(dbName);
for (HQBase q : classInitHqs) {
@@ -136,15 +135,21 @@ public abstract class SystemTestRunner extends ExternalResource {
}
// drop temporary database (should be called per Test class)
- void resetDB() throws Exception {
+ private void cleanDB() throws Exception {
dropDB(dbName);
}
- public final boolean isImmutableTable(final String tableName) {
- return immutableTables.contains(tableName);
+ // drop temporary tables (should be called per Test method)
+ void resetDB() throws Exception {
+ final List<String> tables = tableList();
+ for (String t : tables) {
+ if (!immutableTables.contains(t)) {
+ dropTable(HQ.dropTable(t));
+ }
+ }
}
- // execute HQBase
+ // >execute HQBase
public List<String> exec(@Nonnull final HQBase hq) throws Exception {
if (hq instanceof RawHQ) {
return exec((RawHQ) hq);
@@ -157,10 +162,10 @@ public abstract class SystemTestRunner extends ExternalResource {
}
}
- //// execute RawHQ
+ // >>execute RawHQ
abstract protected List<String> exec(@Nonnull final RawHQ hq) throws Exception;
- //// execute TableHQ
+ // >>execute TableHQ
List<String> exec(@Nonnull final TableHQ hq) throws Exception {
if (hq instanceof CreateTableHQ) {
return createTable((CreateTableHQ) hq);
@@ -175,7 +180,7 @@ public abstract class SystemTestRunner extends ExternalResource {
}
}
- ////// execute UploadFileHQ
+ // >>>execute UploadFileHQ
List<String> exec(@Nonnull final UploadFileHQ hq) throws Exception {
if (hq instanceof UploadFileAsNewTableHQ) {
return uploadFileAsNewTable((UploadFileAsNewTableHQ) hq);
@@ -187,8 +192,8 @@ public abstract class SystemTestRunner extends ExternalResource {
}
// matching HQBase
- public void matching(@Nonnull final HQBase hq, @CheckForNull final String answer,
- final boolean ordered) throws Exception {
+ void matching(@Nonnull final HQBase hq, @CheckForNull final String answer, final boolean ordered)
+ throws Exception {
Preconditions.checkNotNull(answer);
List<String> result = exec(hq);
@@ -203,8 +208,7 @@ public abstract class SystemTestRunner extends ExternalResource {
}
// matching HQBase (ordered == false)
- public void matching(@Nonnull final HQBase hq, @CheckForNull final String answer)
- throws Exception {
+ void matching(@Nonnull final HQBase hq, @CheckForNull final String answer) throws Exception {
matching(hq, answer, false);
}
http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/ddd8dc2d/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestTeam.java
----------------------------------------------------------------------
diff --git a/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestTeam.java b/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestTeam.java
index 86065e4..fcd2fcb 100644
--- a/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestTeam.java
+++ b/systemtest/src/main/java/hivemall/systemtest/runner/SystemTestTeam.java
@@ -19,7 +19,6 @@
package hivemall.systemtest.runner;
import hivemall.systemtest.exception.QueryExecutionException;
-import hivemall.systemtest.model.HQ;
import hivemall.systemtest.model.HQBase;
import hivemall.systemtest.model.RawHQ;
import hivemall.systemtest.model.lazy.LazyMatchingResource;
@@ -66,12 +65,7 @@ public class SystemTestTeam extends ExternalResource {
for (SystemTestRunner runner : reachGoal) {
try {
- final List<String> tables = runner.exec(HQ.tableList());
- for (String t : tables) {
- if (!runner.isImmutableTable(t)) {
- runner.exec(HQ.dropTable(t));
- }
- }
+ runner.resetDB();
} catch (Exception ex) {
throw new QueryExecutionException("Failed to resetPerMethod database. "
+ ex.getMessage());
http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/ddd8dc2d/systemtest/src/main/java/hivemall/systemtest/runner/TDSystemTestRunner.java
----------------------------------------------------------------------
diff --git a/systemtest/src/main/java/hivemall/systemtest/runner/TDSystemTestRunner.java b/systemtest/src/main/java/hivemall/systemtest/runner/TDSystemTestRunner.java
index 87dd835..b2f8290 100644
--- a/systemtest/src/main/java/hivemall/systemtest/runner/TDSystemTestRunner.java
+++ b/systemtest/src/main/java/hivemall/systemtest/runner/TDSystemTestRunner.java
@@ -70,7 +70,7 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected void initRunner() {
+ void initRunner() {
// optional
if (props.containsKey("execFinishRetryLimit")) {
execFinishRetryLimit = Integer.valueOf(props.getProperty("execFinishRetryLimit"));
@@ -102,14 +102,14 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected void finRunner() {
+ void finRunner() {
if (client != null) {
client.close();
}
}
@Override
- protected List<String> exec(@Nonnull final RawHQ hq) throws Exception {
+ public List<String> exec(@Nonnull final RawHQ hq) throws Exception {
logger.info("executing: `" + hq.query + "`");
final TDJobRequest req = TDJobRequest.newHiveQuery(dbName, hq.query);
@@ -157,7 +157,7 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected List<String> createDB(@Nonnull final String dbName) throws Exception {
+ List<String> createDB(@Nonnull final String dbName) throws Exception {
logger.info("executing: create database if not exists " + dbName);
client.createDatabaseIfNotExists(dbName);
@@ -165,7 +165,7 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected List<String> dropDB(@Nonnull final String dbName) throws Exception {
+ List<String> dropDB(@Nonnull final String dbName) throws Exception {
logger.info("executing: drop database if exists " + dbName);
client.deleteDatabaseIfExists(dbName);
@@ -173,13 +173,13 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected List<String> use(@Nonnull final String dbName) throws Exception {
+ List<String> use(@Nonnull final String dbName) throws Exception {
return Collections.singletonList("No need to execute `USE` statement on TD, so skipped `USE "
+ dbName + "`");
}
@Override
- protected List<String> tableList() throws Exception {
+ List<String> tableList() throws Exception {
logger.info("executing: show tables on " + dbName);
final List<TDTable> tables = client.listTables(dbName);
@@ -191,7 +191,7 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected List<String> createTable(@Nonnull final CreateTableHQ hq) throws Exception {
+ List<String> createTable(@Nonnull final CreateTableHQ hq) throws Exception {
logger.info("executing: create table " + hq.tableName + " if not exists on " + dbName);
final List<TDColumn> columns = new ArrayList<TDColumn>();
@@ -204,7 +204,7 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected List<String> dropTable(@Nonnull final DropTableHQ hq) throws Exception {
+ List<String> dropTable(@Nonnull final DropTableHQ hq) throws Exception {
logger.info("executing: drop table " + hq.tableName + " if exists on " + dbName);
client.deleteTableIfExists(dbName, hq.tableName);
@@ -212,8 +212,7 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected List<String> uploadFileAsNewTable(@Nonnull final UploadFileAsNewTableHQ hq)
- throws Exception {
+ List<String> uploadFileAsNewTable(@Nonnull final UploadFileAsNewTableHQ hq) throws Exception {
logger.info("executing: create " + hq.tableName + " based on " + hq.file.getPath()
+ " if not exists on " + dbName);
@@ -292,8 +291,7 @@ public class TDSystemTestRunner extends SystemTestRunner {
}
@Override
- protected List<String> uploadFileToExisting(@Nonnull final UploadFileToExistingHQ hq)
- throws Exception {
+ List<String> uploadFileToExisting(@Nonnull final UploadFileToExistingHQ hq) throws Exception {
logger.info("executing: insert " + hq.file.getPath() + " into " + hq.tableName + " on "
+ dbName);