flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hshreedha...@apache.org
Subject git commit: FLUME-1889, FLUME-1994. Add ELASTICSEARCH, HBASE and ASYNC_HBASE enum types to SinkType.
Date Tue, 30 Apr 2013 05:26:25 GMT
Updated Branches:
  refs/heads/trunk 1149740d0 -> 93f03ab44


FLUME-1889, FLUME-1994. Add ELASTICSEARCH, HBASE and ASYNC_HBASE enum types to SinkType.

(Israel Ekpo via Hari Shreedharan)


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

Branch: refs/heads/trunk
Commit: 93f03ab440f8381bf940f1ddd41fdc2d91712fc2
Parents: 1149740
Author: Hari Shreedharan <hshreedharan@apache.org>
Authored: Mon Apr 29 22:23:44 2013 -0700
Committer: Hari Shreedharan <hshreedharan@apache.org>
Committed: Mon Apr 29 22:23:44 2013 -0700

----------------------------------------------------------------------
 .../apache/flume/conf/sink/SinkConfiguration.java  |   23 +++++++-
 .../java/org/apache/flume/conf/sink/SinkType.java  |   23 +++++++-
 .../TestElasticSearchSinkCreation.java             |   49 ++++++++++++++
 .../flume/sink/hbase/TestHBaseSinkCreation.java    |   50 +++++++++++++++
 4 files changed, 143 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/93f03ab4/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkConfiguration.java
----------------------------------------------------------------------
diff --git a/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkConfiguration.java
b/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkConfiguration.java
index c6c99d5..965d2c5 100644
--- a/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkConfiguration.java
+++ b/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkConfiguration.java
@@ -118,7 +118,28 @@ public class SinkConfiguration extends ComponentConfiguration {
      *
      * @see ThriftSink
      */
-    THRIFT("org.apache.flume.conf.sink.ThriftSinkConfiguration");
+    THRIFT("org.apache.flume.conf.sink.ThriftSinkConfiguration"),
+
+    /**
+     * ElasticSearch Sink
+     *
+     * @see org.apache.flume.sink.elasticsearch.ElasticSearchSink
+     */
+    ELASTICSEARCH("org.apache.flume.sink.elasticsearch.ElasticSearchSinkConfiguration"),
+
+    /**
+     * HBase Sink
+     *
+     * @see org.apache.flume.sink.hbase.HBaseSink
+     */
+    HBASE("org.apache.flume.sink.hbase.HBaseSinkConfiguration"),
+
+    /**
+     * AsyncHBase Sink
+     *
+     * @see org.apache.flume.sink.hbase.AsyncHBaseSink
+     */
+    ASYNCHBASE("org.apache.flume.sink.hbase.HBaseSinkConfiguration");
 
     private final String sinkConfigurationName;
 

http://git-wip-us.apache.org/repos/asf/flume/blob/93f03ab4/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkType.java
----------------------------------------------------------------------
diff --git a/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkType.java
b/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkType.java
index 7e0288e..8ce372d 100644
--- a/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkType.java
+++ b/flume-ng-configuration/src/main/java/org/apache/flume/conf/sink/SinkType.java
@@ -71,7 +71,28 @@ public enum SinkType {
    *
    * @see ThriftSink
    */
-  THRIFT("org.apache.flume.sink.ThriftSink");
+  THRIFT("org.apache.flume.sink.ThriftSink"),
+
+  /**
+   * ElasticSearch sink
+   *
+   * @see org.apache.flume.sink.elasticsearch.ElasticSearchSink
+   */
+  ELASTICSEARCH("org.apache.flume.sink.elasticsearch.ElasticSearchSink"),
+
+  /**
+   * HBase sink
+   *
+   * @see org.apache.flume.sink.hbase.HBaseSink
+   */
+  HBASE("org.apache.flume.sink.hbase.HBaseSink"),
+
+  /**
+   * AsyncHBase sink
+   *
+   * @see org.apache.flume.sink.hbase.AsyncHBaseSink
+   */
+  ASYNCHBASE("org.apache.flume.sink.hbase.AsyncHBaseSink");
 
   private final String sinkClassName;
 

http://git-wip-us.apache.org/repos/asf/flume/blob/93f03ab4/flume-ng-sinks/flume-ng-elasticsearch-sink/src/test/java/org/apache/flume/sink/elasticsearch/TestElasticSearchSinkCreation.java
----------------------------------------------------------------------
diff --git a/flume-ng-sinks/flume-ng-elasticsearch-sink/src/test/java/org/apache/flume/sink/elasticsearch/TestElasticSearchSinkCreation.java
b/flume-ng-sinks/flume-ng-elasticsearch-sink/src/test/java/org/apache/flume/sink/elasticsearch/TestElasticSearchSinkCreation.java
new file mode 100644
index 0000000..b5a4d2f
--- /dev/null
+++ b/flume-ng-sinks/flume-ng-elasticsearch-sink/src/test/java/org/apache/flume/sink/elasticsearch/TestElasticSearchSinkCreation.java
@@ -0,0 +1,49 @@
+/*
+ * 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.flume.sink.elasticsearch;
+
+import org.apache.flume.FlumeException;
+import org.apache.flume.Sink;
+import org.apache.flume.SinkFactory;
+import org.apache.flume.sink.DefaultSinkFactory;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestElasticSearchSinkCreation {
+
+private SinkFactory sinkFactory;
+
+  @Before
+  public void setUp() {
+    sinkFactory = new DefaultSinkFactory();
+  }
+
+  private void verifySinkCreation(String name, String type,
+      Class<?> typeClass) throws FlumeException {
+    Sink sink = sinkFactory.create(name, type);
+    Assert.assertNotNull(sink);
+    Assert.assertTrue(typeClass.isInstance(sink));
+  }
+
+  @Test
+  public void testSinkCreation() {
+    verifySinkCreation("elasticsearch-sink", "elasticsearch", ElasticSearchSink.class);
+  }
+}

http://git-wip-us.apache.org/repos/asf/flume/blob/93f03ab4/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSinkCreation.java
----------------------------------------------------------------------
diff --git a/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSinkCreation.java
b/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSinkCreation.java
new file mode 100644
index 0000000..115bc62
--- /dev/null
+++ b/flume-ng-sinks/flume-ng-hbase-sink/src/test/java/org/apache/flume/sink/hbase/TestHBaseSinkCreation.java
@@ -0,0 +1,50 @@
+/*
+ * 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.flume.sink.hbase;
+
+import org.apache.flume.FlumeException;
+import org.apache.flume.Sink;
+import org.apache.flume.SinkFactory;
+import org.apache.flume.sink.DefaultSinkFactory;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestHBaseSinkCreation {
+
+  private SinkFactory sinkFactory;
+
+  @Before
+  public void setUp() {
+    sinkFactory = new DefaultSinkFactory();
+  }
+
+  private void verifySinkCreation(String name, String type,
+      Class<?> typeClass) throws FlumeException {
+    Sink sink = sinkFactory.create(name, type);
+    Assert.assertNotNull(sink);
+    Assert.assertTrue(typeClass.isInstance(sink));
+  }
+
+  @Test
+  public void testSinkCreation() {
+    verifySinkCreation("hbase-sink", "hbase", HBaseSink.class);
+    verifySinkCreation("asynchbase-sink", "asynchbase", AsyncHBaseSink.class);
+  }
+}


Mime
View raw message