diff --git a/demos/tweetstore/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 index fe28b80802..9c35a8c60f 100644 --- a/demos/tweetstore/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 @@ -3,6 +3,7 @@ package org.jclouds.demo.tweetstore.config.utils; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.inject.name.Names.bindProperties; import static java.lang.String.format; +import static org.jclouds.demo.tweetstore.controller.StoreTweetsController.AUTHORIZED_REQUEST_ORIGINATOR_HEADER; import java.util.Properties; @@ -31,8 +32,6 @@ public class HttpRequestTask implements Runnable { } public static class Factory { - private static final String HTTP_REQUEST_ORIGINATOR_HEADER = "X-RUN@cloud-Originator"; - protected final HttpCommandExecutorService httpClient; protected final String originator; @@ -56,7 +55,7 @@ public class HttpRequestTask implements Runnable { public HttpRequestTask create(HttpRequest request) { HttpRequest requestWithSubmitter = request.toBuilder().headers( copyOfWithEntry(request.getHeaders(), - HTTP_REQUEST_ORIGINATOR_HEADER, originator)).build(); + AUTHORIZED_REQUEST_ORIGINATOR_HEADER, originator)).build(); return new HttpRequestTask(httpClient, requestWithSubmitter); } diff --git a/demos/tweetstore/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 index efe708ea23..037c4a6dbb 100644 --- a/demos/tweetstore/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 @@ -53,7 +53,8 @@ import com.google.common.base.Function; */ @Singleton public class StoreTweetsController extends HttpServlet { - + public static final String AUTHORIZED_REQUEST_ORIGINATOR_HEADER = "X-RUNatcloud-Originator"; + private static final class StatusToBlob implements Function { private final BlobMap map; @@ -109,8 +110,8 @@ public class StoreTweetsController extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - if (request.getHeader("X-RUN@cloud-Submitter") != null - && request.getHeader("X-RUN@cloud-Submitter").equals("twitter")) { + if (request.getHeader(AUTHORIZED_REQUEST_ORIGINATOR_HEADER) != null + && request.getHeader(AUTHORIZED_REQUEST_ORIGINATOR_HEADER).equals("twitter")) { try { String contextName = checkNotNull(request.getHeader("context"), "missing header context"); logger.info("retrieving tweets"); diff --git a/demos/tweetstore/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 index 174b2e95fc..1066dc4138 100644 --- a/demos/tweetstore/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 @@ -19,6 +19,7 @@ package org.jclouds.demo.tweetstore.integration; import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.demo.tweetstore.controller.StoreTweetsController.AUTHORIZED_REQUEST_ORIGINATOR_HEADER; import static org.jclouds.demo.tweetstore.reference.TweetStoreConstants.PROPERTY_TWEETSTORE_BLOBSTORES; import static org.jclouds.demo.tweetstore.reference.TweetStoreConstants.PROPERTY_TWEETSTORE_CONTAINER; import static org.jclouds.demo.tweetstore.reference.TwitterConstants.PROPERTY_TWITTER_ACCESSTOKEN; @@ -173,13 +174,13 @@ public class TweetStoreLiveTest { } @BeforeTest(dependsOnMethods = "clearAndCreateContainers") - @Parameters({ "warfile", "bees.address", "bees.port", "bees.environment", "bees.basedir" }) + @Parameters({ "warfile", "bees.address", "bees.port", "bees.basedir" }) public void startDevAppServer(final String warfile, final String address, final String port, - String environments, String serverBaseDirectory) throws Exception { + String serverBaseDirectory) throws Exception { url = new URL(String.format("http://%s:%s", address, port)); server = new RunAtCloudServer(); - server.writePropertiesAndStartServer(address, port, warfile, environments, + server.writePropertiesAndStartServer(address, port, warfile, "itest", serverBaseDirectory, props); } @@ -202,7 +203,7 @@ public class TweetStoreLiveTest { for (String context : blobstores) { System.out.println("storing at context: " + context); HttpURLConnection connection = (HttpURLConnection) gurl.openConnection(); - connection.addRequestProperty("X-RUN@cloud-Submitter", "twitter"); + connection.addRequestProperty(AUTHORIZED_REQUEST_ORIGINATOR_HEADER, "twitter"); connection.addRequestProperty("context", context); InputStream i = connection.getInputStream(); String string = Strings2.toStringAndClose(i);