You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2014/03/22 00:20:01 UTC
[23/71] [abbrv] fixing STREAMS-26 branch
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/pom.xml
----------------------------------------------------------------------
diff --git a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/pom.xml b/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/pom.xml
deleted file mode 100644
index fd50125..0000000
--- a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/pom.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-provider-gnip</artifactId>
- <version>0.1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>gnip-edc-instagram</artifactId>
-
- <dependencies>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jsonschema2pojo</groupId>
- <artifactId>jsonschema2pojo-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <!--<sourceDirectory>src/main/java</sourceDirectory>-->
- <testSourceDirectory>src/test/java</testSourceDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.8</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/generated-sources/jsonschema2pojo/**/*.java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.jsonschema2pojo</groupId>
- <artifactId>jsonschema2pojo-maven-plugin</artifactId>
- <configuration>
- <addCompileSourceRoot>true</addCompileSourceRoot>
- <generateBuilders>true</generateBuilders>
- <sourcePaths>
- <sourcePath>src/main/jsonschema/com/instagram/Instagram.json</sourcePath>
- </sourcePaths>
- <outputDirectory>target/generated-sources/jsonschema2pojo</outputDirectory>
- <targetPackage>com.instagram</targetPackage>
- <useLongIntegers>true</useLongIntegers>
- <useJodaDates>false</useJodaDates>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- </build>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/main/jsonschema/com/instagram/Instagram.json
----------------------------------------------------------------------
diff --git a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/main/jsonschema/com/instagram/Instagram.json b/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/main/jsonschema/com/instagram/Instagram.json
deleted file mode 100644
index 029f6e9..0000000
--- a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/main/jsonschema/com/instagram/Instagram.json
+++ /dev/null
@@ -1,204 +0,0 @@
-{
- "type": "object",
- "$schema": "http://json-schema.org/draft-03/schema",
- "id": "#",
- "javaType" : "com.instagram.pojo.Instagram",
- "properties": {
- "caption": {
- "type": "object",
- "properties": {
- "created_time": {
- "format": "utc-millisec",
- "type": "string"
- },
- "from": {
- "$ref": "#/properties/user"
- },
- "id": {
- "type": "string"
- },
- "text": {
- "type": "string"
- }
- }
- },
- "comments": {
- "type": "object",
- "properties": {
- "count": {
- "type": "integer"
- },
- "data": {
- "type": "array",
- "items": {
- "type": "object",
- "javaType" : "com.instagram.pojo.Comment",
- "properties": {
- "created_time": {
- "format": "utc-millisec",
- "type": "string"
- },
- "from": {
- "$ref": "#/properties/user"
- },
- "id": {
- "type": "string"
- },
- "text": {
- "type": "string"
- }
- }
- }
- }
- }
- },
- "created_time": {
- "format": "utc-millisec",
- "type": "string"
- },
- "filter": {
- "type": "string"
- },
- "id": {
- "type": "string"
- },
- "images": {
- "type": "object",
- "properties": {
- "low_resolution": {
- "type": "object",
- "javaType" : "com.instagram.pojo.Media",
- "properties": {
- "height": {
- "type": "integer"
- },
- "url": {
- "format": "uri",
- "type": "string"
- },
- "width": {
- "type": "integer"
- }
- }
- },
- "standard_resolution": {
- "$ref": "#/properties/images/properties/low_resolution"
- },
- "thumbnail": {
- "$ref": "#/properties/images/properties/low_resolution"
- }
- }
- },
- "likes": {
- "type": "object",
- "properties": {
- "count": {
- "type": "integer"
- },
- "data": {
- "type": "array",
- "items": {
- "$ref": "#/properties/user"
- }
- }
- }
- },
- "link": {
- "format": "uri",
- "type": "string"
- },
- "location": {
- "type": "object",
- "properties": {
- "latitude": {
- "type": "number"
- },
- "longitude": {
- "type": "number"
- },
- "id": {
- "type": "string"
- },
- "street_address": {
- "type": "string"
- },
- "name": {
- "type": "string"
- }
- }
- },
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "type": {
- "type": "string"
- },
- "user": {
- "type": "object",
- "javaType" : "com.instagram.pojo.User",
- "properties": {
- "bio": {
- "type": "string"
- },
- "full_name": {
- "type": "string"
- },
- "id": {
- "type": "string"
- },
- "profile_picture": {
- "format": "uri",
- "type": "string"
- },
- "username": {
- "type": "string"
- },
- "website": {
- "format": "uri",
- "type": "string"
- }
- }
- },
- "user_has_liked": {
- "type": "boolean"
- },
- "users_in_photo": {
- "type": "array",
- "items": {
- "type": "object",
- "javaType" : "com.instagram.pojo.UserPosition",
- "properties": {
- "user": {
- "$ref": "#/properties/user"
- },
- "position": {
- "type": "object",
- "javaType" : "com.instagram.pojo.Position",
- "properties": {
- "x": {
- "type": "number"
- },
- "y": {
- "type": "number"
- }
- }
- }
- }
- }
- },
- "videos": {
- "type": "object",
- "properties": {
- "low_resolution": {
- "$ref": "#/properties/images/properties/low_resolution"
- },
- "standard_resolution": {
- "$ref": "#/properties/images/properties/low_resolution"
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/test/java/com/instagram/test/InstagramSerDeTest.java
----------------------------------------------------------------------
diff --git a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/test/java/com/instagram/test/InstagramSerDeTest.java b/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/test/java/com/instagram/test/InstagramSerDeTest.java
deleted file mode 100644
index d91693b..0000000
--- a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/test/java/com/instagram/test/InstagramSerDeTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.instagram.test;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.instagram.pojo.Instagram;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class InstagramSerDeTest {
-
- private final static Logger LOGGER = LoggerFactory.getLogger(InstagramSerDeTest.class);
-
- private ObjectMapper mapper = new ObjectMapper();
-
- @Test
- public void Tests()
- {
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.TRUE);
- mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
- mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
-
- InputStream is = InstagramSerDeTest.class.getResourceAsStream("/instagram_jsons.txt");
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
-
- try {
- while (br.ready()) {
- String line = br.readLine();
- LOGGER.debug(line);
-
- Instagram ser = mapper.readValue(line, Instagram.class);
-
- String des = mapper.writeValueAsString(ser);
- LOGGER.debug(des);
- }
- } catch( Exception e ) {
- e.printStackTrace();
- Assert.fail();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/test/resources/instagram_jsons.txt
----------------------------------------------------------------------
diff --git a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/test/resources/instagram_jsons.txt b/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/test/resources/instagram_jsons.txt
deleted file mode 100644
index c24d681..0000000
--- a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-instagram/src/test/resources/instagram_jsons.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-{ "comments": { "data": [], "count": 0 }, "caption": { "created_time": "1296710352", "text": "Inside le truc #foodtruck", "from": { "username": "kevin", "full_name": "Kevin Systrom", "id": "3" }, "id": "26621408" }, "likes": { "count": 15, "data": [{ "username": "mikeyk", "full_name": "Mike Krieger", "id": "4", "profile_picture": "..." }] }, "link": "http://instagr.am/p/BWrVZ/", "user": { "username": "kevin", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_3_75sq_1295574122.jpg", "id": "3" }, "created_time": "1296710327", "images": { "low_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/6ea7baea55774c5e81e7e3e1f6e791a7_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/6ea7baea55774c5e81e7e3e1f6e791a7_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/6ea7baea55774c5e81e7e3e1f6e791a7_7.jpg", "width":
612, "height": 612 } }, "type": "image", "users_in_photo": [], "filter": "Earlybird", "tags": ["foodtruck"], "id": "22721881", "location": { "latitude": 37.778720183610183, "longitude": -122.3962783813477, "id": "520640", "street_address": "", "name": "Le Truc" } }
-{ "location": { "id": "833", "latitude": 37.77956816727314, "longitude": -122.41387367248539, "name": "Civic Center BART" }, "comments": { "count": 16, "data": [ ] }, "caption": null, "link": "http://instagr.am/p/BXsFz/", "likes": { "count": 190, "data": [{ "username": "shayne", "full_name": "Shayne Sweeney", "id": "20", "profile_picture": "..." }] }, "created_time": "1296748524", "images": { "low_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/03/efc502667a554329b52d9a6bab35b24a_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/03/efc502667a554329b52d9a6bab35b24a_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/03/efc502667a554329b52d9a6bab35b24a_7.jpg", "width": 612, "height": 612 } }, "type": "image", "users_in_photo": [], "filter": "Earlybird", "tags": [], "id": "22987123", "user": { "username": "kevin", "full_name": "Kevin
S", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_3_75sq_1295574122.jpg", "id": "3" } }
-{ "type": "image", "users_in_photo": [], "filter": "Earlybird", "tags": ["expobar"], "comments": { "data": [], "count": 0 }, "caption": { "created_time": "1296532028", "text": "@mikeyk pulls a shot on our #Expobar", "from": { "username": "josh", "full_name": "Josh Riedel", "id": "33" }, "id": "25663923" }, "likes": { "count": 35, "data": [{ "username": "mikeyk", "full_name": "Mikeyk", "id": "4", "profile_picture": "..." }] }, "link": "http://instagr.am/p/BUS3X/", "user": { "username": "josh", "profile_picture": "...", "id": "33" }, "created_time": "1296531955", "images": { "low_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2011/01/31/32d364527512437a8a17ba308a7c83bb_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http://distillery.s3.amazonaws.com/media/2011/01/31/32d364527512437a8a17ba308a7c83bb_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2011/01/31/32d364527512437a8a17ba308a7c83bb_
7.jpg", "width": 612, "height": 612 } }, "user_has_liked": false, "id": "22097367", "location": { "latitude": 37.780885099999999, "id": "514276", "longitude": -122.3948632, "name": "Instagram" } }
-{ "type": "image", "users_in_photo": [], "filter": "Earlybird", "tags": ["snow"], "comments": { "data": [{ "created_time": "1296703540", "text": "Snow", "from": { "username": "emohatch", "full_name": "Dave", "id": "1242695" }, "id": "26589964" }, { "created_time": "1296707889", "text": "#snow", "from": { "username": "emohatch", "full_name": "Emo Hatch", "id": "1242695" }, "id": "26609649" }], "count": 3 }, "caption": { "created_time": "1296703540", "text": "#Snow", "from": { "username": "emohatch", "id": "1242695" }, "id": "26589964" }, "likes": { "count": 1, "data": [{ "username": "mikeyk", "full_name": "Mike Krieger", "id": "4", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1242695_75sq_1293915800.jpg" }] }, "link": "http://instagr.am/p/BWl6P/", "user": { "username": "emohatch", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1242695_75sq_1293915800.jpg", "id": "1242695", "full_name": "Dave" }, "created_time": "1296703536",
"images": { "low_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2011/02/02/f9443f3443484c40b4792fa7c76214d5_7.jpg", "width": 612, "height": 612 } }, "id": "22699663", "location": null }
-{ "type": "image", "users_in_photo": [{ "user": { "username": "kevin", "full_name": "Kevin S", "id": "3", "profile_picture": "..." }, "position": { "x": 0.315, "y": 0.9111 } }], "filter": "Walden", "tags": [], "comments": { "data": [{ "created_time": "1279332030", "text": "Love the sign here", "from": { "username": "mikeyk", "full_name": "Mikey Krieger", "id": "4", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1242695_75sq_1293915800.jpg" }, "id": "8" }, { "created_time": "1279341004", "text": "Chilako taco", "from": { "username": "kevin", "full_name": "Kevin S", "id": "3", "profile_picture": "..." }, "id": "3" }], "count": 2 }, "caption": null, "likes": { "count": 1, "data": [{ "username": "mikeyk", "full_name": "Mikeyk", "id": "4", "profile_picture": "..." }] }, "link": "http://instagr.am/p/D/", "user": { "username": "kevin", "full_name": "Kevin S", "profile_picture": "...", "bio": "...", "website": "...", "id": "3" }, "created_time": "1279340983", "image
s": { "low_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_7.jpg", "width": 612, "height": 612 } }, "id": "3", "location": null }
-{ "type": "video", "videos": { "low_resolution": { "url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_102.mp4", "width": 480, "height": 480 }, "standard_resolution": { "url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_101.mp4", "width": 640, "height": 640 } }, "users_in_photo": null, "filter": "Vesper", "tags": ["snow"], "comments": { "data": [{ "created_time": "1279332030", "text": "Love the sign here", "from": { "username": "mikeyk", "full_name": "Mikey Krieger", "id": "4", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1242695_75sq_1293915800.jpg" }, "id": "8" }, { "created_time": "1279341004", "text": "Chilako taco", "from": { "username": "kevin", "full_name": "Kevin S", "id": "3", "profile_picture": "..." }, "id": "3" }], "count": 2 }, "caption": null, "likes": { "count": 1, "data": [{ "username": "mikeyk", "full_name": "Mikeyk", "id": "4", "profile_picture": "..." }] }, "link": "htt
p://instagr.am/p/D/", "user": { "username": "kevin", "full_name": "Kevin S", "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_3_75sq_1295574122.jpg", "id": "3" }, "created_time": "1279340983", "images": { "low_resolution": { "url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_6.jpg", "width": 306, "height": 306 }, "thumbnail": { "url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_5.jpg", "width": 150, "height": 150 }, "standard_resolution": { "url": "http://distilleryimage2.ak.instagram.com/11f75f1cd9cc11e2a0fd22000aa8039a_7.jpg", "width": 612, "height": 612 } }, "id": "363839373298", "location": { "latitude": 37.780885099999999, "id": "514276", "longitude": -122.3948632, "name": "Instagram" } }
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/pom.xml
----------------------------------------------------------------------
diff --git a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/pom.xml b/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/pom.xml
deleted file mode 100644
index d74def2..0000000
--- a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/pom.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-provider-gnip</artifactId>
- <version>0.1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>gnip-edc-reddit</artifactId>
-
- <dependencies>
-
- <dependency>
- <groupId>org.jsonschema2pojo</groupId>
- <artifactId>jsonschema2pojo-core</artifactId>
-
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-xml</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml</groupId>
- <artifactId>jackson-xml-databind</artifactId>
- <version>0.5.0</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.1</version>
- </dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.0.9</version>
- </dependency>
-
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>20090211</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>streams-pojo</artifactId>
- <version>0.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.streams</groupId>
- <artifactId>gnip-powertrack</artifactId>
- <version>0.1-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <sourceDirectory>src/main/java</sourceDirectory>
- <testSourceDirectory>src/test/java</testSourceDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <filesets>
- <fileset>
- <directory>src/main/java/com/reddit/pojo</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </fileset>
- <fileset>
- <directory>target</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <!--<plugin>-->
- <!--<groupId>org.jsonschema2pojo</groupId>-->
- <!--<artifactId>jsonschema2pojo-maven-plugin</artifactId>-->
- <!---->
- <!--<configuration>-->
- <!--<addCompileSourceRoot>true</addCompileSourceRoot>-->
- <!--<generateBuilders>true</generateBuilders>-->
- <!--<sourcePaths>-->
- <!--<sourcePath>src/main/jsonschema/com/reddit</sourcePath>-->
- <!--</sourcePaths>-->
- <!--<outputDirectory>src/main/java</outputDirectory>-->
- <!--<targetPackage>org.apache.streams</targetPackage>-->
- <!--<useLongIntegers>true</useLongIntegers>-->
- <!--<useJodaDates>false</useJodaDates>-->
- <!--</configuration>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<goals>-->
- <!--<goal>generate</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--</plugin>-->
- </plugins>
- </build>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/main/java/com/reddit/api/RedditActivitySerializer.java
----------------------------------------------------------------------
diff --git a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/main/java/com/reddit/api/RedditActivitySerializer.java b/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/main/java/com/reddit/api/RedditActivitySerializer.java
deleted file mode 100644
index 3dcc66c..0000000
--- a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/main/java/com/reddit/api/RedditActivitySerializer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.reddit.api;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.commons.lang.NotImplementedException;
-import org.apache.streams.data.ActivitySerializer;
-import org.apache.streams.data.util.ActivityUtil;
-import org.apache.streams.gnip.powertrack.GnipActivityFixer;
-import org.apache.streams.pojo.json.Activity;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created with IntelliJ IDEA.
- * User: mdelaet
- * Date: 8/29/13
- * Time: 8:32 AM
- * To change this template use File | Settings | File Templates.
- */
-public class RedditActivitySerializer implements ActivitySerializer<String> {
- private final static Logger LOGGER = LoggerFactory.getLogger(RedditActivitySerializer.class);
-
- public static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
- public static final String PROVIDER_NAME = "facebook";
-
-
- @Override
- public String serializationFormat() {
- return "application/reddit+xml";
- }
-
- @Override
- public String serialize(Activity deserialized) {
- ObjectMapper jsonMapper = new ObjectMapper();
- String jsonString = new String();
- try{
- jsonString = jsonMapper.writeValueAsString(deserialized);
- }catch(Exception e){
- LOGGER.error("Exception serializing Activity Object: " + e);
- }
- return jsonString; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- @Override
- public Activity deserialize(String serialized) {
- ObjectMapper jsonMapper = new ObjectMapper();
- JSONObject jsonObject = new JSONObject();
- JSONObject fixedObject = new JSONObject();
-
- HashMap<String, String> raw = new HashMap<String, String>();
- raw.put("original", serialized);
-
- try{
- jsonObject = new JSONObject(serialized);
- fixedObject = GnipActivityFixer.fix(jsonObject);
- }catch(Exception e){
- LOGGER.error("Exception deserializing string: " + e);
- }
-
- Activity activity = new Activity();
- try {
- activity = jsonMapper.readValue(fixedObject.toString(), Activity.class);
- Map<String, Object> extension = ActivityUtil.ensureExtensions(activity);
- if (fixedObject.names().toString().contains("object")){
- if (fixedObject.getJSONObject("object").names().toString().contains("statistics")){
- if (fixedObject.getJSONObject("object").getJSONObject("statistics").names().toString().contains("upVotes")){
- extension.put("likes", fixedObject.getJSONObject("object").getJSONObject("statistics").get("upVotes"));
- }
- }
- }
-
- } catch( Exception e ) {
- LOGGER.error(jsonObject.toString());
- LOGGER.error(fixedObject.toString());
- e.printStackTrace();
- }
- return activity;
- }
-
- @Override
- public List<Activity> deserializeAll(List<String> serializedList) {
- //TODO Support
- throw new NotImplementedException("Not currently supported by this deserializer");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/6ea69f29/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/test/java/com/reddit/api/RedditEDCAsActivityJSONTest.java
----------------------------------------------------------------------
diff --git a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/test/java/com/reddit/api/RedditEDCAsActivityJSONTest.java b/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/test/java/com/reddit/api/RedditEDCAsActivityJSONTest.java
deleted file mode 100644
index 4bdb312..0000000
--- a/trunk/streams-contrib/streams-provider-gnip/gnip-edc-reddit/src/test/java/com/reddit/api/RedditEDCAsActivityJSONTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.reddit.api;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-import org.apache.streams.pojo.json.Activity;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-/**
-* Created with IntelliJ IDEA.
-* User: mdelaet
-* Date: 8/30/13
-* Time: 1:21 PM
-* To change this template use File | Settings | File Templates.
-*/
-public class RedditEDCAsActivityJSONTest {
- private final static Logger LOGGER = LoggerFactory.getLogger(RedditEDCAsActivityJSONTest.class);
-
- private ObjectMapper jsonMapper;
- XmlMapper xmlMapper;
- private RedditActivitySerializer redditSerializer;
-
- public RedditEDCAsActivityJSONTest() {
- redditSerializer = new RedditActivitySerializer();
- jsonMapper = new ObjectMapper();
- xmlMapper = new XmlMapper();
- }
-
- @Test
- public void Tests() throws Exception
- {
- InputStream is = RedditEDCAsActivityJSONTest.class.getResourceAsStream("/RedditEDCFixed.json");
- if(is == null) System.out.println("null");
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
- xmlMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
- xmlMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
- jsonMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
- jsonMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, Boolean.TRUE);
- jsonMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, Boolean.TRUE);
-
- try {
- while (br.ready()) {
- String line = br.readLine();
-
- Activity activity = null;
- try {
- activity = redditSerializer.deserialize(line);
- } catch( Exception e ) {
- LOGGER.error(line);
- e.printStackTrace();
- Assert.fail("Exception on redditSerializer.deserialize(jsonString) : " + e);
- }
-
- try {
- String activityString = redditSerializer.serialize(activity);
- System.out.println(jsonMapper.writeValueAsString(activity));
- }catch (Exception e ){
- LOGGER.error(activity.toString());
- e.printStackTrace();
- Assert.fail("Exception on redditSerializer.serialize(activity) : " + e);
- }
-
- //LOGGER.info(activity);
- }
- } catch( Exception e ) {
- System.out.println("Exception: " + e);
- LOGGER.error(e.getMessage());
- Assert.fail("");
- }
- }
-
-}
-