gearpump-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEARPUMP-204) Add unit test for external_hbase module
Date Tue, 27 Sep 2016 13:16:20 GMT

    [ https://issues.apache.org/jira/browse/GEARPUMP-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15526093#comment-15526093
] 

ASF GitHub Bot commented on GEARPUMP-204:
-----------------------------------------

Github user manuzhang commented on a diff in the pull request:

    https://github.com/apache/incubator-gearpump/pull/86#discussion_r80688415
  
    --- Diff: external/hbase/src/main/scala/org/apache/gearpump/external/hbase/HBaseSink.scala
---
    @@ -19,27 +19,33 @@ package org.apache.gearpump.external.hbase
     
     import java.io.{File, ObjectInputStream, ObjectOutputStream}
     
    +import org.apache.gearpump.Message
    +import org.apache.gearpump.cluster.UserConfig
    +import org.apache.gearpump.streaming.sink.DataSink
    +import org.apache.gearpump.streaming.task.TaskContext
    +import org.apache.gearpump.util.{Constants, FileUtils}
     import org.apache.hadoop.conf.Configuration
     import org.apache.hadoop.hbase.client.{Connection, ConnectionFactory, Put}
    +import org.apache.hadoop.hbase.security.UserProvider
     import org.apache.hadoop.hbase.util.Bytes
     import org.apache.hadoop.hbase.{HBaseConfiguration, TableName}
    -import org.apache.hadoop.hbase.security.{User, UserProvider}
     import org.apache.hadoop.security.UserGroupInformation
     
    -import org.apache.gearpump.Message
    -import org.apache.gearpump.cluster.UserConfig
    -import org.apache.gearpump.streaming.sink.DataSink
    -import org.apache.gearpump.streaming.task.TaskContext
    -import org.apache.gearpump.util.{Constants, FileUtils}
    +class HBaseSink(userconfig: UserConfig, tableName: String,
    +    val conn: (UserConfig, Configuration)
    +    => Connection, @transient var configuration: Configuration)
    +  extends DataSink {
     
    -class HBaseSink(
    -    userconfig: UserConfig, tableName: String, @transient var configuration: Configuration)
    -  extends DataSink{
    -  lazy val connection = HBaseSink.getConnection(userconfig, configuration)
    +  lazy val connection = conn(userconfig, configuration)
       lazy val table = connection.getTable(TableName.valueOf(tableName))
     
       override def open(context: TaskContext): Unit = {}
     
    +  def this(userconfig: UserConfig, tableName: String, configuration: Configuration) =
{
    +    this(userconfig, tableName, (userconfig: UserConfig, config: Configuration) =>
    +      {HBaseSink.getConnection(userconfig, config)}, configuration)
    --- End diff --
    
    just passing in `getConnection` will do, I think


> Add unit test for external_hbase module
> ---------------------------------------
>
>                 Key: GEARPUMP-204
>                 URL: https://issues.apache.org/jira/browse/GEARPUMP-204
>             Project: Apache Gearpump
>          Issue Type: Improvement
>            Reporter: Manu Zhang
>            Assignee: Kaifang Bao
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message