mirror of https://github.com/apache/jclouds.git
switched aws demo to use s3 and ec2
This commit is contained in:
parent
7a4b513191
commit
72da36bf33
|
@ -44,26 +44,6 @@
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>jclouds-blobstore</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>jclouds-azure</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>jclouds-rackspace</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>jclouds-enterprise</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>jclouds-gae</artifactId>
|
<artifactId>jclouds-gae</artifactId>
|
||||||
|
@ -205,22 +185,6 @@
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<systemProperties>
|
<systemProperties>
|
||||||
<property>
|
|
||||||
<name>jclouds.azure.storage.account</name>
|
|
||||||
<value>${jclouds.azure.storage.account}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>jclouds.azure.storage.key</name>
|
|
||||||
<value>${jclouds.azure.storage.key}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>jclouds.rackspace.user</name>
|
|
||||||
<value>${jclouds.rackspace.user}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>jclouds.rackspace.key</name>
|
|
||||||
<value>${jclouds.rackspace.key}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
<property>
|
||||||
<name>jclouds.aws.accesskeyid</name>
|
<name>jclouds.aws.accesskeyid</name>
|
||||||
<value>${jclouds.aws.accesskeyid}</value>
|
<value>${jclouds.aws.accesskeyid}</value>
|
||||||
|
|
|
@ -33,8 +33,10 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.samples.googleappengine.functions.BlobStoreContextToContainerResult;
|
import org.jclouds.samples.googleappengine.functions.BlobStoreContextToStatusResult;
|
||||||
|
import org.jclouds.samples.googleappengine.functions.ComputeServiceContextToStatusResult;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
@ -45,39 +47,48 @@ import com.google.common.collect.Sets;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class GetAllContainersController extends HttpServlet {
|
public class GetAllStatusController extends HttpServlet {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Map<String, BlobStoreContext> contexts;
|
private final Map<String, BlobStoreContext> blobsStoreContexts;
|
||||||
private final BlobStoreContextToContainerResult blobStoreContextToContainerResult;
|
private final Map<String, ComputeServiceContext> computeServiceContexts;
|
||||||
|
private final BlobStoreContextToStatusResult blobStoreContextToContainerResult;
|
||||||
|
private final ComputeServiceContextToStatusResult computeServiceContextToContainerResult;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public GetAllContainersController(Map<String, BlobStoreContext> contexts,
|
GetAllStatusController(Map<String, BlobStoreContext> blobsStoreContexts,
|
||||||
BlobStoreContextToContainerResult blobStoreContextToContainerResult) {
|
Map<String, ComputeServiceContext> computeServiceContexts,
|
||||||
this.contexts = contexts;
|
BlobStoreContextToStatusResult blobStoreContextToContainerResult,
|
||||||
|
ComputeServiceContextToStatusResult computeServiceContextToContainerResult) {
|
||||||
|
this.blobsStoreContexts = blobsStoreContexts;
|
||||||
|
this.computeServiceContexts = computeServiceContexts;
|
||||||
this.blobStoreContextToContainerResult = blobStoreContextToContainerResult;
|
this.blobStoreContextToContainerResult = blobStoreContextToContainerResult;
|
||||||
|
this.computeServiceContextToContainerResult = computeServiceContextToContainerResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
try {
|
try {
|
||||||
addMyContainersToRequest(request);
|
addStatusResultsToRequest(request);
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(
|
||||||
"/WEB-INF/jsp/containers.jsp");
|
"/WEB-INF/jsp/status.jsp");
|
||||||
dispatcher.forward(request, response);
|
dispatcher.forward(request, response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e, "Error listing containers");
|
logger.error(e, "Error listing status");
|
||||||
throw new ServletException(e);
|
throw new ServletException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMyContainersToRequest(HttpServletRequest request) throws InterruptedException,
|
private void addStatusResultsToRequest(HttpServletRequest request) throws InterruptedException,
|
||||||
ExecutionException, TimeoutException {
|
ExecutionException, TimeoutException {
|
||||||
request.setAttribute("containers", Sets.newTreeSet(Iterables.transform(contexts.keySet(),
|
request.setAttribute("status", Sets
|
||||||
blobStoreContextToContainerResult)));
|
.newTreeSet(Iterables.concat(Iterables.transform(blobsStoreContexts.keySet(),
|
||||||
|
blobStoreContextToContainerResult), Iterables.transform(
|
||||||
|
computeServiceContexts.keySet(), computeServiceContextToContainerResult))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,26 +18,27 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.samples.googleappengine.config;
|
package org.jclouds.samples.googleappengine.config;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.blobstore.BlobStoreContextBuilder;
|
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||||
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
|
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||||
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
|
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
|
||||||
import org.jclouds.samples.googleappengine.GetAllContainersController;
|
import org.jclouds.samples.googleappengine.GetAllStatusController;
|
||||||
|
|
||||||
import com.google.appengine.repackaged.com.google.common.collect.ImmutableList;
|
import com.google.appengine.repackaged.com.google.common.base.Throwables;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.io.Closeables;
|
import com.google.common.io.Closeables;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
import com.google.inject.Module;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import com.google.inject.servlet.GuiceServletContextListener;
|
import com.google.inject.servlet.GuiceServletContextListener;
|
||||||
import com.google.inject.servlet.ServletModule;
|
import com.google.inject.servlet.ServletModule;
|
||||||
|
@ -49,31 +50,23 @@ import com.google.inject.servlet.ServletModule;
|
||||||
*/
|
*/
|
||||||
public class GuiceServletConfig extends GuiceServletContextListener {
|
public class GuiceServletConfig extends GuiceServletContextListener {
|
||||||
|
|
||||||
public static final String PROPERTY_BLOBSTORE_CONTEXTS = "blobstore.contexts";
|
private Map<String, BlobStoreContext> blobsStoreContexts;
|
||||||
|
private Map<String, ComputeServiceContext> computeServiceContexts;
|
||||||
|
|
||||||
private Map<String, BlobStoreContext> contexts;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public void contextInitialized(ServletContextEvent servletContextEvent) {
|
public void contextInitialized(ServletContextEvent servletContextEvent) {
|
||||||
Properties props = loadJCloudsProperties(servletContextEvent);
|
Properties props = loadJCloudsProperties(servletContextEvent);
|
||||||
ImmutableList<String> list = ImmutableList.<String> of(checkNotNull(
|
ImmutableSet<Module> modules = ImmutableSet
|
||||||
props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS), PROPERTY_BLOBSTORE_CONTEXTS).split(
|
.<Module> of(new GoogleAppEngineConfigurationModule());
|
||||||
","));
|
try {
|
||||||
contexts = Maps.newHashMap();
|
blobsStoreContexts = ImmutableMap.<String, BlobStoreContext> of("s3",
|
||||||
for (String className : list) {
|
new BlobStoreContextFactory().createContext("s3", modules, props));
|
||||||
try {
|
computeServiceContexts = ImmutableMap.<String, ComputeServiceContext> of("ec2",
|
||||||
Class<BlobStoreContextBuilder<?, ?>> builderClass;
|
new ComputeServiceContextFactory().createContext("ec2", modules, props));
|
||||||
builderClass = (Class<BlobStoreContextBuilder<?, ?>>) Class.forName(className);
|
} catch (IOException e) {
|
||||||
String name = builderClass.getSimpleName().replaceAll("BlobStoreContextBuilder", "");
|
Throwables.propagate(e);
|
||||||
Constructor<BlobStoreContextBuilder<?, ?>> constructor = builderClass
|
|
||||||
.getConstructor(Properties.class);
|
|
||||||
contexts.put(name, constructor.newInstance(props).withModules(
|
|
||||||
new GoogleAppEngineConfigurationModule()).buildBlobStoreContext());
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.contextInitialized(servletContextEvent);
|
super.contextInitialized(servletContextEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,8 +90,10 @@ public class GuiceServletConfig extends GuiceServletContextListener {
|
||||||
@Override
|
@Override
|
||||||
protected void configureServlets() {
|
protected void configureServlets() {
|
||||||
bind(new TypeLiteral<Map<String, BlobStoreContext>>() {
|
bind(new TypeLiteral<Map<String, BlobStoreContext>>() {
|
||||||
}).toInstance(GuiceServletConfig.this.contexts);
|
}).toInstance(GuiceServletConfig.this.blobsStoreContexts);
|
||||||
serve("*.blobstore").with(GetAllContainersController.class);
|
bind(new TypeLiteral<Map<String, ComputeServiceContext>>() {
|
||||||
|
}).toInstance(GuiceServletConfig.this.computeServiceContexts);
|
||||||
|
serve("*.check").with(GetAllStatusController.class);
|
||||||
requestInjection(this);
|
requestInjection(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +103,10 @@ public class GuiceServletConfig extends GuiceServletContextListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextDestroyed(ServletContextEvent servletContextEvent) {
|
public void contextDestroyed(ServletContextEvent servletContextEvent) {
|
||||||
for (BlobStoreContext context : contexts.values()) {
|
for (BlobStoreContext context : blobsStoreContexts.values()) {
|
||||||
|
context.close();
|
||||||
|
}
|
||||||
|
for (ComputeServiceContext context : computeServiceContexts.values()) {
|
||||||
context.close();
|
context.close();
|
||||||
}
|
}
|
||||||
super.contextDestroyed(servletContextEvent);
|
super.contextDestroyed(servletContextEvent);
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.io.Serializable;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class ContainerResult implements Comparable<ContainerResult>, Serializable {
|
public class StatusResult implements Comparable<StatusResult>, Serializable {
|
||||||
/** The serialVersionUID */
|
/** The serialVersionUID */
|
||||||
private static final long serialVersionUID = -3257496189689220018L;
|
private static final long serialVersionUID = -3257496189689220018L;
|
||||||
private final String service;
|
private final String service;
|
||||||
|
@ -32,7 +32,7 @@ public class ContainerResult implements Comparable<ContainerResult>, Serializabl
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String status;
|
private final String status;
|
||||||
|
|
||||||
public ContainerResult(String service, String host, String name, String status) {
|
public StatusResult(String service, String host, String name, String status) {
|
||||||
this.service = service;
|
this.service = service;
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -58,7 +58,7 @@ public class ContainerResult implements Comparable<ContainerResult>, Serializabl
|
||||||
return false;
|
return false;
|
||||||
if (getClass() != obj.getClass())
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
ContainerResult other = (ContainerResult) obj;
|
StatusResult other = (StatusResult) obj;
|
||||||
if (host == null) {
|
if (host == null) {
|
||||||
if (other.host != null)
|
if (other.host != null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -82,7 +82,7 @@ public class ContainerResult implements Comparable<ContainerResult>, Serializabl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(ContainerResult o) {
|
public int compareTo(StatusResult o) {
|
||||||
return (this == o) ? 0 : getService().compareTo(o.getService());
|
return (this == o) ? 0 : getService().compareTo(o.getService());
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jclouds.blobstore.ContainerNotFoundException;
|
||||||
import org.jclouds.blobstore.domain.StorageMetadata;
|
import org.jclouds.blobstore.domain.StorageMetadata;
|
||||||
import org.jclouds.blobstore.domain.StorageType;
|
import org.jclouds.blobstore.domain.StorageType;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.samples.googleappengine.domain.ContainerResult;
|
import org.jclouds.samples.googleappengine.domain.StatusResult;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -37,8 +37,8 @@ import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class BlobStoreContextToContainerResult implements Function<String, ContainerResult> {
|
public class BlobStoreContextToStatusResult implements Function<String, StatusResult> {
|
||||||
private final class BuildContainerResult implements Function<StorageMetadata, ContainerResult> {
|
private final class BuildContainerResult implements Function<StorageMetadata, StatusResult> {
|
||||||
private final String host;
|
private final String host;
|
||||||
private final BlobStoreContext context;
|
private final BlobStoreContext context;
|
||||||
private final String contextName;
|
private final String contextName;
|
||||||
|
@ -49,7 +49,7 @@ public class BlobStoreContextToContainerResult implements Function<String, Conta
|
||||||
this.contextName = contextName;
|
this.contextName = contextName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainerResult apply(StorageMetadata from) {
|
public StatusResult apply(StorageMetadata from) {
|
||||||
String status;
|
String status;
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
|
@ -63,7 +63,7 @@ public class BlobStoreContextToContainerResult implements Function<String, Conta
|
||||||
logger.error(e, "Error listing container %s//%s", contextName, from);
|
logger.error(e, "Error listing container %s//%s", contextName, from);
|
||||||
status = (e.getMessage());
|
status = (e.getMessage());
|
||||||
}
|
}
|
||||||
return new ContainerResult(contextName, host, from.getName(), status);
|
return new StatusResult(contextName, host, from.getName(), status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class BlobStoreContextToContainerResult implements Function<String, Conta
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
public ContainerResult apply(final String contextName) {
|
public StatusResult apply(final String contextName) {
|
||||||
final BlobStoreContext context = contexts.get(contextName);
|
final BlobStoreContext context = contexts.get(contextName);
|
||||||
final String host = context.getProviderSpecificContext().getEndPoint().getHost();
|
final String host = context.getProviderSpecificContext().getEndPoint().getHost();
|
||||||
try {
|
try {
|
||||||
|
@ -87,7 +87,7 @@ public class BlobStoreContextToContainerResult implements Function<String, Conta
|
||||||
})));
|
})));
|
||||||
return new BuildContainerResult(host, context, contextName).apply(md);
|
return new BuildContainerResult(host, context, contextName).apply(md);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ContainerResult result = new ContainerResult(contextName, host, null, e.getMessage());
|
StatusResult result = new StatusResult(contextName, host, null, e.getMessage());
|
||||||
logger.error(e, "Error listing service %s", contextName);
|
logger.error(e, "Error listing service %s", contextName);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 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.samples.googleappengine.functions;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
|
import org.jclouds.compute.domain.ComputeMetadata;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.samples.googleappengine.domain.StatusResult;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class ComputeServiceContextToStatusResult implements Function<String, StatusResult> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Map<String, ComputeServiceContext> contexts;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
|
public StatusResult apply(final String contextName) {
|
||||||
|
final ComputeServiceContext context = contexts.get(contextName);
|
||||||
|
final String host = context.getProviderSpecificContext().getEndPoint().getHost();
|
||||||
|
String status;
|
||||||
|
String name = "not found";
|
||||||
|
try {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
Map<String, ? extends ComputeMetadata> nodes = context.getComputeService().getNodes();
|
||||||
|
if (nodes.size() > 0)
|
||||||
|
name = Iterables.get(nodes.keySet(), 0);
|
||||||
|
status = ((System.currentTimeMillis() - start) + "ms");
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e, "Error listing service %s", contextName);
|
||||||
|
status = (e.getMessage());
|
||||||
|
}
|
||||||
|
return new StatusResult(contextName, host, name, status);
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,14 +22,14 @@
|
||||||
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
|
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>jclouds: anyweight cloudware for java</title>
|
<title>jclouds: multi-cloud framework</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>Container List</h2>
|
<h2>Status List</h2>
|
||||||
<display:table name="containers" >
|
<display:table name="status" >
|
||||||
<display:column property="service" title="Service" />
|
<display:column property="service" title="Service" />
|
||||||
<display:column property="host" title="Host" />
|
<display:column property="host" title="Host" />
|
||||||
<display:column property="name" title="Container" />
|
<display:column property="name" title="Item" />
|
||||||
<display:column property="status" title="Status" />
|
<display:column property="status" title="Status" />
|
||||||
</display:table>
|
</display:table>
|
||||||
</body>
|
</body>
|
|
@ -20,12 +20,11 @@
|
||||||
--%>
|
--%>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>jclouds: anyweight cloudware for java</title>
|
<title>jclouds: multi-cloud framework</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>Welcome!</h2>
|
<h2>Welcome!</h2>
|
||||||
Click
|
Click
|
||||||
<a href="/guice/containers.blobstore">here</a>
|
<a href="/guice/status.check">here</a> to get status of cloud services.
|
||||||
to list my containers.
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -21,23 +21,14 @@ package org.jclouds.samples.googleappengine.functest;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_ACCESSKEYID;
|
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_ACCESSKEYID;
|
||||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_SECRETACCESSKEY;
|
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_SECRETACCESSKEY;
|
||||||
import static org.jclouds.azure.storage.reference.AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT;
|
|
||||||
import static org.jclouds.azure.storage.reference.AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY;
|
|
||||||
import static org.jclouds.rackspace.reference.RackspaceConstants.PROPERTY_RACKSPACE_KEY;
|
|
||||||
import static org.jclouds.rackspace.reference.RackspaceConstants.PROPERTY_RACKSPACE_USER;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.aws.s3.S3ContextBuilder;
|
import org.jclouds.aws.ec2.EC2PropertiesBuilder;
|
||||||
import org.jclouds.aws.s3.S3PropertiesBuilder;
|
import org.jclouds.aws.s3.S3PropertiesBuilder;
|
||||||
import org.jclouds.azure.storage.blob.AzureBlobPropertiesBuilder;
|
|
||||||
import org.jclouds.azure.storage.blob.AzureBlobContextBuilder;
|
|
||||||
import org.jclouds.rackspace.cloudfiles.CloudFilesContextBuilder;
|
|
||||||
import org.jclouds.rackspace.cloudfiles.CloudFilesPropertiesBuilder;
|
|
||||||
import org.jclouds.samples.googleappengine.config.GuiceServletConfig;
|
|
||||||
import org.jclouds.util.Utils;
|
import org.jclouds.util.Utils;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Parameters;
|
import org.testng.annotations.Parameters;
|
||||||
|
@ -62,10 +53,6 @@ public class GoogleAppEngineLiveTest {
|
||||||
url = new URL(String.format("http://%s:%s", address, port));
|
url = new URL(String.format("http://%s:%s", address, port));
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
|
|
||||||
props.setProperty(GuiceServletConfig.PROPERTY_BLOBSTORE_CONTEXTS, String.format("%s,%s,%s",
|
|
||||||
S3ContextBuilder.class.getName(), CloudFilesContextBuilder.class.getName(),
|
|
||||||
AzureBlobContextBuilder.class.getName()));
|
|
||||||
|
|
||||||
props = new S3PropertiesBuilder(props)
|
props = new S3PropertiesBuilder(props)
|
||||||
.withCredentials(
|
.withCredentials(
|
||||||
checkNotNull(System.getProperty(PROPERTY_AWS_ACCESSKEYID),
|
checkNotNull(System.getProperty(PROPERTY_AWS_ACCESSKEYID),
|
||||||
|
@ -73,14 +60,12 @@ public class GoogleAppEngineLiveTest {
|
||||||
System.getProperty(PROPERTY_AWS_SECRETACCESSKEY,
|
System.getProperty(PROPERTY_AWS_SECRETACCESSKEY,
|
||||||
PROPERTY_AWS_SECRETACCESSKEY)).build();
|
PROPERTY_AWS_SECRETACCESSKEY)).build();
|
||||||
|
|
||||||
props = new CloudFilesPropertiesBuilder(props).withCredentials(
|
props = new EC2PropertiesBuilder(props)
|
||||||
checkNotNull(System.getProperty(PROPERTY_RACKSPACE_USER), PROPERTY_RACKSPACE_USER),
|
.withCredentials(
|
||||||
System.getProperty(PROPERTY_RACKSPACE_KEY, PROPERTY_RACKSPACE_KEY)).build();
|
checkNotNull(System.getProperty(PROPERTY_AWS_ACCESSKEYID),
|
||||||
|
PROPERTY_AWS_ACCESSKEYID),
|
||||||
props = new AzureBlobPropertiesBuilder(props).withCredentials(
|
System.getProperty(PROPERTY_AWS_SECRETACCESSKEY,
|
||||||
checkNotNull(System.getProperty(PROPERTY_AZURESTORAGE_ACCOUNT),
|
PROPERTY_AWS_SECRETACCESSKEY)).build();
|
||||||
PROPERTY_AZURESTORAGE_ACCOUNT),
|
|
||||||
System.getProperty(PROPERTY_AZURESTORAGE_KEY, PROPERTY_AZURESTORAGE_KEY)).build();
|
|
||||||
|
|
||||||
server = new GoogleDevServer();
|
server = new GoogleDevServer();
|
||||||
server.writePropertiesAndStartServer(address, port, warfile, props);
|
server.writePropertiesAndStartServer(address, port, warfile, props);
|
||||||
|
@ -95,7 +80,7 @@ public class GoogleAppEngineLiveTest {
|
||||||
|
|
||||||
@Test(invocationCount = 5, enabled = true)
|
@Test(invocationCount = 5, enabled = true)
|
||||||
public void testGuiceJCloudsSerial() throws InterruptedException, IOException {
|
public void testGuiceJCloudsSerial() throws InterruptedException, IOException {
|
||||||
URL gurl = new URL(url, "/guice/containers.blobstore");
|
URL gurl = new URL(url, "/guice/status.check");
|
||||||
InputStream i = gurl.openStream();
|
InputStream i = gurl.openStream();
|
||||||
String string = Utils.toStringAndClose(i);
|
String string = Utils.toStringAndClose(i);
|
||||||
assert string.indexOf("List") >= 0 : string;
|
assert string.indexOf("List") >= 0 : string;
|
||||||
|
@ -103,7 +88,7 @@ public class GoogleAppEngineLiveTest {
|
||||||
|
|
||||||
@Test(invocationCount = 10, enabled = true, threadPoolSize = 3)
|
@Test(invocationCount = 10, enabled = true, threadPoolSize = 3)
|
||||||
public void testGuiceJCloudsParallel() throws InterruptedException, IOException {
|
public void testGuiceJCloudsParallel() throws InterruptedException, IOException {
|
||||||
URL gurl = new URL(url, "/guice/containers.blobstore");
|
URL gurl = new URL(url, "/guice/status.check");
|
||||||
InputStream i = gurl.openStream();
|
InputStream i = gurl.openStream();
|
||||||
String string = Utils.toStringAndClose(i);
|
String string = Utils.toStringAndClose(i);
|
||||||
assert string.indexOf("List") >= 0 : string;
|
assert string.indexOf("List") >= 0 : string;
|
||||||
|
|
Loading…
Reference in New Issue