mirror of https://github.com/apache/jclouds.git
Merge branch 'master' of git@github.com:jclouds/jclouds
* 'master' of git@github.com:jclouds/jclouds: Issue 574: don't make build dependent on tz 'appid' value in cloudbees-web.xml value is sufficient, no need for it in the bees plugin configt need the bees.appid value in the plugin config as it's already set Removed unused deps Added the new TweetStore aggregator project to demos Created a TweetStore parent project, updated twitter4j to 2.2 and switched to OAuth Added instructions to generate Twitter consumer keys and access tokens to READMEs added AWS Security Group Clojure wrapper
This commit is contained in:
commit
08c8430619
|
@ -0,0 +1,101 @@
|
|||
;
|
||||
;
|
||||
; Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
;
|
||||
; ====================================================================
|
||||
; 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.
|
||||
; ====================================================================
|
||||
;
|
||||
|
||||
(ns
|
||||
#^{:author "Juegen Hoetzel, juergen@archlinux.org"
|
||||
:doc "A clojure binding for the jclouds AWS security group interface."}
|
||||
org.jclouds.ec2.security-group2
|
||||
(:require (org.jclouds [compute2 :as compute])
|
||||
[org.jclouds.ec2.ebs :as ebs])
|
||||
(:import org.jclouds.ec2.domain.IpProtocol
|
||||
org.jclouds.ec2.domain.SecurityGroup
|
||||
org.jclouds.ec2.services.SecurityGroupClient))
|
||||
|
||||
(defn #^SecurityGroupClient
|
||||
sg-service
|
||||
"Returns the SecurityGroup Client associated with the specified compute service."
|
||||
[compute]
|
||||
(-> compute .getContext .getProviderSpecificContext .getApi .getSecurityGroupServices))
|
||||
|
||||
(defn create-group
|
||||
"Creates a new security group.
|
||||
|
||||
e.g. (create-group compute \"Database Server\" \"Description for group\" :region :us-west-1)"
|
||||
[compute name & {:keys [description region]}]
|
||||
(.createSecurityGroupInRegion (sg-service compute) (ebs/get-region region) name (or description name)))
|
||||
|
||||
(defn delete-group
|
||||
"Deletes a security group.
|
||||
|
||||
e.g. (delete-group compute \"Database Server\" :region :us-west-1)"
|
||||
[compute name & {:keys [region]}]
|
||||
(.deleteSecurityGroupInRegion (sg-service compute) (ebs/get-region region) name))
|
||||
|
||||
(defn groups
|
||||
"Returns a map of GroupName -> org.jclouds.ec2.domain.SecurityGroup instances.
|
||||
|
||||
e.g. (groups compute :region :us-east-1)"
|
||||
[compute & {:keys [region]}]
|
||||
(into {} (for [#^SecurityGroup group (.describeSecurityGroupsInRegion (sg-service compute)
|
||||
(ebs/get-region region)
|
||||
(into-array String '()))]
|
||||
[(.getName group) group])))
|
||||
|
||||
(defn get-protocol [v]
|
||||
"Coerce argument to a IP Protocol."
|
||||
(cond
|
||||
(instance? IpProtocol v) v
|
||||
(keyword? v) (if-let [p (get {:tcp IpProtocol/TCP
|
||||
:udp IpProtocol/UDP
|
||||
:icmp IpProtocol/ICMP}
|
||||
v)]
|
||||
p
|
||||
(throw (IllegalArgumentException.
|
||||
(str "Can't obtain IP protocol from " v " (valid :tcp, :udp and :icmp)"))))
|
||||
(nil? v) IpProtocol/TCP
|
||||
:else (throw (IllegalArgumentException.
|
||||
(str "Can't obtain IP protocol from argument of type " (type v))))))
|
||||
|
||||
(defn authorize
|
||||
"Adds permissions to a security group.
|
||||
|
||||
e.g. (authorize compute \"jclouds#webserver#us-east-1\" 80 :ip-range \"0.0.0.0/0\")
|
||||
(authorize compute \"jclouds#webserver#us-east-1\" [1000,2000] :protocol :udp)"
|
||||
|
||||
[compute group-name port & {:keys [protocol ip-range region]}]
|
||||
(let [group ((groups compute :region region) group-name)
|
||||
[from-port to-port] (if (number? port) [port port] port)]
|
||||
(if group
|
||||
(.authorizeSecurityGroupIngressInRegion
|
||||
(sg-service compute) (ebs/get-region region) (.getName group) (get-protocol protocol) from-port to-port (or ip-range "0.0.0.0/0"))
|
||||
(throw (IllegalArgumentException.
|
||||
(str "Can't find security group for name " group-name))))))
|
||||
|
||||
(defn revoke
|
||||
"Revokes permissions from a security group.
|
||||
|
||||
e.g. (revoke compute 80 \"jclouds#webserver#us-east-1\" :protocol :tcp 80 80 :ip-range \"0.0.0.0/0\")"
|
||||
[compute group-name port & {:keys [protocol ip-range region]}]
|
||||
(let [group ((groups compute :region region) group-name)
|
||||
[from-port to-port] (if (number? port) [port port] port)]
|
||||
(if group
|
||||
(.revokeSecurityGroupIngressInRegion
|
||||
(sg-service compute) (ebs/get-region region) (.getName group) (get-protocol protocol) from-port to-port (or ip-range "0.0.0.0/0"))
|
||||
(throw (IllegalArgumentException.
|
||||
(str "Can't find security group for name " group-name))))))
|
|
@ -68,7 +68,7 @@ public class DateServiceTest extends PerformanceTest {
|
|||
public final Date date;
|
||||
|
||||
TestData(String iso8601, String iso8601DateStringTz, String iso8601Seconds, String rfc822, String cDateString,
|
||||
Date dateTime) {
|
||||
Date dateTime) {
|
||||
this.iso8601DateString = iso8601;
|
||||
this.iso8601DateStringTz = iso8601DateStringTz;
|
||||
this.iso8601SecondsDateString = iso8601Seconds;
|
||||
|
@ -79,20 +79,21 @@ public class DateServiceTest extends PerformanceTest {
|
|||
}
|
||||
|
||||
public DateServiceTest() {
|
||||
// Constant time test values, each TestData item must contain matching times!
|
||||
// Constant time test values, each TestData item must contain matching
|
||||
// times!
|
||||
testData = new TestData[] {
|
||||
new TestData("2009-03-12T02:00:07.000Z", "2009-03-12T02:00:07-04:00", "2009-03-12T02:00:07Z",
|
||||
"Thu, 12 Mar 2009 02:00:07 GMT", "Thu Mar 12 02:00:07 +0000 2009", new Date(1236823207000l)),
|
||||
new TestData("2009-03-12T02:00:07.000Z", "2009-03-12T02:00:07+04:00", "2009-03-12T02:00:07Z",
|
||||
"Thu, 12 Mar 2009 02:00:07 GMT", "Thu Mar 12 02:00:07 +0000 2009", new Date(1236823207000l)),
|
||||
new TestData("2009-03-14T04:00:07.000Z", "2009-03-14T04:00:07Z+04:00", "2009-03-14T04:00:07Z",
|
||||
"Sat, 14 Mar 2009 04:00:07 GMT", "Thu Mar 14 04:00:07 +0000 2009", new Date(1237003207000l)),
|
||||
new TestData("2009-03-16T06:00:07.000Z", "2009-03-16T06:00:07Z+04:00", "2009-03-16T06:00:07Z",
|
||||
"Mon, 16 Mar 2009 06:00:07 GMT", "Thu Mar 16 06:00:07 +0000 2009", new Date(1237183207000l)),
|
||||
new TestData("2009-03-18T08:00:07.000Z", "2009-03-18T08:00:07Z+04:00", "2009-03-18T08:00:07Z",
|
||||
"Wed, 18 Mar 2009 08:00:07 GMT", "Thu Mar 18 08:00:07 +0000 2009", new Date(1237363207000l)),
|
||||
new TestData("2009-03-20T10:00:07.000Z", "2009-03-20T10:00:07Z+04:00", "2009-03-20T10:00:07Z",
|
||||
"Fri, 20 Mar 2009 10:00:07 GMT", "Thu Mar 20 10:00:07 +0000 2009", new Date(1237543207000l)) };
|
||||
new TestData("2009-03-12T02:00:07.000Z", "2009-03-12T02:00:07-04:00", "2009-03-12T02:00:07Z",
|
||||
"Thu, 12 Mar 2009 02:00:07 GMT", "Thu Mar 12 02:00:07 +0000 2009", new Date(1236823207000l)),
|
||||
new TestData("2009-03-12T02:00:07.000Z", "2009-03-12T02:00:07+04:00", "2009-03-12T02:00:07Z",
|
||||
"Thu, 12 Mar 2009 02:00:07 GMT", "Thu Mar 12 02:00:07 +0000 2009", new Date(1236823207000l)),
|
||||
new TestData("2009-03-14T04:00:07.000Z", "2009-03-14T04:00:07Z+04:00", "2009-03-14T04:00:07Z",
|
||||
"Sat, 14 Mar 2009 04:00:07 GMT", "Thu Mar 14 04:00:07 +0000 2009", new Date(1237003207000l)),
|
||||
new TestData("2009-03-16T06:00:07.000Z", "2009-03-16T06:00:07Z+04:00", "2009-03-16T06:00:07Z",
|
||||
"Mon, 16 Mar 2009 06:00:07 GMT", "Thu Mar 16 06:00:07 +0000 2009", new Date(1237183207000l)),
|
||||
new TestData("2009-03-18T08:00:07.000Z", "2009-03-18T08:00:07Z+04:00", "2009-03-18T08:00:07Z",
|
||||
"Wed, 18 Mar 2009 08:00:07 GMT", "Thu Mar 18 08:00:07 +0000 2009", new Date(1237363207000l)),
|
||||
new TestData("2009-03-20T10:00:07.000Z", "2009-03-20T10:00:07Z+04:00", "2009-03-20T10:00:07Z",
|
||||
"Fri, 20 Mar 2009 10:00:07 GMT", "Thu Mar 20 10:00:07 +0000 2009", new Date(1237543207000l)) };
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -164,10 +165,8 @@ public class DateServiceTest extends PerformanceTest {
|
|||
|
||||
@Test
|
||||
void testTzWithExtraZ() throws ExecutionException, InterruptedException {
|
||||
assertEquals(dateService.iso8601SecondsDateParse("2011-05-26T06:14:13-04:00").toString(),
|
||||
"Wed May 25 23:14:13 PDT 2011");
|
||||
assertEquals(dateService.iso8601SecondsDateParse("2011-05-26T06:14:13-04:00Z").toString(),
|
||||
"Wed May 25 23:14:13 PDT 2011");
|
||||
assertEquals(dateService.iso8601SecondsDateParse("2011-05-26T06:14:13-04:00").getTime(), 1306390453000l);
|
||||
assertEquals(dateService.iso8601SecondsDateParse("2011-05-26T06:14:13-04:00Z").getTime(), 1306390453000l);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,313 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
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.
|
||||
====================================================================
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-demos-project</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>jclouds-demo-gae-tweetstore</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>JClouds TweetStore for Google App Engine</name>
|
||||
<description>JClouds TweetStore for Google App Engine using Guice for Dependency Injection</description>
|
||||
|
||||
<properties>
|
||||
<!--
|
||||
note you must set the property ${appengine.sdk.root} to a valid
|
||||
extraction of appengine-java-sdk
|
||||
-->
|
||||
<appengine.applicationid>jclouds-tweetstore</appengine.applicationid>
|
||||
<appengine.sdk.version>1.4.2</appengine.sdk.version>
|
||||
<devappserver.address>localhost</devappserver.address>
|
||||
<devappserver.port>8088</devappserver.port>
|
||||
<jclouds.tweetstore.blobstores>cloudfiles-us,aws-s3,azureblob</jclouds.tweetstore.blobstores>
|
||||
<jclouds.tweetstore.container>jclouds-tweetstore</jclouds.tweetstore.container>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-blobstore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.twitter4j</groupId>
|
||||
<artifactId>twitter4j-core</artifactId>
|
||||
<version>[2.1,)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-blobstore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>aws-s3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>cloudfiles-us</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>azureblob</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-gae</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.inject.extensions</groupId>
|
||||
<artifactId>guice-servlet</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>displaytag</groupId>
|
||||
<artifactId>displaytag</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>jstl</artifactId>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>standard</artifactId>
|
||||
<groupId>taglibs</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Google App Engine API -->
|
||||
<dependency>
|
||||
<groupId>com.google.appengine</groupId>
|
||||
<artifactId>appengine-api-1.0-sdk</artifactId>
|
||||
<version>${appengine.sdk.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.appengine</groupId>
|
||||
<artifactId>appengine-tools-sdk</artifactId>
|
||||
<version>${appengine.sdk.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Needed..??> -->
|
||||
|
||||
<!-- Google App Engine Runtime Dependencies -->
|
||||
<!--dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jpa_3.0_spec</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.appengine.orm</groupId>
|
||||
<artifactId>jdo2-api</artifactId>
|
||||
<version>2.3-eb</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.datanucleus</groupId>
|
||||
<artifactId>datanucleus-core</artifactId>
|
||||
<version>1.1.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.appengine.orm</groupId>
|
||||
<artifactId>datanucleus-appengine</artifactId>
|
||||
<version>1.0.8</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.datanucleus</groupId>
|
||||
<artifactId>datanucleus-jpa</artifactId>
|
||||
<version>1.1.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency-->
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<webResources>
|
||||
<resource>
|
||||
<directory>src/main/appengine</directory>
|
||||
<targetPath>WEB-INF/</targetPath>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</webResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>appengine.sdk.root</name>
|
||||
<value>${appengine.sdk.root}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>devappserver.address</name>
|
||||
<value>${devappserver.address}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>devappserver.port</name>
|
||||
<value>${devappserver.port}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>warfile</name>
|
||||
<value>${project.build.directory}/${project.artifactId}</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>live</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>test.twitter.identity</name>
|
||||
<value>${test.twitter.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.credential</name>
|
||||
<value>${test.twitter.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.azureblob.identity</name>
|
||||
<value>${test.azureblob.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.azureblob.credential</name>
|
||||
<value>${test.azureblob.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.cloudfiles-us.identity</name>
|
||||
<value>${test.cloudfiles-us.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.cloudfiles-us.credential</name>
|
||||
<value>${test.cloudfiles-us.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.aws-s3.identity</name>
|
||||
<value>${test.aws-s3.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.aws-s3.credential</name>
|
||||
<value>${test.aws-s3.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>appengine.sdk.root</name>
|
||||
<value>${appengine.sdk.root}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>devappserver.address</name>
|
||||
<value>${devappserver.address}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>devappserver.port</name>
|
||||
<value>${devappserver.port}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>jclouds.tweetstore.blobstores</name>
|
||||
<value>${jclouds.tweetstore.blobstores}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>jclouds.tweetstore.container</name>
|
||||
<value>${jclouds.tweetstore.container}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>warfile</name>
|
||||
<value>${project.build.directory}/${project.artifactId}</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
|
@ -32,15 +32,13 @@
|
|||
<packaging>pom</packaging>
|
||||
<name>jclouds demos project</name>
|
||||
<modules>
|
||||
<module>gae-tweetstore</module>
|
||||
<module>gae-tweetstore-spring</module>
|
||||
<module>getpath</module>
|
||||
<module>googleappengine</module>
|
||||
<module>perftest</module>
|
||||
<module>runatcloud-tweetstore</module>
|
||||
<module>speedtest-azurequeue</module>
|
||||
<module>speedtest-sqs</module>
|
||||
<module>simpledb</module>
|
||||
<module>tweetstore</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
@ -25,6 +25,8 @@ It should not be regarded as a sample of how to write a web application using Sp
|
|||
however! The original jclouds-demo-gae-tweetstore has been modified in as few places as
|
||||
possible; it has not been rewritten in the style of a Spring MVC application.
|
||||
|
||||
A guide to generating Twitter consumer keys and access tokens is at http://tinyurl.com/2fhebgb
|
||||
|
||||
This sample uses the Google App Engine for Java SDK located at
|
||||
http://code.google.com/p/googleappengine/downloads/list
|
||||
|
||||
|
@ -48,13 +50,15 @@ attempting to run 'mvn -Plive install'
|
|||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<jclouds.aws-s3.identity>YOUR_ACCESS_KEY_ID</jclouds.aws-s3.identity>
|
||||
<jclouds.aws-s3.credential>YOUR_SECRET_KEY</jclouds.aws-s3.credential>
|
||||
<jclouds.cloudfiles-us.identity>YOUR_USER</jclouds.cloudfiles-us.identity>
|
||||
<jclouds.cloudfiles-us.credential>YOUR_HEX_KEY</jclouds.cloudfiles-us.credential>
|
||||
<jclouds.azureblob.identity>YOUR_ACCOUNT</jclouds.azureblob.identity>
|
||||
<jclouds.azureblob.credential>YOUR_BASE64_ENCODED_KEY</jclouds.azureblob.credential>
|
||||
<jclouds.twitter.identity>YOUR_TWITTER_USERNAME</jclouds.twitter.identity>
|
||||
<jclouds.twitter.credential>YOUR_TWITTER_PASSWORD</jclouds.twitter.credential>
|
||||
<test.aws-s3.identity>YOUR_ACCESS_KEY_ID</test.aws-s3.identity>
|
||||
<test.aws-s3.credential>YOUR_SECRET_KEY</test.aws-s3.credential>
|
||||
<test.cloudfiles-us.identity>YOUR_USER</test.cloudfiles-us.identity>
|
||||
<test.cloudfiles-us.credential>YOUR_HEX_KEY</test.cloudfiles-us.credential>
|
||||
<test.azureblob.identity>YOUR_ACCOUNT</test.azureblob.identity>
|
||||
<test.azureblob.credential>YOUR_BASE64_ENCODED_KEY</test.azureblob.credential>
|
||||
<test.twitter.gae-tweetstore-spring.consumer.identity>YOUR_TWITTER_CONSUMER_KEY</test.twitter.gae-tweetstore-spring.consumer.identity>
|
||||
<test.twitter.gae-tweetstore-spring.consumer.credential>YOUR_TWITTER_CONSUMER_SECRET</test.twitter.gae-tweetstore-spring.consumer.credential>
|
||||
<test.twitter.gae-tweetstore-spring.access.identity>YOUR_TWITTER_ACCESSTOKEN</test.twitter.gae-tweetstore-spring.access.identity>
|
||||
<test.twitter.gae-tweetstore-spring.access.credential>YOUR_TWITTER_ACCESSTOKEN_SECRET</test.twitter.gae-tweetstore-spring.access.credential>
|
||||
</properties>
|
||||
</profile>
|
|
@ -24,7 +24,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-demos-project</artifactId>
|
||||
<artifactId>jclouds-demos-tweetstore-project</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>jclouds-demo-gae-tweetstore-spring</artifactId>
|
||||
|
@ -41,46 +41,10 @@
|
|||
<appengine.sdk.version>1.4.2</appengine.sdk.version>
|
||||
<devappserver.address>localhost</devappserver.address>
|
||||
<devappserver.port>8088</devappserver.port>
|
||||
<jclouds.tweetstore.blobstores>cloudfiles-us,aws-s3,azureblob</jclouds.tweetstore.blobstores>
|
||||
<jclouds.tweetstore.container>jclouds-tweetstore-spring</jclouds.tweetstore.container>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-blobstore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.twitter4j</groupId>
|
||||
<artifactId>twitter4j-core</artifactId>
|
||||
<version>[2.1,)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-blobstore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>aws-s3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>cloudfiles-us</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>azureblob</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-gae</artifactId>
|
||||
|
@ -102,42 +66,6 @@
|
|||
<version>2.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>displaytag</groupId>
|
||||
<artifactId>displaytag</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>standard</artifactId>
|
||||
<groupId>taglibs</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>jstl</artifactId>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Google App Engine API -->
|
||||
<dependency>
|
||||
|
@ -152,21 +80,9 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<webResources>
|
||||
<resource>
|
||||
<directory>src/main/appengine</directory>
|
||||
<targetPath>WEB-INF/</targetPath>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</webResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
|
@ -219,12 +135,20 @@
|
|||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>test.twitter.identity</name>
|
||||
<value>${test.twitter.identity}</value>
|
||||
<name>test.twitter.consumer.identity</name>
|
||||
<value>${test.twitter.gae-tweetstore-spring.consumer.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.credential</name>
|
||||
<value>${test.twitter.credential}</value>
|
||||
<name>test.twitter.consumer.credential</name>
|
||||
<value>${test.twitter.gae-tweetstore-spring.consumer.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.access.identity</name>
|
||||
<value>${test.twitter.gae-tweetstore-spring.access.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.access.credential</name>
|
||||
<value>${test.twitter.gae-tweetstore-spring.access.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.azureblob.identity</name>
|
|
@ -1,38 +1,38 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* 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. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* 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());
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
|
@ -1,38 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
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.
|
||||
====================================================================
|
||||
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<!-- the usual <context:annotation-config/> can't be used because the
|
||||
CommonAnnotationBeanPostProcessor causes a security exception in GAE when it
|
||||
tries to load javax.annotation.Resource -->
|
||||
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
|
||||
<bean class="org.springframework.context.annotation.ConfigurationClassPostProcessor" />
|
||||
<bean class="org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor">
|
||||
<property name="initAnnotationType" value="javax.annotation.PostConstruct" />
|
||||
<property name="destroyAnnotationType" value="javax.annotation.PreDestroy" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.jclouds.demo.tweetstore.config.SpringServletConfig" />
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
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.
|
||||
====================================================================
|
||||
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<!-- the usual <context:annotation-config/> can't be used because the
|
||||
CommonAnnotationBeanPostProcessor causes a security exception in GAE when it
|
||||
tries to load javax.annotation.Resource -->
|
||||
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
|
||||
<bean class="org.springframework.context.annotation.ConfigurationClassPostProcessor" />
|
||||
<bean class="org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor">
|
||||
<property name="initAnnotationType" value="javax.annotation.PostConstruct" />
|
||||
<property name="destroyAnnotationType" value="javax.annotation.PreDestroy" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.jclouds.demo.tweetstore.config.SpringServletConfig" />
|
||||
</beans>
|
|
@ -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<Status> 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";
|
||||
}
|
||||
}
|
20
demos/gae-tweetstore/README.txt → demos/tweetstore/gae-tweetstore/README.txt
Executable file → Normal file
20
demos/gae-tweetstore/README.txt → demos/tweetstore/gae-tweetstore/README.txt
Executable file → Normal file
|
@ -17,6 +17,8 @@
|
|||
====================================================================
|
||||
====
|
||||
|
||||
A guide to generating Twitter consumer keys and access tokens is at http://tinyurl.com/2fhebgb
|
||||
|
||||
This sample uses the Google App Engine for Java SDK located at
|
||||
http://code.google.com/p/googleappengine/downloads/list
|
||||
|
||||
|
@ -40,13 +42,15 @@ attempting to run 'mvn -Plive install'
|
|||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<jclouds.aws-s3.identity>YOUR_ACCESS_KEY_ID</jclouds.aws-s3.identity>
|
||||
<jclouds.aws-s3.credential>YOUR_SECRET_KEY</jclouds.aws-s3.credential>
|
||||
<jclouds.cloudfiles-us.identity>YOUR_USER</jclouds.cloudfiles-us.identity>
|
||||
<jclouds.cloudfiles-us.credential>YOUR_HEX_KEY</jclouds.cloudfiles-us.credential>
|
||||
<jclouds.azureblob.identity>YOUR_ACCOUNT</jclouds.azureblob.identity>
|
||||
<jclouds.azureblob.credential>YOUR_BASE64_ENCODED_KEY</jclouds.azureblob.credential>
|
||||
<jclouds.twitter.identity>YOUR_TWITTER_USERNAME</jclouds.twitter.identity>
|
||||
<jclouds.twitter.credential>YOUR_TWITTER_PASSWORD</jclouds.twitter.credential>
|
||||
<test.aws-s3.identity>YOUR_ACCESS_KEY_ID</test.aws-s3.identity>
|
||||
<test.aws-s3.credential>YOUR_SECRET_KEY</test.aws-s3.credential>
|
||||
<test.cloudfiles-us.identity>YOUR_USER</test.cloudfiles-us.identity>
|
||||
<test.cloudfiles-us.credential>YOUR_HEX_KEY</test.cloudfiles-us.credential>
|
||||
<test.azureblob.identity>YOUR_ACCOUNT</test.azureblob.identity>
|
||||
<test.azureblob.credential>YOUR_BASE64_ENCODED_KEY</test.azureblob.credential>
|
||||
<test.twitter.gae-tweetstore.consumer.identity>YOUR_TWITTER_CONSUMER_KEY</test.twitter.gae-tweetstore.consumer.identity>
|
||||
<test.twitter.gae-tweetstore.consumer.credential>YOUR_TWITTER_CONSUMER_SECRET</test.twitter.gae-tweetstore.consumer.credential>
|
||||
<test.twitter.gae-tweetstore.access.identity>YOUR_TWITTER_ACCESSTOKEN</test.twitter.gae-tweetstore.access.identity>
|
||||
<test.twitter.gae-tweetstore.access.credential>YOUR_TWITTER_ACCESSTOKEN_SECRET</test.twitter.gae-tweetstore.access.credential>
|
||||
</properties>
|
||||
</profile>
|
|
@ -0,0 +1,196 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
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.
|
||||
====================================================================
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-demos-tweetstore-project</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>jclouds-demo-gae-tweetstore</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>JClouds TweetStore for Google App Engine</name>
|
||||
<description>JClouds TweetStore for Google App Engine using Guice for Dependency Injection</description>
|
||||
|
||||
<properties>
|
||||
<!--
|
||||
note you must set the property ${appengine.sdk.root} to a valid
|
||||
extraction of appengine-java-sdk
|
||||
-->
|
||||
<appengine.applicationid>jclouds-tweetstore</appengine.applicationid>
|
||||
<appengine.sdk.version>1.4.2</appengine.sdk.version>
|
||||
<devappserver.address>localhost</devappserver.address>
|
||||
<devappserver.port>8088</devappserver.port>
|
||||
<jclouds.tweetstore.container>jclouds-tweetstore</jclouds.tweetstore.container>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-gae</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.inject.extensions</groupId>
|
||||
<artifactId>guice-servlet</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Google App Engine API -->
|
||||
<dependency>
|
||||
<groupId>com.google.appengine</groupId>
|
||||
<artifactId>appengine-api-1.0-sdk</artifactId>
|
||||
<version>${appengine.sdk.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.appengine</groupId>
|
||||
<artifactId>appengine-tools-sdk</artifactId>
|
||||
<version>${appengine.sdk.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>appengine.sdk.root</name>
|
||||
<value>${appengine.sdk.root}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>devappserver.address</name>
|
||||
<value>${devappserver.address}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>devappserver.port</name>
|
||||
<value>${devappserver.port}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>warfile</name>
|
||||
<value>${project.build.directory}/${project.artifactId}</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>live</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>test.twitter.consumer.identity</name>
|
||||
<value>${test.twitter.gae-tweetstore.consumer.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.consumer.credential</name>
|
||||
<value>${test.twitter.gae-tweetstore.consumer.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.access.identity</name>
|
||||
<value>${test.twitter.gae-tweetstore.access.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.access.credential</name>
|
||||
<value>${test.twitter.gae-tweetstore.access.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.azureblob.identity</name>
|
||||
<value>${test.azureblob.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.azureblob.credential</name>
|
||||
<value>${test.azureblob.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.cloudfiles-us.identity</name>
|
||||
<value>${test.cloudfiles-us.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.cloudfiles-us.credential</name>
|
||||
<value>${test.cloudfiles-us.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.aws-s3.identity</name>
|
||||
<value>${test.aws-s3.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.aws-s3.credential</name>
|
||||
<value>${test.aws-s3.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>appengine.sdk.root</name>
|
||||
<value>${appengine.sdk.root}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>devappserver.address</name>
|
||||
<value>${devappserver.address}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>devappserver.port</name>
|
||||
<value>${devappserver.port}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>jclouds.tweetstore.blobstores</name>
|
||||
<value>${jclouds.tweetstore.blobstores}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>jclouds.tweetstore.container</name>
|
||||
<value>${jclouds.tweetstore.container}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>warfile</name>
|
||||
<value>${project.build.directory}/${project.artifactId}</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
0
demos/gae-tweetstore/src/main/appengine/appengine-web.xml → demos/tweetstore/gae-tweetstore/src/main/platform/appengine-web.xml
Executable file → Normal file
0
demos/gae-tweetstore/src/main/appengine/appengine-web.xml → demos/tweetstore/gae-tweetstore/src/main/platform/appengine-web.xml
Executable file → Normal file
0
demos/gae-tweetstore/src/main/webapp/WEB-INF/web.xml → demos/tweetstore/gae-tweetstore/src/main/webapp/WEB-INF/web.xml
Executable file → Normal file
0
demos/gae-tweetstore/src/main/webapp/WEB-INF/web.xml → demos/tweetstore/gae-tweetstore/src/main/webapp/WEB-INF/web.xml
Executable file → Normal file
0
demos/gae-tweetstore/src/main/webapp/index.jsp → demos/tweetstore/gae-tweetstore/src/main/webapp/index.jsp
Executable file → Normal file
0
demos/gae-tweetstore/src/main/webapp/index.jsp → demos/tweetstore/gae-tweetstore/src/main/webapp/index.jsp
Executable file → Normal file
0
demos/gae-tweetstore/src/main/webapp/tweets.jsp → demos/tweetstore/gae-tweetstore/src/main/webapp/tweets.jsp
Executable file → Normal file
0
demos/gae-tweetstore/src/main/webapp/tweets.jsp → demos/tweetstore/gae-tweetstore/src/main/webapp/tweets.jsp
Executable file → Normal file
|
@ -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";
|
||||
}
|
||||
}
|
0
demos/gae-tweetstore/src/test/resources/log4j.xml → demos/tweetstore/gae-tweetstore/src/test/resources/log4j.xml
Executable file → Normal file
0
demos/gae-tweetstore/src/test/resources/log4j.xml → demos/tweetstore/gae-tweetstore/src/test/resources/log4j.xml
Executable file → Normal file
|
@ -0,0 +1,137 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
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.
|
||||
====================================================================
|
||||
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>jclouds-demos-project</artifactId>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jclouds-demos-tweetstore-project</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>jclouds TweetStore demos project</name>
|
||||
<modules>
|
||||
<module>gae-tweetstore</module>
|
||||
<module>gae-tweetstore-spring</module>
|
||||
<module>runatcloud-tweetstore</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<jclouds.tweetstore.blobstores>cloudfiles-us,aws-s3,azureblob</jclouds.tweetstore.blobstores>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-blobstore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.twitter4j</groupId>
|
||||
<artifactId>twitter4j-core</artifactId>
|
||||
<version>[2.2,)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-blobstore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>aws-s3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>cloudfiles-us</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>azureblob</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>displaytag</groupId>
|
||||
<artifactId>displaytag</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>jstl</artifactId>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>standard</artifactId>
|
||||
<groupId>taglibs</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<configuration>
|
||||
<!-- see http://jira.codehaus.org/browse/MWAR-248 -->
|
||||
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
|
||||
<webResources>
|
||||
<resource>
|
||||
<directory>src/main/platform</directory>
|
||||
<targetPath>WEB-INF</targetPath>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</webResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -17,6 +17,8 @@
|
|||
====================================================================
|
||||
====
|
||||
|
||||
A guide to generating Twitter consumer keys and access tokens is at http://tinyurl.com/2fhebgb
|
||||
|
||||
Please modify your maven settings.xml like below before attempting to run 'mvn -Plive install'
|
||||
|
||||
<profile>
|
||||
|
@ -25,8 +27,8 @@ Please modify your maven settings.xml like below before attempting to run 'mvn -
|
|||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<bees.appid>yourappid</bees.appid>
|
||||
<bees.environment>yourenv</bees.environment>
|
||||
<bees.apikey>yourapikey</bees.apikey>
|
||||
<bees.secret>yoursecret</bees.secret>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
|
@ -36,13 +38,15 @@ Please modify your maven settings.xml like below before attempting to run 'mvn -
|
|||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<jclouds.aws-s3.identity>YOUR_ACCESS_KEY_ID</jclouds.aws-s3.identity>
|
||||
<jclouds.aws-s3.credential>YOUR_SECRET_KEY</jclouds.aws-s3.credential>
|
||||
<jclouds.cloudfiles-us.identity>YOUR_USER</jclouds.cloudfiles-us.identity>
|
||||
<jclouds.cloudfiles-us.credential>YOUR_HEX_KEY</jclouds.cloudfiles-us.credential>
|
||||
<jclouds.azureblob.identity>YOUR_ACCOUNT</jclouds.azureblob.identity>
|
||||
<jclouds.azureblob.credential>YOUR_BASE64_ENCODED_KEY</jclouds.azureblob.credential>
|
||||
<jclouds.twitter.identity>YOUR_TWITTER_USERNAME</jclouds.twitter.identity>
|
||||
<jclouds.twitter.credential>YOUR_TWITTER_PASSWORD</jclouds.twitter.credential>
|
||||
<test.aws-s3.identity>YOUR_ACCESS_KEY_ID</test.aws-s3.identity>
|
||||
<test.aws-s3.credential>YOUR_SECRET_KEY</test.aws-s3.credential>
|
||||
<test.cloudfiles-us.identity>YOUR_USER</test.cloudfiles-us.identity>
|
||||
<test.cloudfiles-us.credential>YOUR_HEX_KEY</test.cloudfiles-us.credential>
|
||||
<test.azureblob.identity>YOUR_ACCOUNT</test.azureblob.identity>
|
||||
<test.azureblob.credential>YOUR_BASE64_ENCODED_KEY</test.azureblob.credential>
|
||||
<test.twitter.runatcloud-tweetstore.consumer.identity>YOUR_TWITTER_CONSUMER_KEY</test.twitter.runatcloud-tweetstore.consumer.identity>
|
||||
<test.twitter.runatcloud-tweetstore.consumer.credential>YOUR_TWITTER_CONSUMER_SECRET</test.twitter.runatcloud-tweetstore.consumer.credential>
|
||||
<test.twitter.runatcloud-tweetstore.access.identity>YOUR_TWITTER_ACCESSTOKEN</test.twitter.runatcloud-tweetstore.access.identity>
|
||||
<test.twitter.runatcloud-tweetstore.access.credential>YOUR_TWITTER_ACCESSTOKEN_SECRET</test.twitter.runatcloud-tweetstore.access.credential>
|
||||
</properties>
|
||||
</profile>
|
|
@ -22,7 +22,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-demos-project</artifactId>
|
||||
<artifactId>jclouds-demos-tweetstore-project</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>jclouds-demo-runatcloud-tweetstore</artifactId>
|
||||
|
@ -31,91 +31,19 @@
|
|||
<description>jclouds TweetStore for CloudBees' RUN@cloud using Guice for Dependency Injection</description>
|
||||
|
||||
<properties>
|
||||
<bees.appid>tweetstore</bees.appid>
|
||||
<bees.environment>run</bees.environment>
|
||||
<bees.address>localhost</bees.address>
|
||||
<bees.port>8088</bees.port>
|
||||
<jclouds.tweetstore.blobstores>cloudfiles-us,aws-s3,azureblob</jclouds.tweetstore.blobstores>
|
||||
<jclouds.tweetstore.container>jclouds-tweetstore-runatcloud</jclouds.tweetstore.container>
|
||||
<bees.appid>jclouds/tweetstore</bees.appid>
|
||||
<bees.environment>run</bees.environment>
|
||||
<bees.address>localhost</bees.address>
|
||||
<bees.port>8088</bees.port>
|
||||
<jclouds.tweetstore.container>jclouds-tweetstore-runatcloud</jclouds.tweetstore.container>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-blobstore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.twitter4j</groupId>
|
||||
<artifactId>twitter4j-core</artifactId>
|
||||
<version>[2.1,)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-blobstore</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>aws-s3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>cloudfiles-us</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>azureblob</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.inject.extensions</groupId>
|
||||
<artifactId>guice-servlet</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>displaytag</groupId>
|
||||
<artifactId>displaytag</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>jstl</artifactId>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>standard</artifactId>
|
||||
<groupId>taglibs</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- RUN@cloud API -->
|
||||
<dependency>
|
||||
|
@ -140,7 +68,6 @@
|
|||
</pluginRepositories>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
@ -178,13 +105,18 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.cloudbees</groupId>
|
||||
<artifactId>bees-maven-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.cloudbees</groupId>
|
||||
<artifactId>bees-maven-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<configuration>
|
||||
<environment>${bees.environment}</environment>
|
||||
<apikey>${bees.apikey}</apikey>
|
||||
<secret>${bees.secret}</secret>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
|
@ -203,12 +135,20 @@
|
|||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>test.twitter.identity</name>
|
||||
<value>${test.twitter.identity}</value>
|
||||
<name>test.twitter.consumer.identity</name>
|
||||
<value>${test.twitter.runatcloud-tweetstore.consumer.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.credential</name>
|
||||
<value>${test.twitter.credential}</value>
|
||||
<name>test.twitter.consumer.credential</name>
|
||||
<value>${test.twitter.runatcloud-tweetstore.consumer.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.access.identity</name>
|
||||
<value>${test.twitter.runatcloud-tweetstore.access.identity}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.twitter.access.credential</name>
|
||||
<value>${test.twitter.runatcloud-tweetstore.access.credential}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>test.azureblob.identity</name>
|
|
@ -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";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue