flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject git commit: FLUME-2336: HBase tests that pass in ZK configs must use a new context object
Date Sun, 02 Mar 2014 00:02:32 GMT
Repository: flume
Updated Branches:
  refs/heads/trunk ad5f286ea -> a6a6c4c2a


FLUME-2336: HBase tests that pass in ZK configs must use a new context object

(Hari Shreedharan via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/a6a6c4c2
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/a6a6c4c2
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/a6a6c4c2

Branch: refs/heads/trunk
Commit: a6a6c4c2a0420f42924cc31f304f4bc3ca8348ea
Parents: ad5f286
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Sat Mar 1 16:01:49 2014 -0800
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Sat Mar 1 16:01:49 2014 -0800

----------------------------------------------------------------------
 .../apache/flume/sink/hbase/TestHBaseSink.java  | 42 +++++++++++---------
 1 file changed, 23 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/a6a6c4c2/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSink.java
----------------------------------------------------------------------
diff --git a/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSink.java
b/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSink.java
index 20b7fe5..d1b0182 100644
--- a/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSink.java
+++ b/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSink.java
@@ -417,6 +417,7 @@ public class TestHBaseSink {
     HBaseSink sink = new HBaseSink(conf);
     Configurables.configure(sink, ctx);
     // Reset the context to a higher batchSize
+    ctx.put("batchSize", "100");
     Channel channel = new MemoryChannel();
     Configurables.configure(channel, new Context());
     sink.setChannel(channel);
@@ -448,19 +449,17 @@ public class TestHBaseSink {
 
   @Test
   public void testWithoutConfigurationObject() throws Exception{
-    ctx.put("batchSize", "2");
-    ctx.put(HBaseSinkConfigurationConstants.ZK_QUORUM,
+    Context tmpContext = new Context(ctx.getParameters());
+    tmpContext.put("batchSize", "2");
+    tmpContext.put(HBaseSinkConfigurationConstants.ZK_QUORUM,
       ZKConfig.getZKQuorumServersString(conf) );
     System.out.print(ctx.getString(HBaseSinkConfigurationConstants.ZK_QUORUM));
-    ctx.put(HBaseSinkConfigurationConstants.ZK_ZNODE_PARENT,
-      conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT));
+    tmpContext.put(HBaseSinkConfigurationConstants.ZK_ZNODE_PARENT,
+      conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT,
+        HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT));
     testUtility.createTable(tableName.getBytes(), columnFamily.getBytes());
     HBaseSink sink = new HBaseSink();
-    Configurables.configure(sink, ctx);
-    // Reset context to values usable by other tests.
-    ctx.put(HBaseSinkConfigurationConstants.ZK_QUORUM, null);
-    ctx.put(HBaseSinkConfigurationConstants.ZK_ZNODE_PARENT,null);
-    ctx.put("batchSize", "100");
+    Configurables.configure(sink, tmpContext);
     Channel channel = new MemoryChannel();
     Configurables.configure(channel, ctx);
     sink.setChannel(channel);
@@ -498,14 +497,16 @@ public class TestHBaseSink {
 
   @Test
   public void testZKQuorum() throws Exception{
+    Context tmpContext = new Context(ctx.getParameters());
     String zkQuorum = "zk1.flume.apache.org:3342, zk2.flume.apache.org:3342, " +
       "zk3.flume.apache.org:3342";
-    ctx.put("batchSize", "2");
-    ctx.put(HBaseSinkConfigurationConstants.ZK_QUORUM, zkQuorum);
-    ctx.put(HBaseSinkConfigurationConstants.ZK_ZNODE_PARENT,
-      conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT));
+    tmpContext.put("batchSize", "2");
+    tmpContext.put(HBaseSinkConfigurationConstants.ZK_QUORUM, zkQuorum);
+    tmpContext.put(HBaseSinkConfigurationConstants.ZK_ZNODE_PARENT,
+      conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT,
+        HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT));
     HBaseSink sink = new HBaseSink();
-    Configurables.configure(sink, ctx);
+    Configurables.configure(sink, tmpContext);
     Assert.assertEquals("zk1.flume.apache.org,zk2.flume.apache.org," +
       "zk3.flume.apache.org", sink.getConfig().get(HConstants
       .ZOOKEEPER_QUORUM));
@@ -515,14 +516,17 @@ public class TestHBaseSink {
 
   @Test (expected = FlumeException.class)
   public void testZKQuorumIncorrectPorts() throws Exception{
+    Context tmpContext = new Context(ctx.getParameters());
+
     String zkQuorum = "zk1.flume.apache.org:3345, zk2.flume.apache.org:3342, " +
       "zk3.flume.apache.org:3342";
-    ctx.put("batchSize", "2");
-    ctx.put(HBaseSinkConfigurationConstants.ZK_QUORUM, zkQuorum);
-    ctx.put(HBaseSinkConfigurationConstants.ZK_ZNODE_PARENT,
-      conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT));
+    tmpContext.put("batchSize", "2");
+    tmpContext.put(HBaseSinkConfigurationConstants.ZK_QUORUM, zkQuorum);
+    tmpContext.put(HBaseSinkConfigurationConstants.ZK_ZNODE_PARENT,
+      conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT,
+        HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT));
     HBaseSink sink = new HBaseSink();
-    Configurables.configure(sink, ctx);
+    Configurables.configure(sink, tmpContext);
     Assert.fail();
   }
 }
\ No newline at end of file


Mime
View raw message