This is an automated email from the ASF dual-hosted git repository. suvasude pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-gobblin.git
The following commit(s) were added to refs/heads/master by this push: new a7ada3d [GOBBLIN-1003] HiveDataNode node addition to support adl and abfs URI for gobblin-se… a7ada3d is described below commit a7ada3d500c67725ef33c2dd9d0767316140c9d8 Author: Pawan Teja Reddy <pre...@preddy-mn1.linkedin.biz> AuthorDate: Wed Dec 11 17:34:45 2019 -0800 [GOBBLIN-1003] HiveDataNode node addition to support adl and abfs URI for gobblin-se… Closes #2849 from pawanbtej/newHiveAdlDataNode --- .../flowgraph/datanodes/hive/HiveDataNode.java | 10 +++- .../flowgraph/datanodes/hive/HiveDataNodeTest.java | 67 ++++++++++++++++++++++ 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flowgraph/datanodes/hive/HiveDataNode.java b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flowgraph/datanodes/hive/HiveDataNode.java index 047e278..9eca408 100644 --- a/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flowgraph/datanodes/hive/HiveDataNode.java +++ b/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flowgraph/datanodes/hive/HiveDataNode.java @@ -28,18 +28,18 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import org.apache.gobblin.annotation.Alpha; +import org.apache.gobblin.service.modules.flowgraph.BaseDataNode; import org.apache.gobblin.service.modules.flowgraph.FlowGraphConfigurationKeys; -import org.apache.gobblin.service.modules.flowgraph.datanodes.fs.HdfsDataNode; import org.apache.gobblin.util.ConfigUtils; /** - * An abstract {@link HiveDataNode} implementation. In addition to the required properties of a {@link HdfsDataNode}, an {@link HiveDataNode} + * An {@link HiveDataNode} implementation. In addition to the required properties of a {@link BaseDataNode}, an {@link HiveDataNode} * must have a metastore URI specified. */ @Alpha @EqualsAndHashCode (callSuper = true) -public class HiveDataNode extends HdfsDataNode { +public class HiveDataNode extends BaseDataNode { public static final String METASTORE_URI_KEY = FlowGraphConfigurationKeys.DATA_NODE_PREFIX + "hive.metastore.uri"; @Getter @@ -63,6 +63,10 @@ public class HiveDataNode extends HdfsDataNode { } } + /** + * @param metastoreUri hive metastore URI + * @return true if the scheme is "thrift" and authority is not empty. + */ public boolean isMetastoreUriValid(URI metastoreUri) { String scheme = metastoreUri.getScheme(); if (!scheme.equals("thrift")) { diff --git a/gobblin-service/src/test/java/org/apache/gobblin/service/modules/flowgraph/datanodes/hive/HiveDataNodeTest.java b/gobblin-service/src/test/java/org/apache/gobblin/service/modules/flowgraph/datanodes/hive/HiveDataNodeTest.java new file mode 100644 index 0000000..b4c7c0d --- /dev/null +++ b/gobblin-service/src/test/java/org/apache/gobblin/service/modules/flowgraph/datanodes/hive/HiveDataNodeTest.java @@ -0,0 +1,67 @@ +/* + * 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.gobblin.service.modules.flowgraph.datanodes.hive; + +import org.apache.gobblin.service.modules.flowgraph.DataNode; +import org.apache.gobblin.service.modules.flowgraph.FlowGraphConfigurationKeys; + +import org.junit.Assert; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.typesafe.config.Config; +import com.typesafe.config.ConfigFactory; +import com.typesafe.config.ConfigValueFactory; + + +public class HiveDataNodeTest { + + Config config = null; + + @BeforeMethod + public void setUp() { + String expectedNodeId = "some-node-id"; + String expectedAdlFsUri = "abfs://d...@adl.dfs.core.windows.net"; + String expectedHiveMetastoreUri = "thrift://hcat.company.com:7552"; + + config = ConfigFactory.empty() + .withValue(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY, ConfigValueFactory.fromAnyRef(expectedNodeId)) + .withValue(FlowGraphConfigurationKeys.DATA_NODE_PREFIX + "fs.uri", ConfigValueFactory.fromAnyRef(expectedAdlFsUri)) + .withValue(FlowGraphConfigurationKeys.DATA_NODE_PREFIX + "hive.metastore.uri", ConfigValueFactory.fromAnyRef(expectedHiveMetastoreUri)); + } + + @AfterMethod + public void tearDown() { + } + + + @Test + public void testIsMetastoreUriValid() throws Exception { + HiveDataNode hiveDataNode = new HiveDataNode(config); + Assert.assertNotNull(hiveDataNode); + } + + @Test(expectedExceptions = DataNode.DataNodeCreationException.class) + public void testIsMetastoreUriInValid() throws Exception { + String expectedHiveMetastoreUri = "thrift-1://hcat.company.com:7552"; + config = config.withValue(FlowGraphConfigurationKeys.DATA_NODE_PREFIX + "hive.metastore.uri", ConfigValueFactory.fromAnyRef(expectedHiveMetastoreUri)); + HiveDataNode hiveDataNode = new HiveDataNode(config); + } + +} \ No newline at end of file