Ported gae-tweetstore-spring to 1.4.2 appengine API and changes in Twitter4j

This commit is contained in:
Andrew Phillips 2011-05-21 06:55:30 -04:00
parent b07ca99372
commit 194cd528e7
3 changed files with 12 additions and 24 deletions

View File

@ -62,26 +62,7 @@
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.jclouds.provider</groupId>
<artifactId>aws-s3</artifactId>

View File

@ -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<Module> modules = ImmutableSet.<Module> 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);
}

View File

@ -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<Status> statuses = client.getMentions();