Formatting.

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2572 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
sharedocs1@gmail.com 2010-01-02 18:56:21 +00:00
parent 71ddcd5c87
commit 51b5f2583e
1 changed files with 120 additions and 118 deletions

View File

@ -58,8 +58,8 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* Starts up the Google App Engine for Java Development environment and deploys an application which
* tests accesses twitter and blobstores.
* Starts up the Google App Engine for Java Development environment and deploys
* an application which tests accesses twitter and blobstores.
*
* @author Adrian Cole
*/
@ -73,12 +73,12 @@ public class TweetStoreLiveTest {
@BeforeTest
@Parameters( { "warfile", "devappserver.address", "devappserver.port" })
public void startDevAppServer(final String warfile, final String address, final String port)
throws Exception {
public void startDevAppServer(final String warfile, final String address,
final String port) throws Exception {
url = new URL(String.format("http://%s:%s", address, port));
Properties props = new Properties();
props.setProperty(PROPERTY_TWEETSTORE_CONTAINER, checkNotNull(System
.getProperty(PROPERTY_TWEETSTORE_CONTAINER)));
props.setProperty(PROPERTY_TWEETSTORE_CONTAINER,
checkNotNull(System.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER));
props.setProperty(PROPERTY_BLOBSTORE_CONTEXTBUILDERS,
// WATCH THIS.. when adding a new context, you must update the string
String.format("%s,%s,%s", S3BlobStoreContextBuilder.class.getName(),
@ -87,49 +87,50 @@ public class TweetStoreLiveTest {
props = new TwitterPropertiesBuilder(props).withCredentials(
checkNotNull(System.getProperty(PROPERTY_TWITTER_USER), PROPERTY_TWITTER_USER),
System.getProperty(PROPERTY_TWITTER_PASSWORD, PROPERTY_TWITTER_PASSWORD)).build();
System.getProperty(PROPERTY_TWITTER_PASSWORD, PROPERTY_TWITTER_PASSWORD))
.build();
props = new S3PropertiesBuilder(props)
.withCredentials(
checkNotNull(System.getProperty(PROPERTY_AWS_ACCESSKEYID),
PROPERTY_AWS_ACCESSKEYID),
System.getProperty(PROPERTY_AWS_SECRETACCESSKEY,
PROPERTY_AWS_SECRETACCESSKEY)).build();
props = new S3PropertiesBuilder(props).withCredentials(
checkNotNull(System.getProperty(PROPERTY_AWS_ACCESSKEYID), PROPERTY_AWS_ACCESSKEYID),
System.getProperty(PROPERTY_AWS_SECRETACCESSKEY, PROPERTY_AWS_SECRETACCESSKEY))
.build();
props = new CloudFilesPropertiesBuilder(props).withCredentials(
checkNotNull(System.getProperty(PROPERTY_RACKSPACE_USER), PROPERTY_RACKSPACE_USER),
System.getProperty(PROPERTY_RACKSPACE_KEY, PROPERTY_RACKSPACE_KEY)).build();
System.getProperty(PROPERTY_RACKSPACE_KEY, PROPERTY_RACKSPACE_KEY))
.build();
props = new AzureBlobPropertiesBuilder(props).withCredentials(
checkNotNull(System.getProperty(PROPERTY_AZURESTORAGE_ACCOUNT),
PROPERTY_AZURESTORAGE_ACCOUNT),
System.getProperty(PROPERTY_AZURESTORAGE_KEY, PROPERTY_AZURESTORAGE_KEY)).build();
checkNotNull(System.getProperty(PROPERTY_AZURESTORAGE_ACCOUNT), PROPERTY_AZURESTORAGE_ACCOUNT),
System.getProperty(PROPERTY_AZURESTORAGE_KEY, PROPERTY_AZURESTORAGE_KEY))
.build();
server = new GoogleDevServer();
server.writePropertiesAndStartServer(address, port, warfile, props);
}
@BeforeClass
void clearAndCreateContainers() throws InterruptedException, ExecutionException,
TimeoutException {
void clearAndCreateContainers() throws InterruptedException,
ExecutionException, TimeoutException {
container = checkNotNull(System.getProperty(PROPERTY_TWEETSTORE_CONTAINER));
BlobStoreContext<?, ?> s3Context = S3BlobStoreContextFactory.createContext(checkNotNull(
System.getProperty(PROPERTY_AWS_ACCESSKEYID), PROPERTY_AWS_ACCESSKEYID), System
.getProperty(PROPERTY_AWS_SECRETACCESSKEY, PROPERTY_AWS_SECRETACCESSKEY));
BlobStoreContext<?, ?> s3Context = S3BlobStoreContextFactory.createContext(
checkNotNull(System.getProperty(PROPERTY_AWS_ACCESSKEYID), PROPERTY_AWS_ACCESSKEYID),
System.getProperty(PROPERTY_AWS_SECRETACCESSKEY, PROPERTY_AWS_SECRETACCESSKEY));
BlobStoreContext<?, ?> cfContext = CloudFilesBlobStoreContextFactory.createContext(
checkNotNull(System.getProperty(PROPERTY_RACKSPACE_USER), PROPERTY_RACKSPACE_USER),
System.getProperty(PROPERTY_RACKSPACE_KEY, PROPERTY_RACKSPACE_KEY));
BlobStoreContext<?, ?> azContext = AzureBlobStoreContextFactory.createContext(checkNotNull(
System.getProperty(PROPERTY_AZURESTORAGE_ACCOUNT), PROPERTY_AZURESTORAGE_ACCOUNT),
BlobStoreContext<?, ?> azContext = AzureBlobStoreContextFactory.createContext(
checkNotNull(System.getProperty(PROPERTY_AZURESTORAGE_ACCOUNT), PROPERTY_AZURESTORAGE_ACCOUNT),
System.getProperty(PROPERTY_AZURESTORAGE_KEY, PROPERTY_AZURESTORAGE_KEY));
this.contexts = ImmutableSet.of(s3Context, cfContext, azContext);
boolean deleted = false;
for (BlobStoreContext<?, ?> context : contexts) {
if (context.getBlobStore().containerExists(container)) {
System.err.printf("deleting container %s at %s%n", container, context.getEndPoint());
System.err.printf("deleting container %s at %s%n", container,
context.getEndPoint());
context.getBlobStore().deleteContainer(container);
deleted = true;
}
@ -139,7 +140,8 @@ public class TweetStoreLiveTest {
Thread.sleep(30000);
}
for (BlobStoreContext<?, ?> context : contexts) {
System.err.printf("creating container %s at %s%n", container, context.getEndPoint());
System.err.printf("creating container %s at %s%n", container,
context.getEndPoint());
context.getBlobStore().createContainer(container);
}
if (deleted) {
@ -166,7 +168,8 @@ public class TweetStoreLiveTest {
for (String context : new String[] { "S3", "Azure", "CloudFiles" }) {
System.out.println("storing at context: " + context);
HttpURLConnection connection = (HttpURLConnection) gurl.openConnection();
HttpURLConnection connection = (HttpURLConnection) gurl
.openConnection();
connection.addRequestProperty("X-AppEngine-QueueName", "twitter");
connection.addRequestProperty("context", context);
InputStream i = connection.getInputStream();
@ -178,7 +181,6 @@ public class TweetStoreLiveTest {
System.err.println("sleeping 10 seconds to allow for eventual consistency delay");
Thread.sleep(10000);
for (BlobStoreContext<?, ?> context : contexts) {
assert context.createInputStreamMap(container).size() > 0 : context.getEndPoint();
}
}