You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Everett Toews <no...@github.com> on 2013/10/11 22:46:21 UTC

[jclouds] New base class for all OpenStack mock tests. (#177)

This is going to look a little odd because it doesn&#39;t appear to be used anywhere. It&#39;s actually being used by openstack-swift in jclouds-labs-openstack. But I can&#39;t submit my PR to jclouds-labs-openstack until this has been merged, otherwise the jclouds-labs-openstack tests will fail. Just a natural consequence of having different repos. Once the openstack-swift refactoring is done, I&#39;ll be able to use it for openstack-marconi too. 
You can merge this Pull Request by running:

  git pull https://github.com/rackspace/jclouds refactor-BaseSwiftMockTest

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds/pull/177

-- Commit Summary --

  * New base class for all OpenStack mock tests.

-- File Changes --

    M apis/openstack-keystone/pom.xml (6)
    A apis/openstack-keystone/src/test/java/org/jclouds/openstack/v2_0/internal/BaseOpenStackMockTest.java (99)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/177.patch
https://github.com/jclouds/jclouds/pull/177.diff

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by Everett Toews <no...@github.com>.
> +      return ContextBuilder.newBuilder(provider)
> +            .credentials("jclouds:joe", "letmein")
> +            .endpoint(uri)
> +            .overrides(overrides)
> +            .modules(modules)
> +            .buildApi(new TypeToken<A>(getClass()) {});
> +   }
> +
> +   public A api(String uri, String provider) {
> +      return api(uri, provider, new Properties());
> +   }
> +
> +   private final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(sameThreadExecutor(),
> +         sameThreadExecutor()));
> +
> +   public MockWebServer mockSwiftServer() throws IOException {

Made static and renamed in proposed commit https://github.com/rackspace/jclouds/commit/0c53a48df010e0d7f2b4d9cfee4cbd95ccb2b522

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177/files#r6945963

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by Andrew Phillips <no...@github.com>.
> +      return ContextBuilder.newBuilder(provider)
> +            .credentials("jclouds:joe", "letmein")
> +            .endpoint(uri)
> +            .overrides(overrides)
> +            .modules(modules)
> +            .buildApi(new TypeToken<A>(getClass()) {});
> +   }
> +
> +   public A api(String uri, String provider) {
> +      return api(uri, provider, new Properties());
> +   }
> +
> +   private final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(sameThreadExecutor(),
> +         sameThreadExecutor()));
> +
> +   public MockWebServer mockSwiftServer() throws IOException {

Any reason this and `getURLReplacingQueueDispatcher` are not `static`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177/files#r6932800

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by Everett Toews <no...@github.com>.
Trying to trigger a CloudBees build.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177#issuecomment-26177306

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by Adrian Cole <no...@github.com>.
> +      return ContextBuilder.newBuilder(provider)
> +            .credentials("jclouds:joe", "letmein")
> +            .endpoint(uri)
> +            .overrides(overrides)
> +            .modules(modules)
> +            .buildApi(new TypeToken<A>(getClass()) {});
> +   }
> +
> +   public A api(String uri, String provider) {
> +      return api(uri, provider, new Properties());
> +   }
> +
> +   private final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(sameThreadExecutor(),
> +         sameThreadExecutor()));
> +
> +   public MockWebServer mockSwiftServer() throws IOException {

Probably mockSwiftServer isnt a good name. mockOpenStack

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177/files#r6934792

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by Andrew Phillips <no...@github.com>.
Couple of questions, but nothing important. +1 - looks good to me!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177#issuecomment-26206209

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #299](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/299/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177#issuecomment-26178420

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by Andrew Phillips <no...@github.com>.
> +import java.io.IOException;
> +import java.net.URL;
> +import java.util.Properties;
> +import java.util.Set;
> +import java.util.concurrent.BlockingQueue;
> +import java.util.concurrent.LinkedBlockingQueue;
> +
> +import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
> +import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
> +
> +/**
> + * @author Jeremy Daggett
> + */
> +public class BaseOpenStackMockTest<A extends Closeable> {
> +
> +   public static String access = "{\"access\":{\"token\":{\"id\":\"b84f4a37-5126-4603-9521-ccd0665fbde1\",\"expires\":\"2013-04-13T16:49:57.000-05:00\",\"tenant\":{\"id\":\"123123\",\"name\":\"123123\"}},\"serviceCatalog\":[{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudMonitoring\",\"type\":\"rax:monitor\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFilesCDN\",\"type\":\"rax:object-cdn\"},{\"endpoints\":[{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudLoadBalancers\",\"type\":\"rax:load-balan
 cer\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDatabases\",\"type\":\"rax:database\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFiles\",\"type\":\"object-store\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\",\"versionInfo\":\"URL/v1.0\",\"versionList\":\"URL/\",\"versionId\":\"1.0\"}],\"name\":\"cloudServers\",\"type\":\"compute\"},{\"
 endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"}],\"name\":\"cloudServersOpenStack\",\"type\":\"compute\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDNS\",\"type\":\"rax:dns\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudBackup\",\"type\":\"rax:backup\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"}],\"name\":\"cloudBlockStorage\",\"type\":\"volume\"}],\"user\":{\"id\":\"1234\",\"roles\":[{\"id\":\"3\",\"description\":\"User Admin Role.\",\"name\":\"identity:user-admin\"}],\"name\":\"jclouds-joe\",
 \"RAX-AUTH:defaultRegion\":\"DFW\"}}}";

Deliberately not `final`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177/files#r6932798

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #761](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/761/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177#issuecomment-26178433

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by Everett Toews <no...@github.com>.
> +import java.io.IOException;
> +import java.net.URL;
> +import java.util.Properties;
> +import java.util.Set;
> +import java.util.concurrent.BlockingQueue;
> +import java.util.concurrent.LinkedBlockingQueue;
> +
> +import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
> +import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
> +
> +/**
> + * @author Jeremy Daggett
> + */
> +public class BaseOpenStackMockTest<A extends Closeable> {
> +
> +   public static String access = "{\"access\":{\"token\":{\"id\":\"b84f4a37-5126-4603-9521-ccd0665fbde1\",\"expires\":\"2013-04-13T16:49:57.000-05:00\",\"tenant\":{\"id\":\"123123\",\"name\":\"123123\"}},\"serviceCatalog\":[{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudMonitoring\",\"type\":\"rax:monitor\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFilesCDN\",\"type\":\"rax:object-cdn\"},{\"endpoints\":[{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudLoadBalancers\",\"type\":\"rax:load-balancer\"},{
 \"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDatabases\",\"type\":\"rax:database\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFiles\",\"type\":\"object-store\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\",\"versionInfo\":\"URL/v1.0\",\"versionList\":\"URL/\",\"versionId\":\"1.0\"}],\"name\":\"cloudServers\",\"type\":\"compute\"},{\"endpoints\":[{\"
 region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"}],\"name\":\"cloudServersOpenStack\",\"type\":\"compute\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDNS\",\"type\":\"rax:dns\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudBackup\",\"type\":\"rax:backup\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"}],\"name\":\"cloudBlockStorage\",\"type\":\"volume\"}],\"user\":{\"id\":\"1234\",\"roles\":[{\"id\":\"3\",\"description\":\"User Admin Role.\",\"name\":\"identity:user-admin\"}],\"name\":\"jclouds-joe\",\"RAX-AUTH:defaultRegion
 \":\"DFW\"}}}";

Made final and renamed in proposed commit https://github.com/rackspace/jclouds/commit/0c53a48df010e0d7f2b4d9cfee4cbd95ccb2b522

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177/files#r6945952

Re: [jclouds] New base class for all OpenStack mock tests. (#177)

Posted by Adrian Cole <no...@github.com>.
> +import java.io.IOException;
> +import java.net.URL;
> +import java.util.Properties;
> +import java.util.Set;
> +import java.util.concurrent.BlockingQueue;
> +import java.util.concurrent.LinkedBlockingQueue;
> +
> +import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
> +import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
> +
> +/**
> + * @author Jeremy Daggett
> + */
> +public class BaseOpenStackMockTest<A extends Closeable> {
> +
> +   public static String access = "{\"access\":{\"token\":{\"id\":\"b84f4a37-5126-4603-9521-ccd0665fbde1\",\"expires\":\"2013-04-13T16:49:57.000-05:00\",\"tenant\":{\"id\":\"123123\",\"name\":\"123123\"}},\"serviceCatalog\":[{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudMonitoring\",\"type\":\"rax:monitor\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFilesCDN\",\"type\":\"rax:object-cdn\"},{\"endpoints\":[{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudLoadBalancers\",\"type\":\"rax:load-balan
 cer\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDatabases\",\"type\":\"rax:database\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFiles\",\"type\":\"object-store\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\",\"versionInfo\":\"URL/v1.0\",\"versionList\":\"URL/\",\"versionId\":\"1.0\"}],\"name\":\"cloudServers\",\"type\":\"compute\"},{\"
 endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"}],\"name\":\"cloudServersOpenStack\",\"type\":\"compute\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDNS\",\"type\":\"rax:dns\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudBackup\",\"type\":\"rax:backup\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"}],\"name\":\"cloudBlockStorage\",\"type\":\"volume\"}],\"user\":{\"id\":\"1234\",\"roles\":[{\"id\":\"3\",\"description\":\"User Admin Role.\",\"name\":\"identity:user-admin\"}],\"name\":\"jclouds-joe\",
 \"RAX-AUTH:defaultRegion\":\"DFW\"}}}";

these are different in ways that break things between rax and hpcs.  Make 2? accessRAX and accessHPCS?  cc @andrewgaul 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/177/files#r6934797