From b3e27b15e267685822a4bec88e47c9f9e3786519 Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Mon, 9 Nov 2009 06:32:44 +0000 Subject: [PATCH] reorganized twitter git-svn-id: http://jclouds.googlecode.com/svn/trunk@2239 3d8758e0-26b5-11de-8745-db77d3ebf521 --- twitter/core/pom.xml | 48 ------------ twitter/pom.xml | 73 ++++++++++--------- .../java/org/jclouds/twitter/Twitter.java | 0 .../org/jclouds/twitter/TwitterClient.java | 0 .../twitter/TwitterContextBuilder.java | 0 .../twitter/TwitterContextFactory.java | 11 +-- .../twitter/TwitterPropertiesBuilder.java | 2 +- .../twitter/config/TwitterContextModule.java | 0 .../config/TwitterRestClientModule.java | 0 .../org/jclouds/twitter/domain/Status.java | 0 .../java/org/jclouds/twitter/domain/User.java | 0 .../ParseStatusesFromJsonResponse.java | 2 +- .../twitter/reference/TwitterConstants.java | 0 .../twitter/TwitterClientLiveTest.java | 0 .../jclouds/twitter/TwitterClientTest.java | 4 +- .../twitter/TwitterContextBuilderTest.java | 12 +-- .../config/TwitterContextModuleTest.java | 2 +- .../ParseStatusesFromJsonResponseTest.java | 0 .../{core => }/src/test/resources/log4j.xml | 0 .../src/test/resources/test_mentions.json | 0 20 files changed, 54 insertions(+), 100 deletions(-) delete mode 100644 twitter/core/pom.xml rename twitter/{core => }/src/main/java/org/jclouds/twitter/Twitter.java (100%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/TwitterClient.java (100%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java (100%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/TwitterContextFactory.java (90%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java (98%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/config/TwitterContextModule.java (100%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java (100%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/domain/Status.java (100%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/domain/User.java (100%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponse.java (97%) rename twitter/{core => }/src/main/java/org/jclouds/twitter/reference/TwitterConstants.java (100%) rename twitter/{core => }/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java (100%) rename twitter/{core => }/src/test/java/org/jclouds/twitter/TwitterClientTest.java (95%) rename twitter/{core => }/src/test/java/org/jclouds/twitter/TwitterContextBuilderTest.java (93%) rename twitter/{core => }/src/test/java/org/jclouds/twitter/config/TwitterContextModuleTest.java (99%) rename twitter/{core => }/src/test/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponseTest.java (100%) rename twitter/{core => }/src/test/resources/log4j.xml (100%) rename twitter/{core => }/src/test/resources/test_mentions.json (100%) diff --git a/twitter/core/pom.xml b/twitter/core/pom.xml deleted file mode 100644 index 03baadee0f..0000000000 --- a/twitter/core/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - org.jclouds - jclouds-twitter-project - 1.0-SNAPSHOT - ../pom.xml - - 4.0.0 - org.jclouds - jclouds-twitter - jclouds twitter core - jar - jclouds core components to access twitter - - - scm:svn:http://jclouds.googlecode.com/svn/trunk//twitter/core - scm:svn:https://jclouds.googlecode.com/svn/trunk//twitter/core - http://jclouds.googlecode.com/svn/trunk//twitter/core - - - diff --git a/twitter/pom.xml b/twitter/pom.xml index 244df617b1..f1175c4c0c 100644 --- a/twitter/pom.xml +++ b/twitter/pom.xml @@ -1,44 +1,45 @@ - - + http://www.apache.org/licenses/LICENSE-2.0.html 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. + ==================================================================== + --> + - jclouds-project org.jclouds + jclouds-project 1.0-SNAPSHOT ../pom.xml 4.0.0 - jclouds-twitter-project - pom - jclouds twitter - - core - + org.jclouds + jclouds-twitter + jclouds twitter core + jar + jclouds components to access twitter + + + scm:svn:http://jclouds.googlecode.com/svn/trunk/twitter + scm:svn:https://jclouds.googlecode.com/svn/trunk/twitter + http://jclouds.googlecode.com/svn/trunk/twitter + ${jclouds.twitter.user} ${jclouds.twitter.password} @@ -57,10 +58,10 @@ test - log4j - log4j - 1.2.14 - test + log4j + log4j + 1.2.14 + test ${project.groupId} diff --git a/twitter/core/src/main/java/org/jclouds/twitter/Twitter.java b/twitter/src/main/java/org/jclouds/twitter/Twitter.java similarity index 100% rename from twitter/core/src/main/java/org/jclouds/twitter/Twitter.java rename to twitter/src/main/java/org/jclouds/twitter/Twitter.java diff --git a/twitter/core/src/main/java/org/jclouds/twitter/TwitterClient.java b/twitter/src/main/java/org/jclouds/twitter/TwitterClient.java similarity index 100% rename from twitter/core/src/main/java/org/jclouds/twitter/TwitterClient.java rename to twitter/src/main/java/org/jclouds/twitter/TwitterClient.java diff --git a/twitter/core/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java b/twitter/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java similarity index 100% rename from twitter/core/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java rename to twitter/src/main/java/org/jclouds/twitter/TwitterContextBuilder.java diff --git a/twitter/core/src/main/java/org/jclouds/twitter/TwitterContextFactory.java b/twitter/src/main/java/org/jclouds/twitter/TwitterContextFactory.java similarity index 90% rename from twitter/core/src/main/java/org/jclouds/twitter/TwitterContextFactory.java rename to twitter/src/main/java/org/jclouds/twitter/TwitterContextFactory.java index fa31461cc9..aac6516009 100644 --- a/twitter/core/src/main/java/org/jclouds/twitter/TwitterContextFactory.java +++ b/twitter/src/main/java/org/jclouds/twitter/TwitterContextFactory.java @@ -32,8 +32,8 @@ import org.jclouds.rest.RestContext; import com.google.inject.Module; /** - * Creates {@link RestContext} instances based on the most commonly requested - * arguments. + * Creates {@link RestContext} for {@link TwitterClient} instances based on the most commonly + * requested arguments. *

* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided. *

@@ -42,13 +42,14 @@ import com.google.inject.Module; * {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed. * * @author Adrian Cole - * @see RestContext + * @see RestContext + * @see TwitterClient */ public class TwitterContextFactory { - public static RestContext createContext(String user, String key, + public static RestContext createContext(String user, String password, Module... modules) { - return new TwitterContextBuilder(new TwitterPropertiesBuilder(user, key).build()) + return new TwitterContextBuilder(new TwitterPropertiesBuilder(user, password).build()) .withModules(modules).buildContext(); } diff --git a/twitter/core/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java b/twitter/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java similarity index 98% rename from twitter/core/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java rename to twitter/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java index e762f2a8c0..8f9113c744 100644 --- a/twitter/core/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java +++ b/twitter/src/main/java/org/jclouds/twitter/TwitterPropertiesBuilder.java @@ -57,7 +57,7 @@ public class TwitterPropertiesBuilder extends HttpPropertiesBuilder { public TwitterPropertiesBuilder withCredentials(String id, String secret) { properties.setProperty(PROPERTY_TWITTER_USER, checkNotNull(id, "user")); - properties.setProperty(PROPERTY_TWITTER_PASSWORD, checkNotNull(secret, "key")); + properties.setProperty(PROPERTY_TWITTER_PASSWORD, checkNotNull(secret, "password")); return this; } diff --git a/twitter/core/src/main/java/org/jclouds/twitter/config/TwitterContextModule.java b/twitter/src/main/java/org/jclouds/twitter/config/TwitterContextModule.java similarity index 100% rename from twitter/core/src/main/java/org/jclouds/twitter/config/TwitterContextModule.java rename to twitter/src/main/java/org/jclouds/twitter/config/TwitterContextModule.java diff --git a/twitter/core/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java b/twitter/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java similarity index 100% rename from twitter/core/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java rename to twitter/src/main/java/org/jclouds/twitter/config/TwitterRestClientModule.java diff --git a/twitter/core/src/main/java/org/jclouds/twitter/domain/Status.java b/twitter/src/main/java/org/jclouds/twitter/domain/Status.java similarity index 100% rename from twitter/core/src/main/java/org/jclouds/twitter/domain/Status.java rename to twitter/src/main/java/org/jclouds/twitter/domain/Status.java diff --git a/twitter/core/src/main/java/org/jclouds/twitter/domain/User.java b/twitter/src/main/java/org/jclouds/twitter/domain/User.java similarity index 100% rename from twitter/core/src/main/java/org/jclouds/twitter/domain/User.java rename to twitter/src/main/java/org/jclouds/twitter/domain/User.java diff --git a/twitter/core/src/main/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponse.java b/twitter/src/main/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponse.java similarity index 97% rename from twitter/core/src/main/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponse.java rename to twitter/src/main/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponse.java index c5f568eab8..298da98156 100644 --- a/twitter/core/src/main/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponse.java +++ b/twitter/src/main/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponse.java @@ -39,7 +39,7 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; /** - * This parses {@link Status} from a gson string. + * This parses {@link Status} from a json string. * * @author Adrian Cole */ diff --git a/twitter/core/src/main/java/org/jclouds/twitter/reference/TwitterConstants.java b/twitter/src/main/java/org/jclouds/twitter/reference/TwitterConstants.java similarity index 100% rename from twitter/core/src/main/java/org/jclouds/twitter/reference/TwitterConstants.java rename to twitter/src/main/java/org/jclouds/twitter/reference/TwitterConstants.java diff --git a/twitter/core/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java b/twitter/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java similarity index 100% rename from twitter/core/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java rename to twitter/src/test/java/org/jclouds/twitter/TwitterClientLiveTest.java diff --git a/twitter/core/src/test/java/org/jclouds/twitter/TwitterClientTest.java b/twitter/src/test/java/org/jclouds/twitter/TwitterClientTest.java similarity index 95% rename from twitter/core/src/test/java/org/jclouds/twitter/TwitterClientTest.java rename to twitter/src/test/java/org/jclouds/twitter/TwitterClientTest.java index edaa5c2464..2a5de89936 100644 --- a/twitter/core/src/test/java/org/jclouds/twitter/TwitterClientTest.java +++ b/twitter/src/test/java/org/jclouds/twitter/TwitterClientTest.java @@ -58,7 +58,7 @@ public class TwitterClientTest extends RestClientTest { Method method = TwitterClient.class.getMethod("getMyMentions"); GeneratedHttpRequest httpMethod = processor.createRequest(method); - assertRequestLineEquals(httpMethod, "GET http://localhost/tweettest/statuses/mentions.json HTTP/1.1"); + assertRequestLineEquals(httpMethod, "GET http://twitter.com/statuses/mentions.json HTTP/1.1"); assertHeadersEqual(httpMethod, ""); assertEntityEquals(httpMethod, null); @@ -87,7 +87,7 @@ public class TwitterClientTest extends RestClientTest { @Override protected void configure() { bind(URI.class).annotatedWith(Twitter.class).toInstance( - URI.create("http://localhost/tweettest")); + URI.create("http://twitter.com")); bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() { public Logger getLogger(String category) { return Logger.NULL; diff --git a/twitter/core/src/test/java/org/jclouds/twitter/TwitterContextBuilderTest.java b/twitter/src/test/java/org/jclouds/twitter/TwitterContextBuilderTest.java similarity index 93% rename from twitter/core/src/test/java/org/jclouds/twitter/TwitterContextBuilderTest.java rename to twitter/src/test/java/org/jclouds/twitter/TwitterContextBuilderTest.java index db092f3575..168b8b9be2 100644 --- a/twitter/core/src/test/java/org/jclouds/twitter/TwitterContextBuilderTest.java +++ b/twitter/src/test/java/org/jclouds/twitter/TwitterContextBuilderTest.java @@ -46,7 +46,7 @@ import com.google.inject.TypeLiteral; * * @author Adrian Cole */ -@Test(groups = "unit", testName = "cloudfiles.TwitterContextBuilderTest") +@Test(groups = "unit", testName = "twitter.TwitterContextBuilderTest") public class TwitterContextBuilderTest { public void testNewBuilder() { @@ -54,15 +54,15 @@ public class TwitterContextBuilderTest { assertEquals(builder.getProperties().getProperty(TwitterConstants.PROPERTY_TWITTER_ENDPOINT), "http://twitter.com"); assertEquals(builder.getProperties().getProperty(TwitterConstants.PROPERTY_TWITTER_USER), - "id"); + "user"); assertEquals(builder.getProperties().getProperty(TwitterConstants.PROPERTY_TWITTER_PASSWORD), - "secret"); + "password"); } public void testBuildContext() { RestContext context = newBuilder().buildContext(); assertEquals(context.getClass(), RestContextImpl.class); - assertEquals(context.getAccount(), "id"); + assertEquals(context.getAccount(), "user"); assertEquals(context.getEndPoint(), URI.create("http://twitter.com")); } @@ -82,8 +82,8 @@ public class TwitterContextBuilderTest { } private TwitterContextBuilder newBuilder() { - TwitterContextBuilder builder = new TwitterContextBuilder(new TwitterPropertiesBuilder("id", - "secret").build()); + TwitterContextBuilder builder = new TwitterContextBuilder(new TwitterPropertiesBuilder("user", + "password").build()); return builder; } diff --git a/twitter/core/src/test/java/org/jclouds/twitter/config/TwitterContextModuleTest.java b/twitter/src/test/java/org/jclouds/twitter/config/TwitterContextModuleTest.java similarity index 99% rename from twitter/core/src/test/java/org/jclouds/twitter/config/TwitterContextModuleTest.java rename to twitter/src/test/java/org/jclouds/twitter/config/TwitterContextModuleTest.java index 7e92932294..6c97cfaadc 100644 --- a/twitter/core/src/test/java/org/jclouds/twitter/config/TwitterContextModuleTest.java +++ b/twitter/src/test/java/org/jclouds/twitter/config/TwitterContextModuleTest.java @@ -58,7 +58,7 @@ public class TwitterContextModuleTest { bindConstant().annotatedWith(Jsr330.named(TwitterConstants.PROPERTY_TWITTER_USER)).to( "user"); bindConstant().annotatedWith(Jsr330.named(TwitterConstants.PROPERTY_TWITTER_PASSWORD)) - .to("key"); + .to("password"); bindConstant().annotatedWith(Jsr330.named(TwitterConstants.PROPERTY_TWITTER_ENDPOINT)) .to("http://localhost"); bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() { diff --git a/twitter/core/src/test/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponseTest.java b/twitter/src/test/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponseTest.java similarity index 100% rename from twitter/core/src/test/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponseTest.java rename to twitter/src/test/java/org/jclouds/twitter/functions/ParseStatusesFromJsonResponseTest.java diff --git a/twitter/core/src/test/resources/log4j.xml b/twitter/src/test/resources/log4j.xml similarity index 100% rename from twitter/core/src/test/resources/log4j.xml rename to twitter/src/test/resources/log4j.xml diff --git a/twitter/core/src/test/resources/test_mentions.json b/twitter/src/test/resources/test_mentions.json similarity index 100% rename from twitter/core/src/test/resources/test_mentions.json rename to twitter/src/test/resources/test_mentions.json