You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by za...@apache.org on 2015/07/15 02:25:34 UTC
jclouds git commit: Adds missing floating-ip-pool expect test Fixes
broken namespace for the ip pool extension
Repository: jclouds
Updated Branches:
refs/heads/1.9.x 5eb36ef25 -> defbd1151
Adds missing floating-ip-pool expect test
Fixes broken namespace for the ip pool extension
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/defbd115
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/defbd115
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/defbd115
Branch: refs/heads/1.9.x
Commit: defbd1151cc6eb86b09cb534b5987b8ba642d383
Parents: 5eb36ef
Author: Zack Shoylev <za...@rackspace.com>
Authored: Tue Jul 14 18:43:32 2015 -0500
Committer: Zack Shoylev <za...@rackspace.com>
Committed: Tue Jul 14 19:25:15 2015 -0500
----------------------------------------------------------------------
.../v2_0/extensions/ExtensionNamespaces.java | 2 +-
.../extensions/FloatingIPPoolApiExpectTest.java | 95 ++++++++++++++++++++
2 files changed, 96 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/defbd115/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
index 21de36f..888ab7a 100644
--- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
+++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java
@@ -116,7 +116,7 @@ public final class ExtensionNamespaces {
/**
* Floating IP pools support
*/
- public static final String FLOATING_IP_POOLS = "http://docs.openstack.org/ext/floating_ip_pools/api/v1.1";
+ public static final String FLOATING_IP_POOLS = "http://docs.openstack.org/compute/ext/floating_ip_pools/api/v1.1";
/**
* Attach interfaces extension
*/
http://git-wip-us.apache.org/repos/asf/jclouds/blob/defbd115/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPPoolApiExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPPoolApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPPoolApiExpectTest.java
new file mode 100644
index 0000000..200e1d7
--- /dev/null
+++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPPoolApiExpectTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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.nova.v2_0.extensions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPPoolListTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests annotation parsing of {@code FloatingIPPoolApi}
+ */
+@Test(groups = "unit", testName = "FloatingIPPoolApiExpectTest")
+public class FloatingIPPoolApiExpectTest extends BaseNovaApiExpectTest {
+ public void testWhenNamespaceInExtensionsListFloatingIpPoolPresent() throws Exception {
+
+ NovaApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse);
+
+ assertEquals(apiWhenExtensionNotInList.getConfiguredRegions(),
+ ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertTrue(apiWhenExtensionNotInList.getFloatingIPPoolApi("az-1.region-a.geo-1").isPresent());
+
+ }
+
+ public void testWhenNamespaceNotInExtensionsListFloatingIpPoolNotPresent() throws Exception {
+
+ NovaApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, unmatchedExtensionsOfNovaResponse);
+
+ assertEquals(apiWhenExtensionNotInList.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertFalse(apiWhenExtensionNotInList.getFloatingIPPoolApi("az-1.region-a.geo-1").isPresent());
+
+ }
+
+ public void testListFloatingIPPoolWhenResponseIs2xx() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-floating-ip-pools")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(200)
+ .payload(payloadFromResource("/floatingippool_list.json")).build();
+
+ NovaApi apiWhenFloatingIPPoolExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
+
+ assertEquals(apiWhenFloatingIPPoolExists.getConfiguredRegions(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
+
+ assertEquals(apiWhenFloatingIPPoolExists.getFloatingIPPoolApi("az-1.region-a.geo-1").get().list()
+ .toString(), new ParseFloatingIPPoolListTest().expected().toString());
+ }
+
+ public void testListFloatingIPsWhenResponseIs404() throws Exception {
+ HttpRequest list = HttpRequest
+ .builder()
+ .method("GET")
+ .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v2/3456/os-floating-ip-pools")
+ .addHeader("Accept", "application/json")
+ .addHeader("X-Auth-Token", authToken).build();
+
+ HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
+
+ NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+ responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
+
+ assertTrue(apiWhenNoServersExist.getFloatingIPPoolApi("az-1.region-a.geo-1").get().list().isEmpty());
+ }
+}