diff --git a/demos/gae-tweetstore/pom.xml b/demos/gae-tweetstore/pom.xml deleted file mode 100644 index 44e81fa938..0000000000 --- a/demos/gae-tweetstore/pom.xml +++ /dev/null @@ -1,313 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-demos-project - 1.0-SNAPSHOT - - jclouds-demo-gae-tweetstore - war - JClouds TweetStore for Google App Engine - JClouds TweetStore for Google App Engine using Guice for Dependency Injection - - - - jclouds-tweetstore - 1.4.2 - localhost - 8088 - cloudfiles-us,aws-s3,azureblob - jclouds-tweetstore - - - - - ${project.groupId} - jclouds-blobstore - ${project.version} - - - org.twitter4j - twitter4j-core - [2.1,) - - - ${project.groupId} - jclouds-blobstore - ${project.version} - test-jar - test - - - org.jclouds.provider - aws-s3 - ${project.version} - runtime - - - org.jclouds.provider - cloudfiles-us - ${project.version} - runtime - - - org.jclouds.provider - azureblob - ${project.version} - runtime - - - org.jclouds.driver - jclouds-gae - ${project.version} - - - com.google.inject.extensions - guice-servlet - 3.0 - - - displaytag - displaytag - 1.2 - runtime - - - org.slf4j - slf4j-log4j12 - - - - - org.slf4j - slf4j-jdk14 - 1.5.6 - runtime - - - jstl - javax.servlet - 1.1.2 - runtime - - - standard - taglibs - 1.1.2 - runtime - - - javax.servlet - servlet-api - 2.5 - provided - - - - - com.google.appengine - appengine-api-1.0-sdk - ${appengine.sdk.version} - - - com.google.appengine - appengine-tools-sdk - ${appengine.sdk.version} - test - - - - - - - - - ${project.artifactId} - - - maven-war-plugin - - - - src/main/appengine - WEB-INF/ - true - - - - - - maven-surefire-plugin - - - integration - integration-test - - test - - - - - appengine.sdk.root - ${appengine.sdk.root} - - - devappserver.address - ${devappserver.address} - - - devappserver.port - ${devappserver.port} - - - warfile - ${project.build.directory}/${project.artifactId} - - - - - - - - - - - - live - - - - maven-surefire-plugin - - - integration - integration-test - - test - - - - - test.twitter.identity - ${test.twitter.identity} - - - test.twitter.credential - ${test.twitter.credential} - - - test.azureblob.identity - ${test.azureblob.identity} - - - test.azureblob.credential - ${test.azureblob.credential} - - - test.cloudfiles-us.identity - ${test.cloudfiles-us.identity} - - - test.cloudfiles-us.credential - ${test.cloudfiles-us.credential} - - - test.aws-s3.identity - ${test.aws-s3.identity} - - - test.aws-s3.credential - ${test.aws-s3.credential} - - - appengine.sdk.root - ${appengine.sdk.root} - - - devappserver.address - ${devappserver.address} - - - devappserver.port - ${devappserver.port} - - - jclouds.tweetstore.blobstores - ${jclouds.tweetstore.blobstores} - - - jclouds.tweetstore.container - ${jclouds.tweetstore.container} - - - warfile - ${project.build.directory}/${project.artifactId} - - - - - - - - - - - diff --git a/demos/pom.xml b/demos/pom.xml index 50209cbeae..d1b0d379ec 100644 --- a/demos/pom.xml +++ b/demos/pom.xml @@ -32,12 +32,9 @@ pom jclouds demos project - gae-tweetstore - gae-tweetstore-spring getpath googleappengine perftest - runatcloud-tweetstore speedtest-azurequeue speedtest-sqs simpledb diff --git a/demos/gae-tweetstore-spring/pom.xml b/demos/tweetstore/gae-tweetstore-spring/pom.xml similarity index 73% rename from demos/gae-tweetstore-spring/pom.xml rename to demos/tweetstore/gae-tweetstore-spring/pom.xml index 5be9f733b2..5f4e9deb31 100644 --- a/demos/gae-tweetstore-spring/pom.xml +++ b/demos/tweetstore/gae-tweetstore-spring/pom.xml @@ -24,7 +24,7 @@ 4.0.0 org.jclouds - jclouds-demos-project + jclouds-demos-tweetstore-project 1.0-SNAPSHOT jclouds-demo-gae-tweetstore-spring @@ -41,46 +41,10 @@ 1.4.2 localhost 8088 - cloudfiles-us,aws-s3,azureblob jclouds-tweetstore-spring - - ${project.groupId} - jclouds-blobstore - ${project.version} - - - org.twitter4j - twitter4j-core - [2.1,) - - - ${project.groupId} - jclouds-blobstore - ${project.version} - test-jar - test - - - org.jclouds.provider - aws-s3 - ${project.version} - runtime - - - org.jclouds.provider - cloudfiles-us - ${project.version} - runtime - - - org.jclouds.provider - azureblob - ${project.version} - runtime - org.jclouds.driver jclouds-gae @@ -102,42 +66,6 @@ 2.2 runtime - - displaytag - displaytag - 1.2 - runtime - - - org.slf4j - slf4j-log4j12 - - - - - org.slf4j - slf4j-jdk14 - 1.5.6 - runtime - - - standard - taglibs - 1.1.2 - runtime - - - jstl - javax.servlet - 1.1.2 - runtime - - - javax.servlet - servlet-api - 2.5 - provided - @@ -152,21 +80,9 @@ test + - ${project.artifactId} - - maven-war-plugin - - - - src/main/appengine - WEB-INF/ - true - - - - maven-surefire-plugin @@ -219,12 +135,20 @@ - test.twitter.identity - ${test.twitter.identity} + test.twitter.consumer.identity + ${test.twitter.gae-tweetstore-spring.consumer.identity} - test.twitter.credential - ${test.twitter.credential} + test.twitter.consumer.credential + ${test.twitter.gae-tweetstore-spring.consumer.credential} + + + test.twitter.access.identity + ${test.twitter.gae-tweetstore-spring.access.identity} + + + test.twitter.access.credential + ${test.twitter.gae-tweetstore-spring.access.credential} test.azureblob.identity diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/LoggingConfig.java b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/LoggingConfig.java similarity index 97% rename from demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/LoggingConfig.java rename to demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/LoggingConfig.java index 3983f34aae..f136619933 100644 --- a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/LoggingConfig.java +++ b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/LoggingConfig.java @@ -1,38 +1,38 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * 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.jclouds.demo.tweetstore.config; - -import org.jclouds.logging.Logger; -import org.jclouds.logging.Logger.LoggerFactory; -import org.jclouds.logging.jdk.JDKLogger; - -/** - * Spring config that provides a logger. - * - * @author Andrew Phillips - */ -abstract class LoggingConfig { - private static final LoggerFactory FACTORY = new JDKLogger.JDKLoggerFactory(); - protected final Logger logger; - - protected LoggingConfig() { - logger = FACTORY.getLogger(this.getClass().getName()); - } - -} +/** + * + * Copyright (C) 2011 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.jclouds.demo.tweetstore.config; + +import org.jclouds.logging.Logger; +import org.jclouds.logging.Logger.LoggerFactory; +import org.jclouds.logging.jdk.JDKLogger; + +/** + * Spring config that provides a logger. + * + * @author Andrew Phillips + */ +abstract class LoggingConfig { + private static final LoggerFactory FACTORY = new JDKLogger.JDKLoggerFactory(); + protected final Logger logger; + + protected LoggingConfig() { + logger = FACTORY.getLogger(this.getClass().getName()); + } + +} diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java similarity index 99% rename from demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java rename to demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java index 9cb71791c5..5b458d32e0 100644 --- a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java +++ b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java @@ -55,7 +55,6 @@ import twitter4j.conf.ConfigurationBuilder; import com.google.appengine.api.taskqueue.Queue; import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions.Builder; import com.google.appengine.api.taskqueue.TaskOptions.Method; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableSet; diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java similarity index 100% rename from demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java rename to demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java similarity index 100% rename from demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java rename to demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java similarity index 100% rename from demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java rename to demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java similarity index 100% rename from demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java rename to demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java similarity index 100% rename from demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java rename to demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java b/demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java similarity index 100% rename from demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java rename to demos/tweetstore/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java diff --git a/demos/gae-tweetstore-spring/src/main/appengine/appengine-web.xml b/demos/tweetstore/gae-tweetstore-spring/src/main/platform/appengine-web.xml similarity index 100% rename from demos/gae-tweetstore-spring/src/main/appengine/appengine-web.xml rename to demos/tweetstore/gae-tweetstore-spring/src/main/platform/appengine-web.xml diff --git a/demos/gae-tweetstore-spring/src/main/appengine/logging.properties b/demos/tweetstore/gae-tweetstore-spring/src/main/platform/logging.properties similarity index 100% rename from demos/gae-tweetstore-spring/src/main/appengine/logging.properties rename to demos/tweetstore/gae-tweetstore-spring/src/main/platform/logging.properties diff --git a/demos/gae-tweetstore-spring/src/main/webapp/WEB-INF/dispatcher-servlet.xml b/demos/tweetstore/gae-tweetstore-spring/src/main/webapp/WEB-INF/dispatcher-servlet.xml similarity index 98% rename from demos/gae-tweetstore-spring/src/main/webapp/WEB-INF/dispatcher-servlet.xml rename to demos/tweetstore/gae-tweetstore-spring/src/main/webapp/WEB-INF/dispatcher-servlet.xml index fd82460f9e..6b65ce8a8c 100644 --- a/demos/gae-tweetstore-spring/src/main/webapp/WEB-INF/dispatcher-servlet.xml +++ b/demos/tweetstore/gae-tweetstore-spring/src/main/webapp/WEB-INF/dispatcher-servlet.xml @@ -1,38 +1,38 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/demos/gae-tweetstore-spring/src/main/webapp/WEB-INF/queue.xml b/demos/tweetstore/gae-tweetstore-spring/src/main/webapp/WEB-INF/queue.xml similarity index 100% rename from demos/gae-tweetstore-spring/src/main/webapp/WEB-INF/queue.xml rename to demos/tweetstore/gae-tweetstore-spring/src/main/webapp/WEB-INF/queue.xml diff --git a/demos/gae-tweetstore-spring/src/main/webapp/WEB-INF/web.xml b/demos/tweetstore/gae-tweetstore-spring/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from demos/gae-tweetstore-spring/src/main/webapp/WEB-INF/web.xml rename to demos/tweetstore/gae-tweetstore-spring/src/main/webapp/WEB-INF/web.xml diff --git a/demos/gae-tweetstore-spring/src/main/webapp/index.jsp b/demos/tweetstore/gae-tweetstore-spring/src/main/webapp/index.jsp similarity index 100% rename from demos/gae-tweetstore-spring/src/main/webapp/index.jsp rename to demos/tweetstore/gae-tweetstore-spring/src/main/webapp/index.jsp diff --git a/demos/gae-tweetstore-spring/src/main/webapp/tweets.jsp b/demos/tweetstore/gae-tweetstore-spring/src/main/webapp/tweets.jsp similarity index 100% rename from demos/gae-tweetstore-spring/src/main/webapp/tweets.jsp rename to demos/tweetstore/gae-tweetstore-spring/src/main/webapp/tweets.jsp diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java b/demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java similarity index 100% rename from demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java rename to demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java b/demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java similarity index 100% rename from demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java rename to demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java b/demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java similarity index 100% rename from demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java rename to demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java b/demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java similarity index 100% rename from demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java rename to demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/GoogleDevServer.java b/demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/GoogleDevServer.java similarity index 100% rename from demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/GoogleDevServer.java rename to demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/GoogleDevServer.java diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java b/demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java similarity index 77% rename from demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java rename to demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java index a76f004412..6463f73d13 100644 --- a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java +++ b/demos/tweetstore/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java @@ -78,7 +78,7 @@ public class TweetStoreLiveTest { @BeforeTest void clearAndCreateContainers() throws InterruptedException, ExecutionException, TimeoutException, IOException, TwitterException { - container = checkNotNull(System.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER); + container = getRequiredSystemProperty(PROPERTY_TWEETSTORE_CONTAINER); props.setProperty(PROPERTY_TWEETSTORE_CONTAINER, container); props.setProperty(SpringServletConfig.PROPERTY_BLOBSTORE_CONTEXTS, Joiner.on(',').join(blobstores)); @@ -98,10 +98,13 @@ public class TweetStoreLiveTest { contexts.put(provider, factory.createContext(provider, wiring, props)); } - Configuration twitterConf = new ConfigurationBuilder() - .setUser(props.getProperty("twitter.identity")) - .setPassword(props.getProperty("twitter.credential")).build(); - Twitter client = new TwitterFactory(twitterConf).getInstance(); + Configuration conf = new ConfigurationBuilder() + .setOAuthConsumerKey(props.getProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY)) + .setOAuthConsumerSecret(props.getProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET)) + .setOAuthAccessToken(props.getProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN)) + .setOAuthAccessTokenSecret(props.getProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET)) + .build(); + Twitter client = new TwitterFactory(conf).getInstance(); StoreTweetsController controller = new StoreTweetsController(contexts, container, client); ResponseList statuses = client.getMentions(); @@ -135,21 +138,29 @@ public class TweetStoreLiveTest { } } + private static String getRequiredSystemProperty(String key) { + return checkNotNull(System.getProperty(key), key); + } + private void addConfigurationForTwitter(Properties props) { - props.setProperty("twitter.identity", - checkNotNull(System.getProperty("test.twitter.identity"), "test.twitter.identity")); - props.setProperty("twitter.credential", - checkNotNull(System.getProperty("test.twitter.credential"), "test.twitter.credential")); - } + props.setProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET)); + } - private void addCredentialsForBlobStores(Properties props) { - for (String provider : blobstores) { - props.setProperty(provider + ".identity", - checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity")); - props.setProperty(provider + ".credential", - checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider + ".credential")); - } - } + private void addCredentialsForBlobStores(Properties props) { + for (String provider : blobstores) { + props.setProperty(provider + ".identity", + getRequiredSystemProperty("test." + provider + ".identity")); + props.setProperty(provider + ".credential", + getRequiredSystemProperty("test." + provider + ".credential")); + } + } @BeforeTest @Parameters({ "warfile", "devappserver.address", "devappserver.port" }) @@ -208,4 +219,11 @@ public class TweetStoreLiveTest { String string = Strings2.toStringAndClose(i); assert string.indexOf("Tweets in Clouds") >= 0 : string; } + + private static interface TwitterConstants { + static final String PROPERTY_TWITTER_CONSUMER_KEY = "twitter.consumer.identity"; + static final String PROPERTY_TWITTER_CONSUMER_SECRET = "twitter.consumer.credential"; + static final String PROPERTY_TWITTER_ACCESSTOKEN = "twitter.access.identity"; + static final String PROPERTY_TWITTER_ACCESSTOKEN_SECRET = "twitter.access.credential"; + } } diff --git a/demos/gae-tweetstore-spring/src/test/resources/log4j.xml b/demos/tweetstore/gae-tweetstore-spring/src/test/resources/log4j.xml similarity index 100% rename from demos/gae-tweetstore-spring/src/test/resources/log4j.xml rename to demos/tweetstore/gae-tweetstore-spring/src/test/resources/log4j.xml diff --git a/demos/tweetstore/gae-tweetstore/pom.xml b/demos/tweetstore/gae-tweetstore/pom.xml new file mode 100644 index 0000000000..8c1d45baf2 --- /dev/null +++ b/demos/tweetstore/gae-tweetstore/pom.xml @@ -0,0 +1,236 @@ + + + + 4.0.0 + + org.jclouds + jclouds-demos-tweetstore-project + 1.0-SNAPSHOT + + jclouds-demo-gae-tweetstore + war + JClouds TweetStore for Google App Engine + JClouds TweetStore for Google App Engine using Guice for Dependency Injection + + + + jclouds-tweetstore + 1.4.2 + localhost + 8088 + jclouds-tweetstore + + + + + org.jclouds.driver + jclouds-gae + ${project.version} + + + com.google.inject.extensions + guice-servlet + 3.0 + + + + + com.google.appengine + appengine-api-1.0-sdk + ${appengine.sdk.version} + + + com.google.appengine + appengine-tools-sdk + ${appengine.sdk.version} + test + + + + + + + + + + + maven-surefire-plugin + + + integration + integration-test + + test + + + + + appengine.sdk.root + ${appengine.sdk.root} + + + devappserver.address + ${devappserver.address} + + + devappserver.port + ${devappserver.port} + + + warfile + ${project.build.directory}/${project.artifactId} + + + + + + + + + + + + live + + + + maven-surefire-plugin + + + integration + integration-test + + test + + + + + test.twitter.consumer.identity + ${test.twitter.gae-tweetstore.consumer.identity} + + + test.twitter.consumer.credential + ${test.twitter.gae-tweetstore.consumer.credential} + + + test.twitter.access.identity + ${test.twitter.gae-tweetstore.access.identity} + + + test.twitter.access.credential + ${test.twitter.gae-tweetstore.access.credential} + + + test.azureblob.identity + ${test.azureblob.identity} + + + test.azureblob.credential + ${test.azureblob.credential} + + + test.cloudfiles-us.identity + ${test.cloudfiles-us.identity} + + + test.cloudfiles-us.credential + ${test.cloudfiles-us.credential} + + + test.aws-s3.identity + ${test.aws-s3.identity} + + + test.aws-s3.credential + ${test.aws-s3.credential} + + + appengine.sdk.root + ${appengine.sdk.root} + + + devappserver.address + ${devappserver.address} + + + devappserver.port + ${devappserver.port} + + + jclouds.tweetstore.blobstores + ${jclouds.tweetstore.blobstores} + + + jclouds.tweetstore.container + ${jclouds.tweetstore.container} + + + warfile + ${project.build.directory}/${project.artifactId} + + + + + + + + + + + diff --git a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java b/demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java rename to demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java diff --git a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java b/demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java rename to demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java diff --git a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java b/demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java similarity index 100% rename from demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java rename to demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java diff --git a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java b/demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java rename to demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java diff --git a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java b/demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java similarity index 100% rename from demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java rename to demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java diff --git a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java b/demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java rename to demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java diff --git a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java b/demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java similarity index 100% rename from demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java rename to demos/tweetstore/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java diff --git a/demos/gae-tweetstore/src/main/appengine/appengine-web.xml b/demos/tweetstore/gae-tweetstore/src/main/platform/appengine-web.xml old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/main/appengine/appengine-web.xml rename to demos/tweetstore/gae-tweetstore/src/main/platform/appengine-web.xml diff --git a/demos/gae-tweetstore/src/main/appengine/logging.properties b/demos/tweetstore/gae-tweetstore/src/main/platform/logging.properties similarity index 100% rename from demos/gae-tweetstore/src/main/appengine/logging.properties rename to demos/tweetstore/gae-tweetstore/src/main/platform/logging.properties diff --git a/demos/gae-tweetstore/src/main/webapp/WEB-INF/queue.xml b/demos/tweetstore/gae-tweetstore/src/main/webapp/WEB-INF/queue.xml similarity index 100% rename from demos/gae-tweetstore/src/main/webapp/WEB-INF/queue.xml rename to demos/tweetstore/gae-tweetstore/src/main/webapp/WEB-INF/queue.xml diff --git a/demos/gae-tweetstore/src/main/webapp/WEB-INF/web.xml b/demos/tweetstore/gae-tweetstore/src/main/webapp/WEB-INF/web.xml old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/main/webapp/WEB-INF/web.xml rename to demos/tweetstore/gae-tweetstore/src/main/webapp/WEB-INF/web.xml diff --git a/demos/gae-tweetstore/src/main/webapp/index.jsp b/demos/tweetstore/gae-tweetstore/src/main/webapp/index.jsp old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/main/webapp/index.jsp rename to demos/tweetstore/gae-tweetstore/src/main/webapp/index.jsp diff --git a/demos/gae-tweetstore/src/main/webapp/tweets.jsp b/demos/tweetstore/gae-tweetstore/src/main/webapp/tweets.jsp old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/main/webapp/tweets.jsp rename to demos/tweetstore/gae-tweetstore/src/main/webapp/tweets.jsp diff --git a/demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java b/demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java similarity index 100% rename from demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java rename to demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java diff --git a/demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java b/demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java similarity index 100% rename from demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java rename to demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java diff --git a/demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java b/demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java similarity index 100% rename from demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java rename to demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java diff --git a/demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java b/demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java similarity index 100% rename from demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java rename to demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java diff --git a/demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/GoogleDevServer.java b/demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/GoogleDevServer.java old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/GoogleDevServer.java rename to demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/GoogleDevServer.java diff --git a/demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java b/demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java old mode 100755 new mode 100644 similarity index 80% rename from demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java rename to demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java index 772d891934..ac96008c49 --- a/demos/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java +++ b/demos/tweetstore/gae-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java @@ -77,8 +77,7 @@ public class TweetStoreLiveTest { @BeforeTest void clearAndCreateContainers() throws InterruptedException, ExecutionException, TimeoutException, IOException, TwitterException { - container = checkNotNull(System.getProperty(PROPERTY_TWEETSTORE_CONTAINER), - PROPERTY_TWEETSTORE_CONTAINER); + container = getRequiredSystemProperty(PROPERTY_TWEETSTORE_CONTAINER); props.setProperty(PROPERTY_TWEETSTORE_CONTAINER, container); props.setProperty(GuiceServletConfig.PROPERTY_BLOBSTORE_CONTEXTS, Joiner.on(',').join(blobstores)); @@ -99,8 +98,11 @@ public class TweetStoreLiveTest { } Configuration conf = new ConfigurationBuilder() - .setUser(props.getProperty("twitter.identity")) - .setPassword(props.getProperty("twitter.credential")).build(); + .setOAuthConsumerKey(props.getProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY)) + .setOAuthConsumerSecret(props.getProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET)) + .setOAuthAccessToken(props.getProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN)) + .setOAuthAccessTokenSecret(props.getProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET)) + .build(); Twitter client = new TwitterFactory(conf).getInstance(); StoreTweetsController controller = new StoreTweetsController(contexts, container, client); @@ -140,6 +142,30 @@ public class TweetStoreLiveTest { } } + private static String getRequiredSystemProperty(String key) { + return checkNotNull(System.getProperty(key), key); + } + + private void addConfigurationForTwitter(Properties props) { + props.setProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET)); + } + + private void addCredentialsForBlobStores(Properties props) { + for (String provider : blobstores) { + props.setProperty(provider + ".identity", + getRequiredSystemProperty("test." + provider + ".identity")); + props.setProperty(provider + ".credential", + getRequiredSystemProperty("test." + provider + ".credential")); + } + } + @BeforeTest(dependsOnMethods = "clearAndCreateContainers") @Parameters({ "warfile", "devappserver.address", "devappserver.port" }) public void startDevAppServer(final String warfile, final String address, final String port) throws Exception { @@ -148,22 +174,7 @@ public class TweetStoreLiveTest { server = new GoogleDevServer(); server.writePropertiesAndStartServer(address, port, warfile, props); } - - private void addConfigurationForTwitter(Properties props) { - props.setProperty("twitter.identity", checkNotNull(System.getProperty("test.twitter.identity"), "test.twitter.identity")); - props.setProperty("twitter.credential", - checkNotNull(System.getProperty("test.twitter.credential"), "test.twitter.credential")); - } - - private void addCredentialsForBlobStores(Properties props) { - for (String provider : blobstores) { - props.setProperty(provider + ".identity", - checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity")); - props.setProperty(provider + ".credential", - checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider + ".credential")); - } - } - + @Test public void shouldPass() throws InterruptedException, IOException { InputStream i = url.openStream(); @@ -213,4 +224,11 @@ public class TweetStoreLiveTest { String string = Strings2.toStringAndClose(i); assert string.indexOf("Tweets in Clouds") >= 0 : string; } + + private static interface TwitterConstants { + static final String PROPERTY_TWITTER_CONSUMER_KEY = "twitter.consumer.identity"; + static final String PROPERTY_TWITTER_CONSUMER_SECRET = "twitter.consumer.credential"; + static final String PROPERTY_TWITTER_ACCESSTOKEN = "twitter.access.identity"; + static final String PROPERTY_TWITTER_ACCESSTOKEN_SECRET = "twitter.access.credential"; + } } diff --git a/demos/gae-tweetstore/src/test/resources/log4j.xml b/demos/tweetstore/gae-tweetstore/src/test/resources/log4j.xml old mode 100755 new mode 100644 similarity index 100% rename from demos/gae-tweetstore/src/test/resources/log4j.xml rename to demos/tweetstore/gae-tweetstore/src/test/resources/log4j.xml diff --git a/demos/tweetstore/pom.xml b/demos/tweetstore/pom.xml new file mode 100644 index 0000000000..25940bb504 --- /dev/null +++ b/demos/tweetstore/pom.xml @@ -0,0 +1,137 @@ + + + + + + jclouds-demos-project + org.jclouds + 1.0-SNAPSHOT + + 4.0.0 + jclouds-demos-tweetstore-project + pom + jclouds TweetStore demos project + + gae-tweetstore + gae-tweetstore-spring + runatcloud-tweetstore + + + + cloudfiles-us,aws-s3,azureblob + + + + + ${project.groupId} + jclouds-blobstore + ${project.version} + + + org.twitter4j + twitter4j-core + [2.2,) + + + ${project.groupId} + jclouds-blobstore + ${project.version} + test-jar + test + + + org.jclouds.provider + aws-s3 + ${project.version} + runtime + + + org.jclouds.provider + cloudfiles-us + ${project.version} + runtime + + + org.jclouds.provider + azureblob + ${project.version} + runtime + + + displaytag + displaytag + 1.2 + runtime + + + org.slf4j + slf4j-log4j12 + + + + + org.slf4j + slf4j-jdk14 + 1.5.6 + runtime + + + jstl + javax.servlet + 1.1.2 + runtime + + + standard + taglibs + 1.1.2 + runtime + + + javax.servlet + servlet-api + 2.5 + provided + + + + + ${project.artifactId} + + + maven-war-plugin + 2.1.1 + + + WEB-INF/web.xml + + + src/main/platform + WEB-INF + true + + + + + + + diff --git a/demos/runatcloud-tweetstore/pom.xml b/demos/tweetstore/runatcloud-tweetstore/pom.xml similarity index 72% rename from demos/runatcloud-tweetstore/pom.xml rename to demos/tweetstore/runatcloud-tweetstore/pom.xml index 657073af65..5b0b0fce46 100644 --- a/demos/runatcloud-tweetstore/pom.xml +++ b/demos/tweetstore/runatcloud-tweetstore/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.jclouds - jclouds-demos-project + jclouds-demos-tweetstore-project 1.0-SNAPSHOT jclouds-demo-runatcloud-tweetstore @@ -31,91 +31,19 @@ jclouds TweetStore for CloudBees' RUN@cloud using Guice for Dependency Injection - tweetstore - run - localhost - 8088 - cloudfiles-us,aws-s3,azureblob - jclouds-tweetstore-runatcloud + jclouds/tweetstore + run + localhost + 8088 + jclouds-tweetstore-runatcloud - - ${project.groupId} - jclouds-blobstore - ${project.version} - - - org.twitter4j - twitter4j-core - [2.1,) - - - ${project.groupId} - jclouds-blobstore - ${project.version} - test-jar - test - - - org.jclouds.provider - aws-s3 - ${project.version} - runtime - - - org.jclouds.provider - cloudfiles-us - ${project.version} - runtime - - - org.jclouds.provider - azureblob - ${project.version} - runtime - com.google.inject.extensions guice-servlet 3.0 - - displaytag - displaytag - 1.2 - runtime - - - org.slf4j - slf4j-log4j12 - - - - - org.slf4j - slf4j-jdk14 - 1.5.6 - runtime - - - jstl - javax.servlet - 1.1.2 - runtime - - - standard - taglibs - 1.1.2 - runtime - - - javax.servlet - servlet-api - 2.5 - provided - @@ -140,7 +68,6 @@ - ${project.artifactId} maven-surefire-plugin @@ -178,13 +105,19 @@ - - com.cloudbees - bees-maven-plugin - 1.0-SNAPSHOT - + + com.cloudbees + bees-maven-plugin + 1.0-SNAPSHOT + + ${bees.appid} + ${bees.environment} + ${bees.apikey} + ${bees.secret} + + - + @@ -203,12 +136,20 @@ - test.twitter.identity - ${test.twitter.identity} + test.twitter.consumer.identity + ${test.twitter.runatcloud-tweetstore.consumer.identity} - test.twitter.credential - ${test.twitter.credential} + test.twitter.consumer.credential + ${test.twitter.runatcloud-tweetstore.consumer.credential} + + + test.twitter.access.identity + ${test.twitter.runatcloud-tweetstore.access.identity} + + + test.twitter.access.credential + ${test.twitter.runatcloud-tweetstore.access.credential} test.azureblob.identity diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/HttpRequestTask.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/HttpRequestTask.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/HttpRequestTask.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/HttpRequestTask.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/ImmutableHttpCommand.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/ImmutableHttpCommand.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/ImmutableHttpCommand.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/ImmutableHttpCommand.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/ObjectFields.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/ObjectFields.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/ObjectFields.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/ObjectFields.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/TaskQueue.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/TaskQueue.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/TaskQueue.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/utils/TaskQueue.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/AddTweetsController.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/domain/StoredTweetStatus.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatus.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatuses.java diff --git a/demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java b/demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java similarity index 100% rename from demos/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java rename to demos/tweetstore/runatcloud-tweetstore/src/main/java/org/jclouds/demo/tweetstore/reference/TweetStoreConstants.java diff --git a/demos/runatcloud-tweetstore/src/main/webapp/WEB-INF/cloudbees-web.xml b/demos/tweetstore/runatcloud-tweetstore/src/main/platform/cloudbees-web.xml similarity index 100% rename from demos/runatcloud-tweetstore/src/main/webapp/WEB-INF/cloudbees-web.xml rename to demos/tweetstore/runatcloud-tweetstore/src/main/platform/cloudbees-web.xml diff --git a/demos/runatcloud-tweetstore/src/main/webapp/WEB-INF/web.xml b/demos/tweetstore/runatcloud-tweetstore/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from demos/runatcloud-tweetstore/src/main/webapp/WEB-INF/web.xml rename to demos/tweetstore/runatcloud-tweetstore/src/main/webapp/WEB-INF/web.xml diff --git a/demos/runatcloud-tweetstore/src/main/webapp/index.jsp b/demos/tweetstore/runatcloud-tweetstore/src/main/webapp/index.jsp similarity index 100% rename from demos/runatcloud-tweetstore/src/main/webapp/index.jsp rename to demos/tweetstore/runatcloud-tweetstore/src/main/webapp/index.jsp diff --git a/demos/runatcloud-tweetstore/src/main/webapp/tweets.jsp b/demos/tweetstore/runatcloud-tweetstore/src/main/webapp/tweets.jsp similarity index 100% rename from demos/runatcloud-tweetstore/src/main/webapp/tweets.jsp rename to demos/tweetstore/runatcloud-tweetstore/src/main/webapp/tweets.jsp diff --git a/demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java b/demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java similarity index 100% rename from demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java rename to demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/AddTweetsControllerTest.java diff --git a/demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java b/demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java similarity index 100% rename from demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java rename to demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java diff --git a/demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java b/demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java similarity index 100% rename from demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java rename to demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/KeyToStoredTweetStatusTest.java diff --git a/demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java b/demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java similarity index 100% rename from demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java rename to demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/functions/ServiceToStoredTweetStatusesTest.java diff --git a/demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/RunAtCloudServer.java b/demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/RunAtCloudServer.java similarity index 100% rename from demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/RunAtCloudServer.java rename to demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/RunAtCloudServer.java diff --git a/demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/StaxSdkAppServer2.java b/demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/StaxSdkAppServer2.java similarity index 100% rename from demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/StaxSdkAppServer2.java rename to demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/StaxSdkAppServer2.java diff --git a/demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java b/demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java similarity index 79% rename from demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java rename to demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java index 7ab92ebce2..d3830df2a2 100644 --- a/demos/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java +++ b/demos/tweetstore/runatcloud-tweetstore/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java @@ -78,7 +78,7 @@ public class TweetStoreLiveTest { @BeforeTest void clearAndCreateContainers() throws InterruptedException, ExecutionException, TimeoutException, IOException, TwitterException { - container = checkNotNull(System.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER); + container = getRequiredSystemProperty(PROPERTY_TWEETSTORE_CONTAINER); props.setProperty(PROPERTY_TWEETSTORE_CONTAINER, container); props.setProperty(GuiceServletConfig.PROPERTY_BLOBSTORE_CONTEXTS, Joiner.on(',').join(blobstores)); @@ -99,8 +99,11 @@ public class TweetStoreLiveTest { } Configuration conf = new ConfigurationBuilder() - .setUser(props.getProperty("twitter.identity")) - .setPassword(props.getProperty("twitter.credential")).build(); + .setOAuthConsumerKey(props.getProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY)) + .setOAuthConsumerSecret(props.getProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET)) + .setOAuthAccessToken(props.getProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN)) + .setOAuthAccessTokenSecret(props.getProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET)) + .build(); Twitter client = new TwitterFactory(conf).getInstance(); StoreTweetsController controller = new StoreTweetsController(contexts, container, client); @@ -140,6 +143,30 @@ public class TweetStoreLiveTest { } } + private static String getRequiredSystemProperty(String key) { + return checkNotNull(System.getProperty(key), key); + } + + private void addConfigurationForTwitter(Properties props) { + props.setProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_CONSUMER_KEY)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_CONSUMER_SECRET)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN)); + props.setProperty(TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET, + getRequiredSystemProperty("test." + TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN_SECRET)); + } + + private void addCredentialsForBlobStores(Properties props) { + for (String provider : blobstores) { + props.setProperty(provider + ".identity", + getRequiredSystemProperty("test." + provider + ".identity")); + props.setProperty(provider + ".credential", + getRequiredSystemProperty("test." + provider + ".credential")); + } + } + @BeforeTest(dependsOnMethods = "clearAndCreateContainers") @Parameters({ "warfile", "bees.address", "bees.port", "bees.environment", "bees.basedir" }) public void startDevAppServer(final String warfile, final String address, final String port, @@ -151,21 +178,6 @@ public class TweetStoreLiveTest { serverBaseDirectory, props); } - private void addConfigurationForTwitter(Properties props) { - props.setProperty("twitter.identity", checkNotNull(System.getProperty("test.twitter.identity"), "test.twitter.identity")); - props.setProperty("twitter.credential", - checkNotNull(System.getProperty("test.twitter.credential"), "test.twitter.credential")); - } - - private void addCredentialsForBlobStores(Properties props) { - for (String provider : blobstores) { - props.setProperty(provider + ".identity", - checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity")); - props.setProperty(provider + ".credential", - checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider + ".credential")); - } - } - @Test public void shouldPass() throws InterruptedException, IOException { InputStream i = url.openStream(); @@ -215,4 +227,11 @@ public class TweetStoreLiveTest { String string = Strings2.toStringAndClose(i); assert string.indexOf("Tweets in Clouds") >= 0 : string; } + + private static interface TwitterConstants { + static final String PROPERTY_TWITTER_CONSUMER_KEY = "twitter.consumer.identity"; + static final String PROPERTY_TWITTER_CONSUMER_SECRET = "twitter.consumer.credential"; + static final String PROPERTY_TWITTER_ACCESSTOKEN = "twitter.access.identity"; + static final String PROPERTY_TWITTER_ACCESSTOKEN_SECRET = "twitter.access.credential"; + } } diff --git a/demos/runatcloud-tweetstore/src/test/resources/log4j.xml b/demos/tweetstore/runatcloud-tweetstore/src/test/resources/log4j.xml similarity index 100% rename from demos/runatcloud-tweetstore/src/test/resources/log4j.xml rename to demos/tweetstore/runatcloud-tweetstore/src/test/resources/log4j.xml