From 194cd528e72d2c73aeece253fb1deea49daf1b61 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sat, 21 May 2011 06:55:30 -0400 Subject: [PATCH] Ported gae-tweetstore-spring to 1.4.2 appengine API and changes in Twitter4j --- demos/gae-tweetstore-spring/pom.xml | 21 +------------------ .../config/SpringServletConfig.java | 7 +++++-- .../integration/TweetStoreLiveTest.java | 8 +++++-- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/demos/gae-tweetstore-spring/pom.xml b/demos/gae-tweetstore-spring/pom.xml index cf56a469e1..295952e1e2 100644 --- a/demos/gae-tweetstore-spring/pom.xml +++ b/demos/gae-tweetstore-spring/pom.xml @@ -62,26 +62,7 @@ ${project.version} test-jar test - - - ${project.groupId} - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - log4j - log4j - 1.2.16 - test - + org.jclouds.provider aws-s3 diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java b/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java index 2c1522578b..6ce634b061 100644 --- a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java +++ b/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java @@ -51,6 +51,7 @@ import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; import twitter4j.Twitter; import twitter4j.TwitterFactory; +import twitter4j.conf.ConfigurationBuilder; import com.google.appengine.api.labs.taskqueue.Queue; import com.google.appengine.api.labs.taskqueue.QueueFactory; @@ -88,8 +89,10 @@ public class SpringServletConfig extends LoggingConfig implements ServletConfigA Set modules = ImmutableSet. of(googleModule); // shared across all blobstores and used to retrieve tweets try { - twitterClient = new TwitterFactory().getInstance(props.getProperty("twitter.identity"), - props.getProperty("twitter.credential")); + twitter4j.conf.Configuration twitterConf = new ConfigurationBuilder() + .setUser(props.getProperty("twitter.identity")) + .setPassword(props.getProperty("twitter.credential")).build(); + twitterClient = new TwitterFactory(twitterConf).getInstance(); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("properties for twitter not configured properly in " + props.toString(), e); } diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java b/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java index 5aa2ffe745..d3f43e7a02 100644 --- a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java +++ b/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java @@ -47,6 +47,8 @@ import twitter4j.Status; import twitter4j.Twitter; import twitter4j.TwitterException; import twitter4j.TwitterFactory; +import twitter4j.conf.Configuration; +import twitter4j.conf.ConfigurationBuilder; import com.google.common.base.Joiner; import com.google.common.base.Splitter; @@ -98,8 +100,10 @@ public class TweetStoreLiveTest { contexts.put(provider, factory.createContext(provider, wiring, props)); } - Twitter client = new TwitterFactory().getInstance(props.getProperty("twitter.identity"), - props.getProperty("twitter.credential")); + Configuration twitterConf = new ConfigurationBuilder() + .setUser(props.getProperty("twitter.identity")) + .setPassword(props.getProperty("twitter.credential")).build(); + Twitter client = new TwitterFactory(twitterConf).getInstance(); StoreTweetsController controller = new StoreTweetsController(contexts, container, client); ResponseList statuses = client.getMentions();