http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java
 
b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java
new file mode 100644
index 0000000..0f0ca70
--- /dev/null
+++ 
b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.v3.parsers;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseFirstJsonValueNamed;
+import org.jclouds.json.internal.GsonWrapper;
+import org.jclouds.openstack.keystone.v3.domain.Token;
+
+import com.google.common.base.Function;
+import com.google.inject.Inject;
+import com.google.inject.TypeLiteral;
+
+@Singleton
+public class ParseTokenFromHttpResponse implements Function<HttpResponse, 
Token> {
+   private final ParseFirstJsonValueNamed<Token> parser;
+
+   @Inject
+   ParseTokenFromHttpResponse(GsonWrapper gsonView) {
+      this.parser = new ParseFirstJsonValueNamed<Token>(gsonView, 
TypeLiteral.get(Token.class), "token");
+   }
+
+   public Token apply(HttpResponse response) {
+      checkNotNull(response, "response");
+      Token toParse = parser.apply(response);
+      checkNotNull(toParse, "parsed result from %s", response);
+      String xSubjectToken = response.getFirstHeaderOrNull("X-Subject-Token");
+      return toParse.toBuilder().id(xSubjectToken).build();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/config/InternalUrlModule.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/config/InternalUrlModule.java
 
b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/config/InternalUrlModule.java
deleted file mode 100644
index 71b36cb..0000000
--- 
a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/config/InternalUrlModule.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.v2_0.config;
-
-import org.jclouds.openstack.keystone.v2_0.functions.EndpointToSupplierURI;
-import org.jclouds.openstack.keystone.v2_0.functions.InternalURL;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Singleton;
-
-/**
- * Guice module to configure JClouds in order to use the internal urls to
- * communicate with the services.
- */
-@Singleton
-public class InternalUrlModule extends AbstractModule {
-   @Override
-   protected void configure() {
-      bind(EndpointToSupplierURI.class).to(InternalURL.class);
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionApi.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionApi.java
 
b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionApi.java
index 633b327..466bcc9 100644
--- 
a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionApi.java
+++ 
b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/features/ExtensionApi.java
@@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType;
 import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
 import org.jclouds.Fallbacks.NullOnNotFoundOr404;
 import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
 import org.jclouds.openstack.v2_0.domain.Extension;
 import org.jclouds.rest.annotations.Fallback;
 import org.jclouds.rest.annotations.RequestFilters;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/reference/AuthHeaders.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/reference/AuthHeaders.java
 
b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/reference/AuthHeaders.java
deleted file mode 100644
index 88ea817..0000000
--- 
a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/reference/AuthHeaders.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.v2_0.reference;
-
-public final class AuthHeaders {
-
-   public static final String AUTH_USER = "X-Auth-User";
-   public static final String AUTH_KEY = "X-Auth-Key";
-   public static final String AUTH_TOKEN = "X-Auth-Token";
-
-   private AuthHeaders() {
-      throw new AssertionError("intentionally unimplemented");
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/config/CredentialTypesTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/config/CredentialTypesTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/config/CredentialTypesTest.java
new file mode 100644
index 0000000..93af93c
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/config/CredentialTypesTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.auth.config;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.openstack.keystone.auth.domain.PasswordCredentials;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+@Test(groups = "unit", testName = "CredentialTypesTest")
+public class CredentialTypesTest {
+
+   public void testCredentialTypeOfWhenValid() {
+      assertEquals(
+            
CredentialTypes.credentialTypeOf(PasswordCredentials.builder().username("username").password("password")
+                  .build()), CredentialTypes.PASSWORD_CREDENTIALS);
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testCredentialTypeOfWithoutAnnotation() {
+      CredentialTypes.credentialTypeOf("");
+   }
+
+   public void testIndexByCredentialTypeWhenValid() {
+      assertEquals(
+            CredentialTypes.indexByCredentialType(
+                  
ImmutableSet.of(PasswordCredentials.builder().username("username").password("password").build()))
+                  .keySet(), 
ImmutableSet.of(CredentialTypes.PASSWORD_CREDENTIALS));
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testIndexByCredentialTypeWithoutAnnotation() {
+      CredentialTypes.indexByCredentialType(ImmutableSet.of(""));
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/config/ProviderModuleExpectTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/config/ProviderModuleExpectTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/config/ProviderModuleExpectTest.java
new file mode 100644
index 0000000..a11c7de
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/config/ProviderModuleExpectTest.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.auth.config;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static 
org.jclouds.openstack.keystone.config.KeystoneProperties.CREDENTIAL_TYPE;
+import static 
org.jclouds.openstack.keystone.config.KeystoneProperties.KEYSTONE_VERSION;
+import static 
org.jclouds.openstack.keystone.config.KeystoneProperties.SERVICE_TYPE;
+import static org.jclouds.util.Suppliers2.getLastValueInMap;
+import static org.testng.Assert.assertTrue;
+
+import java.io.Closeable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.net.URI;
+import java.util.Properties;
+
+import javax.inject.Qualifier;
+import javax.inject.Singleton;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.json.config.GsonModule.DateAdapter;
+import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
+import org.jclouds.location.suppliers.RegionIdToURISupplier;
+import org.jclouds.openstack.keystone.catalog.config.ServiceCatalogModule;
+import 
org.jclouds.openstack.keystone.catalog.config.ServiceCatalogModule.ProviderModule;
+import 
org.jclouds.openstack.keystone.catalog.config.ServiceCatalogModule.RegionModule;
+import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
+import 
org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestApiExpectTest;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.config.HttpApiModule;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+import com.google.inject.Provides;
+
+/**
+ * Tests configuration via {@link ProviderModule}
+ */
+@Test(groups = "unit", testName = "ProviderModuleExpectTest")
+public class ProviderModuleExpectTest extends 
BaseRestApiExpectTest<ProviderModuleExpectTest.DNSApi> {
+
+   @Retention(RUNTIME)
+   @Target(METHOD)
+   @Qualifier
+   static @interface DNS {
+   }
+
+   @ConfiguresHttpApi
+   public static class DNSHttpApiModule extends HttpApiModule<DNSApi> {
+
+      @Override
+      public void configure() {
+         bind(DateAdapter.class).to(Iso8601DateAdapter.class);
+         super.configure();
+      }
+
+      @Provides
+      @Singleton
+      @DNS
+      protected final Supplier<URI> 
provideCDNUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String 
apiVersion) {
+         return getLastValueInMap(factory.createForApiTypeAndVersion("dns", 
apiVersion));
+      }
+   }
+
+   @org.jclouds.rest.annotations.Endpoint(DNS.class)
+   interface DNSApi extends Closeable {
+      @HEAD
+      @Path("/zones/{zoneName}")
+      @Fallback(FalseOnNotFoundOr404.class)
+      boolean zoneExists(@PathParam("zoneName") String zoneName);
+   }
+
+   public void testDNSEndpointApplied() {
+      KeystoneAuth keystoneAuth = new KeystoneAuth();
+
+      DNSApi api = requestsSendResponses(
+            keystoneAuth.getKeystoneAuthWithUsernameAndPassword(),
+            keystoneAuth.getResponseWithKeystoneAccess(),
+            
HttpRequest.builder().method("HEAD").endpoint("http://172.16.0.1:8776/v1/3456/zones/foo.com";).build(),
+            HttpResponse.builder().statusCode(200).build());
+      assertTrue(api.zoneExists("foo.com"));
+   }
+
+   private static class DNSApiMetadata extends BaseHttpApiMetadata<DNSApi> {
+
+      @Override
+      public Builder toBuilder() {
+         return new Builder().fromApiMetadata(this);
+      }
+
+      public DNSApiMetadata() {
+         this(new Builder());
+      }
+
+      protected DNSApiMetadata(Builder builder) {
+         super(builder);
+      }
+
+      public static Properties defaultProperties() {
+         Properties properties = BaseHttpApiMetadata.defaultProperties();
+         properties.setProperty(SERVICE_TYPE, "dns");
+         properties.setProperty(KEYSTONE_VERSION, "2");
+         properties.setProperty(CREDENTIAL_TYPE, 
CredentialTypes.PASSWORD_CREDENTIALS);
+         return properties;
+      }
+
+      public static class Builder extends BaseHttpApiMetadata.Builder<DNSApi, 
Builder> {
+
+         protected Builder() {
+            id("dns")
+            .name("DNS API")
+            .identityName("${tenantName}:${userName} or ${userName}, if your 
keystone supports a default tenant")
+            .credentialName("${password}")
+            .endpointName("Keystone base url ending in /v2.0/")
+            .documentation(URI.create("http://dns";))
+            .version("1.0")
+            .defaultEndpoint("http://localhost:5000/v2.0/";)
+            .defaultProperties(DNSApiMetadata.defaultProperties())
+            .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
+                                        .add(AuthenticationModule.class)
+                                        .add(ServiceCatalogModule.class)
+                                        .add(RegionModule.class)
+                                        .add(DNSHttpApiModule.class).build());
+         }
+
+         @Override
+         public DNSApiMetadata build() {
+            return new DNSApiMetadata(this);
+         }
+
+         @Override
+         protected Builder self() {
+            return this;
+         }
+      }
+   }
+
+   @Override
+   public ApiMetadata createApiMetadata() {
+      return new DNSApiMetadata();
+   }
+   
+   public static class KeystoneAuth extends 
BaseKeystoneRestApiExpectTest<KeystoneApi> {
+      public HttpRequest getKeystoneAuthWithUsernameAndPassword() {
+         return keystoneAuthWithUsernameAndPassword;
+      }
+      
+      public HttpResponse getResponseWithKeystoneAccess() {
+         return responseWithKeystoneAccess;
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/handlers/RetryOnRenewTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/handlers/RetryOnRenewTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/handlers/RetryOnRenewTest.java
new file mode 100644
index 0000000..01611ff
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/handlers/RetryOnRenewTest.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.auth.handlers;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.domain.Credentials;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
+import org.jclouds.io.Payloads;
+import org.jclouds.openstack.keystone.auth.domain.AuthInfo;
+import org.testng.annotations.Test;
+
+import com.google.common.cache.LoadingCache;
+
+/**
+ * Tests behavior of {@code RetryOnRenew} handler
+ */
+@Test(groups = "unit", testName = "RetryOnRenewTest")
+public class RetryOnRenewTest {
+   @Test
+   public void test401ShouldRetry() {
+      HttpCommand command = createMock(HttpCommand.class);
+      HttpRequest request = createMock(HttpRequest.class);
+      HttpResponse response = createMock(HttpResponse.class);
+      @SuppressWarnings("unchecked")
+      LoadingCache<Credentials, AuthInfo> cache = 
createMock(LoadingCache.class);
+      BackoffLimitedRetryHandler backoffHandler = 
createMock(BackoffLimitedRetryHandler.class);
+
+      expect(command.getCurrentRequest()).andReturn(request);
+
+      cache.invalidateAll();
+      expectLastCall();
+
+      
expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes();
+      expect(response.getStatusCode()).andReturn(401).atLeastOnce();
+
+      replay(command);
+      replay(response);
+      replay(cache);
+      replay(backoffHandler);
+
+      RetryOnRenew retry = new RetryOnRenew(cache, backoffHandler);
+
+      assertTrue(retry.shouldRetryRequest(command, response));
+
+      verify(command);
+      verify(response);
+      verify(cache);
+   }
+
+   @Test
+   public void test401ShouldRetry4Times() {
+      HttpCommand command = createMock(HttpCommand.class);
+      HttpRequest request = createMock(HttpRequest.class);
+      HttpResponse response = createMock(HttpResponse.class);
+
+      @SuppressWarnings("unchecked")
+      LoadingCache<Credentials, AuthInfo> cache = 
createMock(LoadingCache.class);
+      BackoffLimitedRetryHandler backoffHandler = 
createMock(BackoffLimitedRetryHandler.class);
+
+      expect(command.getCurrentRequest()).andReturn(request).anyTimes();
+      expect(request.getHeaders()).andStubReturn(null);
+
+      cache.invalidateAll();
+      expectLastCall().anyTimes();
+
+      
expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes();
+      expect(response.getStatusCode()).andReturn(401).anyTimes();
+
+      replay(command, request, response, cache);
+
+      RetryOnRenew retry = new RetryOnRenew(cache, backoffHandler);
+
+      for (int i = 0; i < RetryOnRenew.NUM_RETRIES - 1; ++i) {
+         assertTrue(retry.shouldRetryRequest(command, response), "Expected 
retry to succeed");
+      }
+
+      assertFalse(retry.shouldRetryRequest(command, response), "Expected retry 
to fail on attempt " + RetryOnRenew.NUM_RETRIES);
+
+      verify(command, response, cache);
+   }
+
+   @Test
+   public void test408ShouldRetry() {
+      HttpCommand command = createMock(HttpCommand.class);
+      HttpResponse response = createMock(HttpResponse.class);
+      @SuppressWarnings("unchecked")
+      LoadingCache<Credentials, AuthInfo> cache = 
createMock(LoadingCache.class);
+      BackoffLimitedRetryHandler backoffHandler = 
createMock(BackoffLimitedRetryHandler.class);
+
+      expect(backoffHandler.shouldRetryRequest(command, 
response)).andReturn(true).once();
+      expect(response.getStatusCode()).andReturn(408).once();
+
+      replay(command);
+      replay(response);
+      replay(cache);
+      replay(backoffHandler);
+
+      RetryOnRenew retry = new RetryOnRenew(cache, backoffHandler);
+
+      assertTrue(retry.shouldRetryRequest(command, response));
+
+      verify(command);
+      verify(response);
+      verify(cache);
+      verify(backoffHandler);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/LocationIdToURIFromAccessForTypeAndVersionTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/LocationIdToURIFromAccessForTypeAndVersionTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/LocationIdToURIFromAccessForTypeAndVersionTest.java
new file mode 100644
index 0000000..0b1c890
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/LocationIdToURIFromAccessForTypeAndVersionTest.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.auth.suppliers;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Singleton;
+
+import org.jclouds.location.Provider;
+import org.jclouds.openstack.keystone.auth.domain.AuthInfo;
+import org.jclouds.openstack.keystone.catalog.ServiceEndpoint;
+import 
org.jclouds.openstack.keystone.catalog.suppliers.LocationIdToURIFromServiceEndpointsForTypeAndVersion;
+import org.jclouds.openstack.keystone.v2_0.catalog.V2ServiceCatalog;
+import org.jclouds.openstack.keystone.v2_0.parse.ParseAccessTest;
+import org.jclouds.openstack.keystone.v2_0.parse.ParseRackspaceAccessTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+
+@Test(groups = "unit", testName = 
"LocationIdToURIFromAccessForTypeAndVersionTest")
+public class LocationIdToURIFromAccessForTypeAndVersionTest {
+   private final LocationIdToURIFromServiceEndpointsForTypeAndVersion.Factory 
factory = Guice.createInjector(
+         new AbstractModule() {
+
+            @Override
+            protected void configure() {
+               
bindConstant().annotatedWith(Provider.class).to("openstack-keystone");
+               bind(new TypeLiteral<Supplier<URI>>() {
+               
}).annotatedWith(Provider.class).toInstance(Suppliers.ofInstance(URI.create("https://identity";)));
+               install(new 
FactoryModuleBuilder().implement(LocationIdToURIFromServiceEndpointsForTypeAndVersion.class,
+                     
LocationIdToURIFromServiceEndpointsForTypeAndVersion.class).build(
+                     
LocationIdToURIFromServiceEndpointsForTypeAndVersion.Factory.class));
+               // We test against a 2.0 service catalog but it is OK for the 
purpose of this test
+               bind(new TypeLiteral<Supplier<List<ServiceEndpoint>>>() {
+               }).to(V2ServiceCatalog.class).in(Scopes.SINGLETON);
+            }
+
+            @Provides
+            @Singleton
+            public Supplier<AuthInfo> provide() {
+               return Suppliers.<AuthInfo> ofInstance(new 
ParseAccessTest().expected());
+            }
+
+         
}).getInstance(LocationIdToURIFromServiceEndpointsForTypeAndVersion.Factory.class);
+
+   public void testRegionUnmatchesOkWhenNoVersionIdSet() {
+      assertEquals(
+            Maps.transformValues(factory.createForApiTypeAndVersion("compute", 
"2").get(),
+                  Suppliers.<URI> supplierFunction()),
+            ImmutableMap.of("az-1.region-a.geo-1",
+                  
URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";), 
"az-2.region-a.geo-1",
+                  
URI.create("https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";), 
"az-3.region-a.geo-1",
+                  
URI.create("https://az-3.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";)));
+   }
+
+   public void testRegionMatches() {
+      assertEquals(
+            Maps.transformValues(factory.createForApiTypeAndVersion("compute", 
"2").get(),
+                  Suppliers.<URI> supplierFunction()),
+            ImmutableMap.of("az-1.region-a.geo-1",
+                  
URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";), 
"az-2.region-a.geo-1",
+                  
URI.create("https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";), 
"az-3.region-a.geo-1",
+                  
URI.create("https://az-3.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";)));
+   }
+
+   private final LocationIdToURIFromServiceEndpointsForTypeAndVersion.Factory 
raxFactory = Guice.createInjector(
+         new AbstractModule() {
+
+            @Override
+            protected void configure() {
+               bindConstant().annotatedWith(Provider.class).to("rackspace");
+               bind(new TypeLiteral<Supplier<URI>>() {
+               
}).annotatedWith(Provider.class).toInstance(Suppliers.ofInstance(URI.create("https://identity";)));
+               install(new 
FactoryModuleBuilder().implement(LocationIdToURIFromServiceEndpointsForTypeAndVersion.class,
+                     
LocationIdToURIFromServiceEndpointsForTypeAndVersion.class).build(
+                     
LocationIdToURIFromServiceEndpointsForTypeAndVersion.Factory.class));
+               // We test against a 2.0 service catalog but it is OK for the 
purpose of this test
+               bind(new TypeLiteral<Supplier<List<ServiceEndpoint>>>() {
+               }).to(V2ServiceCatalog.class).in(Scopes.SINGLETON);
+            }
+
+            @Provides
+            @Singleton
+            public Supplier<AuthInfo> provide() {
+               return Suppliers.<AuthInfo> ofInstance(new 
ParseRackspaceAccessTest().expected());
+            }
+         
}).getInstance(LocationIdToURIFromServiceEndpointsForTypeAndVersion.Factory.class);
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testWhenNotInList() {
+      assertEquals(
+            Maps.transformValues(raxFactory.createForApiTypeAndVersion("goo", 
"1.0").get(),
+                  Suppliers.<URI> supplierFunction()),
+            ImmutableMap.of("rackspace", 
URI.create("https://servers.api.rackspacecloud.com/v1.0/40806637803162";)));
+   }
+
+   public void testProviderWhenNoRegions() {
+      Map<String, URI> withNoRegions = 
Maps.transformValues(raxFactory.createForApiTypeAndVersion("compute", "1.0")
+            .get(), Suppliers.<URI> supplierFunction());
+      assertEquals(withNoRegions,
+            ImmutableMap.of("rackspace", 
URI.create("https://servers.api.rackspacecloud.com/v1.0/40806637803162";)));
+   }
+
+   public void testOkWithNoVersions() {
+      
assertEquals(Maps.transformValues(raxFactory.createForApiTypeAndVersion("rax:database",
 null).get(),
+            Suppliers.<URI> supplierFunction()), ImmutableMap.of("DFW",
+            
URI.create("https://dfw.databases.api.rackspacecloud.com/v1.0/40806637803162";), 
"ORD",
+            
URI.create("https://ord.databases.api.rackspacecloud.com/v1.0/40806637803162";)));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersionTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersionTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersionTest.java
new file mode 100644
index 0000000..3a632e2
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersionTest.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.auth.suppliers;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Singleton;
+
+import org.jclouds.location.Provider;
+import org.jclouds.openstack.keystone.auth.domain.AuthInfo;
+import org.jclouds.openstack.keystone.catalog.ServiceEndpoint;
+import 
org.jclouds.openstack.keystone.catalog.suppliers.RegionIdToAdminURIFromServiceEndpointsForTypeAndVersion;
+import 
org.jclouds.openstack.keystone.catalog.suppliers.RegionIdToAdminURISupplier;
+import org.jclouds.openstack.keystone.v2_0.catalog.V2ServiceCatalog;
+import org.jclouds.openstack.keystone.v2_0.parse.ParseAccessTest;
+import org.jclouds.openstack.keystone.v2_0.parse.ParseRackspaceAccessTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+
+@Test(groups = "unit", testName = 
"RegionIdToAdminURIFromAccessForTypeAndVersionTest")
+public class RegionIdToAdminURIFromAccessForTypeAndVersionTest {
+   private final RegionIdToAdminURISupplier.Factory factory = 
Guice.createInjector(new AbstractModule() {
+
+      @Override
+      protected void configure() {
+         bindConstant().annotatedWith(Provider.class).to("openstack-keystone");
+         bind(new TypeLiteral<Supplier<URI>>() {
+         
}).annotatedWith(Provider.class).toInstance(Suppliers.ofInstance(URI.create("https://identity";)));
+         install(new 
FactoryModuleBuilder().implement(RegionIdToAdminURISupplier.class,
+                  
RegionIdToAdminURIFromServiceEndpointsForTypeAndVersion.class).build(RegionIdToAdminURISupplier.Factory.class));
+         // We test against a 2.0 service catalog but it is OK for the purpose 
of this test
+         bind(new TypeLiteral<Supplier<List<ServiceEndpoint>>>() {
+         }).to(V2ServiceCatalog.class).in(Scopes.SINGLETON);
+      }
+
+      @Provides
+      @Singleton
+      public Supplier<AuthInfo> provide() {
+         return Suppliers.<AuthInfo> ofInstance(new 
ParseAccessTest().expected());
+      }
+   }).getInstance(RegionIdToAdminURISupplier.Factory.class);
+
+   public void testRegionMatches() {
+      
assertEquals(Maps.transformValues(factory.createForApiTypeAndVersion("identity",
 "2.0").get(), Suppliers
+               .<URI> supplierFunction()), ImmutableMap.of("region-a.geo-1", 
URI.create("https://csnode.jclouds.org:35357/v2.0/";)));
+      Map<String, URI> map = Maps.newLinkedHashMap();
+      map.put("region-a.geo-1", null);
+      map.put("region-b.geo-1", null);
+      map.put("region-c.geo-1", null);
+      
assertEquals(Maps.transformValues(factory.createForApiTypeAndVersion("compute", 
"2").get(), Suppliers
+               .<URI> supplierFunction()), map);
+   }
+   
+   private final RegionIdToAdminURISupplier.Factory raxFactory = 
Guice.createInjector(new AbstractModule() {
+
+      @Override
+      protected void configure() {
+         bindConstant().annotatedWith(Provider.class).to("rackspace");
+         bind(new TypeLiteral<Supplier<URI>>() {
+         
}).annotatedWith(Provider.class).toInstance(Suppliers.ofInstance(URI.create("https://identity";)));
+         install(new 
FactoryModuleBuilder().implement(RegionIdToAdminURISupplier.class,
+                  
RegionIdToAdminURIFromServiceEndpointsForTypeAndVersion.class).build(RegionIdToAdminURISupplier.Factory.class));
+         // We test against a 2.0 service catalog but it is OK for the purpose 
of this test
+         bind(new TypeLiteral<Supplier<List<ServiceEndpoint>>>() {
+         }).to(V2ServiceCatalog.class).in(Scopes.SINGLETON);
+      }
+
+      @Provides
+      @Singleton
+      public Supplier<AuthInfo> provide() {
+         return Suppliers.<AuthInfo> ofInstance(new 
ParseRackspaceAccessTest().expected());
+      }
+   }).getInstance(RegionIdToAdminURISupplier.Factory.class);
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testWhenNotInList() {
+      
assertEquals(Maps.transformValues(raxFactory.createForApiTypeAndVersion("goo", 
"1.0").get(), Suppliers
+               .<URI> supplierFunction()), ImmutableMap.of("rackspace", URI
+               
.create("https://servers.api.rackspacecloud.com/v1.0/40806637803162";)));
+   }
+   
+   public void testProviderWhenNoRegions() {
+      Map<String, URI> map = Maps.newLinkedHashMap();
+      map.put("rackspace", null);
+      
assertEquals(Maps.transformValues(raxFactory.createForApiTypeAndVersion("compute",
 "1.0").get(), Suppliers
+               .<URI> supplierFunction()), map);
+   }
+   
+   public void testOkWithNoVersions() {
+      Map<String, URI> map = Maps.newLinkedHashMap();
+      map.put("DFW", null);
+      map.put("ORD", null);
+      
assertEquals(Maps.transformValues(raxFactory.createForApiTypeAndVersion("rax:database",
 null).get(), Suppliers
+               .<URI> supplierFunction()), map);
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/RegionIdToURIFromAccessForTypeAndVersionTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/RegionIdToURIFromAccessForTypeAndVersionTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/RegionIdToURIFromAccessForTypeAndVersionTest.java
new file mode 100644
index 0000000..65b820d
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/auth/suppliers/RegionIdToURIFromAccessForTypeAndVersionTest.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.auth.suppliers;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import javax.inject.Singleton;
+
+import org.jclouds.location.Provider;
+import org.jclouds.location.suppliers.RegionIdToURISupplier;
+import org.jclouds.openstack.keystone.auth.domain.AuthInfo;
+import org.jclouds.openstack.keystone.catalog.ServiceEndpoint;
+import 
org.jclouds.openstack.keystone.catalog.suppliers.RegionIdToURIFromServiceEndpointsForTypeAndVersion;
+import org.jclouds.openstack.keystone.v2_0.catalog.V2ServiceCatalog;
+import org.jclouds.openstack.keystone.v2_0.parse.ParseAccessTest;
+import org.jclouds.openstack.keystone.v2_0.parse.ParseRackspaceAccessTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+
+@Test(groups = "unit", testName = 
"RegionIdToURIFromAccessForTypeAndVersionTest")
+public class RegionIdToURIFromAccessForTypeAndVersionTest {
+   private final RegionIdToURISupplier.Factory factory = 
Guice.createInjector(new AbstractModule() {
+
+      @Override
+      protected void configure() {
+         bindConstant().annotatedWith(Provider.class).to("openstack-keystone");
+         bind(new TypeLiteral<Supplier<URI>>() {
+         
}).annotatedWith(Provider.class).toInstance(Suppliers.ofInstance(URI.create("https://identity";)));
+         install(new 
FactoryModuleBuilder().implement(RegionIdToURISupplier.class,
+                  
RegionIdToURIFromServiceEndpointsForTypeAndVersion.class).build(
+                  RegionIdToURISupplier.Factory.class));
+         // We test against a 2.0 service catalog but it is OK for the purpose 
of this test
+         bind(new TypeLiteral<Supplier<List<ServiceEndpoint>>>() {
+         }).to(V2ServiceCatalog.class).in(Scopes.SINGLETON);
+      }
+
+      @Provides
+      @Singleton
+      public Supplier<AuthInfo> provide() {
+         return Suppliers.<AuthInfo> ofInstance(new 
ParseAccessTest().expected());
+      }
+   }).getInstance(RegionIdToURISupplier.Factory.class);
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testRegionUnmatches() {
+      Maps.transformValues(factory.createForApiTypeAndVersion("compute", 
"1.0").get(),
+               Suppliers.<URI> supplierFunction());
+   }
+   
+   public void testRegionMatches() {
+      
assertEquals(Maps.transformValues(factory.createForApiTypeAndVersion("compute", 
"2").get(), Suppliers
+               .<URI> supplierFunction()), 
ImmutableMap.of("az-1.region-a.geo-1", URI
+               
.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";), 
"az-2.region-a.geo-1", URI
+               
.create("https://az-2.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";), 
"az-3.region-a.geo-1", URI
+               
.create("https://az-3.region-a.geo-1.compute.hpcloudsvc.com/v2/3456";)));
+   }
+
+   private final RegionIdToURISupplier.Factory raxFactory = 
Guice.createInjector(new AbstractModule() {
+
+      @Override
+      protected void configure() {
+         bindConstant().annotatedWith(Provider.class).to("rackspace");
+         bind(new TypeLiteral<Supplier<URI>>() {
+         
}).annotatedWith(Provider.class).toInstance(Suppliers.ofInstance(URI.create("https://identity";)));
+         install(new 
FactoryModuleBuilder().implement(RegionIdToURISupplier.class,
+                  
RegionIdToURIFromServiceEndpointsForTypeAndVersion.class).build(
+                  RegionIdToURISupplier.Factory.class));
+         // We test against a 2.0 service catalog but it is OK for the purpose 
of this test
+         bind(new TypeLiteral<Supplier<List<ServiceEndpoint>>>() {
+         }).to(V2ServiceCatalog.class).in(Scopes.SINGLETON);
+      }
+
+      @Provides
+      @Singleton
+      public Supplier<AuthInfo> provide() {
+         return Suppliers.<AuthInfo> ofInstance(new 
ParseRackspaceAccessTest().expected());
+      }
+   }).getInstance(RegionIdToURISupplier.Factory.class);
+
+   @Test(expectedExceptions = NoSuchElementException.class)
+   public void testWhenNotInList() {
+      
assertEquals(Maps.transformValues(raxFactory.createForApiTypeAndVersion("goo", 
"1.0").get(), Suppliers
+               .<URI> supplierFunction()), ImmutableMap.of("rackspace", URI
+               
.create("https://servers.api.rackspacecloud.com/v1.0/40806637803162";)));
+   }
+
+   public void testProviderWhenNoRegions() {
+      
assertEquals(Maps.transformValues(raxFactory.createForApiTypeAndVersion("compute",
 "1.0").get(), Suppliers
+               .<URI> supplierFunction()), ImmutableMap.of("rackspace", URI
+               
.create("https://servers.api.rackspacecloud.com/v1.0/40806637803162";)));
+   }
+
+   public void testOkWithNoVersions() {
+      
assertEquals(Maps.transformValues(raxFactory.createForApiTypeAndVersion("rax:database",
 null).get(), Suppliers
+               .<URI> supplierFunction()), ImmutableMap.of("DFW", URI
+               
.create("https://dfw.databases.api.rackspacecloud.com/v1.0/40806637803162";), 
"ORD", URI
+               
.create("https://ord.databases.api.rackspacecloud.com/v1.0/40806637803162";)));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/AdminURLTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/AdminURLTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/AdminURLTest.java
new file mode 100644
index 0000000..ed5280e
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/AdminURLTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.catalog.functions;
+
+import static 
org.jclouds.openstack.keystone.catalog.ServiceEndpoint.Interface.ADMIN;
+import static 
org.jclouds.openstack.keystone.catalog.ServiceEndpoint.Interface.PUBLIC;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Collections;
+
+import org.jclouds.openstack.keystone.catalog.ServiceEndpoint;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "AdminURLTest")
+public class AdminURLTest {
+   private final AdminURL fn = new AdminURL();
+
+   public void testAdminURL() {
+      assertEquals(
+            fn.apply(
+                  Collections.singletonList(ServiceEndpoint
+                        .builder()
+                        .type("cdn")
+                        .regionId("LON")
+                        .version("1.0")
+                        .url(URI
+                              
.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";))
+                        .iface(ADMIN).build())).get(),
+            
URI.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";));
+   }
+
+   public void testReturnsNullIfNotAdminURI() {
+      assertEquals(
+            fn.apply(
+                  
Collections.singletonList(ServiceEndpoint.builder().type("cdn").regionId("LON").version("1.0")
+                        
.url(URI.create("https://192.168.1.1";)).iface(PUBLIC).build())).get(), null);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/InternalURLTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/InternalURLTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/InternalURLTest.java
new file mode 100644
index 0000000..fec5dd8
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/InternalURLTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.catalog.functions;
+
+import static 
org.jclouds.openstack.keystone.catalog.ServiceEndpoint.Interface.INTERNAL;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Collections;
+
+import org.jclouds.openstack.keystone.catalog.ServiceEndpoint;
+import org.testng.annotations.Test;
+
+/**
+ */
+@Test(groups = "unit", testName = "InternalURLTest")
+public class InternalURLTest {
+   private final InternalURL fn = new InternalURL();
+
+   public void testInternalURL() {
+      assertEquals(
+            
fn.apply(Collections.singletonList(ServiceEndpoint.builder().type("cdn").regionId("regionOne")
+                  .version("2.0")
+                  
.url(URI.create("https://ericsson.com/v2/1900e98b-7272-4cbd-8e95-0b8c2a9266c0";))
+                  .iface(INTERNAL).build())).get(),
+            
URI.create("https://ericsson.com/v2/1900e98b-7272-4cbd-8e95-0b8c2a9266c0";));
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/PublicURLOrInternalTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/PublicURLOrInternalTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/PublicURLOrInternalTest.java
new file mode 100644
index 0000000..477236b
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/PublicURLOrInternalTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.catalog.functions;
+
+import static 
org.jclouds.openstack.keystone.catalog.ServiceEndpoint.Interface.INTERNAL;
+import static 
org.jclouds.openstack.keystone.catalog.ServiceEndpoint.Interface.PUBLIC;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Collections;
+
+import org.jclouds.openstack.keystone.catalog.ServiceEndpoint;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "PublicURLOrInternalTest")
+public class PublicURLOrInternalTest {
+   private final PublicURLOrInternal fn = new PublicURLOrInternal();
+
+   public void testPublicURLNotNullReturnsPublicURL() {
+      assertEquals(
+            fn.apply(
+                  Collections.singletonList(ServiceEndpoint
+                        .builder()
+                        .type("cdn")
+                        .regionId("LON")
+                        .version("1.0")
+                        .url(URI
+                              
.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";))
+                        .iface(PUBLIC).build())).get(),
+            
URI.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";));
+   }
+
+   public void testPublicURLNullReturnsInternalURL() {
+      assertEquals(
+            fn.apply(
+                  
Collections.singletonList(ServiceEndpoint.builder().type("cdn").regionId("LON").version("1.0")
+                        
.url(URI.create("https://192.168.1.1";)).iface(INTERNAL).build())).get(),
+            URI.create("https://192.168.1.1";));
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/ReturnRegionOrProviderTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/ReturnRegionOrProviderTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/ReturnRegionOrProviderTest.java
new file mode 100644
index 0000000..bc25ad3
--- /dev/null
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/catalog/functions/ReturnRegionOrProviderTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.openstack.keystone.catalog.functions;
+
+import static 
org.jclouds.openstack.keystone.catalog.ServiceEndpoint.Interface.PUBLIC;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.openstack.keystone.catalog.ServiceEndpoint;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ReturnRegionOrProviderTest")
+public class ReturnRegionOrProviderTest {
+   private final ReturnRegionOrProvider fn = new 
ReturnRegionOrProvider("openstack-keystone");
+
+   public void testRegionNotNullReturnsRegion() {
+      assertEquals(
+            
fn.apply(ServiceEndpoint.builder().type("cdn").regionId("LON").version("1.0")
+                  
.url(URI.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";))
+                  .iface(PUBLIC).build()), "LON");
+   }
+
+   public void testRegionNullReturnsProvider() {
+      assertEquals(
+            fn.apply(ServiceEndpoint.builder().type("cdn").version("1.0")
+                  
.url(URI.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";))
+                  .iface(PUBLIC).build()), "openstack-keystone");
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/CredentialTypesTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/CredentialTypesTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/CredentialTypesTest.java
deleted file mode 100644
index a609630..0000000
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/CredentialTypesTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.config;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-@Test(groups = "unit", testName = "CredentialTypesTest")
-public class CredentialTypesTest {
-
-   public void testCredentialTypeOfWhenValid() {
-      
assertEquals(CredentialTypes.credentialTypeOf(PasswordCredentials.createWithUsernameAndPassword("username",
-               "password")), CredentialTypes.PASSWORD_CREDENTIALS);
-   }
-
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testCredentialTypeOfWithoutAnnotation() {
-      CredentialTypes.credentialTypeOf("");
-   }
-
-   public void testIndexByCredentialTypeWhenValid() {
-      assertEquals(CredentialTypes.indexByCredentialType(
-               
ImmutableSet.of(PasswordCredentials.createWithUsernameAndPassword("username", 
"password"))).keySet(),
-               ImmutableSet.of(CredentialTypes.PASSWORD_CREDENTIALS));
-   }
-
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testIndexByCredentialTypeWithoutAnnotation() {
-      CredentialTypes.indexByCredentialType(ImmutableSet.of(""));
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/ProviderModuleExpectTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/ProviderModuleExpectTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/ProviderModuleExpectTest.java
deleted file mode 100644
index b40fcbf..0000000
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/ProviderModuleExpectTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.config;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static 
org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
-import static 
org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
-import static org.jclouds.util.Suppliers2.getLastValueInMap;
-import static org.testng.Assert.assertTrue;
-
-import java.io.Closeable;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import java.net.URI;
-import java.util.Properties;
-
-import javax.inject.Qualifier;
-import javax.inject.Singleton;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.apis.ApiMetadata;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
-import org.jclouds.location.suppliers.RegionIdToURISupplier;
-import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
-import 
org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule;
-import 
org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestApiExpectTest;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.annotations.ApiVersion;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.config.HttpApiModule;
-import org.jclouds.rest.internal.BaseHttpApiMetadata;
-import org.jclouds.rest.internal.BaseRestApiExpectTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import com.google.inject.Provides;
-
-/**
- * Tests configuration via {@link ProviderModule}
- */
-@Test(groups = "unit", testName = "ProviderModuleExpectTest")
-public class ProviderModuleExpectTest extends 
BaseRestApiExpectTest<ProviderModuleExpectTest.DNSApi> {
-
-   @Retention(RUNTIME)
-   @Target(METHOD)
-   @Qualifier
-   static @interface DNS {
-   }
-
-   @ConfiguresHttpApi
-   public static class DNSHttpApiModule extends HttpApiModule<DNSApi> {
-
-      @Override
-      public void configure() {
-         bind(DateAdapter.class).to(Iso8601DateAdapter.class);
-         super.configure();
-      }
-
-      @Provides
-      @Singleton
-      @DNS
-      protected final Supplier<URI> 
provideCDNUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String 
apiVersion) {
-         return getLastValueInMap(factory.createForApiTypeAndVersion("dns", 
apiVersion));
-      }
-   }
-
-   @org.jclouds.rest.annotations.Endpoint(DNS.class)
-   interface DNSApi extends Closeable {
-      @HEAD
-      @Path("/zones/{zoneName}")
-      @Fallback(FalseOnNotFoundOr404.class)
-      boolean zoneExists(@PathParam("zoneName") String zoneName);
-   }
-
-   public void testDNSEndpointApplied() {
-      KeystoneAuth keystoneAuth = new KeystoneAuth();
-
-      DNSApi api = requestsSendResponses(
-            keystoneAuth.getKeystoneAuthWithUsernameAndPassword(),
-            keystoneAuth.getResponseWithKeystoneAccess(),
-            
HttpRequest.builder().method("HEAD").endpoint("http://172.16.0.1:8776/v1/3456/zones/foo.com";).build(),
-            HttpResponse.builder().statusCode(200).build());
-      assertTrue(api.zoneExists("foo.com"));
-   }
-
-   private static class DNSApiMetadata extends BaseHttpApiMetadata<DNSApi> {
-
-      @Override
-      public Builder toBuilder() {
-         return new Builder().fromApiMetadata(this);
-      }
-
-      public DNSApiMetadata() {
-         this(new Builder());
-      }
-
-      protected DNSApiMetadata(Builder builder) {
-         super(builder);
-      }
-
-      public static Properties defaultProperties() {
-         Properties properties = BaseHttpApiMetadata.defaultProperties();
-         properties.setProperty(SERVICE_TYPE, "dns");
-         properties.setProperty(CREDENTIAL_TYPE, 
CredentialTypes.PASSWORD_CREDENTIALS);
-         return properties;
-      }
-
-      public static class Builder extends BaseHttpApiMetadata.Builder<DNSApi, 
Builder> {
-
-         protected Builder() {
-            id("dns")
-            .name("DNS API")
-            .identityName("${tenantName}:${userName} or ${userName}, if your 
keystone supports a default tenant")
-            .credentialName("${password}")
-            .endpointName("Keystone base url ending in /v2.0/")
-            .documentation(URI.create("http://dns";))
-            .version("1.0")
-            .defaultEndpoint("http://localhost:5000/v2.0/";)
-            .defaultProperties(DNSApiMetadata.defaultProperties())
-            .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
-                                        .add(AuthenticationApiModule.class)
-                                        
.add(KeystoneAuthenticationModule.class)
-                                        .add(RegionModule.class)
-                                        .add(DNSHttpApiModule.class).build());
-         }
-
-         @Override
-         public DNSApiMetadata build() {
-            return new DNSApiMetadata(this);
-         }
-
-         @Override
-         protected Builder self() {
-            return this;
-         }
-      }
-   }
-
-   @Override
-   public ApiMetadata createApiMetadata() {
-      return new DNSApiMetadata();
-   }
-   
-   public static class KeystoneAuth extends 
BaseKeystoneRestApiExpectTest<KeystoneApi> {
-      public HttpRequest getKeystoneAuthWithUsernameAndPassword() {
-         return keystoneAuthWithUsernameAndPassword;
-      }
-      
-      public HttpResponse getResponseWithKeystoneAccess() {
-         return responseWithKeystoneAccess;
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApiLiveTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApiLiveTest.java
index accdf9b..01b7f8d 100644
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApiLiveTest.java
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApiLiveTest.java
@@ -59,7 +59,7 @@ public class RoleAdminApiLiveTest extends 
BaseKeystoneApiLiveTest {
    protected void tearDown() {
       if (testRole != null) {
          final String roleId = testRole.getId();
-         boolean success = roleAdminOption.get().delete(roleId);
+         assertTrue(roleAdminOption.get().delete(roleId));
          assertTrue(retry(new Predicate<RoleAdminApi>() {
             public boolean apply(RoleAdminApi roleApi) {
                return roleApi.get(roleId) == null;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApiLiveTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApiLiveTest.java
index e999816..a83bed1 100644
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApiLiveTest.java
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApiLiveTest.java
@@ -59,7 +59,7 @@ public class ServiceAdminApiLiveTest extends 
BaseKeystoneApiLiveTest {
    protected void tearDown() {
       if (testService != null) {
          final String serviceId = testService.getId();
-         boolean success = serviceAdminOption.get().delete(serviceId);
+         assertTrue(serviceAdminOption.get().delete(serviceId));
          assertTrue(retry(new Predicate<ServiceAdminApi>() {
             public boolean apply(ServiceAdminApi serviceApi) {
                return serviceApi.get(serviceId) == null;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApiLiveTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApiLiveTest.java
index b679579..cc7f8eb 100644
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApiLiveTest.java
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApiLiveTest.java
@@ -61,7 +61,7 @@ public class TenantAdminApiLiveTest extends 
BaseKeystoneApiLiveTest {
    protected void tearDown() {
       if (testTenant != null) {
          final String tenantId = testTenant.getId();
-         boolean success = tenantAdminOption.get().delete(tenantId);
+         assertTrue(tenantAdminOption.get().delete(tenantId));
          assertTrue(retry(new Predicate<TenantApi>() {
             public boolean apply(TenantApi tenantApi) {
                return tenantApi.get(tenantId) == null;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiLiveTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiLiveTest.java
index 152cc92..3859bdf 100644
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiLiveTest.java
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApiLiveTest.java
@@ -60,7 +60,7 @@ public class UserAdminApiLiveTest extends 
BaseKeystoneApiLiveTest {
    protected void tearDown() {
       if (testUser != null) {
          final String userId = testUser.getId();
-         boolean success = userAdminOption.get().delete(userId);
+         assertTrue(userAdminOption.get().delete(userId));
          assertTrue(retry(new Predicate<UserApi>() {
             public boolean apply(UserApi userApi) {
                return userApi.get(userId) == null;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java
index af9e2d5..8cc3c69 100644
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java
+++ 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java
@@ -26,11 +26,11 @@ import java.util.Properties;
 import java.util.Set;
 
 import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
 import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
 import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
 import org.jclouds.openstack.keystone.v2_0.domain.Token;
 import org.jclouds.openstack.keystone.v2_0.domain.User;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
 import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest;
 import org.testng.annotations.Test;
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURLTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURLTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURLTest.java
deleted file mode 100644
index 310d41b..0000000
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURLTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "AdminURLTest")
-public class AdminURLTest {
-   private final AdminURL fn = new AdminURL();
-
-   public void testAdminURL() {
-      assertEquals(fn.apply(
-               Endpoint.builder().region("LON").versionId("1.0").adminURL(
-                        
URI.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";))
-                        .build()).get(), URI
-               
.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";));
-   }
-
-   public void testPublicURLNullReturnsInternalURL() {
-      assertEquals(fn
-               .apply(
-                        Endpoint.builder().region("lon").versionId("1.0")
-                                 
.internalURL(URI.create("https://192.168.1.1";)).build()).get(), null);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/InternalURLTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/InternalURLTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/InternalURLTest.java
deleted file mode 100644
index 3f37825..0000000
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/InternalURLTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-import org.testng.annotations.Test;
-
-/**
- */
-@Test(groups = "unit", testName = "InternalURLTest")
-public class InternalURLTest {
-   private final InternalURL fn = new InternalURL();
-
-   public void testInternalURL() {
-      assertEquals(
-            fn.apply(
-                  Endpoint.builder().region("regionOne").versionId("2.0")
-                        
.internalURL(URI.create("https://ericsson.com/v2/1900e98b-7272-4cbd-8e95-0b8c2a9266c0";))
-                        .build()).get(), 
URI.create("https://ericsson.com/v2/1900e98b-7272-4cbd-8e95-0b8c2a9266c0";));
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/PublicURLOrInternalIfNullTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/PublicURLOrInternalIfNullTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/PublicURLOrInternalIfNullTest.java
deleted file mode 100644
index 7e169ac..0000000
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/PublicURLOrInternalIfNullTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "PublicURLOrInternalIfNullTest")
-public class PublicURLOrInternalIfNullTest {
-   private final PublicURLOrInternalIfNull fn = new 
PublicURLOrInternalIfNull();
-
-   public void testPublicURLNotNullReturnsPublicURL() {
-      assertEquals(fn.apply(
-               Endpoint.builder().region("LON").versionId("1.0").publicURL(
-                        
URI.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";))
-                        .build()).get(), URI
-               
.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";));
-   }
-
-   public void testPublicURLNullReturnsInternalURL() {
-      assertEquals(fn
-               .apply(
-                        Endpoint.builder().region("lon").versionId("1.0")
-                                 
.internalURL(URI.create("https://192.168.1.1";)).build()).get(), URI
-               .create("https://192.168.1.1";));
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegionOrProviderTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegionOrProviderTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegionOrProviderTest.java
deleted file mode 100644
index c606edd..0000000
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegionOrProviderTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "ReturnRegionOrProviderTest")
-public class ReturnRegionOrProviderTest {
-   private final ReturnRegionOrProvider fn = new 
ReturnRegionOrProvider("openstack-keystone");
-
-   public void testRegionNotNullReturnsRegion() {
-      assertEquals(
-               
fn.apply(Endpoint.builder().region("LON").versionId("1.0").publicURL(
-                        
URI.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";))
-                        .build()), "LON");
-   }
-
-   public void testRegionNullReturnsProvider() {
-      assertEquals(
-               fn.apply(Endpoint.builder().versionId("1.0").publicURL(
-                        
URI.create("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953";))
-                        .build()), "openstack-keystone");
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/dd73410d/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenewTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenewTest.java
 
b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenewTest.java
deleted file mode 100644
index 840cda3..0000000
--- 
a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenewTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.openstack.keystone.v2_0.handlers;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.domain.Credentials;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
-import org.jclouds.io.Payloads;
-import org.jclouds.openstack.keystone.v2_0.domain.Access;
-import org.testng.annotations.Test;
-
-import com.google.common.cache.LoadingCache;
-
-/**
- * Tests behavior of {@code RetryOnRenew} handler
- */
-@Test(groups = "unit", testName = "RetryOnRenewTest")
-public class RetryOnRenewTest {
-   @Test
-   public void test401ShouldRetry() {
-      HttpCommand command = createMock(HttpCommand.class);
-      HttpRequest request = createMock(HttpRequest.class);
-      HttpResponse response = createMock(HttpResponse.class);
-      @SuppressWarnings("unchecked")
-      LoadingCache<Credentials, Access> cache = createMock(LoadingCache.class);
-      BackoffLimitedRetryHandler backoffHandler = 
createMock(BackoffLimitedRetryHandler.class);
-
-      expect(command.getCurrentRequest()).andReturn(request);
-
-      cache.invalidateAll();
-      expectLastCall();
-
-      
expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes();
-      expect(response.getStatusCode()).andReturn(401).atLeastOnce();
-
-      replay(command);
-      replay(response);
-      replay(cache);
-      replay(backoffHandler);
-
-      RetryOnRenew retry = new RetryOnRenew(cache, backoffHandler);
-
-      assertTrue(retry.shouldRetryRequest(command, response));
-
-      verify(command);
-      verify(response);
-      verify(cache);
-   }
-
-   @Test
-   public void test401ShouldRetry4Times() {
-      HttpCommand command = createMock(HttpCommand.class);
-      HttpRequest request = createMock(HttpRequest.class);
-      HttpResponse response = createMock(HttpResponse.class);
-
-      @SuppressWarnings("unchecked")
-      LoadingCache<Credentials, Access> cache = createMock(LoadingCache.class);
-      BackoffLimitedRetryHandler backoffHandler = 
createMock(BackoffLimitedRetryHandler.class);
-
-      expect(command.getCurrentRequest()).andReturn(request).anyTimes();
-      expect(request.getHeaders()).andStubReturn(null);
-
-      cache.invalidateAll();
-      expectLastCall().anyTimes();
-
-      
expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes();
-      expect(response.getStatusCode()).andReturn(401).anyTimes();
-
-      replay(command, request, response, cache);
-
-      RetryOnRenew retry = new RetryOnRenew(cache, backoffHandler);
-
-      for (int i = 0; i < RetryOnRenew.NUM_RETRIES - 1; ++i) {
-         assertTrue(retry.shouldRetryRequest(command, response), "Expected 
retry to succeed");
-      }
-
-      assertFalse(retry.shouldRetryRequest(command, response), "Expected retry 
to fail on attempt " + RetryOnRenew.NUM_RETRIES);
-
-      verify(command, response, cache);
-   }
-
-   @Test
-   public void test408ShouldRetry() {
-      HttpCommand command = createMock(HttpCommand.class);
-      HttpResponse response = createMock(HttpResponse.class);
-      @SuppressWarnings("unchecked")
-      LoadingCache<Credentials, Access> cache = createMock(LoadingCache.class);
-      BackoffLimitedRetryHandler backoffHandler = 
createMock(BackoffLimitedRetryHandler.class);
-
-      expect(backoffHandler.shouldRetryRequest(command, 
response)).andReturn(true).once();
-      expect(response.getStatusCode()).andReturn(408).once();
-
-      replay(command);
-      replay(response);
-      replay(cache);
-      replay(backoffHandler);
-
-      RetryOnRenew retry = new RetryOnRenew(cache, backoffHandler);
-
-      assertTrue(retry.shouldRetryRequest(command, response));
-
-      verify(command);
-      verify(response);
-      verify(cache);
-      verify(backoffHandler);
-   }
-}

Reply via email to