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 2016/11/18 01:00:37 UTC

incubator-streams git commit: STREAMS-457: update page schema and converter to match api v2.8

Repository: incubator-streams
Updated Branches:
  refs/heads/master f597411a0 -> 9e6ed3e38


STREAMS-457: update page schema and converter to match api v2.8


Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/9e6ed3e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/9e6ed3e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/9e6ed3e3

Branch: refs/heads/master
Commit: 9e6ed3e389fa55f3714391a5ef3d570ab06e870f
Parents: f597411
Author: Steve Blackmon @steveblackmon <sb...@apache.org>
Authored: Wed Nov 16 19:07:44 2016 +0100
Committer: Steve Blackmon @steveblackmon <sb...@apache.org>
Committed: Wed Nov 16 19:07:44 2016 +0100

----------------------------------------------------------------------
 .../serializer/FacebookActivityUtil.java        |   6 +-
 .../org/apache/streams/facebook/Page.json       | 184 +++++++++++++++----
 .../streams/facebook/test/SimplePageTest.java   |   4 +-
 3 files changed, 152 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9e6ed3e3/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java b/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
index e8f2fff..2cf2a7c 100644
--- a/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
+++ b/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
@@ -199,10 +199,10 @@ public class FacebookActivityUtil {
         if(location != null)
             extensions.put("location", page.getLocation().toString());
 
-        extensions.put("favorites", page.getLikes());
-        extensions.put("followers", page.getTalkingAboutCount());
+        extensions.put("favorites", page.getTalkingAboutCount());
+        extensions.put("followers", page.getFanCount());
 
-        extensions.put("screenName", page.getUsername());
+        extensions.put("facebook", page);
 
         actor.setAdditionalProperty("extensions", extensions);
     }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9e6ed3e3/streams-contrib/streams-provider-facebook/src/main/jsonschema/org/apache/streams/facebook/Page.json
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-facebook/src/main/jsonschema/org/apache/streams/facebook/Page.json b/streams-contrib/streams-provider-facebook/src/main/jsonschema/org/apache/streams/facebook/Page.json
index 6d7cdeb..72f96f3 100644
--- a/streams-contrib/streams-provider-facebook/src/main/jsonschema/org/apache/streams/facebook/Page.json
+++ b/streams-contrib/streams-provider-facebook/src/main/jsonschema/org/apache/streams/facebook/Page.json
@@ -19,152 +19,262 @@
             "required": false
         },
         "accessToken": {
-            "type": "null",
-            "id": "http://jsonschema.net/accessToken",
+            "type": "string",
+            "required": false
+        },
+        "birthday": {
+            "type": "string",
             "required": false
         },
         "category": {
             "type": "string",
-            "id": "http://jsonschema.net/category",
+            "required": false
+        },
+        "can_checkin": {
+            "type": "boolean",
+            "required": false
+        },
+        "can_post": {
+            "type": "boolean",
             "required": false
         },
         "checkins": {
             "type": "integer",
-            "id": "http://jsonschema.net/checkins",
             "required": false
         },
         "communityPage": {
             "type": "boolean",
-            "id": "http://jsonschema.net/communityPage",
             "required": false
         },
         "cover": {
             "type": "object",
-            "id": "http://jsonschema.net/cover",
             "required": false,
             "properties": {
                 "id": {
                     "type": "null",
-                    "id": "http://jsonschema.net/cover/id",
                     "required": false
                 },
                 "offsetY": {
                     "type": "number",
-                    "id": "http://jsonschema.net/cover/offsetY",
                     "required": false
                 },
                 "source": {
                     "type": "string",
-                    "id": "http://jsonschema.net/cover/source",
                     "required": false
                 }
             }
         },
-        "createdTime": {
-            "type": "null",
-            "id": "http://jsonschema.net/createdTime",
+        "display_subtext": {
+            "type": "string",
             "required": false
         },
-        "id": {
+        "displayed_message_response_time": {
             "type": "string",
-            "id": "http://jsonschema.net/id",
             "required": false
         },
-        "likes": {
+        "engagement": {
+            "type": "object",
+            "required": false,
+            "properties": {
+                "count": {
+                    "type": "integer",
+                    "required": false
+                },
+                "social_sentence": {
+                    "type": "string",
+                    "required": false
+                }
+            }
+        },
+        "fan_count": {
             "type": "integer",
-            "id": "http://jsonschema.net/likes",
+            "required": false
+        },
+        "founded": {
+            "type": "string",
+            "required": false
+        },
+        "general_info": {
+            "type": "string",
+            "required": false
+        },
+        "global_brand_root_id": {
+            "type": "string",
+            "required": false
+        },
+        "id": {
+            "type": "string",
+            "required": false
+        },
+        "is_community_page": {
+            "type": "boolean",
+            "required": false
+        },
+        "is_always_open": {
+            "type": "boolean",
+            "required": false
+        },
+        "is_permanently_closed": {
+            "type": "boolean",
+            "required": false
+        },
+        "is_published": {
+            "type": "boolean",
+            "required": false
+        },
+        "is_unclaimed": {
+            "type": "boolean",
+            "required": false
+        },
+        "is_webhooks_subscribed": {
+            "type": "boolean",
+            "required": false
+        },
+        "leadgen_tos_accepted": {
+            "type": "boolean",
             "required": false
         },
         "link": {
             "type": "string",
-            "id": "http://jsonschema.net/link",
             "required": false
         },
         "location": {
             "type": "object",
-            "id": "http://jsonschema.net/location",
             "required": false,
             "properties": {
                 "city": {
                     "type": "string",
-                    "id": "http://jsonschema.net/location/city",
                     "required": false
                 },
                 "country": {
                     "type": "string",
-                    "id": "http://jsonschema.net/location/country",
                     "required": false
                 },
                 "latitude": {
                     "type": "null",
-                    "id": "http://jsonschema.net/location/latitude",
                     "required": false
                 },
                 "longitude": {
                     "type": "null",
-                    "id": "http://jsonschema.net/location/longitude",
                     "required": false
                 },
                 "state": {
                     "type": "string",
-                    "id": "http://jsonschema.net/location/state",
                     "required": false
                 },
                 "street": {
                     "type": "string",
-                    "id": "http://jsonschema.net/location/street",
                     "required": false
                 },
                 "text": {
                     "type": "null",
-                    "id": "http://jsonschema.net/location/text",
                     "required": false
                 },
                 "zip": {
                     "type": "string",
-                    "id": "http://jsonschema.net/location/zip",
                     "required": false
                 }
             }
         },
-        "metadata": {
-            "type": "null",
-            "id": "http://jsonschema.net/metadata",
+        "mission": {
+            "type": "string",
             "required": false
         },
+        "parking": {
+            "type": "object",
+            "required": false,
+            "properties": {
+                "lot": {
+                    "type": "integer",
+                    "required": false
+                },
+                "street": {
+                    "type": "integer",
+                    "required": false
+                },
+                "valet": {
+                    "type": "integer",
+                    "required": false
+                }
+            }
+        },
         "name": {
             "type": "string",
             "id": "http://jsonschema.net/name",
             "required": false
         },
+        "name_with_location_descriptor": {
+            "type": "string",
+            "required": false
+        },
+        "overall_star_rating": {
+            "type": "integer",
+            "required": false
+        },
         "phone": {
             "type": "string",
-            "id": "http://jsonschema.net/phone",
             "required": false
         },
         "picture": {
             "type": "null",
-            "id": "http://jsonschema.net/picture",
             "required": false
         },
         "published": {
             "type": "boolean",
-            "id": "http://jsonschema.net/published",
             "required": false
         },
-        "talkingAboutCount": {
+        "rating_count": {
             "type": "integer",
-            "id": "http://jsonschema.net/talkingAboutCount",
+            "required": false
+        },
+        "talking_about_count": {
+            "type": "integer",
+            "required": false
+        },
+        "voip_info": {
+            "type": "object",
+            "required": false,
+            "properties": {
+                "has_mobile_app": {
+                    "type": "boolean",
+                    "required": false
+                },
+                "has_permission": {
+                    "type": "boolean",
+                    "required": false
+                },
+                "is_callable": {
+                    "type": "boolean",
+                    "required": false
+                },
+                "is_callable_webrtc": {
+                    "type": "boolean",
+                    "required": false
+                },
+                "is_pushable": {
+                    "type": "boolean",
+                    "required": false
+                },
+                "reason_code": {
+                    "type": "integer",
+                    "required": false
+                },
+                "reason_description": {
+                    "type": "string",
+                    "required": false
+                }
+            }
+        },
+        "verification_status": {
+            "type": "string",
             "required": false
         },
         "website": {
             "type": "string",
-            "id": "http://jsonschema.net/website",
             "required": false
         },
-        "wereHereCount": {
+        "were_here_count": {
             "type": "integer",
-            "id": "http://jsonschema.net/wereHereCount",
             "required": false
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/9e6ed3e3/streams-contrib/streams-provider-facebook/src/test/java/org/apache/streams/facebook/test/SimplePageTest.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-facebook/src/test/java/org/apache/streams/facebook/test/SimplePageTest.java b/streams-contrib/streams-provider-facebook/src/test/java/org/apache/streams/facebook/test/SimplePageTest.java
index 04e9143..45864ef 100644
--- a/streams-contrib/streams-provider-facebook/src/test/java/org/apache/streams/facebook/test/SimplePageTest.java
+++ b/streams-contrib/streams-provider-facebook/src/test/java/org/apache/streams/facebook/test/SimplePageTest.java
@@ -49,7 +49,7 @@ public class SimplePageTest {
     private ObjectMapper mapper = StreamsJacksonMapper.getInstance();
     private ObjectNode event;
 
-    private static final String FACEBOOK_JSON= "{\"metadata\":null,\"id\":\"id\",\"name\":\"name\",\"category\":\"Government official\",\"createdTime\":null,\"link\":\"https://www.facebook.com/facebook\",\"likes\":10246,\"location\":{\"street\":\"street\",\"city\":\"city\",\"state\":\"DC\",\"country\":\"United States\",\"zip\":\"20510\",\"latitude\":null,\"longitude\":null,\"text\":null},\"phone\":\"phone\",\"checkins\":0,\"picture\":null,\"cover\":{\"id\":null,\"source\":\"https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xpa1/v/t1.0-9/10288792_321537751334804_8200105519500362465_n.jpg?oh=fbcde9b3e1e011dfa3e699628629bc53&oe=546FB617&__gda__=1416717487_3fa5781d7d9c3d58f2bc798a36ac6fc0\",\"offsetY\":9},\"website\":\"http://usa.gov\",\"talkingAboutCount\":5034,\"accessToken\":null,\"wereHereCount\":0,\"about\":\"Welcome to the official Facebook page of ...\",\"username\":\"username\",\"published\":true,\"communityPage\":false}";
+    private static final String FACEBOOK_JSON= "{\"about\":\"The Facebook Page celebrates how our friends inspire us, support us, and help us discover the world when we connect.\",\"username\":\"facebook\",\"birthday\":\"02/04/2004\",\"category\":\"Product/Service\",\"can_checkin\":true,\"can_post\":false,\"checkins\":12,\"cover\":{\"id\":\"10154345508521729\",\"source\":\"https://scontent.xx.fbcdn.net/v/t1.0-9/s720x720/12573693_10154345508521729_8347370496501004621_n.png?oh=b75f9ec17e7e8d6c84658f5a1eb1f724&oe=58BFB505\",\"cover_id\":\"10154345508521729\",\"offset_x\":0,\"offset_y\":0},\"display_subtext\":\"12 people checked in here\",\"displayed_message_response_time\":\"AUTOMATIC\",\"engagement\":{\"count\":174813083,\"social_sentence\":\"You and 174M others like this.\"},\"fan_count\":174813083,\"founded\":\"February 4, 2004\",\"general_info\":\"Your ideas and suggestions help us to constantly improve Facebook\u2019s features. Let us know how we can improve your experience.  \\n \\n
 www.facebook.com/help/feedback\\n\",\"global_brand_root_id\":\"1499730620315598\",\"id\":\"20531316728\",\"is_community_page\":false,\"is_always_open\":false,\"is_permanently_closed\":false,\"is_published\":true,\"is_unclaimed\":false,\"is_webhooks_subscribed\":false,\"leadgen_tos_accepted\":false,\"link\":\"https://www.facebook.com/facebook/\",\"mission\":\"Founded in 2004, Facebook\u2019s mission is to give people the power to share and make the world more open and connected. People use Facebook to stay connected with friends and family, to discover what\u2019s going on in the world, and to share and express what matters to them.\",\"parking\":{\"lot\":0,\"street\":0,\"valet\":0},\"name\":\"Facebook\",\"name_with_location_descriptor\":\"Facebook\",\"overall_star_rating\":0,\"rating_count\":0,\"talking_about_count\":367210,\"voip_info\":{\"has_mobile_app\":false,\"has_permission\":false,\"is_callable\":false,\"is_callable_webrtc\":false,\"is_pushable\":false,\"reason_code\":1356044,\"rea
 son_description\":\"This person isn't available right now.\"},\"verification_status\":\"blue_verified\",\"website\":\"http://www.facebook.com\",\"were_here_count\":0,\"app_links\":{\"android\":[{\"app_name\":\"Facebook\",\"package\":\"com.facebook.katana\",\"url\":\"fb://page/20531316728\"}],\"ios\":[{\"app_name\":\"Facebook\",\"app_store_id\":\"284882215\",\"url\":\"fb://page/?id=20531316728\"}]},\"featured_video\":{\"updated_time\":\"2016-05-17T15:57:33+0000\",\"description\":\"Explore Grand Central Terminal and the stories that unfold there in the first film shot with the new Facebook Surround 360 camera. Watch the film in standard monoscopic 360 here, or find it in the Oculus Video app to watch in full 3D-360 with Gear VR.\",\"id\":\"10154659446236729\"},\"context\":{\"friends_who_like\":{\"summary\":{\"total_count\":0,\"social_sentence\":\"0 of your friends like this.\"},\"data\":[]},\"id\":\"b3Blbl9ncmFwaF9jb250ZAXh0OjIwNTMxMzE2NzI4\"},\"global_brand_page_name\":\"Facebook\",\
 "has_added_app\":false,\"is_verified\":true}\n";
 
     private FacebookPageActivitySerializer facebookPageActivitySerializer = new FacebookPageActivitySerializer();
 
@@ -75,7 +75,7 @@ public class SimplePageTest {
 
         assertThat(page, is(not(nullValue())));
         assertThat(page.getAbout(), is(not(nullValue())));
-        assertThat(page.getLikes(), is(not(nullValue())));
+        assertThat(page.getFanCount(), is(not(nullValue())));
         assertThat(page.getTalkingAboutCount(), is(not(nullValue())));
     }