Repository: hive Updated Branches: refs/heads/master 6e9b63e48 -> b8fdd1392
HIVE-18511: Fix generated checkstyle errors (Peter Vary, reviewed by Yongzhi Chen) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/b8fdd139 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/b8fdd139 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/b8fdd139 Branch: refs/heads/master Commit: b8fdd1392077c4f6dab685a2b3e87ab2d26ac13e Parents: 6e9b63e Author: Peter Vary <[email protected]> Authored: Thu Feb 8 14:42:43 2018 +0100 Committer: Peter Vary <[email protected]> Committed: Thu Feb 8 14:42:43 2018 +0100 ---------------------------------------------------------------------- .../client/MetaStoreFactoryForTests.java | 8 ++++--- .../hive/metastore/client/TestDatabases.java | 5 ++++- .../hive/metastore/client/package-info.java | 22 +++++++++++++++++++ .../minihms/AbstractMetaStoreService.java | 10 ++++++++- .../minihms/EmbeddedMetaStoreForTests.java | 2 +- .../hadoop/hive/metastore/minihms/MiniHMS.java | 22 ++++++++++++------- .../minihms/RemoteMetaStoreForTests.java | 10 +++++---- .../hive/metastore/minihms/package-info.java | 23 ++++++++++++++++++++ 8 files changed, 84 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/b8fdd139/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/MetaStoreFactoryForTests.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/MetaStoreFactoryForTests.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/MetaStoreFactoryForTests.java index e2b1a68..e723f60 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/MetaStoreFactoryForTests.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/MetaStoreFactoryForTests.java @@ -34,9 +34,11 @@ import java.util.List; * {@link org.apache.hadoop.hive.metastore.minihms.AbstractMetaStoreService} implementations for * tests. */ -public class MetaStoreFactoryForTests { +public final class MetaStoreFactoryForTests { private static final int DEFAULT_LIMIT_PARTITION_REQUEST = 100; + private MetaStoreFactoryForTests() {} + /** * We would like to run the tests with 2 MetaStore configurations * - Embedded - Where the MetaStore is running in the same thread, and does not use Thrift @@ -94,7 +96,7 @@ public class MetaStoreFactoryForTests { .setConf(conf) .setType(MiniHMS.MiniHMSType.EMBEDDED) .build(); - metaStores.add(new Object[] { "Embedded", embedded}); + metaStores.add(new Object[] {"Embedded", embedded}); // Create Remote MetaStore conf.set("javax.jdo.option.ConnectionURL", @@ -104,7 +106,7 @@ public class MetaStoreFactoryForTests { .setConf(conf) .setType(MiniHMS.MiniHMSType.REMOTE) .build(); - metaStores.add(new Object[] { "Remote", remote}); + metaStores.add(new Object[] {"Remote", remote}); return metaStores; } http://git-wip-us.apache.org/repos/asf/hive/blob/b8fdd139/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestDatabases.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestDatabases.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestDatabases.java index fe7e0e4..db80072 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestDatabases.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestDatabases.java @@ -52,6 +52,9 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; +/** + * Test class for IMetaStoreClient API. Testing the Database related functions. + */ @RunWith(Parameterized.class) public class TestDatabases { private static final Logger LOG = LoggerFactory.getLogger(TestDatabases.class); @@ -408,7 +411,7 @@ public class TestDatabases { } /** - * Creates an index in the given database for testing purposes + * Creates an index in the given database for testing purposes. * @param databaseName The database name in which the index should be creatd * @throws TException If there is an error during the index creation */ http://git-wip-us.apache.org/repos/asf/hive/blob/b8fdd139/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/package-info.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/package-info.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/package-info.java new file mode 100644 index 0000000..6adc7b8 --- /dev/null +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ + +/** + * This package contains test and utility classes for IMetaStoreClient API tests. + */ +package org.apache.hadoop.hive.metastore.client; http://git-wip-us.apache.org/repos/asf/hive/blob/b8fdd139/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/AbstractMetaStoreService.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/AbstractMetaStoreService.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/AbstractMetaStoreService.java index b549c7c..f2c8fe4 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/AbstractMetaStoreService.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/AbstractMetaStoreService.java @@ -38,7 +38,7 @@ import java.util.Map; * configurations. */ public abstract class AbstractMetaStoreService { - protected Configuration configuration; + private Configuration configuration; private Warehouse warehouse; private FileSystem warehouseRootFs; private Path trashDir; @@ -48,6 +48,14 @@ public abstract class AbstractMetaStoreService { } /** + * Returns the actual configuration of the MetaStore. + * @return The actual configuration + */ + protected Configuration getConfiguration() { + return configuration; + } + + /** * Starts the MetaStoreService. Be aware, as the current MetaStore does not implement clean * shutdown, starting MetaStoreService is possible only once per test. * http://git-wip-us.apache.org/repos/asf/hive/blob/b8fdd139/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/EmbeddedMetaStoreForTests.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/EmbeddedMetaStoreForTests.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/EmbeddedMetaStoreForTests.java index 1fafe97..518a65c 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/EmbeddedMetaStoreForTests.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/EmbeddedMetaStoreForTests.java @@ -30,4 +30,4 @@ public class EmbeddedMetaStoreForTests extends AbstractMetaStoreService { public EmbeddedMetaStoreForTests(Configuration configuration) { super(configuration); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/hive/blob/b8fdd139/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/MiniHMS.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/MiniHMS.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/MiniHMS.java index 88db493..0b2e4d1 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/MiniHMS.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/MiniHMS.java @@ -31,12 +31,18 @@ import org.apache.hadoop.hive.metastore.conf.MetastoreConf; * so the same tests could be run against a real cluster */ public class MiniHMS { + /** + * The possible MetaStore types. + */ public enum MiniHMSType { EMBEDDED, REMOTE, CLUSTER } + /** + * Builder for creating a Mini MetaStore object. + */ public static class Builder { private Configuration metaStoreConf = MetastoreConf.newMetastoreConf(); private MiniHMSType miniHMSType = MiniHMSType.EMBEDDED; @@ -56,14 +62,14 @@ public class MiniHMS { public AbstractMetaStoreService build() throws Exception { switch (miniHMSType) { - case REMOTE: - return new RemoteMetaStoreForTests(metaStoreConf); - case EMBEDDED: - return new EmbeddedMetaStoreForTests(metaStoreConf); - case CLUSTER: - return new ClusterMetaStoreForTests(metaStoreConf); - default: - throw new IllegalArgumentException("Unexpected miniHMSType: " + miniHMSType); + case REMOTE: + return new RemoteMetaStoreForTests(metaStoreConf); + case EMBEDDED: + return new EmbeddedMetaStoreForTests(metaStoreConf); + case CLUSTER: + return new ClusterMetaStoreForTests(metaStoreConf); + default: + throw new IllegalArgumentException("Unexpected miniHMSType: " + miniHMSType); } } } http://git-wip-us.apache.org/repos/asf/hive/blob/b8fdd139/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/RemoteMetaStoreForTests.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/RemoteMetaStoreForTests.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/RemoteMetaStoreForTests.java index 5752414..4249991 100644 --- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/RemoteMetaStoreForTests.java +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/RemoteMetaStoreForTests.java @@ -35,9 +35,11 @@ public class RemoteMetaStoreForTests extends AbstractMetaStoreService { } public void start() throws Exception { - MetastoreConf.setBoolVar(configuration, MetastoreConf.ConfVars.EXECUTE_SET_UGI, false); - int port = MetaStoreTestUtils.startMetaStore(HadoopThriftAuthBridge.getBridge(), configuration); - MetastoreConf.setVar(configuration, MetastoreConf.ConfVars.THRIFT_URIS, "thrift://localhost:" + port); + MetastoreConf.setBoolVar(getConfiguration(), MetastoreConf.ConfVars.EXECUTE_SET_UGI, false); + int port = MetaStoreTestUtils.startMetaStore(HadoopThriftAuthBridge.getBridge(), + getConfiguration()); + MetastoreConf.setVar(getConfiguration(), MetastoreConf.ConfVars.THRIFT_URIS, + "thrift://localhost:" + port); super.start(); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/hive/blob/b8fdd139/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/package-info.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/package-info.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/package-info.java new file mode 100644 index 0000000..9e05d31 --- /dev/null +++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/minihms/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/** + * This package contains test and utility classes for creating MetaStore instances for test + * purposes. + */ +package org.apache.hadoop.hive.metastore.minihms;
