You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by rm...@apache.org on 2016/02/26 20:59:10 UTC
[24/25] flink git commit: [FLINK-3511] [twitter] Move twitter
examples to test scope
[FLINK-3511] [twitter] Move twitter examples to test scope
This closes #1725
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/c0ce1b6d
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/c0ce1b6d
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/c0ce1b6d
Branch: refs/heads/release-1.0
Commit: c0ce1b6d97bea3a938dc81454fcb17f373a58f12
Parents: 0dc8240
Author: Till Rohrmann <tr...@apache.org>
Authored: Fri Feb 26 16:27:06 2016 +0100
Committer: Robert Metzger <rm...@apache.org>
Committed: Fri Feb 26 20:57:36 2016 +0100
----------------------------------------------------------------------
flink-batch-connectors/flink-avro/pom.xml | 15 ++---
.../twitter/TwitterFilterSourceExample.java | 68 -------------------
.../examples/TwitterFilterSourceExample.java | 70 ++++++++++++++++++++
.../src/test/resources/twitter.properties | 19 ++++++
4 files changed, 96 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/c0ce1b6d/flink-batch-connectors/flink-avro/pom.xml
----------------------------------------------------------------------
diff --git a/flink-batch-connectors/flink-avro/pom.xml b/flink-batch-connectors/flink-avro/pom.xml
index 6162d3e..c4f7ac6 100644
--- a/flink-batch-connectors/flink-avro/pom.xml
+++ b/flink-batch-connectors/flink-avro/pom.xml
@@ -43,14 +43,6 @@ under the License.
<scope>provided</scope>
</dependency>
-
- <dependency>
- <groupId>org.apache.flink</groupId>
- <artifactId>flink-clients_2.10</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
-
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
@@ -64,6 +56,13 @@ under the License.
<type>test-jar</type>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-clients_2.10</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.flink</groupId>
http://git-wip-us.apache.org/repos/asf/flink/blob/c0ce1b6d/flink-streaming-connectors/flink-connector-twitter/src/main/java/org/apache/flink/streaming/connectors/twitter/TwitterFilterSourceExample.java
----------------------------------------------------------------------
diff --git a/flink-streaming-connectors/flink-connector-twitter/src/main/java/org/apache/flink/streaming/connectors/twitter/TwitterFilterSourceExample.java b/flink-streaming-connectors/flink-connector-twitter/src/main/java/org/apache/flink/streaming/connectors/twitter/TwitterFilterSourceExample.java
deleted file mode 100644
index 43cb179..0000000
--- a/flink-streaming-connectors/flink-connector-twitter/src/main/java/org/apache/flink/streaming/connectors/twitter/TwitterFilterSourceExample.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.flink.streaming.connectors.twitter;
-
-import org.apache.flink.streaming.api.datastream.DataStream;
-import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
-import org.apache.flink.streaming.connectors.json.JSONParseFlatMap;
-import org.apache.flink.util.Collector;
-
-/**
- * This is an example how to use TwitterFilterSource. Before executing the
- * example you have to define the access keys of twitter.properties in the
- * resource folder. The access keys can be found in your twitter account.
- */
-public class TwitterFilterSourceExample {
-
- /**
- * path to the twitter properties
- */
- private static final String PATH_TO_AUTH_FILE = "/twitter.properties";
-
- public static void main(String[] args) {
- final StreamExecutionEnvironment env = StreamExecutionEnvironment
- .getExecutionEnvironment();
-
- TwitterFilterSource twitterSource = new TwitterFilterSource(
- TwitterFilterSourceExample.class.getResource(PATH_TO_AUTH_FILE)
- .getFile());
-
- twitterSource.trackTerm("obama");
- twitterSource.filterLanguage("en");
-
- DataStream<String> streamSource = env.addSource(twitterSource).flatMap(
- new JSONParseFlatMap<String, String>() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void flatMap(String s, Collector<String> c)
- throws Exception {
- c.collect(s);
- }
- });
-
- streamSource.print();
-
- try {
- env.execute("Twitter Streaming Test");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flink/blob/c0ce1b6d/flink-streaming-connectors/flink-connector-twitter/src/test/java/org/apache/flink/streaming/connectors/twitter/examples/TwitterFilterSourceExample.java
----------------------------------------------------------------------
diff --git a/flink-streaming-connectors/flink-connector-twitter/src/test/java/org/apache/flink/streaming/connectors/twitter/examples/TwitterFilterSourceExample.java b/flink-streaming-connectors/flink-connector-twitter/src/test/java/org/apache/flink/streaming/connectors/twitter/examples/TwitterFilterSourceExample.java
new file mode 100644
index 0000000..a30e40d
--- /dev/null
+++ b/flink-streaming-connectors/flink-connector-twitter/src/test/java/org/apache/flink/streaming/connectors/twitter/examples/TwitterFilterSourceExample.java
@@ -0,0 +1,70 @@
+/*
+ * 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.flink.streaming.connectors.twitter.examples;
+
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.streaming.connectors.json.JSONParseFlatMap;
+import org.apache.flink.streaming.connectors.twitter.TwitterFilterSource;
+import org.apache.flink.util.Collector;
+
+/**
+ * This is an example how to use TwitterFilterSource. Before executing the
+ * example you have to define the access keys of twitter.properties in the
+ * resource folder. The access keys can be found in your twitter account.
+ */
+public class TwitterFilterSourceExample {
+
+ /**
+ * path to the twitter properties
+ */
+ private static final String PATH_TO_AUTH_FILE = "/twitter.properties";
+
+ public static void main(String[] args) {
+ final StreamExecutionEnvironment env = StreamExecutionEnvironment
+ .getExecutionEnvironment();
+
+ TwitterFilterSource twitterSource = new TwitterFilterSource(
+ TwitterFilterSourceExample.class.getResource(PATH_TO_AUTH_FILE)
+ .getFile());
+
+ twitterSource.trackTerm("obama");
+ twitterSource.filterLanguage("en");
+
+ DataStream<String> streamSource = env.addSource(twitterSource).flatMap(
+ new JSONParseFlatMap<String, String>() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void flatMap(String s, Collector<String> c)
+ throws Exception {
+ c.collect(s);
+ }
+ });
+
+ streamSource.print();
+
+ try {
+ env.execute("Twitter Streaming Test");
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/c0ce1b6d/flink-streaming-connectors/flink-connector-twitter/src/test/resources/twitter.properties
----------------------------------------------------------------------
diff --git a/flink-streaming-connectors/flink-connector-twitter/src/test/resources/twitter.properties b/flink-streaming-connectors/flink-connector-twitter/src/test/resources/twitter.properties
new file mode 100644
index 0000000..1ca4143
--- /dev/null
+++ b/flink-streaming-connectors/flink-connector-twitter/src/test/resources/twitter.properties
@@ -0,0 +1,19 @@
+# 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.
+
+secret=***
+consumerSecret=***
+token=***-***
+consumerKey=***