Permalink
Browse files

TFJ-633 remove retired trend methods

method removed:
Twitter#getCurrentTrends()
Twitter#getTrends()
  • Loading branch information...
1 parent daa2ef4 commit 06dd4358aa4fb0bb09467545a1d976df23d15ea8 Yusuke Yamamoto committed Oct 19, 2011
View
@@ -49,4 +49,4 @@ Tomohisa Igarashi <tm.igarashi at gmail.com>
Will Glozer <will at glozer.net> @ar3te
William Morgan <william at twitter.com> @wm
withgod <noname at withgod.jp> @withgod
-Yusuke Yamamoto <yusuke at mac.com> @yusukey
+Yusuke Yamamoto <yusuke at mac.com> @yusuke
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 Yusuke Yamamoto
+ * Copyright (C) 2007 Yusuke Yamamoto
+ * Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -81,60 +82,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void getTrends() {
- getDispatcher().invokeLater(new AsyncTask(TRENDS, listeners) {
- public void invoke(List<TwitterListener> listeners) throws
- TwitterException {
- Trends trends = twitter.getTrends();
- for (TwitterListener listener : listeners) {
- try {
- listener.gotTrends(trends);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getCurrentTrends() {
- getDispatcher().invokeLater(new AsyncTask(CURRENT_TRENDS, listeners) {
- public void invoke(List<TwitterListener> listeners) throws
- TwitterException {
- Trends trends = twitter.getCurrentTrends();
- for (TwitterListener listener : listeners) {
- try {
- listener.gotCurrentTrends(trends);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getCurrentTrends(final boolean excludeHashTags) {
- getDispatcher().invokeLater(new AsyncTask(CURRENT_TRENDS, listeners) {
- public void invoke(List<TwitterListener> listeners) throws
- TwitterException {
- Trends trends = twitter.getCurrentTrends(excludeHashTags);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotCurrentTrends(trends);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
public void getDailyTrends() {
getDispatcher().invokeLater(new AsyncTask(DAILY_TRENDS, listeners) {
public void invoke(List<TwitterListener> listeners) throws
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 Yusuke Yamamoto
+ * Copyright (C) 2007 Yusuke Yamamoto
+ * Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +19,6 @@
import twitter4j.api.HelpMethods;
-import java.util.List;
-
/**
* A handy adapter of TwitterListener.
*
@@ -38,12 +37,6 @@ public void searched(QueryResult result) {
/**
* @since Twitter4J 2.0.2
*/
- public void gotTrends(Trends trends) {
- }
-
- /**
- * @since Twitter4J 2.0.2
- */
public void gotCurrentTrends(Trends trends) {
}
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 Yusuke Yamamoto
+ * Copyright (C) 2007 Yusuke Yamamoto
+ * Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +19,6 @@
import twitter4j.api.HelpMethods;
-import java.util.List;
-
/**
* A listner for receiving asynchronous responses from Twitter Async APIs.
*
@@ -34,11 +33,6 @@
/**
* @since Twitter4J 2.0.2
*/
- void gotTrends(Trends trends);
-
- /**
- * @since Twitter4J 2.0.2
- */
void gotCurrentTrends(Trends trends);
/**
@@ -482,8 +476,6 @@
/*Search API Methods*/
TwitterMethod SEARCH = TwitterMethod.SEARCH;
- TwitterMethod TRENDS = TwitterMethod.TRENDS;
- TwitterMethod CURRENT_TRENDS = TwitterMethod.CURRENT_TRENDS;
TwitterMethod DAILY_TRENDS = TwitterMethod.DAILY_TRENDS;
TwitterMethod WEEKLY_TRENDS = TwitterMethod.WEEKLY_TRENDS;
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 Yusuke Yamamoto
+ * Copyright (C) 2007 Yusuke Yamamoto
+ * Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,8 +79,6 @@ private Object readResolve() throws ObjectStreamException {
/*Search API Methods*/
public static final TwitterMethod SEARCH = getInstance("SEARCH");
- public static final TwitterMethod TRENDS = new TwitterMethod("TRENDS");
- public static final TwitterMethod CURRENT_TRENDS = new TwitterMethod("CURRENT_TRENDS");
public static final TwitterMethod DAILY_TRENDS = new TwitterMethod("DAILY_TRENDS");
public static final TwitterMethod WEEKLY_TRENDS = new TwitterMethod("WEEKLY_TRENDS");
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 Yusuke Yamamoto
+ * Copyright (C) 2007 Yusuke Yamamoto
+ * Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,34 +25,6 @@
*/
public interface TrendsMethodsAsync {
/**
- * Returns the top ten topics that are currently trending on Twitter. The response includes the time of the request, the name of each trend, and the url to the Twitter Search results page for that topic.
- * <br>This method calls http://search.twitter.com/trends.json
- *
- * @see <a href="https://dev.twitter.com/docs/api/1/get/trends">GET trends | Twitter Developers</a>
- * @since Twitter4J 2.0.2
- */
- void getTrends();
-
- /**
- * Returns the current top 10 trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic.
- * <br>This method calls http://search.twitter.com/trends/current.json
- *
- * @see <a href="https://dev.twitter.com/docs/api/1/get/trends/current">GET trends/current | Twitter Developers</a>
- * @since Twitter4J 2.0.2
- */
- void getCurrentTrends();
-
- /**
- * Returns the current top 10 trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic.
- * <br>This method calls http://search.twitter.com/trends/current.json
- *
- * @param excludeHashTags Setting this to true will remove all hashtags from the trends list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/trends/current">GET trends/current | Twitter Developers</a>
- * @since Twitter4J 2.0.2
- */
- void getCurrentTrends(boolean excludeHashTags);
-
- /**
* Returns the top 20 trending topics for each hour in a given day.
* <br>This method calls http://search.twitter.com/trends/daily.json
*
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 Yusuke Yamamoto
+ * Copyright (C) 2007 Yusuke Yamamoto
+ * Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -101,28 +102,6 @@ public QueryResult search(Query query) throws TwitterException {
/**
* {@inheritDoc}
*/
- public Trends getTrends() throws TwitterException {
- return factory.createTrends(get(conf.getRestBaseURL() + "trends.json"));
- }
-
- /**
- * {@inheritDoc}
- */
- public Trends getCurrentTrends() throws TwitterException {
- return factory.createTrendsList(get(conf.getRestBaseURL() + "trends/current.json")).get(0);
- }
-
- /**
- * {@inheritDoc}
- */
- public Trends getCurrentTrends(boolean excludeHashTags) throws TwitterException {
- return factory.createTrendsList(get(conf.getRestBaseURL() + "trends/current.json"
- + (excludeHashTags ? "?exclude=hashtags" : ""))).get(0);
- }
-
- /**
- * {@inheritDoc}
- */
public ResponseList<Trends> getDailyTrends() throws TwitterException {
return factory.createTrendsList(get(conf.getRestBaseURL() + "trends/daily.json"));
}
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 Yusuke Yamamoto
+ * Copyright (C) 2007 Yusuke Yamamoto
+ * Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,40 +29,6 @@
*/
public interface TrendsMethods {
/**
- * Returns the top ten topics that are currently trending on Twitter. The response includes the time of the request, the name of each trend, and the url to the Twitter Search results page for that topic.
- * <br>This method calls http://search.twitter.com/trends.json
- *
- * @return the result
- * @throws twitter4j.TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/trends">GET trends | Twitter Developers</a>
- * @since Twitter4J 2.0.2
- */
- Trends getTrends() throws TwitterException;
-
- /**
- * Returns the current top 10 trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic.
- * <br>This method calls http://search.twitter.com/trends/current.json
- *
- * @return the result
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/trends/current">GET trends/current | Twitter Developers</a>
- * @since Twitter4J 2.0.2
- */
- Trends getCurrentTrends() throws TwitterException;
-
- /**
- * Returns the current top 10 trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic.
- * <br>This method calls http://search.twitter.com/trends/current.json
- *
- * @param excludeHashTags Setting this to true will remove all hashtags from the trends list.
- * @return the result
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/trends/current">GET trends/current | Twitter Developers</a>
- * @since Twitter4J 2.0.2
- */
- Trends getCurrentTrends(boolean excludeHashTags) throws TwitterException;
-
- /**
* Returns the top 20 trending topics for each hour in a given day.
* <br>This method calls http://search.twitter.com/trends/daily.json
*
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 Yusuke Yamamoto
+ * Copyright (C) 2007 Yusuke Yamamoto
+ * Copyright (C) 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,58 +121,18 @@ public void testSearch() throws Exception {
}
public void testTrends() throws Exception {
- Trends trends;
- trends = unauthenticated.getTrends();
-
- assertTrue(100000 > (trends.getAsOf().getTime() - System.currentTimeMillis()));
- assertEquals(10, trends.getTrends().length);
- for (int i = 0; i < 10; i++) {
- assertNotNull(trends.getTrends()[i].getName());
- assertNotNull(trends.getTrends()[i].getUrl());
- assertNull(trends.getTrends()[i].getQuery());
- trends.getTrends()[i].hashCode();
- trends.getTrends()[i].toString();
- }
-
- trends = unauthenticated.getCurrentTrends();
- assertTrue(100000 > (trends.getAsOf().getTime() - System.currentTimeMillis()));
- assertEquals(10, trends.getTrends().length);
- for (Trend trend : trends.getTrends()) {
- assertNotNull(trend.getName());
- assertNull(trend.getUrl());
- assertNotNull(trend.getQuery());
- trend.hashCode();
- trend.toString();
- }
-
- trends = unauthenticated.getCurrentTrends(true);
- assertTrue(100000 > (trends.getAsOf().getTime() - System.currentTimeMillis()));
- Trend[] trendArray = trends.getTrends();
- assertEquals(10, trendArray.length);
- for (Trend trend : trends.getTrends()) {
- assertNotNull(trend.getName());
- assertNull(trend.getUrl());
- assertNotNull(trend.getQuery());
- trend.hashCode();
- trend.toString();
- }
-
List<Trends> trendsList;
trendsList = unauthenticated.getDailyTrends();
- assertTrue(100000 > (trends.getAsOf().getTime() - System.currentTimeMillis()));
assertTrends(trendsList, 20);
trendsList = unauthenticated.getDailyTrends(new Date(), true);
- assertTrue(100000 > (trends.getAsOf().getTime() - System.currentTimeMillis()));
assertTrends(trendsList, 20);
trendsList = unauthenticated.getWeeklyTrends();
- assertTrue(100000 > (trends.getAsOf().getTime() - System.currentTimeMillis()));
assertTrends(trendsList, 30);
trendsList = unauthenticated.getWeeklyTrends(new Date(), true);
- assertTrue(100000 > (trends.getAsOf().getTime() - System.currentTimeMillis()));
assertTrends(trendsList, 30);
}
@@ -1,9 +0,0 @@
-echo off
-SETLOCAL enabledelayedexpansion
-cd ..
-call setEnv.cmd
-
-echo on
-"%JAVA_HOME%\bin\java" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.trends.GetCurrentTrends %*
-
-ENDLOCAL
@@ -1,7 +0,0 @@
-#/bin/sh
-cd ..
-. ./setEnv.sh
-
-RUN_CMD="$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.trends.GetCurrentTrends"
-echo $RUN_CMD ${1+"$@"}
-exec $RUN_CMD ${1+"$@"}
@@ -1,9 +0,0 @@
-echo off
-SETLOCAL enabledelayedexpansion
-cd ..
-call setEnv.cmd
-
-echo on
-"%JAVA_HOME%\bin\java" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.trends.GetTrends %*
-
-ENDLOCAL
@@ -1,7 +0,0 @@
-#/bin/sh
-cd ..
-. ./setEnv.sh
-
-RUN_CMD="$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.trends.GetTrends"
-echo $RUN_CMD ${1+"$@"}
-exec $RUN_CMD ${1+"$@"}
Oops, something went wrong.

0 comments on commit 06dd435

Please sign in to comment.