INT-1902 upgraded Twitter to use Twitter4J-2.1.10
This commit is contained in:
@@ -385,7 +385,7 @@ project('spring-integration-twitter') {
|
||||
dependencies {
|
||||
compile project(":spring-integration-core")
|
||||
compile "org.springframework:spring-context-support:$springVersion"
|
||||
compile "org.twitter4j:twitter4j-core:2.1.3"
|
||||
compile "org.twitter4j:twitter4j-core:2.1.10"
|
||||
compile("javax.activation:activation:$javaxActivationVersion") { optional = true }
|
||||
testCompile project(":spring-integration-test")
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<dependency>
|
||||
<groupId>org.twitter4j</groupId>
|
||||
<artifactId>twitter4j-core</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.10</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.integration.twitter.core;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -30,6 +31,8 @@ import twitter4j.Status;
|
||||
import twitter4j.StatusUpdate;
|
||||
import twitter4j.Twitter;
|
||||
import twitter4j.TwitterFactory;
|
||||
import twitter4j.conf.Configuration;
|
||||
import twitter4j.conf.PropertyConfiguration;
|
||||
import twitter4j.http.AccessToken;
|
||||
|
||||
/**
|
||||
@@ -66,7 +69,11 @@ public class Twitter4jTemplate implements TwitterOperations {
|
||||
Assert.hasText(accessToken, "'accessToken' must be provided");
|
||||
Assert.hasText(accessTokenSecret, "'accessTokenSecret' must be provided");
|
||||
AccessToken token = new AccessToken(accessToken, accessTokenSecret);
|
||||
this.twitter = new TwitterFactory().getOAuthAuthorizedInstance(consumerKey, consumerSecret, token);
|
||||
Properties properties = new Properties();
|
||||
properties.put("oauth.consumerKey", consumerKey);
|
||||
properties.put("oauth.consumerSecret", consumerSecret);
|
||||
Configuration configuration = new PropertyConfiguration(properties);
|
||||
this.twitter = new TwitterFactory(configuration).getInstance(token);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -73,19 +73,19 @@ public class DirectMessageReceivingMessageSourceTests {
|
||||
|
||||
firstMessage = mock(DirectMessage.class);
|
||||
when(firstMessage.getCreatedAt()).thenReturn(new Date(5555555555L));
|
||||
when(firstMessage.getId()).thenReturn( 200);
|
||||
when(firstMessage.getId()).thenReturn( (long) 200);
|
||||
|
||||
secondMessage = mock(DirectMessage.class);
|
||||
when(secondMessage.getCreatedAt()).thenReturn(new Date(2222222222L));
|
||||
when(secondMessage.getId()).thenReturn( 2000);
|
||||
when(secondMessage.getId()).thenReturn( (long) 2000);
|
||||
|
||||
thirdMessage = mock(DirectMessage.class);
|
||||
when(thirdMessage.getCreatedAt()).thenReturn(new Date(66666666666L));
|
||||
when(thirdMessage.getId()).thenReturn( 3000);
|
||||
when(thirdMessage.getId()).thenReturn( (long) 3000);
|
||||
|
||||
fourthMessage = mock(DirectMessage.class);
|
||||
when(fourthMessage.getCreatedAt()).thenReturn(new Date(77777777777L));
|
||||
when(fourthMessage.getId()).thenReturn( 4000);
|
||||
when(fourthMessage.getId()).thenReturn( (long) 4000);
|
||||
|
||||
tw = mock(Twitter.class);
|
||||
Field twField = Twitter4jTemplate.class.getDeclaredField("twitter");
|
||||
|
||||
Reference in New Issue
Block a user