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 2015/03/26 18:46:45 UTC

[4/8] incubator-streams git commit: updates to make this module use DocumentClassifier and ActivityConverter interfaces and reflection-based DateTime handling and Activity conversion. tweaks and renames to the tests to match the new model. this change im

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonTweetActivitySerializer.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonTweetActivitySerializer.java b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonTweetActivitySerializer.java
deleted file mode 100644
index e6fc05f..0000000
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonTweetActivitySerializer.java
+++ /dev/null
@@ -1,77 +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
- *
- *   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.streams.twitter.serializer;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.commons.lang.NotImplementedException;
-import org.apache.streams.data.ActivitySerializer;
-import org.apache.streams.exceptions.ActivitySerializerException;
-import org.apache.streams.pojo.json.Activity;
-import org.apache.streams.twitter.pojo.Tweet;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.List;
-
-import static org.apache.streams.twitter.serializer.util.TwitterActivityUtil.*;
-
-public class TwitterJsonTweetActivitySerializer implements ActivitySerializer<String>, Serializable {
-
-    private static TwitterJsonTweetActivitySerializer instance = new TwitterJsonTweetActivitySerializer();
-
-    public static TwitterJsonTweetActivitySerializer getInstance() {
-        return instance;
-    }
-
-    @Override
-    public String serializationFormat() {
-        return null;
-    }
-
-    @Override
-    public String serialize(Activity deserialized) throws ActivitySerializerException {
-        throw new NotImplementedException();
-    }
-
-    @Override
-    public Activity deserialize(String serialized) throws ActivitySerializerException {
-
-        ObjectMapper mapper = StreamsTwitterMapper.getInstance();
-        Tweet tweet = null;
-        try {
-            tweet = mapper.readValue(serialized, Tweet.class);
-        } catch (JsonProcessingException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        Activity activity = new Activity();
-
-        updateActivity(tweet, activity);
-
-        return activity;
-    }
-
-    @Override
-    public List<Activity> deserializeAll(List<String> serializedList) {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonUserActivitySerializer.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonUserActivitySerializer.java b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonUserActivitySerializer.java
deleted file mode 100644
index 4e6979b..0000000
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonUserActivitySerializer.java
+++ /dev/null
@@ -1,78 +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
- *
- *   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.streams.twitter.serializer;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.streams.data.ActivitySerializer;
-import org.apache.streams.exceptions.ActivitySerializerException;
-import org.apache.streams.jackson.StreamsJacksonMapper;
-import org.apache.streams.pojo.json.Activity;
-import org.apache.streams.twitter.pojo.User;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.List;
-
-import static org.apache.streams.twitter.serializer.util.TwitterActivityUtil.updateActivity;
-
-public class TwitterJsonUserActivitySerializer implements ActivitySerializer<String>, Serializable {
-
-    public TwitterJsonUserActivitySerializer() {}
-
-    private static TwitterJsonUserActivitySerializer instance = new TwitterJsonUserActivitySerializer();
-
-    public static TwitterJsonUserActivitySerializer getInstance() {
-        return instance;
-    }
-
-    @Override
-    public String serializationFormat() {
-        return null;
-    }
-
-    @Override
-    public String serialize(Activity deserialized) throws ActivitySerializerException {
-        return null;
-    }
-
-    @Override
-    public Activity deserialize(String event) throws ActivitySerializerException {
-
-        ObjectMapper mapper = StreamsJacksonMapper.getInstance();
-        User user = null;
-        try {
-            user = mapper.readValue(event, User.class);
-        } catch (JsonProcessingException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        Activity activity = new Activity();
-        updateActivity(user, activity);
-
-        return activity;
-    }
-
-    @Override
-    public List<Activity> deserializeAll(List<String> serializedList) {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonUserstreameventActivitySerializer.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonUserstreameventActivitySerializer.java b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonUserstreameventActivitySerializer.java
deleted file mode 100644
index e2832dd..0000000
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/TwitterJsonUserstreameventActivitySerializer.java
+++ /dev/null
@@ -1,115 +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
- *
- *   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.streams.twitter.serializer;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.base.Strings;
-import org.apache.commons.lang.NotImplementedException;
-import org.apache.streams.data.ActivitySerializer;
-import org.apache.streams.exceptions.ActivitySerializerException;
-import org.apache.streams.pojo.json.Activity;
-import org.apache.streams.pojo.json.ActivityObject;
-import org.apache.streams.pojo.json.Actor;
-import org.apache.streams.twitter.pojo.UserstreamEvent;
-
-import java.util.List;
-
-import static org.apache.streams.twitter.serializer.util.TwitterActivityUtil.*;
-
-
-/**
-* Created with IntelliJ IDEA.
-* User: mdelaet
-* Date: 9/30/13
-* Time: 9:24 AM
-* To change this template use File | Settings | File Templates.
-*/
-public class TwitterJsonUserstreameventActivitySerializer implements ActivitySerializer<String> {
-
-    private static TwitterJsonUserstreameventActivitySerializer instance = new TwitterJsonUserstreameventActivitySerializer();
-
-    public static TwitterJsonUserstreameventActivitySerializer getInstance() {
-        return instance;
-    }
-
-    @Override
-    public String serializationFormat() {
-        return null;
-    }
-
-    @Override
-    public String serialize(Activity deserialized) throws ActivitySerializerException {
-        throw new NotImplementedException();
-    }
-
-    @Override
-    public Activity deserialize(String serialized) throws ActivitySerializerException {
-        return null;
-    }
-
-    @Override
-    public List<Activity> deserializeAll(List<String> serializedList) {
-        return null;
-    }
-
-    public Activity convert(ObjectNode item) throws ActivitySerializerException {
-
-        ObjectMapper mapper = StreamsTwitterMapper.getInstance();
-        UserstreamEvent event = null;
-        try {
-            event = mapper.treeToValue(item, UserstreamEvent.class);
-        } catch (JsonProcessingException e) {
-            e.printStackTrace();
-        }
-
-        Activity activity = new Activity();
-        activity.setActor(buildActor(event));
-        activity.setVerb(detectVerb(event));
-        activity.setObject(buildActivityObject(event));
-        activity.setId(formatId(activity.getVerb()));
-        if(Strings.isNullOrEmpty(activity.getId()))
-            throw new ActivitySerializerException("Unable to determine activity id");
-        activity.setProvider(getProvider());
-        return activity;
-    }
-
-    public Actor buildActor(UserstreamEvent event) {
-        Actor actor = new Actor();
-        //actor.setId(formatId(delete.getDelete().getStatus().getUserIdStr()));
-        return actor;
-    }
-
-    public ActivityObject buildActivityObject(UserstreamEvent event) {
-        ActivityObject actObj = new ActivityObject();
-        //actObj.setId(formatId(delete.getDelete().getStatus().getIdStr()));
-        //actObj.setObjectType("tweet");
-        return actObj;
-    }
-
-    public String detectVerb(UserstreamEvent event) {
-        return null;
-    }
-
-    public ActivityObject buildTarget(UserstreamEvent event) {
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/util/TwitterActivityUtil.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/util/TwitterActivityUtil.java b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/util/TwitterActivityUtil.java
deleted file mode 100644
index b6a541c..0000000
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/serializer/util/TwitterActivityUtil.java
+++ /dev/null
@@ -1,346 +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.streams.twitter.serializer.util;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import org.apache.streams.exceptions.ActivitySerializerException;
-import org.apache.streams.pojo.extensions.ExtensionUtil;
-import org.apache.streams.pojo.json.Activity;
-import org.apache.streams.pojo.json.ActivityObject;
-import org.apache.streams.pojo.json.Actor;
-import org.apache.streams.pojo.json.Image;
-import org.apache.streams.pojo.json.Provider;
-import org.apache.streams.twitter.Url;
-import org.apache.streams.twitter.pojo.Delete;
-import org.apache.streams.twitter.pojo.Entities;
-import org.apache.streams.twitter.pojo.Hashtag;
-import org.apache.streams.twitter.pojo.Retweet;
-import org.apache.streams.twitter.pojo.Tweet;
-import org.apache.streams.twitter.pojo.User;
-import org.apache.streams.twitter.pojo.UserMentions;
-import org.apache.streams.twitter.serializer.StreamsTwitterMapper;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.streams.data.util.ActivityUtil.ensureExtensions;
-
-/**
- * Provides utilities for working with Activity objects within the context of Twitter
- */
-public class TwitterActivityUtil {
-
-    /**
-     * Updates the given Activity object with the values from the Tweet
-     * @param tweet the object to use as the source
-     * @param activity the target of the updates.  Will receive all values from the tweet.
-     * @throws ActivitySerializerException
-     */
-    public static void updateActivity(Tweet tweet, Activity activity) throws ActivitySerializerException {
-        ObjectMapper mapper = StreamsTwitterMapper.getInstance();
-        activity.setActor(buildActor(tweet));
-        activity.setId(formatId(activity.getVerb(),
-                Optional.fromNullable(
-                        tweet.getIdStr())
-                        .or(Optional.of(tweet.getId().toString()))
-                        .orNull()));
-
-        if(tweet instanceof Retweet) {
-            updateActivityContent(activity,  ((Retweet) tweet).getRetweetedStatus(), "share");
-        } else {
-            updateActivityContent(activity, tweet, "post");
-        }
-
-        if(Strings.isNullOrEmpty(activity.getId()))
-            throw new ActivitySerializerException("Unable to determine activity id");
-        try {
-            activity.setPublished(tweet.getCreatedAt());
-        } catch( Exception e ) {
-            throw new ActivitySerializerException("Unable to determine publishedDate", e);
-        }
-        activity.setTarget(buildTarget(tweet));
-        activity.setProvider(getProvider());
-        activity.setUrl(String.format("http://twitter.com/%s/%s/%s", tweet.getUser().getScreenName(),"/status/",tweet.getIdStr()));
-
-        addTwitterExtension(activity, mapper.convertValue(tweet, ObjectNode.class));
-    }
-
-    /**
-     * Updates the given Activity object with the values from the User
-     * @param user the object to use as the source
-     * @param activity the target of the updates.  Will receive all values from the tweet.
-     * @throws ActivitySerializerException
-     */
-    public static void updateActivity(User user, Activity activity) throws ActivitySerializerException {
-        activity.setActor(buildActor(user));
-        activity.setId(null);
-    }
-
-    /**
-     * Updates the activity for a delete event
-     * @param delete the delete event
-     * @param activity the Activity object to update
-     * @throws ActivitySerializerException
-     */
-    public static void updateActivity(Delete delete, Activity activity) throws ActivitySerializerException {
-        activity.setActor(buildActor(delete));
-        activity.setVerb("delete");
-        activity.setObject(buildActivityObject(delete));
-        activity.setId(formatId(activity.getVerb(), delete.getDelete().getStatus().getIdStr()));
-        if(Strings.isNullOrEmpty(activity.getId()))
-            throw new ActivitySerializerException("Unable to determine activity id");
-        activity.setProvider(getProvider());
-        addTwitterExtension(activity, StreamsTwitterMapper.getInstance().convertValue(delete, ObjectNode.class));
-    }
-
-    /**
-     * Builds the actor for a delete event
-     * @param delete the delete event
-     * @return a valid Actor
-     */
-    public static Actor buildActor(Delete delete) {
-        Actor actor = new Actor();
-        actor.setId(formatId(delete.getDelete().getStatus().getUserIdStr()));
-        return actor;
-    }
-
-    /**
-     * Builds the ActivityObject for the delete event
-     * @param delete the delete event
-     * @return a valid Activity Object
-     */
-    public static ActivityObject buildActivityObject(Delete delete) {
-        ActivityObject actObj = new ActivityObject();
-        actObj.setId(formatId(delete.getDelete().getStatus().getIdStr()));
-        actObj.setObjectType("tweet");
-        return actObj;
-    }
-
-
-    /**
-     * Updates the content, and associated fields, with those from the given tweet
-     * @param activity the target of the updates.  Will receive all values from the tweet.
-     * @param tweet the object to use as the source
-     * @param verb the verb for the given activity's type
-     */
-    public static void updateActivityContent(Activity activity, Tweet tweet, String verb) {
-        activity.setVerb(verb);
-        activity.setTitle("");
-        if( tweet != null ) {
-            activity.setObject(buildActivityObject(tweet));
-            activity.setLinks(getLinks(tweet));
-            activity.setContent(tweet.getText());
-            addLocationExtension(activity, tweet);
-            addTwitterExtensions(activity, tweet);
-        }
-    }
-
-    /**
-     * Creates an {@link org.apache.streams.pojo.json.ActivityObject} for the tweet
-     * @param tweet the object to use as the source
-     * @return a valid ActivityObject
-     */
-    public static ActivityObject buildActivityObject(Tweet tweet) {
-        ActivityObject actObj = new ActivityObject();
-        String id =  Optional.fromNullable(
-                tweet.getIdStr())
-                .or(Optional.of(tweet.getId().toString()))
-                .orNull();
-        if( id != null )
-            actObj.setId(id);
-        actObj.setObjectType("tweet");
-        actObj.setContent(tweet.getText());
-        return actObj;
-    }
-
-    /**
-     * Builds the activity {@link org.apache.streams.pojo.json.Actor} object from the tweet
-     * @param tweet the object to use as the source
-     * @return a valid Actor populated from the Tweet
-     */
-    public static Actor buildActor(Tweet tweet) {
-        Actor actor = new Actor();
-        User user = tweet.getUser();
-
-        return buildActor(user);
-    }
-
-    /**
-     * Builds the activity {@link org.apache.streams.pojo.json.Actor} object from the User
-     * @param user the object to use as the source
-     * @return a valid Actor populated from the Tweet
-     */
-    public static Actor buildActor(User user) {
-        Actor actor = new Actor();
-        actor.setId(formatId(
-                Optional.fromNullable(
-                        user.getIdStr())
-                        .or(Optional.of(user.getId().toString()))
-                        .orNull()
-        ));
-
-        actor.setDisplayName(user.getName());
-        actor.setAdditionalProperty("handle", user.getScreenName());
-        actor.setSummary(user.getDescription());
-
-        if (user.getUrl()!=null){
-            actor.setUrl(user.getUrl());
-        }
-
-        Map<String, Object> extensions = new HashMap<String, Object>();
-        extensions.put("location", user.getLocation());
-        extensions.put("posts", user.getStatusesCount());
-        extensions.put("favorites", user.getFavouritesCount());
-        extensions.put("followers", user.getFollowersCount());
-
-        Image profileImage = new Image();
-        profileImage.setUrl(user.getProfileImageUrlHttps());
-        actor.setImage(profileImage);
-
-        extensions.put("screenName", user.getScreenName());
-
-        actor.setAdditionalProperty("extensions", extensions);
-        return actor;
-    }
-
-    /**
-     * Gets the links from the Twitter event
-     * @param tweet the object to use as the source
-     * @return a list of links corresponding to the expanded URL (no t.co)
-     */
-    public static List<String> getLinks(Tweet tweet) {
-        List<String> links = Lists.newArrayList();
-        if( tweet.getEntities().getUrls() != null ) {
-            for (Url url : tweet.getEntities().getUrls()) {
-                links.add(url.getUrl());
-            }
-        }
-        else
-            System.out.println("  0 links");
-        return links;
-    }
-
-    /**
-     * Builds the {@link org.apache.streams.twitter.pojo.TargetObject} from the tweet
-     * @param tweet the object to use as the source
-     * @return currently returns null for all activities
-     */
-    public static ActivityObject buildTarget(Tweet tweet) {
-        return null;
-    }
-
-    /**
-     * Adds the location extension and populates with teh twitter data
-     * @param activity the Activity object to update
-     * @param tweet the object to use as the source
-     */
-    public static void addLocationExtension(Activity activity, Tweet tweet) {
-        Map<String, Object> extensions = ExtensionUtil.ensureExtensions(activity);
-        Map<String, Object> location = new HashMap<String, Object>();
-        location.put("id", formatId(
-                Optional.fromNullable(
-                        tweet.getIdStr())
-                        .or(Optional.of(tweet.getId().toString()))
-                        .orNull()
-        ));
-        location.put("coordinates", tweet.getCoordinates());
-        extensions.put("location", location);
-    }
-
-    /**
-     * Gets the common twitter {@link org.apache.streams.pojo.json.Provider} object
-     * @return a provider object representing Twitter
-     */
-    public static Provider getProvider() {
-        Provider provider = new Provider();
-        provider.setId("id:providers:twitter");
-        provider.setDisplayName("Twitter");
-        return provider;
-    }
-    /**
-     * Adds the given Twitter event to the activity as an extension
-     * @param activity the Activity object to update
-     * @param event the Twitter event to add as the extension
-     */
-    public static void addTwitterExtension(Activity activity, ObjectNode event) {
-        Map<String, Object> extensions = ExtensionUtil.ensureExtensions(activity);
-        extensions.put("twitter", event);
-    }
-    /**
-     * Formats the ID to conform with the Apache Streams activity ID convention
-     * @param idparts the parts of the ID to join
-     * @return a valid Activity ID in format "id:twitter:part1:part2:...partN"
-     */
-    public static String formatId(String... idparts) {
-        return Joiner.on(":").join(Lists.asList("id:twitter", idparts));
-    }
-
-    /**
-     * Takes various parameters from the twitter object that are currently not part of teh
-     * activity schema and stores them in a generic extensions attribute
-     * @param activity
-     * @param tweet
-     */
-    public static void addTwitterExtensions(Activity activity, Tweet tweet) {
-        Map<String, Object> extensions = ExtensionUtil.ensureExtensions(activity);
-
-        List<String> hashtags = new ArrayList<String>();
-        for(Hashtag hashtag : tweet.getEntities().getHashtags()) {
-            hashtags.add(hashtag.getText());
-        }
-        extensions.put("hashtags", hashtags);
-
-        Map<String, Object> likes = new HashMap<String, Object>();
-        likes.put("perspectival", tweet.getFavorited());
-        likes.put("count", tweet.getAdditionalProperties().get("favorite_count"));
-
-        extensions.put("likes", likes);
-
-        Map<String, Object> rebroadcasts = new HashMap<String, Object>();
-        rebroadcasts.put("perspectival", tweet.getRetweeted());
-        rebroadcasts.put("count", tweet.getRetweetCount());
-
-        extensions.put("rebroadcasts", rebroadcasts);
-
-        List<Map<String, Object>> userMentions = new ArrayList<Map<String, Object>>();
-        Entities entities = tweet.getEntities();
-
-        for(UserMentions user : entities.getUserMentions()) {
-            //Map the twitter user object into an actor
-            Map<String, Object> actor = new HashMap<String, Object>();
-            actor.put("id", "id:twitter:" + user.getIdStr());
-            actor.put("displayName", user.getName());
-            actor.put("handle", user.getScreenName());
-
-            userMentions.add(actor);
-        }
-
-        extensions.put("user_mentions", userMentions);
-
-        extensions.put("keywords", tweet.getText());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/User.json
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/User.json b/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/User.json
new file mode 100644
index 0000000..399f497
--- /dev/null
+++ b/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/User.json
@@ -0,0 +1,123 @@
+{
+    "type": "object",
+    "$schema": "http://json-schema.org/draft-03/schema",
+    "id": "#",
+    "javaType" : "org.apache.streams.twitter.pojo.User",
+    "javaInterfaces": ["java.io.Serializable"],
+    "properties": {
+        "location": {
+            "type": "string"
+        },
+        "default_profile": {
+            "type": "boolean"
+        },
+        "statuses_count": {
+            "ignore_malformed": false,
+            "type": "integer"
+        },
+        "profile_background_tile": {
+            "type": "boolean"
+        },
+        "lang": {
+            "type": "string"
+        },
+        "profile_link_color": {
+            "type": "string"
+        },
+        "id": {
+            "ignore_malformed": false,
+            "type": "integer"
+        },
+        "protected": {
+            "type": "boolean"
+        },
+        "favourites_count": {
+            "ignore_malformed": false,
+            "type": "integer"
+        },
+        "profile_text_color": {
+            "type": "string"
+        },
+        "verified": {
+            "type": "boolean"
+        },
+        "description": {
+            "type": "string"
+        },
+        "contributors_enabled": {
+            "type": "boolean"
+        },
+        "name": {
+            "type": "string"
+        },
+        "profile_sidebar_border_color": {
+            "type": "string"
+        },
+        "profile_background_color": {
+            "type": "string"
+        },
+        "created_at": {
+            "type": "string",
+            "format": "date-time"
+        },
+        "default_profile_image": {
+            "type": "boolean"
+        },
+        "followers_count": {
+            "ignore_malformed": false,
+            "type": "integer"
+        },
+        "geo_enabled": {
+            "type": "boolean"
+        },
+        "profile_image_url_https": {
+            "type": "string"
+        },
+        "profile_background_image_url": {
+            "type": "string"
+        },
+        "profile_background_image_url_https": {
+            "type": "string"
+        },
+        "follow_request_sent": {
+            "type": "boolean"
+        },
+        "url": {
+            "type": "string"
+        },
+        "utc_offset": {
+            "ignore_malformed": false,
+            "type": "integer"
+        },
+        "time_zone": {
+            "type": "string"
+        },
+        "profile_use_background_image": {
+            "type": "boolean"
+        },
+        "friends_count": {
+            "ignore_malformed": false,
+            "type": "integer"
+        },
+        "profile_sidebar_fill_color": {
+            "type": "string"
+        },
+        "screen_name": {
+            "type": "string"
+        },
+        "id_str": {
+            "type": "string"
+        },
+        "profile_image_url": {
+            "type": "string"
+        },
+        "is_translator": {
+            "type": "boolean"
+        },
+        "listed_count": {
+            "ignore_malformed": false,
+            "type": "integer"
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/tweet.json
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/tweet.json b/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/tweet.json
index cfdc35d..db48656 100644
--- a/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/tweet.json
+++ b/streams-contrib/streams-provider-twitter/src/main/jsonschema/com/twitter/tweet.json
@@ -1,10 +1,7 @@
 {
+    "type": "object",
     "$schema": "http://json-schema.org/draft-03/schema",
-    "$license": [
-        "http://www.apache.org/licenses/LICENSE-2.0"
-    ],
     "id": "#",
-    "type": "object",
     "javaType" : "org.apache.streams.twitter.pojo.Tweet",
     "javaInterfaces": ["java.io.Serializable"],
     "properties": {
@@ -175,126 +172,7 @@
             "type": "string"
         },
         "user": {
-            "id": "user",
-            "type": "object",
-            "javaType" : "org.apache.streams.twitter.pojo.User",
-            "javaInterfaces": ["java.io.Serializable"],
-            "dynamic": "true",
-            "properties": {
-                "location": {
-                    "type": "string"
-                },
-                "default_profile": {
-                    "type": "boolean"
-                },
-                "statuses_count": {
-                    "ignore_malformed": false,
-                    "type": "integer"
-                },
-                "profile_background_tile": {
-                    "type": "boolean"
-                },
-                "lang": {
-                    "type": "string"
-                },
-                "profile_link_color": {
-                    "type": "string"
-                },
-                "id": {
-                    "ignore_malformed": false,
-                    "type": "integer"
-                },
-                "protected": {
-                    "type": "boolean"
-                },
-                "favourites_count": {
-                    "ignore_malformed": false,
-                    "type": "integer"
-                },
-                "profile_text_color": {
-                    "type": "string"
-                },
-                "verified": {
-                    "type": "boolean"
-                },
-                "description": {
-                    "type": "string"
-                },
-                "contributors_enabled": {
-                    "type": "boolean"
-                },
-                "name": {
-                    "type": "string"
-                },
-                "profile_sidebar_border_color": {
-                    "type": "string"
-                },
-                "profile_background_color": {
-                    "type": "string"
-                },
-                "created_at": {
-                    "type": "string",
-                    "format": "date-time"
-                },
-                "default_profile_image": {
-                    "type": "boolean"
-                },
-                "followers_count": {
-                    "ignore_malformed": false,
-                    "type": "integer"
-                },
-                "geo_enabled": {
-                    "type": "boolean"
-                },
-                "profile_image_url_https": {
-                    "type": "string"
-                },
-                "profile_background_image_url": {
-                    "type": "string"
-                },
-                "profile_background_image_url_https": {
-                    "type": "string"
-                },
-                "follow_request_sent": {
-                    "type": "boolean"
-                },
-                "url": {
-                    "type": "string"
-                },
-                "utc_offset": {
-                    "ignore_malformed": false,
-                    "type": "integer"
-                },
-                "time_zone": {
-                    "type": "string"
-                },
-                "profile_use_background_image": {
-                    "type": "boolean"
-                },
-                "friends_count": {
-                    "ignore_malformed": false,
-                    "type": "integer"
-                },
-                "profile_sidebar_fill_color": {
-                    "type": "string"
-                },
-                "screen_name": {
-                    "type": "string"
-                },
-                "id_str": {
-                    "type": "string"
-                },
-                "profile_image_url": {
-                    "type": "string"
-                },
-                "is_translator": {
-                    "type": "boolean"
-                },
-                "listed_count": {
-                    "ignore_malformed": false,
-                    "type": "integer"
-                }
-            }
+            "$ref": "User.json"
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/SimpleTweetTest.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/SimpleTweetTest.java b/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/SimpleTweetTest.java
deleted file mode 100644
index 6b62fe3..0000000
--- a/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/SimpleTweetTest.java
+++ /dev/null
@@ -1,121 +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
- *
- *   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.streams.twitter.test;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
-import org.apache.streams.core.StreamsDatum;
-import org.apache.streams.exceptions.ActivitySerializerException;
-import org.apache.streams.jackson.StreamsJacksonMapper;
-import org.apache.streams.jackson.TypeConverterProcessor;
-import org.apache.streams.pojo.json.Activity;
-import org.apache.streams.twitter.pojo.Delete;
-import org.apache.streams.twitter.pojo.Retweet;
-import org.apache.streams.twitter.pojo.Tweet;
-import org.apache.streams.twitter.serializer.StreamsTwitterMapper;
-import org.apache.streams.twitter.serializer.TwitterJsonActivitySerializer;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-/**
-* Created with IntelliJ IDEA.
-* User: sblackmon
-* Date: 8/20/13
-* Time: 5:57 PM
-* To change this template use File | Settings | File Templates.
-*/
-public class SimpleTweetTest {
-
-    private final static Logger LOGGER = LoggerFactory.getLogger(SimpleTweetTest.class);
-
-    private ObjectMapper mapper = StreamsJacksonMapper.getInstance(Lists.newArrayList(StreamsTwitterMapper.TWITTER_FORMAT));
-
-    private static final String TWITTER_JSON= "{\"created_at\":\"Wed Dec 11 22:27:34 +0000 2013\",\"id\":410898682356047872,\"id_str\":\"410898682356047872\",\"text\":\"RT @ughhblog: RRome (Brooklyn, NY) \\u2013 MY GIRL http:\\/\\/t.co\\/x6uxX9PLsH via @indierapblog @RRoseRRome\",\"source\":\"\\u003ca href=\\\"https:\\/\\/about.twitter.com\\/products\\/tweetdeck\\\" rel=\\\"nofollow\\\"\\u003eTweetDeck\\u003c\\/a\\u003e\",\"truncated\":false,\"in_reply_to_status_id\":null,\"in_reply_to_status_id_str\":null,\"in_reply_to_user_id\":null,\"in_reply_to_user_id_str\":null,\"in_reply_to_screen_name\":null,\"user\":{\"id\":70463906,\"id_str\":\"70463906\",\"name\":\"MHM DESIGNS, LLC\",\"screen_name\":\"MHMDESIGNS\",\"location\":\"Los Angeles New York\",\"url\":\"http:\\/\\/www.mhmdesigns.com\",\"description\":\"Multi Media Made Simple- Web desig, Graphic Design, Internet Marketing, Photography, Video Production and much much more.\",\"protected\":false,\"followers_count\":10,\"friends_coun
 t\":64,\"listed_count\":1,\"created_at\":\"Mon Aug 31 18:31:54 +0000 2009\",\"favourites_count\":0,\"utc_offset\":-28800,\"time_zone\":\"Pacific Time (US & Canada)\",\"geo_enabled\":false,\"verified\":false,\"statuses_count\":87,\"lang\":\"en\",\"contributors_enabled\":false,\"is_translator\":false,\"profile_background_color\":\"9AE4E8\",\"profile_background_image_url\":\"http:\\/\\/a0.twimg.com\\/profile_background_images\\/33456434\\/body.png\",\"profile_background_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_background_images\\/33456434\\/body.png\",\"profile_background_tile\":false,\"profile_image_url\":\"http:\\/\\/pbs.twimg.com\\/profile_images\\/391494416\\/mhm_design_logo__normal.png\",\"profile_image_url_https\":\"https:\\/\\/pbs.twimg.com\\/profile_images\\/391494416\\/mhm_design_logo__normal.png\",\"profile_link_color\":\"0084B4\",\"profile_sidebar_border_color\":\"BDDCAD\",\"profile_sidebar_fill_color\":\"DDFFCC\",\"profile_text_color\":\"333333\",\"profile_us
 e_background_image\":true,\"default_profile\":false,\"default_profile_image\":false,\"following\":null,\"follow_request_sent\":null,\"notifications\":null},\"geo\":null,\"coordinates\":null,\"place\":null,\"contributors\":null,\"retweeted_status\":{\"created_at\":\"Wed Dec 11 10:56:49 +0000 2013\",\"id\":410724848306892800,\"id_str\":\"410724848306892800\",\"text\":\"RRome (Brooklyn, NY) \\u2013 MY GIRL http:\\/\\/t.co\\/x6uxX9PLsH via @indierapblog @RRoseRRome\",\"source\":\"\\u003ca href=\\\"http:\\/\\/twitter.com\\/tweetbutton\\\" rel=\\\"nofollow\\\"\\u003eTweet Button\\u003c\\/a\\u003e\",\"truncated\":false,\"in_reply_to_status_id\":null,\"in_reply_to_status_id_str\":null,\"in_reply_to_user_id\":null,\"in_reply_to_user_id_str\":null,\"in_reply_to_screen_name\":null,\"user\":{\"id\":538836510,\"id_str\":\"538836510\",\"name\":\"UGHHBlog\",\"screen_name\":\"ughhblog\",\"location\":\"Los Angeles\",\"url\":\"http:\\/\\/www.undergroundhiphopblog.com\",\"description\":\"http:\\/\\/UN
 DERGROUNDHIPHOPBLOG.com: A top Indie\\/Underground Hip Hop community blog. Submission Email: ughhblog@gmail.com \\/\\/\\/ Official Host: @pawz1\",\"protected\":false,\"followers_count\":2598,\"friends_count\":373,\"listed_count\":25,\"created_at\":\"Wed Mar 28 05:40:49 +0000 2012\",\"favourites_count\":423,\"utc_offset\":-28800,\"time_zone\":\"Pacific Time (US & Canada)\",\"geo_enabled\":false,\"verified\":false,\"statuses_count\":9623,\"lang\":\"en\",\"contributors_enabled\":false,\"is_translator\":false,\"profile_background_color\":\"131516\",\"profile_background_image_url\":\"http:\\/\\/a0.twimg.com\\/profile_background_images\\/544717772\\/UGHHBlogLogo.jpg\",\"profile_background_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_background_images\\/544717772\\/UGHHBlogLogo.jpg\",\"profile_background_tile\":false,\"profile_image_url\":\"http:\\/\\/pbs.twimg.com\\/profile_images\\/2583702975\\/uas8528qzzdlnsb7igzn_normal.jpeg\",\"profile_image_url_https\":\"https:\\/\\/pbs.tw
 img.com\\/profile_images\\/2583702975\\/uas8528qzzdlnsb7igzn_normal.jpeg\",\"profile_link_color\":\"009999\",\"profile_sidebar_border_color\":\"EEEEEE\",\"profile_sidebar_fill_color\":\"EFEFEF\",\"profile_text_color\":\"333333\",\"profile_use_background_image\":true,\"default_profile\":false,\"default_profile_image\":false,\"following\":null,\"follow_request_sent\":null,\"notifications\":null},\"geo\":null,\"coordinates\":null,\"place\":null,\"contributors\":null,\"retweet_count\":4,\"favorite_count\":0,\"entities\":{\"hashtags\":[],\"symbols\":[],\"urls\":[{\"url\":\"http:\\/\\/t.co\\/x6uxX9PLsH\",\"expanded_url\":\"http:\\/\\/indierapblog.com\\/rrome-brooklyn-ny-my-girl\\/\",\"display_url\":\"indierapblog.com\\/rrome-brooklyn\\u2026\",\"indices\":[31,53]}],\"user_mentions\":[{\"screen_name\":\"IndieRapBlog\",\"name\":\"IndieRapBlog.com\",\"id\":922776728,\"id_str\":\"922776728\",\"indices\":[58,71]},{\"screen_name\":\"RRoseRRome\",\"name\":\"RRome\",\"id\":76371478,\"id_str\":\"76
 371478\",\"indices\":[72,83]}]},\"favorited\":false,\"retweeted\":false,\"possibly_sensitive\":false,\"lang\":\"en\"},\"retweet_count\":0,\"favorite_count\":0,\"entities\":{\"hashtags\":[],\"symbols\":[],\"urls\":[{\"url\":\"http:\\/\\/t.co\\/x6uxX9PLsH\",\"expanded_url\":\"http:\\/\\/indierapblog.com\\/rrome-brooklyn-ny-my-girl\\/\",\"display_url\":\"indierapblog.com\\/rrome-brooklyn\\u2026\",\"indices\":[45,67]}],\"user_mentions\":[{\"screen_name\":\"ughhblog\",\"name\":\"UGHHBlog\",\"id\":538836510,\"id_str\":\"538836510\",\"indices\":[3,12]},{\"screen_name\":\"IndieRapBlog\",\"name\":\"IndieRapBlog.com\",\"id\":922776728,\"id_str\":\"922776728\",\"indices\":[72,85]},{\"screen_name\":\"RRoseRRome\",\"name\":\"RRome\",\"id\":76371478,\"id_str\":\"76371478\",\"indices\":[86,97]}]},\"favorited\":false,\"retweeted\":false,\"possibly_sensitive\":false,\"filter_level\":\"medium\",\"lang\":\"en\"}";
-
-    private TwitterJsonActivitySerializer twitterJsonActivitySerializer = new TwitterJsonActivitySerializer();
-
-    @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 = SimpleTweetTest.class.getResourceAsStream("/testtweets.txt");
-        InputStreamReader isr = new InputStreamReader(is);
-        BufferedReader br = new BufferedReader(isr);
-
-        ObjectNode event = null;
-        try {
-            event = (ObjectNode) mapper.readTree(TWITTER_JSON);
-        } catch (IOException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-
-        assertThat(event, is(not(nullValue())));
-
-        Tweet tweet = mapper.convertValue(event, Tweet.class);
-
-        assertThat(tweet, is(not(nullValue())));
-        assertThat(tweet.getCreatedAt(), is(not(nullValue())));
-        assertThat(tweet.getText(), is(not(nullValue())));
-        assertThat(tweet.getUser(), is(not(nullValue())));
-
-        Activity activity = null;
-        try {
-            activity = twitterJsonActivitySerializer.deserialize(TWITTER_JSON);
-        } catch (ActivitySerializerException e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-
-        try {
-            TypeConverterProcessor converter = new TypeConverterProcessor(String.class, Activity.class);
-            converter.prepare(null);
-            converter.process(new StreamsDatum(TWITTER_JSON));
-        } catch (Throwable e) {
-            e.printStackTrace();
-            Assert.fail();
-        }
-
-        assertThat(activity, is(not(nullValue())));
-
-        assertThat(activity.getId(), is(not(nullValue())));
-        assertThat(activity.getActor(), is(not(nullValue())));
-        assertThat(activity.getActor().getId(), is(not(nullValue())));
-        assertThat(activity.getVerb(), is(not(nullValue())));
-        assertThat(activity.getProvider(), is(not(nullValue())));
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TweetActivitySerDeTest.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TweetActivitySerDeTest.java b/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TweetActivitySerDeTest.java
deleted file mode 100644
index d6af4d9..0000000
--- a/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TweetActivitySerDeTest.java
+++ /dev/null
@@ -1,139 +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
- *
- *   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.streams.twitter.test;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang.StringUtils;
-import org.apache.streams.jackson.StreamsJacksonMapper;
-import org.apache.streams.pojo.json.Activity;
-import org.apache.streams.twitter.pojo.Retweet;
-import org.apache.streams.twitter.pojo.Tweet;
-import org.apache.streams.twitter.provider.TwitterEventClassifier;
-import org.apache.streams.twitter.serializer.StreamsTwitterMapper;
-import org.apache.streams.twitter.serializer.TwitterJsonActivitySerializer;
-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;
-
-import static java.util.regex.Pattern.matches;
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-/**
-* Created with IntelliJ IDEA.
-* User: sblackmon
-* Date: 8/20/13
-* Time: 5:57 PM
-* To change this template use File | Settings | File Templates.
-*/
-public class TweetActivitySerDeTest {
-
-    private final static Logger LOGGER = LoggerFactory.getLogger(TweetActivitySerDeTest.class);
-
-    private ObjectMapper mapper = StreamsJacksonMapper.getInstance(Lists.newArrayList(StreamsTwitterMapper.TWITTER_FORMAT));
-
-    private TwitterJsonActivitySerializer twitterJsonActivitySerializer = new TwitterJsonActivitySerializer();
-
-    @Test
-    public void Tests()
-    {
-        InputStream is = TweetActivitySerDeTest.class.getResourceAsStream("/testtweets.txt");
-        InputStreamReader isr = new InputStreamReader(is);
-        BufferedReader br = new BufferedReader(isr);
-
-        try {
-            while (br.ready()) {
-                String line = br.readLine();
-                if(!StringUtils.isEmpty(line))
-                {
-                    LOGGER.info("raw: {}", line);
-
-                    Class detected = TwitterEventClassifier.detectClass(line);
-
-                    Activity activity = twitterJsonActivitySerializer.deserialize(line);
-
-                    String activitystring = mapper.writeValueAsString(activity);
-
-                    LOGGER.info("activity: {}", activitystring);
-
-                    assertThat(activity, is(not(nullValue())));
-
-                    assertThat(activity.getId(), is(not(nullValue())));
-                    assertThat(activity.getActor(), is(not(nullValue())));
-                    assertThat(activity.getActor().getId(), is(not(nullValue())));
-                    assertThat(activity.getVerb(), is(not(nullValue())));
-                    assertThat(activity.getProvider(), is(not(nullValue())));
-
-                    if( detected == Tweet.class ) {
-
-                        assertEquals(activity.getVerb(), "post");
-
-                        Tweet tweet = mapper.readValue(line, Tweet.class);
-
-                        if( tweet.getEntities() != null &&
-                            tweet.getEntities().getUrls() != null &&
-                            tweet.getEntities().getUrls().size() > 0 ) {
-
-
-                            assertThat(activity.getLinks(), is(not(nullValue())));
-                            assertEquals(tweet.getEntities().getUrls().size(), activity.getLinks().size());
-                        }
-
-                    } else if( detected == Retweet.class ) {
-
-                        Retweet retweet = mapper.readValue(line, Retweet.class);
-
-                        assertThat(retweet.getRetweetedStatus(), is(not(nullValue())));
-
-                        assertEquals(activity.getVerb(), "share");
-
-                        assertThat(activity.getObject(), is(not(nullValue())));
-                        assertThat(activity.getObject().getObjectType(), is(not(nullValue())));
-                        assertThat(activity.getObject().getObjectType(), is(not(nullValue())));
-
-                        if( retweet.getRetweetedStatus().getEntities() != null &&
-                            retweet.getRetweetedStatus().getEntities().getUrls() != null &&
-                            retweet.getRetweetedStatus().getEntities().getUrls().size() > 0 ) {
-
-                            assertThat(activity.getLinks(), is(not(nullValue())));
-                            assertEquals(retweet.getRetweetedStatus().getEntities().getUrls().size(), activity.getLinks().size());
-                        }
-
-                    }
-
-
-
-                }
-            }
-        } catch( Exception e ) {
-            System.out.println(e);
-            e.printStackTrace();
-            Assert.fail();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TweetSerDeTest.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TweetSerDeTest.java b/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TweetSerDeTest.java
deleted file mode 100644
index eba5fd0..0000000
--- a/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TweetSerDeTest.java
+++ /dev/null
@@ -1,140 +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
- *
- *   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.streams.twitter.test;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang.StringUtils;
-import org.apache.streams.jackson.StreamsJacksonMapper;
-import org.apache.streams.pojo.json.Activity;
-import org.apache.streams.twitter.pojo.Delete;
-import org.apache.streams.twitter.pojo.Retweet;
-import org.apache.streams.twitter.pojo.Tweet;
-import org.apache.streams.twitter.provider.TwitterEventClassifier;
-import org.apache.streams.twitter.serializer.*;
-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;
-
-import static java.util.regex.Pattern.matches;
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-/**
-* Created with IntelliJ IDEA.
-* User: sblackmon
-* Date: 8/20/13
-* Time: 5:57 PM
-* To change this template use File | Settings | File Templates.
-*/
-public class TweetSerDeTest {
-
-    private final static Logger LOGGER = LoggerFactory.getLogger(TweetSerDeTest.class);
-
-    private ObjectMapper mapper = StreamsJacksonMapper.getInstance(Lists.newArrayList(StreamsTwitterMapper.TWITTER_FORMAT));
-
-    private TwitterJsonActivitySerializer twitterJsonActivitySerializer = new TwitterJsonActivitySerializer();
-
-    @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 = TweetSerDeTest.class.getResourceAsStream("/testtweets.txt");
-        InputStreamReader isr = new InputStreamReader(is);
-        BufferedReader br = new BufferedReader(isr);
-
-        int tweetlinks = 0;
-        int retweetlinks = 0;
-
-        try {
-            while (br.ready()) {
-                String line = br.readLine();
-                if(!StringUtils.isEmpty(line))
-                {
-                    LOGGER.info("raw: {}", line);
-
-                    Class detected = TwitterEventClassifier.detectClass(line);
-
-                    ObjectNode event = (ObjectNode) mapper.readTree(line);
-
-                    assertThat(event, is(not(nullValue())));
-
-                    if( detected == Tweet.class ) {
-
-                        Tweet tweet = mapper.convertValue(event, Tweet.class);
-
-                        assertThat(tweet, is(not(nullValue())));
-                        assertThat(tweet.getCreatedAt(), is(not(nullValue())));
-                        assertThat(tweet.getText(), is(not(nullValue())));
-                        assertThat(tweet.getUser(), is(not(nullValue())));
-
-                        tweetlinks += Optional.fromNullable(tweet.getEntities().getUrls().size()).or(0);
-
-                    } else if( detected == Retweet.class ) {
-
-                        Retweet retweet = mapper.convertValue(event, Retweet.class);
-
-                        assertThat(retweet.getRetweetedStatus(), is(not(nullValue())));
-                        assertThat(retweet.getRetweetedStatus().getCreatedAt(), is(not(nullValue())));
-                        assertThat(retweet.getRetweetedStatus().getText(), is(not(nullValue())));
-                        assertThat(retweet.getRetweetedStatus().getUser(), is(not(nullValue())));
-                        assertThat(retweet.getRetweetedStatus().getUser().getId(), is(not(nullValue())));
-                        assertThat(retweet.getRetweetedStatus().getUser().getCreatedAt(), is(not(nullValue())));
-
-                        retweetlinks += Optional.fromNullable(retweet.getRetweetedStatus().getEntities().getUrls().size()).or(0);
-
-                    } else if( detected == Delete.class ) {
-
-                        Delete delete = mapper.convertValue(event, Delete.class);
-
-                        assertThat(delete.getDelete(), is(not(nullValue())));
-                        assertThat(delete.getDelete().getStatus(), is(not(nullValue())));
-                        assertThat(delete.getDelete().getStatus().getId(), is(not(nullValue())));
-                        assertThat(delete.getDelete().getStatus().getUserId(), is(not(nullValue())));
-
-                    } else {
-                        Assert.fail();
-                    }
-
-                }
-            }
-        } catch( Exception e ) {
-            System.out.println(e);
-            e.printStackTrace();
-            Assert.fail();
-        }
-
-        assertThat(tweetlinks, is(greaterThan(0)));
-        assertThat(retweetlinks, is(greaterThan(0)));
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TwitterActivityConverterProcessorTest.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TwitterActivityConverterProcessorTest.java b/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TwitterActivityConverterProcessorTest.java
new file mode 100644
index 0000000..61a3a6b
--- /dev/null
+++ b/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TwitterActivityConverterProcessorTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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
+ *
+ *   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.streams.twitter.test;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Lists;
+import org.apache.streams.converter.ActivityConverterProcessor;
+import org.apache.streams.converter.ActivityConverterProcessorConfiguration;
+import org.apache.streams.core.StreamsDatum;
+import org.apache.streams.jackson.StreamsJacksonMapper;
+import org.apache.streams.pojo.json.Activity;
+import org.apache.streams.twitter.pojo.Retweet;
+import org.apache.streams.twitter.converter.StreamsTwitterMapper;
+import org.apache.streams.twitter.converter.TwitterDocumentClassifier;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
+/**
+* Created with IntelliJ IDEA.
+* User: sblackmon
+* Date: 8/20/13
+* Time: 5:57 PM
+* To change this template use File | Settings | File Templates.
+*/
+public class TwitterActivityConverterProcessorTest {
+
+    private final static Logger LOGGER = LoggerFactory.getLogger(TwitterActivityConverterProcessorTest.class);
+
+    private ObjectMapper mapper = StreamsJacksonMapper.getInstance(Lists.newArrayList(StreamsTwitterMapper.TWITTER_FORMAT));
+
+    private static final String TWITTER_JSON= "{\"created_at\":\"Wed Dec 11 22:27:34 +0000 2013\",\"id\":410898682356047872,\"id_str\":\"410898682356047872\",\"text\":\"RT @ughhblog: RRome (Brooklyn, NY) \\u2013 MY GIRL http:\\/\\/t.co\\/x6uxX9PLsH via @indierapblog @RRoseRRome\",\"source\":\"\\u003ca href=\\\"https:\\/\\/about.twitter.com\\/products\\/tweetdeck\\\" rel=\\\"nofollow\\\"\\u003eTweetDeck\\u003c\\/a\\u003e\",\"truncated\":false,\"in_reply_to_status_id\":null,\"in_reply_to_status_id_str\":null,\"in_reply_to_user_id\":null,\"in_reply_to_user_id_str\":null,\"in_reply_to_screen_name\":null,\"user\":{\"id\":70463906,\"id_str\":\"70463906\",\"name\":\"MHM DESIGNS, LLC\",\"screen_name\":\"MHMDESIGNS\",\"location\":\"Los Angeles New York\",\"url\":\"http:\\/\\/www.mhmdesigns.com\",\"description\":\"Multi Media Made Simple- Web desig, Graphic Design, Internet Marketing, Photography, Video Production and much much more.\",\"protected\":false,\"followers_count\":10,\"friends_coun
 t\":64,\"listed_count\":1,\"created_at\":\"Mon Aug 31 18:31:54 +0000 2009\",\"favourites_count\":0,\"utc_offset\":-28800,\"time_zone\":\"Pacific Time (US & Canada)\",\"geo_enabled\":false,\"verified\":false,\"statuses_count\":87,\"lang\":\"en\",\"contributors_enabled\":false,\"is_translator\":false,\"profile_background_color\":\"9AE4E8\",\"profile_background_image_url\":\"http:\\/\\/a0.twimg.com\\/profile_background_images\\/33456434\\/body.png\",\"profile_background_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_background_images\\/33456434\\/body.png\",\"profile_background_tile\":false,\"profile_image_url\":\"http:\\/\\/pbs.twimg.com\\/profile_images\\/391494416\\/mhm_design_logo__normal.png\",\"profile_image_url_https\":\"https:\\/\\/pbs.twimg.com\\/profile_images\\/391494416\\/mhm_design_logo__normal.png\",\"profile_link_color\":\"0084B4\",\"profile_sidebar_border_color\":\"BDDCAD\",\"profile_sidebar_fill_color\":\"DDFFCC\",\"profile_text_color\":\"333333\",\"profile_us
 e_background_image\":true,\"default_profile\":false,\"default_profile_image\":false,\"following\":null,\"follow_request_sent\":null,\"notifications\":null},\"geo\":null,\"coordinates\":null,\"place\":null,\"contributors\":null,\"retweeted_status\":{\"created_at\":\"Wed Dec 11 10:56:49 +0000 2013\",\"id\":410724848306892800,\"id_str\":\"410724848306892800\",\"text\":\"RRome (Brooklyn, NY) \\u2013 MY GIRL http:\\/\\/t.co\\/x6uxX9PLsH via @indierapblog @RRoseRRome\",\"source\":\"\\u003ca href=\\\"http:\\/\\/twitter.com\\/tweetbutton\\\" rel=\\\"nofollow\\\"\\u003eTweet Button\\u003c\\/a\\u003e\",\"truncated\":false,\"in_reply_to_status_id\":null,\"in_reply_to_status_id_str\":null,\"in_reply_to_user_id\":null,\"in_reply_to_user_id_str\":null,\"in_reply_to_screen_name\":null,\"user\":{\"id\":538836510,\"id_str\":\"538836510\",\"name\":\"UGHHBlog\",\"screen_name\":\"ughhblog\",\"location\":\"Los Angeles\",\"url\":\"http:\\/\\/www.undergroundhiphopblog.com\",\"description\":\"http:\\/\\/UN
 DERGROUNDHIPHOPBLOG.com: A top Indie\\/Underground Hip Hop community blog. Submission Email: ughhblog@gmail.com \\/\\/\\/ Official Host: @pawz1\",\"protected\":false,\"followers_count\":2598,\"friends_count\":373,\"listed_count\":25,\"created_at\":\"Wed Mar 28 05:40:49 +0000 2012\",\"favourites_count\":423,\"utc_offset\":-28800,\"time_zone\":\"Pacific Time (US & Canada)\",\"geo_enabled\":false,\"verified\":false,\"statuses_count\":9623,\"lang\":\"en\",\"contributors_enabled\":false,\"is_translator\":false,\"profile_background_color\":\"131516\",\"profile_background_image_url\":\"http:\\/\\/a0.twimg.com\\/profile_background_images\\/544717772\\/UGHHBlogLogo.jpg\",\"profile_background_image_url_https\":\"https:\\/\\/si0.twimg.com\\/profile_background_images\\/544717772\\/UGHHBlogLogo.jpg\",\"profile_background_tile\":false,\"profile_image_url\":\"http:\\/\\/pbs.twimg.com\\/profile_images\\/2583702975\\/uas8528qzzdlnsb7igzn_normal.jpeg\",\"profile_image_url_https\":\"https:\\/\\/pbs.tw
 img.com\\/profile_images\\/2583702975\\/uas8528qzzdlnsb7igzn_normal.jpeg\",\"profile_link_color\":\"009999\",\"profile_sidebar_border_color\":\"EEEEEE\",\"profile_sidebar_fill_color\":\"EFEFEF\",\"profile_text_color\":\"333333\",\"profile_use_background_image\":true,\"default_profile\":false,\"default_profile_image\":false,\"following\":null,\"follow_request_sent\":null,\"notifications\":null},\"geo\":null,\"coordinates\":null,\"place\":null,\"contributors\":null,\"retweet_count\":4,\"favorite_count\":0,\"entities\":{\"hashtags\":[],\"symbols\":[],\"urls\":[{\"url\":\"http:\\/\\/t.co\\/x6uxX9PLsH\",\"expanded_url\":\"http:\\/\\/indierapblog.com\\/rrome-brooklyn-ny-my-girl\\/\",\"display_url\":\"indierapblog.com\\/rrome-brooklyn\\u2026\",\"indices\":[31,53]}],\"user_mentions\":[{\"screen_name\":\"IndieRapBlog\",\"name\":\"IndieRapBlog.com\",\"id\":922776728,\"id_str\":\"922776728\",\"indices\":[58,71]},{\"screen_name\":\"RRoseRRome\",\"name\":\"RRome\",\"id\":76371478,\"id_str\":\"76
 371478\",\"indices\":[72,83]}]},\"favorited\":false,\"retweeted\":false,\"possibly_sensitive\":false,\"lang\":\"en\"},\"retweet_count\":0,\"favorite_count\":0,\"entities\":{\"hashtags\":[],\"symbols\":[],\"urls\":[{\"url\":\"http:\\/\\/t.co\\/x6uxX9PLsH\",\"expanded_url\":\"http:\\/\\/indierapblog.com\\/rrome-brooklyn-ny-my-girl\\/\",\"display_url\":\"indierapblog.com\\/rrome-brooklyn\\u2026\",\"indices\":[45,67]}],\"user_mentions\":[{\"screen_name\":\"ughhblog\",\"name\":\"UGHHBlog\",\"id\":538836510,\"id_str\":\"538836510\",\"indices\":[3,12]},{\"screen_name\":\"IndieRapBlog\",\"name\":\"IndieRapBlog.com\",\"id\":922776728,\"id_str\":\"922776728\",\"indices\":[72,85]},{\"screen_name\":\"RRoseRRome\",\"name\":\"RRome\",\"id\":76371478,\"id_str\":\"76371478\",\"indices\":[86,97]}]},\"favorited\":false,\"retweeted\":false,\"possibly_sensitive\":false,\"filter_level\":\"medium\",\"lang\":\"en\"}";
+
+    @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 = TwitterActivityConverterProcessorTest.class.getResourceAsStream("/testtweets.txt");
+        InputStreamReader isr = new InputStreamReader(is);
+        BufferedReader br = new BufferedReader(isr);
+
+        ObjectNode event = null;
+        try {
+            event = (ObjectNode) mapper.readTree(TWITTER_JSON);
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+
+        assertThat(event, is(not(nullValue())));
+
+        Retweet retweet = mapper.convertValue(event, Retweet.class);
+
+        assertThat(retweet, is(not(nullValue())));
+        assertThat(retweet.getCreatedAt(), is(not(nullValue())));
+        assertThat(retweet.getText(), is(not(nullValue())));
+        assertThat(retweet.getUser(), is(not(nullValue())));
+        assertThat(retweet.getRetweetedStatus(), is(not(nullValue())));
+
+        Activity activity = null;
+        try {
+            ActivityConverterProcessorConfiguration converterProcessorConfiguration =
+                    new ActivityConverterProcessorConfiguration()
+                            .withClassifiers((List) Lists.newArrayList(new TwitterDocumentClassifier()));
+            ActivityConverterProcessor converter = new ActivityConverterProcessor(converterProcessorConfiguration);
+            converter.prepare(converterProcessorConfiguration);
+            List<StreamsDatum> result = converter.process(new StreamsDatum(TWITTER_JSON));
+            activity = (Activity)result.get(0).getDocument();
+        } catch (Throwable e) {
+            e.printStackTrace();
+            Assert.fail();
+        }
+
+        assertThat(activity, is(not(nullValue())));
+
+        assertThat(activity.getId(), is(not(nullValue())));
+        assertThat(activity.getActor(), is(not(nullValue())));
+        assertThat(activity.getActor().getId(), is(not(nullValue())));
+        assertThat(activity.getVerb(), is(not(nullValue())));
+        assertThat(activity.getProvider(), is(not(nullValue())));
+        assertThat(activity.getObject(), is(not(nullValue())));
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2cc6118f/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TwitterActivityConvertersTest.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TwitterActivityConvertersTest.java b/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TwitterActivityConvertersTest.java
new file mode 100644
index 0000000..a8f5d86
--- /dev/null
+++ b/streams-contrib/streams-provider-twitter/src/test/java/org/apache/streams/twitter/test/TwitterActivityConvertersTest.java
@@ -0,0 +1,149 @@
+/*
+ * 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
+ *
+ *   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.streams.twitter.test;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang.StringUtils;
+import org.apache.streams.converter.TypeConverterUtil;
+import org.apache.streams.data.ActivityConverter;
+import org.apache.streams.jackson.StreamsJacksonMapper;
+import org.apache.streams.pojo.json.Activity;
+import org.apache.streams.twitter.pojo.Retweet;
+import org.apache.streams.twitter.pojo.Tweet;
+import org.apache.streams.twitter.converter.TwitterDocumentClassifier;
+import org.apache.streams.twitter.converter.StreamsTwitterMapper;
+import org.apache.streams.twitter.converter.TwitterJsonRetweetActivityConverter;
+import org.apache.streams.twitter.converter.TwitterJsonTweetActivityConverter;
+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;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+/**
+* Created with IntelliJ IDEA.
+* User: sblackmon
+* Date: 8/20/13
+* Time: 5:57 PM
+* To change this template use File | Settings | File Templates.
+*/
+public class TwitterActivityConvertersTest {
+
+    private final static Logger LOGGER = LoggerFactory.getLogger(TwitterActivityConvertersTest.class);
+
+    private ObjectMapper mapper = StreamsJacksonMapper.getInstance(StreamsTwitterMapper.TWITTER_FORMAT);
+
+    @Test
+    public void Tests()
+    {
+        InputStream is = TwitterActivityConvertersTest.class.getResourceAsStream("/testtweets.txt");
+        InputStreamReader isr = new InputStreamReader(is);
+        BufferedReader br = new BufferedReader(isr);
+
+        ActivityConverter activityConverter;
+
+        try {
+            while (br.ready()) {
+                String line = br.readLine();
+                if(!StringUtils.isEmpty(line))
+                {
+                    LOGGER.info("raw: {}", line);
+
+                    Class detected = new TwitterDocumentClassifier().detectClasses(line).get(0);
+
+                    if( detected == Tweet.class ) {
+                        activityConverter = new TwitterJsonTweetActivityConverter();
+                    } else if( detected == Retweet.class ) {
+                        activityConverter = new TwitterJsonRetweetActivityConverter();
+                    } else {
+                        Assert.fail();
+                        return;
+                    }
+
+                    Object typedObject = TypeConverterUtil.convert(line, detected, mapper);
+
+                    Activity activity = (Activity) activityConverter.toActivityList(typedObject).get(0);
+
+                    String activitystring = mapper.writeValueAsString(activity);
+
+                    LOGGER.info("activity: {}", activitystring);
+
+                    assertThat(activity, is(not(nullValue())));
+
+                    assertThat(activity.getId(), is(not(nullValue())));
+                    assertThat(activity.getActor(), is(not(nullValue())));
+                    assertThat(activity.getActor().getId(), is(not(nullValue())));
+                    assertThat(activity.getVerb(), is(not(nullValue())));
+                    assertThat(activity.getProvider(), is(not(nullValue())));
+
+                    if( detected == Tweet.class ) {
+
+                        assertEquals(activity.getVerb(), "post");
+
+                        Tweet tweet = mapper.readValue(line, Tweet.class);
+
+                        if( tweet.getEntities() != null &&
+                            tweet.getEntities().getUrls() != null &&
+                            tweet.getEntities().getUrls().size() > 0 ) {
+
+
+                            assertThat(activity.getLinks(), is(not(nullValue())));
+                            assertEquals(tweet.getEntities().getUrls().size(), activity.getLinks().size());
+                        }
+
+                    } else if( detected == Retweet.class ) {
+
+                        Retweet retweet = mapper.readValue(line, Retweet.class);
+
+                        assertThat(retweet.getRetweetedStatus(), is(not(nullValue())));
+
+                        assertEquals(activity.getVerb(), "share");
+
+                        assertThat(activity.getObject(), is(not(nullValue())));
+                        assertThat(activity.getObject().getObjectType(), is(not(nullValue())));
+                        assertThat(activity.getObject().getObjectType(), is(not(nullValue())));
+
+                        if( retweet.getRetweetedStatus().getEntities() != null &&
+                            retweet.getRetweetedStatus().getEntities().getUrls() != null &&
+                            retweet.getRetweetedStatus().getEntities().getUrls().size() > 0 ) {
+
+                            assertThat(activity.getLinks(), is(not(nullValue())));
+                            assertEquals(retweet.getRetweetedStatus().getEntities().getUrls().size(), activity.getLinks().size());
+                        }
+
+                    }
+
+
+
+                }
+            }
+        } catch( Exception e ) {
+            System.out.println(e);
+            e.printStackTrace();
+            Assert.fail();
+        }
+    }
+}