mirror of https://github.com/apache/jclouds.git
updated to latest twitter schema
This commit is contained in:
parent
bff39d81f0
commit
5680ef5c1c
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed 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.jclouds.twitter.domain;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public class Location {
|
||||
private String type;
|
||||
private double[] coordinates;
|
||||
|
||||
public Location() {
|
||||
|
||||
}
|
||||
|
||||
public Location(String type, double[] coordinates) {
|
||||
this.type = type;
|
||||
this.coordinates = Arrays.copyOf(coordinates, coordinates.length);
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public double[] getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + Arrays.hashCode(coordinates);
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Location other = (Location) obj;
|
||||
if (!Arrays.equals(coordinates, other.coordinates))
|
||||
return false;
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Location [coordinates=" + Arrays.toString(coordinates) + ", type=" + type + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -31,12 +31,12 @@ public class Status implements Comparable<Status> {
|
|||
@SerializedName("created_at")
|
||||
private Date createdAt;
|
||||
private boolean favorited;
|
||||
private String geo;
|
||||
private Location geo;
|
||||
private long id;
|
||||
@SerializedName("in_reply_to_screen_name")
|
||||
private String inReplyToScreenName;
|
||||
@SerializedName("in_reply_to_status_id")
|
||||
private Integer inReplyToStatusId;
|
||||
private Long inReplyToStatusId;
|
||||
@SerializedName("in_reply_to_user_id")
|
||||
private Integer inReplyToUserId;
|
||||
private String source;
|
||||
|
@ -47,8 +47,14 @@ public class Status implements Comparable<Status> {
|
|||
public Status() {
|
||||
}
|
||||
|
||||
public Status(Date createdAt, boolean favorited, String geo, long id,
|
||||
String inReplyToScreenName, Integer inReplyToStatusId, Integer inReplyToUserId,
|
||||
public Status(long id, User user, String text) {
|
||||
this.id = id;
|
||||
this.user = user;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Status(Date createdAt, boolean favorited, Location geo, long id,
|
||||
String inReplyToScreenName, Long inReplyToStatusId, Integer inReplyToUserId,
|
||||
String source, String text, boolean truncated, User user) {
|
||||
this.createdAt = createdAt;
|
||||
this.favorited = favorited;
|
||||
|
@ -63,13 +69,15 @@ public class Status implements Comparable<Status> {
|
|||
this.user = user;
|
||||
}
|
||||
|
||||
public int compareTo(Status o) {
|
||||
return (int) ((this == o) ? 0 : id + "".compareTo(o.id + ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode());
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
result = prime * result + ((text == null) ? 0 : text.hashCode());
|
||||
result = prime * result + ((user == null) ? 0 : user.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
@ -83,18 +91,8 @@ public class Status implements Comparable<Status> {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Status other = (Status) obj;
|
||||
if (createdAt == null) {
|
||||
if (other.createdAt != null)
|
||||
return false;
|
||||
} else if (!createdAt.equals(other.createdAt))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (text == null) {
|
||||
if (other.text != null)
|
||||
return false;
|
||||
} else if (!text.equals(other.text))
|
||||
return false;
|
||||
if (user == null) {
|
||||
if (other.user != null)
|
||||
return false;
|
||||
|
@ -103,95 +101,57 @@ public class Status implements Comparable<Status> {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Status [createdAt=" + createdAt + ", favorited=" + favorited + ", geo=" + geo
|
||||
+ ", id=" + id + ", inReplyToScreenName=" + inReplyToScreenName
|
||||
+ ", inReplyToStatusId=" + inReplyToStatusId + ", inReplyToUserId="
|
||||
+ inReplyToUserId + ", source=" + source + ", text=" + text + ", truncated="
|
||||
+ truncated + ", user=" + user + "]";
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public boolean isTruncated() {
|
||||
return truncated;
|
||||
}
|
||||
|
||||
public void setTruncated(boolean truncated) {
|
||||
this.truncated = truncated;
|
||||
}
|
||||
|
||||
public Integer getInReplyToStatusId() {
|
||||
return inReplyToStatusId;
|
||||
}
|
||||
|
||||
public void setInReplyToStatusId(Integer inReplyToStatusId) {
|
||||
this.inReplyToStatusId = inReplyToStatusId;
|
||||
}
|
||||
|
||||
public Integer getInReplyToUserId() {
|
||||
return inReplyToUserId;
|
||||
}
|
||||
|
||||
public void setInReplyToUserId(Integer inReplyToUserId) {
|
||||
this.inReplyToUserId = inReplyToUserId;
|
||||
}
|
||||
|
||||
public boolean isFavorited() {
|
||||
return favorited;
|
||||
}
|
||||
|
||||
public void setFavorited(boolean favorited) {
|
||||
this.favorited = favorited;
|
||||
public Location getGeo() {
|
||||
return geo;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getInReplyToScreenName() {
|
||||
return inReplyToScreenName;
|
||||
}
|
||||
|
||||
public void setInReplyToScreenName(String inReplyToScreenName) {
|
||||
this.inReplyToScreenName = inReplyToScreenName;
|
||||
public Long getInReplyToStatusId() {
|
||||
return inReplyToStatusId;
|
||||
}
|
||||
|
||||
public Integer getInReplyToUserId() {
|
||||
return inReplyToUserId;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public boolean isTruncated() {
|
||||
return truncated;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public int compareTo(Status o) {
|
||||
return (int) ((this == o) ? 0 : id + "".compareTo(o.id + ""));
|
||||
}
|
||||
|
||||
public void setGeo(String geo) {
|
||||
this.geo = geo;
|
||||
}
|
||||
|
||||
public String getGeo() {
|
||||
return geo;
|
||||
}
|
||||
}
|
|
@ -40,9 +40,12 @@ public class User implements Comparable<User> {
|
|||
private int friendsCount;
|
||||
@SerializedName("geo_enabled")
|
||||
private boolean geoEnabled;
|
||||
@SerializedName("contributors_enabled")
|
||||
private boolean contributorsEnabled;
|
||||
private long id;
|
||||
private String location;
|
||||
private String name;
|
||||
private String lang;
|
||||
private boolean notifications;
|
||||
@SerializedName("profile_background_color")
|
||||
private String profileBackgroundColor;
|
||||
|
@ -50,6 +53,8 @@ public class User implements Comparable<User> {
|
|||
private URI profileBackgroundImageUrl;
|
||||
@SerializedName("profile_background_tile")
|
||||
private boolean profileBackgroundTile;
|
||||
@SerializedName("profile_use_background_image")
|
||||
private boolean profileUseBackgroundImage;
|
||||
@SerializedName("profile_image_url")
|
||||
private URI profileImageUrl;
|
||||
@SerializedName("profile_link_color")
|
||||
|
@ -77,9 +82,15 @@ public class User implements Comparable<User> {
|
|||
|
||||
}
|
||||
|
||||
public User(long id, String screenName) {
|
||||
this.id = id;
|
||||
this.screenName = screenName;
|
||||
}
|
||||
|
||||
public User(Date createdAt, String description, int favouritesCount, int followersCount,
|
||||
boolean following, int friendsCount, boolean geoEnabled, long id, String location,
|
||||
String name, boolean notifications, String profileBackgroundColor,
|
||||
boolean following, int friendsCount, boolean geoEnabled, boolean contributorsEnabled,
|
||||
long id, String location, String name, String lang, boolean notifications,
|
||||
String profileBackgroundColor, boolean profileUseBackgroundImage,
|
||||
URI profileBackgroundImageUrl, boolean profileBackgroundTile, URI profileImageUrl,
|
||||
String profileLinkColor, String profileSidebarBorderColor,
|
||||
String profileSidebarFillColor, String profileTextColor, boolean isProtected,
|
||||
|
@ -91,12 +102,15 @@ public class User implements Comparable<User> {
|
|||
this.followersCount = followersCount;
|
||||
this.following = following;
|
||||
this.friendsCount = friendsCount;
|
||||
this.setGeoEnabled(geoEnabled);
|
||||
this.geoEnabled = geoEnabled;
|
||||
this.id = id;
|
||||
this.location = location;
|
||||
this.name = name;
|
||||
this.lang = lang;
|
||||
this.notifications = notifications;
|
||||
this.contributorsEnabled = contributorsEnabled;
|
||||
this.profileBackgroundColor = profileBackgroundColor;
|
||||
this.profileUseBackgroundImage = profileUseBackgroundImage;
|
||||
this.profileBackgroundImageUrl = profileBackgroundImageUrl;
|
||||
this.profileBackgroundTile = profileBackgroundTile;
|
||||
this.profileImageUrl = profileImageUrl;
|
||||
|
@ -113,12 +127,119 @@ public class User implements Comparable<User> {
|
|||
this.verified = verified;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getFavouritesCount() {
|
||||
return favouritesCount;
|
||||
}
|
||||
|
||||
public int getFollowersCount() {
|
||||
return followersCount;
|
||||
}
|
||||
|
||||
public boolean isFollowing() {
|
||||
return following;
|
||||
}
|
||||
|
||||
public int getFriendsCount() {
|
||||
return friendsCount;
|
||||
}
|
||||
|
||||
public boolean isGeoEnabled() {
|
||||
return geoEnabled;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean isNotifications() {
|
||||
return notifications;
|
||||
}
|
||||
|
||||
public String getProfileBackgroundColor() {
|
||||
return profileBackgroundColor;
|
||||
}
|
||||
|
||||
public URI getProfileBackgroundImageUrl() {
|
||||
return profileBackgroundImageUrl;
|
||||
}
|
||||
|
||||
public boolean isProfileBackgroundTile() {
|
||||
return profileBackgroundTile;
|
||||
}
|
||||
|
||||
public boolean isProfileUseBackgroundImage() {
|
||||
return profileUseBackgroundImage;
|
||||
}
|
||||
|
||||
public URI getProfileImageUrl() {
|
||||
return profileImageUrl;
|
||||
}
|
||||
|
||||
public String getProfileLinkColor() {
|
||||
return profileLinkColor;
|
||||
}
|
||||
|
||||
public String getProfileSidebarBorderColor() {
|
||||
return profileSidebarBorderColor;
|
||||
}
|
||||
|
||||
public String getProfileSidebarFillColor() {
|
||||
return profileSidebarFillColor;
|
||||
}
|
||||
|
||||
public String getProfileTextColor() {
|
||||
return profileTextColor;
|
||||
}
|
||||
|
||||
public boolean isProtected() {
|
||||
return isProtected;
|
||||
}
|
||||
|
||||
public String getScreenName() {
|
||||
return screenName;
|
||||
}
|
||||
|
||||
public int getStatusesCount() {
|
||||
return statusesCount;
|
||||
}
|
||||
|
||||
public String getTimeZone() {
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
public URI getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public int getUtcOffset() {
|
||||
return utcOffset;
|
||||
}
|
||||
|
||||
public boolean isVerified() {
|
||||
return verified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (id ^ (id >>> 32));
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((screenName == null) ? 0 : screenName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
@ -134,11 +255,6 @@ public class User implements Comparable<User> {
|
|||
User other = (User) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (screenName == null) {
|
||||
if (other.screenName != null)
|
||||
return false;
|
||||
|
@ -147,204 +263,23 @@ public class User implements Comparable<User> {
|
|||
return true;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getScreenName() {
|
||||
return screenName;
|
||||
}
|
||||
|
||||
public void setScreenName(String screenName) {
|
||||
this.screenName = screenName;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public URI getProfileImageUrl() {
|
||||
return profileImageUrl;
|
||||
}
|
||||
|
||||
public void setProfileImageUrl(URI profileImageUrl) {
|
||||
this.profileImageUrl = profileImageUrl;
|
||||
}
|
||||
|
||||
public URI getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(URI url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public boolean isProtected() {
|
||||
return isProtected;
|
||||
}
|
||||
|
||||
public void setProtected(boolean isProtected) {
|
||||
this.isProtected = isProtected;
|
||||
}
|
||||
|
||||
public int getFollowersCount() {
|
||||
return followersCount;
|
||||
}
|
||||
|
||||
public void setFollowersCount(int followersCount) {
|
||||
this.followersCount = followersCount;
|
||||
}
|
||||
|
||||
public String getProfileBackgroundColor() {
|
||||
return profileBackgroundColor;
|
||||
}
|
||||
|
||||
public void setProfileBackgroundColor(String profileBackgroundColor) {
|
||||
this.profileBackgroundColor = profileBackgroundColor;
|
||||
}
|
||||
|
||||
public String getProfileTextColor() {
|
||||
return profileTextColor;
|
||||
}
|
||||
|
||||
public void setProfileTextColor(String profileTextColor) {
|
||||
this.profileTextColor = profileTextColor;
|
||||
}
|
||||
|
||||
public String getProfileLinkColor() {
|
||||
return profileLinkColor;
|
||||
}
|
||||
|
||||
public void setProfileLinkColor(String profileLinkColor) {
|
||||
this.profileLinkColor = profileLinkColor;
|
||||
}
|
||||
|
||||
public String getProfileSidebarFillColor() {
|
||||
return profileSidebarFillColor;
|
||||
}
|
||||
|
||||
public void setProfileSidebarFillColor(String profileSidebarFillColor) {
|
||||
this.profileSidebarFillColor = profileSidebarFillColor;
|
||||
}
|
||||
|
||||
public String getProfileSidebarBorderColor() {
|
||||
return profileSidebarBorderColor;
|
||||
}
|
||||
|
||||
public void setProfileSidebarBorderColor(String profileSidebarBorderColor) {
|
||||
this.profileSidebarBorderColor = profileSidebarBorderColor;
|
||||
}
|
||||
|
||||
public int getFriendsCount() {
|
||||
return friendsCount;
|
||||
}
|
||||
|
||||
public void setFriendsCount(int friendsCount) {
|
||||
this.friendsCount = friendsCount;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public int getFavouritesCount() {
|
||||
return favouritesCount;
|
||||
}
|
||||
|
||||
public void setFavouritesCount(int favouritesCount) {
|
||||
this.favouritesCount = favouritesCount;
|
||||
}
|
||||
|
||||
public int getUtcOffset() {
|
||||
return utcOffset;
|
||||
}
|
||||
|
||||
public void setUtcOffset(int utcOffset) {
|
||||
this.utcOffset = utcOffset;
|
||||
}
|
||||
|
||||
public String getTimeZone() {
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
public void setTimeZone(String timeZone) {
|
||||
this.timeZone = timeZone;
|
||||
}
|
||||
|
||||
public URI getProfileBackgroundImageUrl() {
|
||||
return profileBackgroundImageUrl;
|
||||
}
|
||||
|
||||
public void setProfileBackgroundImageUrl(URI profileBackgroundImageUrl) {
|
||||
this.profileBackgroundImageUrl = profileBackgroundImageUrl;
|
||||
}
|
||||
|
||||
public boolean isProfileBackgroundTile() {
|
||||
return profileBackgroundTile;
|
||||
}
|
||||
|
||||
public void setProfileBackgroundTile(boolean profileBackgroundTile) {
|
||||
this.profileBackgroundTile = profileBackgroundTile;
|
||||
}
|
||||
|
||||
public int getStatusesCount() {
|
||||
return statusesCount;
|
||||
}
|
||||
|
||||
public void setStatusesCount(int statusesCount) {
|
||||
this.statusesCount = statusesCount;
|
||||
}
|
||||
|
||||
public boolean isNotifications() {
|
||||
return notifications;
|
||||
}
|
||||
|
||||
public void setNotifications(boolean notifications) {
|
||||
this.notifications = notifications;
|
||||
}
|
||||
|
||||
public boolean isFollowing() {
|
||||
return following;
|
||||
}
|
||||
|
||||
public void setFollowing(boolean following) {
|
||||
this.following = following;
|
||||
}
|
||||
|
||||
public boolean isVerified() {
|
||||
return verified;
|
||||
}
|
||||
|
||||
public void setVerified(boolean verified) {
|
||||
this.verified = verified;
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User [createdAt=" + createdAt + ", description=" + description + ", favouritesCount="
|
||||
+ favouritesCount + ", followersCount=" + followersCount + ", following="
|
||||
+ following + ", friendsCount=" + friendsCount + ", geoEnabled=" + geoEnabled
|
||||
+ ", id=" + id + ", isProtected=" + isProtected + ", location=" + location
|
||||
+ ", name=" + name + ", notifications=" + notifications
|
||||
+ ", profileBackgroundColor=" + profileBackgroundColor
|
||||
+ ", profileBackgroundImageUrl=" + profileBackgroundImageUrl
|
||||
+ ", profileBackgroundTile=" + profileBackgroundTile + ", profileImageUrl="
|
||||
+ profileImageUrl + ", profileLinkColor=" + profileLinkColor
|
||||
+ ", profileSidebarBorderColor=" + profileSidebarBorderColor
|
||||
+ ", profileSidebarFillColor=" + profileSidebarFillColor + ", profileTextColor="
|
||||
+ profileTextColor + ", profileUseBackgroundImage=" + profileUseBackgroundImage
|
||||
+ ", screenName=" + screenName + ", statusesCount=" + statusesCount + ", timeZone="
|
||||
+ timeZone + ", url=" + url + ", utcOffset=" + utcOffset + ", verified=" + verified
|
||||
+ "]";
|
||||
}
|
||||
|
||||
public int compareTo(User o) {
|
||||
|
@ -353,11 +288,11 @@ public class User implements Comparable<User> {
|
|||
return (this == o) ? 0 : screenName.compareTo(o.screenName);
|
||||
}
|
||||
|
||||
public void setGeoEnabled(boolean geoEnabled) {
|
||||
this.geoEnabled = geoEnabled;
|
||||
public boolean isContributorsEnabled() {
|
||||
return contributorsEnabled;
|
||||
}
|
||||
|
||||
public boolean isGeoEnabled() {
|
||||
return geoEnabled;
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
}
|
|
@ -26,12 +26,16 @@ import java.util.SortedSet;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.twitter.domain.Status;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code TwitterClient}
|
||||
*
|
||||
|
@ -45,11 +49,14 @@ public class TwitterClientLiveTest {
|
|||
|
||||
@BeforeGroups(groups = "live")
|
||||
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException {
|
||||
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
|
||||
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
|
||||
String identity = checkNotNull(System.getProperty("jclouds.test.identity"),
|
||||
"jclouds.test.identity");
|
||||
String credential = checkNotNull(System.getProperty("jclouds.test.credential"),
|
||||
"jclouds.test.credential");
|
||||
|
||||
context = createContext(contextSpec("twitter", "http://twitter.com", "1", identity, credential,
|
||||
TwitterClient.class, TwitterAsyncClient.class));
|
||||
context = createContext(contextSpec("twitter", "http://twitter.com", "1", identity,
|
||||
credential, TwitterClient.class, TwitterAsyncClient.class), ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()));
|
||||
|
||||
connection = context.getApi();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.SortedSet;
|
|||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.http.functions.config.ParserModule;
|
||||
import org.jclouds.twitter.domain.Location;
|
||||
import org.jclouds.twitter.domain.Status;
|
||||
import org.jclouds.twitter.domain.User;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -60,79 +61,41 @@ public class ParseStatusesFromJsonResponseTest {
|
|||
SortedSet<Status> expects = ImmutableSortedSet
|
||||
.of(
|
||||
|
||||
new Status(
|
||||
dateService.cDateParse("Sat Oct 31 01:45:14 +0000 2009"),
|
||||
new Status(
|
||||
dateService.cDateParse("Tue Jun 29 20:41:15 +0000 2010"),
|
||||
false,
|
||||
new Location("Point", new double[] { 153.08691298, -26.38658779 }),
|
||||
15138751340l,
|
||||
"adrianfcole",
|
||||
15112459535l,
|
||||
21744326,
|
||||
null,
|
||||
"@adrianfcole hehe, yes. Still going :) hope you're keeping well!",
|
||||
false,
|
||||
new User(
|
||||
dateService.cDateParse("Sat Jul 26 08:08:17 +0000 2008"),
|
||||
"London-based South African software geek & amateur photog. Since Nov 2009, travelling the world with @sunflowerkate on an extended honeymoon",
|
||||
21,
|
||||
315,
|
||||
true,
|
||||
405,
|
||||
true,
|
||||
false,
|
||||
null,
|
||||
5303839785l,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>",
|
||||
"RT @jclouds: come find out about #cloud storage and how to access it from #java in palo alto this Tuesday: http://is.gd/4IFA9",
|
||||
15608907,
|
||||
"Travelling around the world",
|
||||
"Andrew Newdigate",
|
||||
"en",
|
||||
false,
|
||||
new User(
|
||||
dateService.cDateParse("Sat Apr 26 06:13:08 +0000 2008"),
|
||||
"Jack of All Trades: Dad to anZel and Arden, VMware, vCloud, Security, Compliance, Former Developer",
|
||||
0,
|
||||
474,
|
||||
false,
|
||||
199,
|
||||
false,
|
||||
14540593,
|
||||
"Bay Area, CA",
|
||||
"Jian Zhen",
|
||||
false,
|
||||
"C6E2EE",
|
||||
URI
|
||||
.create("http://s.twimg.com/a/1256778767/images/themes/theme2/bg.gif"),
|
||||
false,
|
||||
URI
|
||||
.create("http://a3.twimg.com/profile_images/64445411/30b8b19_bigger_normal.jpg"),
|
||||
"1F98C7", "C6E2EE", "DAECF4", "663B12", false, "zhenjl",
|
||||
1981, "Pacific Time (US & Canada)", URI
|
||||
.create("http://zhen.org"), -28800, false)),
|
||||
|
||||
new Status(
|
||||
dateService.cDateParse("Sat Oct 31 09:35:27 +0000 2009"),
|
||||
"FFF04D",
|
||||
true,
|
||||
URI
|
||||
.create("http://a1.twimg.com/profile_background_images/62032362/_MG_8095_6_7HDR_tonemapped.jpg"),
|
||||
false,
|
||||
null,
|
||||
5310690603l,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>",
|
||||
"RT @jclouds: live multi #cloud demo of jclouds connecting to 3 storage clouds from google appengine http://is.gd/4IXMh",
|
||||
false,
|
||||
new User(
|
||||
dateService.cDateParse("Tue Apr 28 15:29:42 +0000 2009"),
|
||||
"Some random guy who seems to care about cloud collisions at siliconANGLE.com",
|
||||
245,
|
||||
572,
|
||||
false,
|
||||
325,
|
||||
false,
|
||||
36093693,
|
||||
"San Francisco ",
|
||||
"James Watters",
|
||||
false,
|
||||
"C6E2EE",
|
||||
URI
|
||||
.create("http://a1.twimg.com/profile_background_images/24067016/17361976.jpg"),
|
||||
true,
|
||||
URI
|
||||
.create("http://a3.twimg.com/profile_images/445071063/tiktaalik-transitional-fossil_normal.png"),
|
||||
"1F98C7",
|
||||
"C6E2EE",
|
||||
"DAECF4",
|
||||
"663B12",
|
||||
false,
|
||||
"wattersjames",
|
||||
1964,
|
||||
"Pacific Time (US & Canada)",
|
||||
URI
|
||||
.create("http://siliconangle.net/ver2/author/jwatters/"),
|
||||
-28800, false))
|
||||
URI
|
||||
.create("http://a1.twimg.com/profile_images/593267212/many_moon_honeymoon_normal.jpg"),
|
||||
"0099CC", "fff8ad", "f6ffd1", "333333", false, "suprememoocow",
|
||||
987, "Kuala Lumpur", URI.create("http://newdigate.me"), -28800,
|
||||
false))
|
||||
|
||||
);
|
||||
|
||||
|
|
|
@ -1,32 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
Copyright (C) 2009 Cloud Conscious, LLC.
|
||||
<info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
Licensed 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
|
||||
====================================================================
|
||||
Licensed 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.
|
||||
====================================================================
|
||||
|
||||
-->
|
||||
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.
|
||||
====================================================================
|
||||
-->
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
|
||||
<!--
|
||||
For more configuration infromation and examples see the Apache Log4j
|
||||
website: http://logging.apache.org/log4j/
|
||||
-->
|
||||
<!--
|
||||
For more configuration infromation and examples see the Apache
|
||||
Log4j website: http://logging.apache.org/log4j/
|
||||
-->
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
||||
debug="false">
|
||||
debug="false">
|
||||
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
|
@ -43,68 +42,68 @@
|
|||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||
|
||||
<!--
|
||||
The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
|
||||
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
|
||||
%m%n"/>
|
||||
The full pattern: Date MS Priority [Category]
|
||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||
-->
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
<param name="File" value="target/test-data/jclouds.log" />
|
||||
<param name="Append" value="true" />
|
||||
<!-- A time/date based rolling appender -->
|
||||
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
<param name="File" value="target/test-data/jclouds.log" />
|
||||
<param name="Append" value="true" />
|
||||
|
||||
<!-- Rollover at midnight each day -->
|
||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||
<!-- Rollover at midnight each day -->
|
||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||
|
||||
<param name="Threshold" value="TRACE" />
|
||||
<param name="Threshold" value="TRACE" />
|
||||
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||
|
||||
<!--
|
||||
The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
|
||||
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
|
||||
%m%n"/>
|
||||
-->
|
||||
</layout>
|
||||
</appender>
|
||||
<!--
|
||||
The full pattern: Date MS Priority [Category]
|
||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||
-->
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
|
||||
<appender-ref ref="FILE" />
|
||||
</appender>
|
||||
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
|
||||
<appender-ref ref="FILE" />
|
||||
</appender>
|
||||
|
||||
<appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
|
||||
<appender-ref ref="WIREFILE" />
|
||||
</appender>
|
||||
|
||||
<!-- ================ -->
|
||||
<!-- Limit categories -->
|
||||
<!-- ================ -->
|
||||
<!-- ================ -->
|
||||
<!-- Limit categories -->
|
||||
<!-- ================ -->
|
||||
|
||||
<category name="org.jclouds">
|
||||
<priority value="DEBUG" />
|
||||
<category name="org.jclouds">
|
||||
<priority value="DEBUG" />
|
||||
<appender-ref ref="ASYNC" />
|
||||
</category>
|
||||
</category>
|
||||
|
||||
<category name="jclouds.headers">
|
||||
<priority value="DEBUG" />
|
||||
<appender-ref ref="ASYNCWIRE" />
|
||||
</category><!--
|
||||
</category>
|
||||
|
||||
<category name="jclouds.wire">
|
||||
<priority value="DEBUG" />
|
||||
<appender-ref ref="ASYNCWIRE" />
|
||||
</category>
|
||||
|
||||
--><!-- ======================= -->
|
||||
<!-- Setup the Root category -->
|
||||
<!-- ======================= -->
|
||||
<!-- ======================= -->
|
||||
<!-- Setup the Root category -->
|
||||
<!-- ======================= -->
|
||||
|
||||
<root>
|
||||
<priority value="WARN" />
|
||||
</root>
|
||||
<root>
|
||||
<priority value="WARN" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
|
@ -1,77 +1,49 @@
|
|||
[ { "created_at" : "Sat Oct 31 09:35:27 +0000 2009",
|
||||
"favorited" : false,
|
||||
"geo" : null,
|
||||
"id" : 5310690603,
|
||||
"in_reply_to_screen_name" : null,
|
||||
"in_reply_to_status_id" : null,
|
||||
"in_reply_to_user_id" : null,
|
||||
"source" : "<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>",
|
||||
"text" : "RT @jclouds: live multi #cloud demo of jclouds connecting to 3 storage clouds from google appengine http://is.gd/4IXMh",
|
||||
"truncated" : false,
|
||||
"user" : { "created_at" : "Tue Apr 28 15:29:42 +0000 2009",
|
||||
"description" : "Some random guy who seems to care about cloud collisions at siliconANGLE.com",
|
||||
"favourites_count" : 245,
|
||||
"followers_count" : 572,
|
||||
"following" : false,
|
||||
"friends_count" : 325,
|
||||
"geo_enabled" : false,
|
||||
"id" : 36093693,
|
||||
"location" : "San Francisco ",
|
||||
"name" : "James Watters",
|
||||
"notifications" : false,
|
||||
"profile_background_color" : "C6E2EE",
|
||||
"profile_background_image_url" : "http://a1.twimg.com/profile_background_images/24067016/17361976.jpg",
|
||||
"profile_background_tile" : true,
|
||||
"profile_image_url" : "http://a3.twimg.com/profile_images/445071063/tiktaalik-transitional-fossil_normal.png",
|
||||
"profile_link_color" : "1F98C7",
|
||||
"profile_sidebar_border_color" : "C6E2EE",
|
||||
"profile_sidebar_fill_color" : "DAECF4",
|
||||
"profile_text_color" : "663B12",
|
||||
"protected" : false,
|
||||
"screen_name" : "wattersjames",
|
||||
"statuses_count" : 1964,
|
||||
"time_zone" : "Pacific Time (US & Canada)",
|
||||
"url" : "http://siliconangle.net/ver2/author/jwatters/",
|
||||
"utc_offset" : -28800,
|
||||
"verified" : false
|
||||
}
|
||||
},
|
||||
{ "created_at" : "Sat Oct 31 01:45:14 +0000 2009",
|
||||
"favorited" : false,
|
||||
"geo" : null,
|
||||
"id" : 5303839785,
|
||||
"in_reply_to_screen_name" : null,
|
||||
"in_reply_to_status_id" : null,
|
||||
"in_reply_to_user_id" : null,
|
||||
"source" : "<a href=\"http://www.tweetdeck.com/\" rel=\"nofollow\">TweetDeck</a>",
|
||||
"text" : "RT @jclouds: come find out about #cloud storage and how to access it from #java in palo alto this Tuesday: http://is.gd/4IFA9",
|
||||
"truncated" : false,
|
||||
"user" : { "created_at" : "Sat Apr 26 06:13:08 +0000 2008",
|
||||
"description" : "Jack of All Trades: Dad to anZel and Arden, VMware, vCloud, Security, Compliance, Former Developer",
|
||||
"favourites_count" : 0,
|
||||
"followers_count" : 474,
|
||||
"following" : false,
|
||||
"friends_count" : 199,
|
||||
"geo_enabled" : false,
|
||||
"id" : 14540593,
|
||||
"location" : "Bay Area, CA",
|
||||
"name" : "Jian Zhen",
|
||||
"notifications" : false,
|
||||
"profile_background_color" : "C6E2EE",
|
||||
"profile_background_image_url" : "http://s.twimg.com/a/1256778767/images/themes/theme2/bg.gif",
|
||||
"profile_background_tile" : false,
|
||||
"profile_image_url" : "http://a3.twimg.com/profile_images/64445411/30b8b19_bigger_normal.jpg",
|
||||
"profile_link_color" : "1F98C7",
|
||||
"profile_sidebar_border_color" : "C6E2EE",
|
||||
"profile_sidebar_fill_color" : "DAECF4",
|
||||
"profile_text_color" : "663B12",
|
||||
"protected" : false,
|
||||
"screen_name" : "zhenjl",
|
||||
"statuses_count" : 1981,
|
||||
"time_zone" : "Pacific Time (US & Canada)",
|
||||
"url" : "http://zhen.org",
|
||||
"utc_offset" : -28800,
|
||||
"verified" : false
|
||||
}
|
||||
}
|
||||
]
|
||||
[{
|
||||
"favorited": false,
|
||||
"contributors": null,
|
||||
"coordinates": {
|
||||
"type": "Point",
|
||||
"coordinates": [153.08691298, -26.38658779]
|
||||
}, "source": "<a href=\"http://itunes.apple.com/app/twitter/id333903271?mt=8\" rel=\"nofollow\">Twitter for iPhone</a>",
|
||||
"created_at": "Mon May 31 23:22:51 +0000 2010",
|
||||
"place": null,
|
||||
"user": {
|
||||
"statuses_count": 987,
|
||||
"notifications": false,
|
||||
"profile_sidebar_border_color": "fff8ad",
|
||||
"description": "London-based South African software geek & amateur photog. Since Nov 2009, travelling the world with @sunflowerkate on an extended honeymoon",
|
||||
"location": "Travelling around the world",
|
||||
"screen_name": "suprememoocow",
|
||||
"profile_use_background_image": true,
|
||||
"followers_count": 315,
|
||||
"contributors_enabled": false,
|
||||
"friends_count": 405,
|
||||
"lang": "en",
|
||||
"geo_enabled": true,
|
||||
"profile_background_color": "FFF04D",
|
||||
"favourites_count": 21,
|
||||
"verified": false,
|
||||
"profile_text_color": "333333",
|
||||
"following": true,
|
||||
"time_zone": "Kuala Lumpur",
|
||||
"created_at": "Sat Jul 26 08:08:17 +0000 2008",
|
||||
"profile_link_color": "0099CC",
|
||||
"protected": false,
|
||||
"profile_background_image_url": "http://a1.twimg.com/profile_background_images/62032362/_MG_8095_6_7HDR_tonemapped.jpg",
|
||||
"name": "Andrew Newdigate",
|
||||
"profile_sidebar_fill_color": "f6ffd1",
|
||||
"url": "http://newdigate.me",
|
||||
"profile_image_url": "http://a1.twimg.com/profile_images/593267212/many_moon_honeymoon_normal.jpg",
|
||||
"id": 15608907,
|
||||
"profile_background_tile": false,
|
||||
"utc_offset": 28800
|
||||
}, "in_reply_to_screen_name": "adrianfcole",
|
||||
"truncated": false,
|
||||
"in_reply_to_user_id": 21744326,
|
||||
"id": 15138751340,
|
||||
"geo": {
|
||||
"type": "Point",
|
||||
"coordinates": [-26.38658779, 153.08691298]
|
||||
}, "in_reply_to_status_id": 15112459535,
|
||||
"text": "@adrianfcole hehe, yes. Still going :) hope you're keeping well!"
|
||||
}]
|
Loading…
Reference in New Issue