diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/DirectMessage.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/DirectMessage.java
deleted file mode 100644
index 74f0c9d10e..0000000000
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/DirectMessage.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2010 the original author or authors
- *
- * 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.springframework.integration.twitter.core;
-
-
-/**
- * Describes a direct-message in twitter. (Also known as a "DM").
- *
- * these are messages sent privately to a user.
- *
- * @author Josh Long
- * @since 2.0
- */
-public interface DirectMessage extends TwitterMessage{
-
- User getSender() ;
-
- User getRecipient();
-
- }
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/GeoLocation.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/GeoLocation.java
deleted file mode 100644
index cea362fb69..0000000000
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/GeoLocation.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2010 the original author or authors
- *
- * 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.springframework.integration.twitter.core;
-
-/**
- * interface for geo location records
- *
- * @author Josh Long
- * @since 2.0
- *
- */
-public interface GeoLocation {
- double getLongitude() ;
- double getLatitude() ;
-}
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/Status.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/Status.java
deleted file mode 100644
index ee9dbd9284..0000000000
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/Status.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2002-2010 the original author or authors.
- *
- * 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.springframework.integration.twitter.core;
-
-
-/**
- * describes a simple status message on twitter. this could be a message that
- * updates a timeline on behalf of a user, or it could be a message that
- * contains a reply.
- *
- *
- * @author Josh Long
- * @since 2.0
- */
-public interface Status extends TwitterMessage{
-
- String getSource();
-
- boolean isTruncated();
-
- long getInReplyToStatusId();
-
- int getInReplyToUserId();
-
- java.lang.String getInReplyToScreenName();
-
- boolean isFavorited();
-
- User getUser();
-
- boolean isRetweet();
-
- Status getRetweetedStatus();
-
- String[] getContributors();
-
-}
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/Twitter4jDecorator.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/Twitter4jDecorator.java
deleted file mode 100644
index c0bd05efc9..0000000000
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/Twitter4jDecorator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2002-2010 the original author or authors.
- *
- * 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.springframework.integration.twitter.core;
-
-import java.lang.reflect.Method;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-import org.springframework.util.Assert;
-import org.springframework.util.ReflectionUtils;
-
-import twitter4j.DirectMessage;
-import twitter4j.GeoLocation;
-import twitter4j.Status;
-import twitter4j.User;
-
-/**
- * Sine our Twitter domain model is modeled after Twitter4j API
- * this interceptor will delegate method calls that are made on SI Twitter interfaces
- * to the corresponding Twitter4j objects.
- *
- * @author Oleg Zhurakousky
- * @since 2.0
- */
-class Twitter4jDecorator implements MethodInterceptor {
-
- private final Object twitterObject;
-
- public Twitter4jDecorator(Object twitterObject){
- this.validateTwitter4JObject(twitterObject);
- this.twitterObject = twitterObject;
- }
-
- /* (non-Javadoc)
- * @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
- */
- public Object invoke(MethodInvocation invocation) throws Throwable {
- Class> twitter4jClass = twitterObject.getClass();
- Object[] args = invocation.getArguments();
- Class>[] argsType = new Class[args.length];
- for (int i = 0; i < args.length; i++) {
- Object object = args[i];
- argsType[i] = object.getClass();
- }
- String invokedmethodName = invocation.getMethod().getName();
- Method targetMethod = ReflectionUtils.findMethod(twitter4jClass, invokedmethodName, argsType);
- return targetMethod.invoke(twitterObject, args);
- }
-
- private void validateTwitter4JObject(Object twitterObject){
- Assert.notNull(twitterObject, "'twitterObject' must not be null");
- Assert.isTrue(twitterObject instanceof Status ||
- twitterObject instanceof DirectMessage ||
- twitterObject instanceof User ||
- twitterObject instanceof GeoLocation,
- "Only twitter4j.DirectMessage, twitter4j.Status, twitter4j.User, twitter4j.GeoLocation is supported");
- }
-}
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterFactory.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterFactory.java
deleted file mode 100644
index 3f293831e9..0000000000
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2002-2010 the original author or authors.
- *
- * 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.springframework.integration.twitter.core;
-
-import org.springframework.aop.framework.ProxyFactory;
-import org.springframework.aop.target.EmptyTargetSource;
-import org.springframework.util.Assert;
-
-import twitter4j.DirectMessage;
-import twitter4j.Status;
-
-/**
- * Factory class with several static factory methods for constructing
- * Twitter objects that are independent from the underlying API (e.g., twitter4j)
- *
- * @author Oleg Zhurakousky
- * @since 2.0
- */
-public class TwitterFactory {
-
- private TwitterFactory(){}
-
- /**
- * Will construct either {@link org.springframework.integration.twitter.core.Status} or
- * {@link org.springframework.integration.twitter.core.DirectMessage} from the instances of
- * {@link Status} pr {@link DirectMessage}
- *
- * @param twitterMessage
- * @return
- */
- public static TwitterMessage formTwitter4jMessage(Object twitterMessage){
- Assert.isTrue(twitterMessage instanceof Status || twitterMessage instanceof DirectMessage,
- "'twitterMessage' must be an instance of either twitter4j.DirectMessage or twitter4j.Status");
- Class> interfaze = twitterMessage instanceof DirectMessage
- ? org.springframework.integration.twitter.core.DirectMessage.class
- : org.springframework.integration.twitter.core.Status.class;
- ProxyFactory factory = new ProxyFactory(interfaze, EmptyTargetSource.INSTANCE);
- factory.addAdvice(new Twitter4jDecorator(twitterMessage));
- return (TwitterMessage) factory.getProxy();
- }
- /**
- * Will constuct {@link GeoLocation} from 'latitude' and 'longitude'
- *
- * @param latitude
- * @param longitude
- * @return
- */
- public static GeoLocation fromLatitudeLongitude(double latitude, double longitude){
- twitter4j.GeoLocation geolocation = new twitter4j.GeoLocation(latitude, longitude);
- return fromTwitter4jGeoLocation(geolocation);
- }
- /**
- * Will constuct {@link GeoLocation} from {@link twitter4j.GeoLocation}
- * @param geolocation
- * @return
- */
- public static GeoLocation fromTwitter4jGeoLocation(twitter4j.GeoLocation geolocation){
- ProxyFactory factory = new ProxyFactory(GeoLocation.class, EmptyTargetSource.INSTANCE);
- factory.addAdvice(new Twitter4jDecorator(geolocation));
- return (GeoLocation) factory.getProxy();
- }
-}
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterMessage.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterMessage.java
deleted file mode 100644
index 07300f4ba8..0000000000
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/TwitterMessage.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2002-2010 the original author or authors.
- *
- * 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.springframework.integration.twitter.core;
-
-import java.util.Date;
-
-/**
- * @author Oleg Zhurakousky
- * @since 2.0
- */
-public interface TwitterMessage {
- int getId();
-
- String getText();
-
- Date getCreatedAt();
-}
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/User.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/User.java
deleted file mode 100644
index c43047c3ae..0000000000
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/core/User.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2010 the original author or authors
- *
- * 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.springframework.integration.twitter.core;
-
-
-/**
- * describes the user producing or receiving messages
- *
- * @author Josh Long
- * @since 2.0
- */
-public interface User {
-
- int getId();
-
- java.lang.String getName();
-
- java.lang.String getScreenName();
-
- java.lang.String getLocation();
-
- java.lang.String getDescription();
-
- boolean isContributorsEnabled();
-
- java.net.URL getProfileImageURL();
-
- java.net.URL getURL();
-
- boolean isProtected();
-
- int getFollowersCount();
-}
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractInboundTwitterStatusEndpointSupport.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractInboundTwitterStatusEndpointSupport.java
index 86a30c0f78..6bf5048846 100644
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractInboundTwitterStatusEndpointSupport.java
+++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractInboundTwitterStatusEndpointSupport.java
@@ -19,8 +19,8 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import org.springframework.integration.twitter.core.Status;
-import org.springframework.integration.twitter.core.TwitterFactory;
+import twitter4j.Status;
+import twitter4j.TwitterFactory;
/**
* Simple base class for the reply and timeline cases (as well as any other {@link twitter4j.Status} implementations of
@@ -37,13 +37,13 @@ abstract public class AbstractInboundTwitterStatusEndpointSupport extends Abstra
}
};
- protected List fromTwitter4jStatuses(List stats) {
- List fwd = new ArrayList();
- for (twitter4j.Status s : stats) {
- fwd.add((Status) TwitterFactory.formTwitter4jMessage(s));
- }
- return fwd;
- }
+// protected List fromTwitter4jStatuses(List stats) {
+// List fwd = new ArrayList();
+// for (twitter4j.Status s : stats) {
+// fwd.add((Status) TwitterFactory.formTwitter4jMessage(s));
+// }
+// return fwd;
+// }
@Override
protected void markLastStatusId(Status statusId) {
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundDirectMessageEndpoint.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundDirectMessageEndpoint.java
index 9733ae91ec..1a4e4670fc 100644
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundDirectMessageEndpoint.java
+++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundDirectMessageEndpoint.java
@@ -21,9 +21,8 @@ import java.util.Comparator;
import java.util.List;
import org.springframework.integration.MessagingException;
-import org.springframework.integration.twitter.core.DirectMessage;
-import org.springframework.integration.twitter.core.TwitterFactory;
+import twitter4j.DirectMessage;
import twitter4j.Paging;
/**
@@ -73,13 +72,13 @@ public class InboundDirectMessageEndpoint extends AbstractInboundTwitterEndpoint
List dms = !hasMarkedStatus()
? twitter.getDirectMessages()
: twitter.getDirectMessages(new Paging(sinceId));
-
- List dmsToFwd = new ArrayList();
-
- for( twitter4j.DirectMessage dm : dms) {
- dmsToFwd.add((DirectMessage) TwitterFactory.formTwitter4jMessage(dm));
- }
- forwardAll(dmsToFwd);
+
+// List dmsToFwd = new ArrayList();
+//
+// for( twitter4j.DirectMessage dm : dms) {
+// dmsToFwd.add((DirectMessage) TwitterFactory.formTwitter4jMessage(dm));
+// }
+ forwardAll(dms);
} catch (Exception e) {
e.printStackTrace();
if (e instanceof RuntimeException){
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundMentionEndpoint.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundMentionEndpoint.java
index 4d427e6a24..e1e4c9073e 100644
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundMentionEndpoint.java
+++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundMentionEndpoint.java
@@ -40,9 +40,9 @@ public class InboundMentionEndpoint extends AbstractInboundTwitterStatusEndpoint
try {
long sinceId = getMarkerId();
List stats = (!hasMarkedStatus())
- ? twitter.getMentions()
- : twitter.getMentions(new Paging(sinceId));
- forwardAll( fromTwitter4jStatuses( stats));
+ ? twitter.getMentions()
+ : twitter.getMentions(new Paging(sinceId));
+ forwardAll(stats);
} catch (Exception e) {
if (e instanceof RuntimeException){
throw (RuntimeException)e;
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundTimelineUpdateEndpoint.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundTimelineUpdateEndpoint.java
index 08e266e013..ec83c67cd5 100644
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundTimelineUpdateEndpoint.java
+++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/InboundTimelineUpdateEndpoint.java
@@ -41,9 +41,9 @@ public class InboundTimelineUpdateEndpoint extends AbstractInboundTwitterStatusE
public void run() {
try {
long sinceId = getMarkerId();
- forwardAll( fromTwitter4jStatuses(!hasMarkedStatus()
- ? twitter.getFriendsTimeline() :
- twitter.getFriendsTimeline(new Paging(sinceId))));
+ forwardAll(!hasMarkedStatus()
+ ? twitter.getFriendsTimeline()
+ : twitter.getFriendsTimeline(new Paging(sinceId)));
} catch (Exception e) {
if (e instanceof RuntimeException){
throw (RuntimeException)e;
diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/outbound/OutboundStatusUpdateMessageMapper.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/outbound/OutboundStatusUpdateMessageMapper.java
index 2b8ce71630..25a10520c7 100644
--- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/outbound/OutboundStatusUpdateMessageMapper.java
+++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/outbound/OutboundStatusUpdateMessageMapper.java
@@ -18,10 +18,10 @@ package org.springframework.integration.twitter.outbound;
import org.springframework.integration.Message;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.mapping.OutboundMessageMapper;
-import org.springframework.integration.twitter.core.GeoLocation;
import org.springframework.integration.twitter.core.TwitterHeaders;
import org.springframework.util.StringUtils;
+import twitter4j.GeoLocation;
import twitter4j.StatusUpdate;
@@ -69,15 +69,9 @@ public class OutboundStatusUpdateMessageMapper implements OutboundMessageMapper<
if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_GEOLOCATION)) {
- org.springframework.integration.twitter.core.GeoLocation geoLocation = (org.springframework.integration.twitter.core.GeoLocation) message.getHeaders()
- .get(TwitterHeaders.TWITTER_GEOLOCATION);
- twitter4j.GeoLocation gl = null;
-
- if (geoLocation instanceof GeoLocation) {
- gl = new twitter4j.GeoLocation(geoLocation.getLatitude(), geoLocation.getLongitude());
- if (null != gl) {
- statusUpdate.location(gl);
- }
+ GeoLocation geoLocation = (GeoLocation) message.getHeaders().get(TwitterHeaders.TWITTER_GEOLOCATION);
+ if (null != geoLocation) {
+ statusUpdate.location(geoLocation);
}
}
diff --git a/spring-integration-twitter/src/test/java/log4j.properties b/spring-integration-twitter/src/test/java/log4j.properties
new file mode 100644
index 0000000000..8bdb401027
--- /dev/null
+++ b/spring-integration-twitter/src/test/java/log4j.properties
@@ -0,0 +1,11 @@
+log4j.rootCategory=WARN, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n
+
+
+log4j.category.org.springframework=WARN
+# log4j.category.org.springframework.integration=DEBUG
+# log4j.category.org.springframework.integration.jdbc=DEBUG
+log4j.category.org.springframework.twitter=DEBUG
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/InboundDirectMessageStatusEndpointTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/InboundDirectMessageStatusEndpointTests.java
deleted file mode 100644
index 6385baa555..0000000000
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/InboundDirectMessageStatusEndpointTests.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2002-2010 the original author or authors.
- *
- * 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.springframework.integration.twitter;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.integration.Message;
-import org.springframework.integration.channel.QueueChannel;
-import org.springframework.integration.twitter.inbound.InboundDirectMessageEndpoint;
-import org.springframework.integration.twitter.oauth.OAuthConfiguration;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-
-import twitter4j.DirectMessage;
-import twitter4j.Paging;
-import twitter4j.RateLimitStatus;
-import twitter4j.ResponseList;
-import twitter4j.Twitter;
-
-/**
- * @author Oleg Zhurakousky
- *
- */
-public class InboundDirectMessageStatusEndpointTests {
- private DirectMessage firstMessage;
- private DirectMessage secondMessage;
- private Twitter twitter;
-
- @Test
- @Ignore
- /*
- * In order to run this test you need to provide values to the twitter.properties file
- */
- public void testUpdatesWithRealTwitter() throws Exception{
- CountDownLatch latch = new CountDownLatch(1);
- new ClassPathXmlApplicationContext("TestReceivingUsingNamespace-context.xml", this.getClass());
- latch.await(10000, TimeUnit.SECONDS);
- }
-
- @Test
- public void testTwitterMockedUpdates() throws Exception{
- QueueChannel channel = new QueueChannel();
-
- InboundDirectMessageEndpoint endpoint = new InboundDirectMessageEndpoint();
- endpoint.setOutputChannel(channel);
- ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
- scheduler.afterPropertiesSet();
- endpoint.setTaskScheduler(scheduler);
-
- endpoint.setConfiguration(this.getTestConfigurationForDirectMessages());
- endpoint.afterPropertiesSet();
- endpoint.start();
- Message message1 = channel.receive(3000);
- assertNotNull(message1);
- System.out.println();
- assertEquals(secondMessage.getId(), ((org.springframework.integration.twitter.core.DirectMessage)message1.getPayload()).getId());
- Message message2 = channel.receive(3000);
- assertNotNull(message2);
- assertEquals(firstMessage.getId(), ((org.springframework.integration.twitter.core.DirectMessage)message2.getPayload()).getId());
- }
-
- @Before
- public void prepare(){
- twitter = mock(Twitter.class);
- firstMessage = mock(DirectMessage.class);
- when(firstMessage.getCreatedAt()).thenReturn(new Date(5555555555L));
- when(firstMessage.getId()).thenReturn(200);
- secondMessage = mock(DirectMessage.class);
- when(secondMessage.getCreatedAt()).thenReturn(new Date(2222222222L));
- when(secondMessage.getId()).thenReturn(2000);
- }
-
- @SuppressWarnings("unchecked")
- private OAuthConfiguration getTestConfigurationForDirectMessages() throws Exception{
- OAuthConfiguration configuration = mock(OAuthConfiguration.class);
- RateLimitStatus rateLimitStatus = mock(RateLimitStatus.class);
- when(twitter.getRateLimitStatus()).thenReturn(rateLimitStatus);
- when(configuration.getTwitter()).thenReturn(twitter);
-
- when(rateLimitStatus.getSecondsUntilReset()).thenReturn(2464);
- when(rateLimitStatus.getRemainingHits()).thenReturn(250);
-
- ResponseList responses = mock(ResponseList.class);
- List testMessages = new ArrayList();
-
- testMessages.add(firstMessage);
- testMessages.add(secondMessage);
-
- when(responses.iterator()).thenReturn(testMessages.iterator());
- when(twitter.getDirectMessages()).thenReturn(responses);
-
- when(twitter.getDirectMessages(Mockito.any(Paging.class))).thenReturn(responses);
- return configuration;
- }
-}
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/SimpleTwitterTestClient-context.xml b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/SimpleTwitterTestClient-context.xml
deleted file mode 100644
index d7b3f4c3b1..0000000000
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/SimpleTwitterTestClient-context.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestReceivingUsingNamespace.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestReceivingUsingNamespace.java
deleted file mode 100644
index a6c533b5cf..0000000000
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestReceivingUsingNamespace.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2010 the original author or authors
- *
- * 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.springframework.integration.twitter;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
-
-/**
- * provides a simple example of a command-line client to receive DMs, messages, timeline updates.
- *
- * @author Josh Long
- */
-@ContextConfiguration
-public class TestReceivingUsingNamespace
- extends AbstractJUnit4SpringContextTests {
- @Autowired
- private TwitterAnnouncer twitterAnnouncer;
-
- @Test
- @Ignore
- public void testIt() throws Throwable {
- long ctr = 0;
- long s = 1000;
-
- while (ctr < (s * 60 * 3)) {
- Thread.sleep(s);
- ctr += s;
- }
- }
-}
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestReceivingUsingNamespace-context.xml b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestReceivingUsingNamespace-context.xml
index 6a5b8c4734..c406470708 100644
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestReceivingUsingNamespace-context.xml
+++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestReceivingUsingNamespace-context.xml
@@ -18,11 +18,8 @@
-
-
@@ -45,7 +42,7 @@
-
+
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestReceivingUsingNamespace.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestReceivingUsingNamespace.java
index 683c9a2036..39453be9fb 100644
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestReceivingUsingNamespace.java
+++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestReceivingUsingNamespace.java
@@ -36,6 +36,8 @@ public class TestReceivingUsingNamespace {
public void testUpdatesWithRealTwitter() throws Exception{
CountDownLatch latch = new CountDownLatch(1);
new ClassPathXmlApplicationContext("TestReceivingUsingNamespace-context.xml", this.getClass());
+ System.out.println("done");
latch.await(10000, TimeUnit.SECONDS);
+
}
}
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingDMsUsingNamespace-context.xml b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingDMsUsingNamespace-context.xml
index 80daadc2d3..69cd62b3cd 100644
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingDMsUsingNamespace-context.xml
+++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingDMsUsingNamespace-context.xml
@@ -18,7 +18,7 @@
mb = MessageBuilder.withPayload("'Hello world!', from the Spring Integration outbound Twitter adapter " + System.currentTimeMillis())
- .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, TwitterFactory.fromLatitudeLongitude(-76.226823, 23.642465)) // antarctica
+ .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new GeoLocation(-76.226823, 23.642465)) // antarctica
.setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true);
if (StringUtils.hasText(dmUsr)) {
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace-context.xml b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingUpdatesUsingNamespace-context.xml
similarity index 100%
rename from spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace-context.xml
rename to spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingUpdatesUsingNamespace-context.xml
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingUpdatesUsingNamespace.java
similarity index 97%
rename from spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace.java
rename to spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingUpdatesUsingNamespace.java
index a098e15d4e..9377e0b2e1 100644
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace.java
+++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TestSendingUpdatesUsingNamespace.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.twitter;
+package org.springframework.integration.twitter.config;
import org.junit.Ignore;
import org.junit.Test;
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TwitterAnnouncer.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TwitterAnnouncer.java
similarity index 87%
rename from spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TwitterAnnouncer.java
rename to spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TwitterAnnouncer.java
index 8c41578ad6..db5591000b 100644
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TwitterAnnouncer.java
+++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/config/TwitterAnnouncer.java
@@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.integration.twitter;
+package org.springframework.integration.twitter.config;
-import org.springframework.integration.twitter.core.DirectMessage;
-import org.springframework.integration.twitter.core.Status;
import org.springframework.stereotype.Component;
+import twitter4j.DirectMessage;
+import twitter4j.Status;
+
@Component
public class TwitterAnnouncer {
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/core/Twitter4jDecoratorTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/core/Twitter4jDecoratorTests.java
deleted file mode 100644
index 434e7a6238..0000000000
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/core/Twitter4jDecoratorTests.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- */
-package org.springframework.integration.twitter.core;
-
-import static junit.framework.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.junit.Test;
-import org.springframework.aop.framework.ProxyFactory;
-import org.springframework.aop.target.EmptyTargetSource;
-import org.springframework.integration.twitter.core.Twitter4jDecorator;
-
-import twitter4j.Status;
-
-/**
- * @author ozhurakousky
- *
- */
-public class Twitter4jDecoratorTests {
-
- @Test
- public void testTwitter4JDecorator(){
- Status status = mock(Status.class);
- when(status.getSource()).thenReturn("Hello World");
- ProxyFactory factory = new ProxyFactory(org.springframework.integration.twitter.core.Status.class, EmptyTargetSource.INSTANCE);
- factory.addAdvice(new Twitter4jDecorator(status));
- Object decoratedStatus = factory.getProxy();
- assertTrue(decoratedStatus instanceof org.springframework.integration.twitter.core.Status);
- String source = ((org.springframework.integration.twitter.core.Status)decoratedStatus).getSource();
- System.out.println("source: " + source);
- }
-}
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/InboundDirectMessageStatusEndpointTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/InboundDirectMessageStatusEndpointTests.java
index 0cbebcabc5..e9f1ca5226 100644
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/InboundDirectMessageStatusEndpointTests.java
+++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/inbound/InboundDirectMessageStatusEndpointTests.java
@@ -63,10 +63,10 @@ public class InboundDirectMessageStatusEndpointTests {
Message message1 = channel.receive(3000);
assertNotNull(message1);
System.out.println();
- assertEquals(secondMessage.getId(), ((org.springframework.integration.twitter.core.DirectMessage)message1.getPayload()).getId());
+ assertEquals(secondMessage.getId(), ((DirectMessage)message1.getPayload()).getId());
Message message2 = channel.receive(3000);
assertNotNull(message2);
- assertEquals(firstMessage.getId(), ((org.springframework.integration.twitter.core.DirectMessage)message2.getPayload()).getId());
+ assertEquals(firstMessage.getId(), ((DirectMessage)message2.getPayload()).getId());
}
@Before
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/OutboundDirectMessageMessageHandlerTests.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/OutboundDirectMessageMessageHandlerTests.java
index e2f7a970ce..1121a3155b 100644
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/OutboundDirectMessageMessageHandlerTests.java
+++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/outbound/OutboundDirectMessageMessageHandlerTests.java
@@ -22,10 +22,10 @@ import static org.mockito.Mockito.when;
import org.junit.Test;
import org.springframework.integration.support.MessageBuilder;
-import org.springframework.integration.twitter.core.TwitterFactory;
import org.springframework.integration.twitter.core.TwitterHeaders;
import org.springframework.integration.twitter.oauth.OAuthConfiguration;
+import twitter4j.GeoLocation;
import twitter4j.Twitter;
/**
@@ -38,7 +38,7 @@ public class OutboundDirectMessageMessageHandlerTests {
@Test
public void validateSendDirectMessage() throws Exception{
MessageBuilder mb = MessageBuilder.withPayload("hello")
- .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, TwitterFactory.fromLatitudeLongitude(-76.226823, 23.642465)) // antarctica
+ .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new GeoLocation(-76.226823, 23.642465)) // antarctica
.setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true)
.setHeader(TwitterHeaders.TWITTER_DM_TARGET_USER_ID, "foo");
OutboundDirectMessageMessageHandler handler = new OutboundDirectMessageMessageHandler();
@@ -50,7 +50,7 @@ public class OutboundDirectMessageMessageHandlerTests {
verify(twitter, times(1)).sendDirectMessage("foo", "hello");
mb = MessageBuilder.withPayload("hello")
- .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, TwitterFactory.fromLatitudeLongitude(-76.226823, 23.642465)) // antarctica
+ .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new GeoLocation(-76.226823, 23.642465)) // antarctica
.setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true)
.setHeader(TwitterHeaders.TWITTER_DM_TARGET_USER_ID, 123);
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/receiving_replies_using_ns.xml b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/receiving_replies_using_ns.xml
deleted file mode 100644
index d94a6a9158..0000000000
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/receiving_replies_using_ns.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/receiving_updates_using_ns.xml b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/receiving_updates_using_ns.xml
deleted file mode 100644
index 496e5d3683..0000000000
--- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/receiving_updates_using_ns.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-integration-twitter/src/test/java/twitter.receiver.properties b/spring-integration-twitter/src/test/java/twitter.receiver.properties
new file mode 100644
index 0000000000..b48cc7f3ba
--- /dev/null
+++ b/spring-integration-twitter/src/test/java/twitter.receiver.properties
@@ -0,0 +1,6 @@
+# oauth setup for prosibook twitter account
+twitter.oauth.consumerKey=
+twitter.oauth.consumerSecret=
+twitter.oauth.pin=
+twitter.oauth.accessToken=
+twitter.oauth.accessTokenSecret=
\ No newline at end of file
diff --git a/spring-integration-twitter/src/test/java/twitter.properties b/spring-integration-twitter/src/test/java/twitter.sender.properties
similarity index 100%
rename from spring-integration-twitter/src/test/java/twitter.properties
rename to spring-integration-twitter/src/test/java/twitter.sender.properties