From b2be1499460b49de85c20161c022cee86998a638 Mon Sep 17 00:00:00 2001 From: jasdeep-hundal Date: Tue, 8 Apr 2014 15:12:12 -0700 Subject: [PATCH] JCLOUDS-526: Removing Nova QuotaClassApi The quota-classes API in Nova has been removed (and apparently never worked) --- .../jclouds/openstack/nova/v2_0/NovaApi.java | 8 -- .../openstack/nova/v2_0/NovaAsyncApi.java | 8 -- .../v2_0/config/NovaRestClientModule.java | 11 +- .../nova/v2_0/domain/QuotaClass.java | 62 ----------- .../v2_0/extensions/ExtensionNamespaces.java | 5 - .../nova/v2_0/extensions/QuotaClassApi.java | 51 --------- .../v2_0/extensions/QuotaClassAsyncApi.java | 78 ------------- .../extensions/QuotaClassApiExpectTest.java | 105 ------------------ .../extensions/QuotaClassApiLiveTest.java | 73 ------------ .../test/resources/extension_list_full.json | 10 +- .../src/test/resources/quota_class.json | 15 --- 11 files changed, 4 insertions(+), 422 deletions(-) delete mode 100644 apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java delete mode 100644 apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java delete mode 100644 apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java delete mode 100644 apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiExpectTest.java delete mode 100644 apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java delete mode 100644 apis/openstack-nova/src/test/resources/quota_class.json diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java index b03727eede..8a01a83345 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java @@ -28,7 +28,6 @@ import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationApi; import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi; import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi; import org.jclouds.openstack.nova.v2_0.extensions.QuotaApi; -import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi; import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi; import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminApi; import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi; @@ -177,13 +176,6 @@ public interface NovaApi extends Closeable { Optional getQuotaExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); - /** - * Provides synchronous access to Quota Classes features. - */ - @Delegate - Optional getQuotaClassExtensionForZone( - @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); - /** * Provides synchronous access to Volume features. */ diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java index 9abea53124..e0ee52f028 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java @@ -29,7 +29,6 @@ import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncApi; -import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncApi; @@ -183,13 +182,6 @@ public interface NovaAsyncApi extends Closeable { Optional getQuotaExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); - /** - * Provides asynchronous access to Quota Classes features. - */ - @Delegate - Optional getQuotaClassExtensionForZone( - @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); - /** * Provides asynchronous access to Volume features. */ diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java index 556ec60b3a..ea0d9478bc 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java @@ -46,8 +46,6 @@ import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi; import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.QuotaApi; import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncApi; -import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi; -import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi; import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncApi; import org.jclouds.openstack.nova.v2_0.extensions.ServerAdminApi; @@ -90,7 +88,7 @@ import com.google.inject.Provides; /** * Configures the Nova connection. - * + * * @author Adrian Cole */ @ConfiguresRestClient @@ -113,12 +111,11 @@ public class NovaRestClientModule ext .put(HostAggregateApi.class, HostAggregateAsyncApi.class) .put(FlavorExtraSpecsApi.class, FlavorExtraSpecsAsyncApi.class) .put(QuotaApi.class, QuotaAsyncApi.class) - .put(QuotaClassApi.class, QuotaClassAsyncApi.class) .put(VolumeApi.class, VolumeAsyncApi.class) .put(VolumeAttachmentApi.class, VolumeAttachmentAsyncApi.class) .put(VolumeTypeApi.class, VolumeTypeAsyncApi.class) .build(); - + @SuppressWarnings("unchecked") public NovaRestClientModule() { super(TypeToken.class.cast(typeToken(NovaApi.class)), TypeToken.class.cast(typeToken(NovaAsyncApi.class)), DELEGATE_MAP); @@ -134,7 +131,7 @@ public class NovaRestClientModule ext bind(ImplicitOptionalConverter.class).to(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class); super.configure(); } - + @Provides @Singleton public Multimap aliases() { @@ -163,8 +160,6 @@ public class NovaRestClientModule ext URI.create("http://docs.openstack.org/compute/ext/flavor_extra_specs/api/v1.1")) .put(URI.create(ExtensionNamespaces.QUOTAS), URI.create("http://docs.openstack.org/compute/ext/quotas-sets/api/v1.1")) - .put(URI.create(ExtensionNamespaces.QUOTA_CLASSES), - URI.create("http://docs.openstack.org/compute/ext/quota-classes-sets/api/v1.1")) .put(URI.create(ExtensionNamespaces.VOLUME_TYPES), URI.create("http://docs.openstack.org/compute/ext/volume_types/api/v1.1")) .build(); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java deleted file mode 100644 index 27199ef4c6..0000000000 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/QuotaClass.java +++ /dev/null @@ -1,62 +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.nova.v2_0.domain; - -import java.beans.ConstructorProperties; - -/** - * Represents the set of limits (quota class) returned by the Quota Class Extension - * - * @see org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi -*/ -public class QuotaClass extends Quota { - - public static Builder builder() { - return new ConcreteBuilder(); - } - - public Builder toBuilder() { - return new ConcreteBuilder().fromQuotaClass(this); - } - - public abstract static class Builder> extends Quota.Builder { - - public QuotaClass build() { - return new QuotaClass(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs); - } - - public T fromQuotaClass(QuotaClass in) { - return super.fromQuotas(in); - } - } - - private static class ConcreteBuilder extends Builder { - @Override - protected ConcreteBuilder self() { - return this; - } - } - - - @ConstructorProperties({ - "id", "metadata_items", "injected_file_content_bytes", "volumes", "gigabytes", "ram", "floating_ips", "instances", "injected_files", "cores", "security_groups", "security_group_rules", "key_pairs" - }) - protected QuotaClass(String id, int metadataItems, int injectedFileContentBytes, int volumes, int gigabytes, int ram, int floatingIps, int instances, int injectedFiles, int cores, int securityGroups, int securityGroupRules, int keyPairs) { - super(id, metadataItems, injectedFileContentBytes, volumes, gigabytes, ram, floatingIps, instances, injectedFiles, cores, securityGroups, securityGroupRules, keyPairs); - } - -} 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 a249190882..98cddd8698 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 @@ -93,11 +93,6 @@ public interface ExtensionNamespaces { */ public static final String EXTENDED_STATUS = "http://docs.openstack.org/compute/ext/extended_status/api/v1.1"; - /** - * Quota Classes extension - */ - public static final String QUOTA_CLASSES = "http://docs.openstack.org/ext/quota-classes-sets/api/v1.1"; - /** * Disk Config extension */ diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java deleted file mode 100644 index 4a6c01013a..0000000000 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApi.java +++ /dev/null @@ -1,51 +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.nova.v2_0.extensions; - -import org.jclouds.openstack.nova.v2_0.domain.QuotaClass; -import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.openstack.v2_0.services.Extension; - -import com.google.common.annotations.Beta; - -/** - * Provides synchronous access to Quota Classes via the REST API. - *

- * To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas. - * - * @author Adam Lowe - * @see QuotaClassAsyncApi - * @see - * @see - */ -@Beta -@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTA_CLASSES) -public interface QuotaClassApi { - - /** - * @return the quota settings for the tenant - */ - QuotaClass get(String id); - - /** - * Update the quotas for a given tenant - * - * @return true if successful - */ - boolean update(String id, QuotaClass quotas); - -} diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java deleted file mode 100644 index f07148f3f3..0000000000 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java +++ /dev/null @@ -1,78 +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.nova.v2_0.extensions; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest; -import org.jclouds.openstack.nova.v2_0.domain.QuotaClass; -import org.jclouds.openstack.v2_0.ServiceType; -import org.jclouds.openstack.v2_0.services.Extension; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.binders.BindToJsonPayload; - -import com.google.common.annotations.Beta; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Quota Classes via the REST API. - * - * @author Adam Lowe - * @see QuotaClassApi - * @see - * @see - */ -@Beta -@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTA_CLASSES) -@RequestFilters(AuthenticateRequest.class) -@Path("/os-quota-class-sets") -public interface QuotaClassAsyncApi { - - /** - * @see QuotaClassApi#get - */ - @Named("quotaclass:get") - @GET - @SelectJson("quota_class_set") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/{id}") - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("id") String id); - - /** - * @see QuotaClassApi#update - */ - @Named("quotaclass:update") - @PUT - @Path("/{id}") - @Produces(MediaType.APPLICATION_JSON) - @MapBinder(BindToJsonPayload.class) - ListenableFuture update(@PathParam("id") String id, @PayloadParam("quota_class_set") QuotaClass quotas); - -} diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiExpectTest.java deleted file mode 100644 index 4611ea9123..0000000000 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiExpectTest.java +++ /dev/null @@ -1,105 +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.nova.v2_0.extensions; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; - -import java.net.URI; - -import javax.ws.rs.core.MediaType; - -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.openstack.nova.v2_0.domain.QuotaClass; -import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest; -import org.jclouds.rest.ResourceNotFoundException; -import org.testng.annotations.Test; - -/** - * Tests HostAdministrationApi guice wiring and parsing - * - * @author Adam Lowe - */ -@Test(groups = "unit", testName = "QuotaClassApiExpectTest") -public class QuotaClassApiExpectTest extends BaseNovaApiExpectTest { - - public void testGetQuotas() throws Exception { - URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas"); - QuotaClassApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, - authenticatedGET().endpoint(endpoint).build(), - HttpResponse.builder().statusCode(200).payload(payloadFromResource("/quota_class.json")).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get(); - - assertEquals(api.get("jcloudstestquotas"), getTestQuotas()); - } - - public void testGetQuotasFailsTenantNotFound() throws Exception { - URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas"); - QuotaClassApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, - authenticatedGET().endpoint(endpoint).build(), - HttpResponse.builder().statusCode(404).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get(); - assertNull(api.get("jcloudstestquotas")); - } - - public void testUpdateQuotas() throws Exception { - URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/myclass"); - QuotaClassApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, - HttpRequest.builder().endpoint(endpoint).method("PUT") - .addHeader("X-Auth-Token", authToken) - .payload(payloadFromResourceWithContentType("/quota_class.json", MediaType.APPLICATION_JSON)) - .build(), - HttpResponse.builder().statusCode(200).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get(); - - assertTrue(api.update("myclass", getTestQuotas())); - } - - @Test(expectedExceptions = ResourceNotFoundException.class) - public void testUpdateQuotasFailsNotFound() throws Exception { - URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas"); - QuotaClassApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, - HttpRequest.builder().endpoint(endpoint).method("PUT") - .addHeader("X-Auth-Token", authToken) - .payload(payloadFromResourceWithContentType("/quota_class.json", MediaType.APPLICATION_JSON)) - .build(), - HttpResponse.builder().statusCode(404).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get(); - - api.update("jcloudstestquotas", getTestQuotas()); - } - - public static QuotaClass getTestQuotas() { - return QuotaClass.builder() - .metadataItems(128) - .injectedFileContentBytes(10240) - .injectedFiles(5) - .gigabytes(1000) - .ram(4096) - .floatingIps(10) - .securityGroups(10) - .securityGroupRules(20) - .instances(5) - .keyPairs(100) - .volumes(5) - .cores(10) - .id("jcloudstestquotas").build(); - } - -} diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java deleted file mode 100644 index 43fd342979..0000000000 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java +++ /dev/null @@ -1,73 +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.nova.v2_0.extensions; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import org.jclouds.openstack.nova.v2_0.domain.QuotaClass; -import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.common.base.Optional; -import com.google.common.collect.Iterables; - -/** - * Tests behavior of QuotaApi - * - * @author Adam Lowe - */ -@Test(groups = "live", testName = "QuotaClassApiLiveTest", singleThreaded = true) -public class QuotaClassApiLiveTest extends BaseNovaApiLiveTest { - private Optional apiOption; - private String zone; - - @BeforeClass(groups = {"integration", "live"}) - @Override - public void setup() { - super.setup(); - zone = Iterables.getLast(api.getConfiguredZones(), "nova"); - apiOption = api.getQuotaClassExtensionForZone(zone); - } - - public void testUpdateAndGetQuotaClass() { - if (apiOption.isPresent()) { - QuotaClassApi api = apiOption.get(); - - QuotaClass firstVersion = - QuotaClassApiExpectTest.getTestQuotas().toBuilder() - .id("jcloudstestquotas") - .cores(10) - .instances(5) - .ram(4096) - .volumes(5) - .build(); - - assertTrue(api.update(firstVersion.getId(), firstVersion)); - - assertEquals(api.get(firstVersion.getId()), firstVersion); - - // Change it again (since we may have run this test before and we can't delete the QuotaClass) - QuotaClass secondVersion = firstVersion.toBuilder().ram(8192).build(); - - assertTrue(api.update(secondVersion.getId(), secondVersion)); - - assertEquals(api.get(secondVersion.getId()), secondVersion); - } - } -} diff --git a/apis/openstack-nova/src/test/resources/extension_list_full.json b/apis/openstack-nova/src/test/resources/extension_list_full.json index 490bebc0fe..61909cea3c 100644 --- a/apis/openstack-nova/src/test/resources/extension_list_full.json +++ b/apis/openstack-nova/src/test/resources/extension_list_full.json @@ -191,14 +191,6 @@ "alias": "os-server-start-stop", "description": "Start/Stop instance compute API support" }, -{ - "updated": "2012-03-12T00:00:00+00:00", - "name": "QuotaClasses", - "links": [], - "namespace": "http://docs.openstack.org/compute/ext/quota-classes-sets/api/v1.1", - "alias": "os-quota-class-sets", - "description": "Quota classes management support" -}, { "updated": "2012-01-19T00:00:00+00:00", "name": "Certificates", @@ -278,4 +270,4 @@ "namespace": "http://docs.openstack.org/compute/ext/floating_ips/api/v1.1", "alias": "os-floating-ips", "description": "Floating IPs support"} -]} \ No newline at end of file +]} diff --git a/apis/openstack-nova/src/test/resources/quota_class.json b/apis/openstack-nova/src/test/resources/quota_class.json deleted file mode 100644 index 837b9cc967..0000000000 --- a/apis/openstack-nova/src/test/resources/quota_class.json +++ /dev/null @@ -1,15 +0,0 @@ -{"quota_class_set": { - "metadata_items": 128, - "injected_file_content_bytes": 10240, - "injected_files": 5, - "gigabytes": 1000, - "ram": 4096, - "floating_ips": 10, - "security_group_rules": 20, - "instances": 5, - "key_pairs": 100, - "volumes": 5, - "cores": 10, - "id": "jcloudstestquotas", - "security_groups": 10 -}} \ No newline at end of file