mirror of https://github.com/apache/jclouds.git
Issue 77: removed inconsistent NOT_FOUND objects
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2554 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
1e0e63ddd2
commit
cc0dbf6e1c
|
@ -65,10 +65,6 @@ import org.jclouds.rackspace.cloudservers.functions.ParseServerFromJsonResponse;
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ParseServerListFromJsonResponse;
|
import org.jclouds.rackspace.cloudservers.functions.ParseServerListFromJsonResponse;
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ParseSharedIpGroupFromJsonResponse;
|
import org.jclouds.rackspace.cloudservers.functions.ParseSharedIpGroupFromJsonResponse;
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ParseSharedIpGroupListFromJsonResponse;
|
import org.jclouds.rackspace.cloudservers.functions.ParseSharedIpGroupListFromJsonResponse;
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ReturnFlavorNotFoundOn404;
|
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ReturnImageNotFoundOn404;
|
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ReturnServerNotFoundOn404;
|
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ReturnSharedIpGroupNotFoundOn404;
|
|
||||||
import org.jclouds.rackspace.cloudservers.options.CreateServerOptions;
|
import org.jclouds.rackspace.cloudservers.options.CreateServerOptions;
|
||||||
import org.jclouds.rackspace.cloudservers.options.CreateSharedIpGroupOptions;
|
import org.jclouds.rackspace.cloudservers.options.CreateSharedIpGroupOptions;
|
||||||
import org.jclouds.rackspace.cloudservers.options.ListOptions;
|
import org.jclouds.rackspace.cloudservers.options.ListOptions;
|
||||||
|
@ -116,7 +112,6 @@ public interface CloudServersAsyncClient {
|
||||||
@GET
|
@GET
|
||||||
@ResponseParser(ParseServerFromJsonResponse.class)
|
@ResponseParser(ParseServerFromJsonResponse.class)
|
||||||
@QueryParams(keys = "format", values = "json")
|
@QueryParams(keys = "format", values = "json")
|
||||||
@ExceptionParser(ReturnServerNotFoundOn404.class)
|
|
||||||
@Path("/servers/{id}")
|
@Path("/servers/{id}")
|
||||||
Future<Server> getServer(@PathParam("id") int id);
|
Future<Server> getServer(@PathParam("id") int id);
|
||||||
|
|
||||||
|
@ -246,7 +241,6 @@ public interface CloudServersAsyncClient {
|
||||||
@GET
|
@GET
|
||||||
@ResponseParser(ParseFlavorFromJsonResponse.class)
|
@ResponseParser(ParseFlavorFromJsonResponse.class)
|
||||||
@QueryParams(keys = "format", values = "json")
|
@QueryParams(keys = "format", values = "json")
|
||||||
@ExceptionParser(ReturnFlavorNotFoundOn404.class)
|
|
||||||
@Path("/flavors/{id}")
|
@Path("/flavors/{id}")
|
||||||
Future<Flavor> getFlavor(@PathParam("id") int id);
|
Future<Flavor> getFlavor(@PathParam("id") int id);
|
||||||
|
|
||||||
|
@ -265,7 +259,6 @@ public interface CloudServersAsyncClient {
|
||||||
@GET
|
@GET
|
||||||
@ResponseParser(ParseImageFromJsonResponse.class)
|
@ResponseParser(ParseImageFromJsonResponse.class)
|
||||||
@QueryParams(keys = "format", values = "json")
|
@QueryParams(keys = "format", values = "json")
|
||||||
@ExceptionParser(ReturnImageNotFoundOn404.class)
|
|
||||||
@Path("/images/{id}")
|
@Path("/images/{id}")
|
||||||
Future<Image> getImage(@PathParam("id") int id);
|
Future<Image> getImage(@PathParam("id") int id);
|
||||||
|
|
||||||
|
@ -283,7 +276,6 @@ public interface CloudServersAsyncClient {
|
||||||
@POST
|
@POST
|
||||||
@ResponseParser(ParseImageFromJsonResponse.class)
|
@ResponseParser(ParseImageFromJsonResponse.class)
|
||||||
@QueryParams(keys = "format", values = "json")
|
@QueryParams(keys = "format", values = "json")
|
||||||
@ExceptionParser(ReturnImageNotFoundOn404.class)
|
|
||||||
@MapBinder(BindCreateImageToJsonPayload.class)
|
@MapBinder(BindCreateImageToJsonPayload.class)
|
||||||
@Path("/images")
|
@Path("/images")
|
||||||
Future<Image> createImageFromServer(@MapPayloadParam("imageName") String imageName,
|
Future<Image> createImageFromServer(@MapPayloadParam("imageName") String imageName,
|
||||||
|
@ -304,7 +296,6 @@ public interface CloudServersAsyncClient {
|
||||||
@GET
|
@GET
|
||||||
@ResponseParser(ParseSharedIpGroupFromJsonResponse.class)
|
@ResponseParser(ParseSharedIpGroupFromJsonResponse.class)
|
||||||
@QueryParams(keys = "format", values = "json")
|
@QueryParams(keys = "format", values = "json")
|
||||||
@ExceptionParser(ReturnSharedIpGroupNotFoundOn404.class)
|
|
||||||
@Path("/shared_ip_groups/{id}")
|
@Path("/shared_ip_groups/{id}")
|
||||||
Future<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id);
|
Future<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id);
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public interface CloudServersClient {
|
||||||
*
|
*
|
||||||
* This operation returns details of the specified server.
|
* This operation returns details of the specified server.
|
||||||
*
|
*
|
||||||
* @return {@link Server#NOT_FOUND} if the server is not found
|
* @throws ResourceNotFoundException if the server is not found
|
||||||
* @see Server
|
* @see Server
|
||||||
*/
|
*/
|
||||||
Server getServer(@PathParam("id") int id);
|
Server getServer(@PathParam("id") int id);
|
||||||
|
@ -243,7 +243,7 @@ public interface CloudServersClient {
|
||||||
*
|
*
|
||||||
* This operation returns details of the specified flavor.
|
* This operation returns details of the specified flavor.
|
||||||
*
|
*
|
||||||
* @return {@link Flavor#NOT_FOUND} if the flavor is not found
|
* @throws ResourceNotFoundException if the flavor is not found
|
||||||
* @see Flavor
|
* @see Flavor
|
||||||
*/
|
*/
|
||||||
Flavor getFlavor(int id);
|
Flavor getFlavor(int id);
|
||||||
|
@ -261,7 +261,7 @@ public interface CloudServersClient {
|
||||||
*
|
*
|
||||||
* This operation returns details of the specified image.
|
* This operation returns details of the specified image.
|
||||||
*
|
*
|
||||||
* @return {@link Image#NOT_FOUND} if the image is not found
|
* @throws ResourceNotFoundException if the image is not found
|
||||||
* @see Image
|
* @see Image
|
||||||
*/
|
*/
|
||||||
Image getImage(int id);
|
Image getImage(int id);
|
||||||
|
@ -294,7 +294,7 @@ public interface CloudServersClient {
|
||||||
* Note: At present, image creation is an asynchronous operation, so coordinating the creation
|
* Note: At present, image creation is an asynchronous operation, so coordinating the creation
|
||||||
* with data quiescence, etc. is currently not possible.
|
* with data quiescence, etc. is currently not possible.
|
||||||
*
|
*
|
||||||
* @return {@link Image#NOT_FOUND} if the server is not found
|
* @throws ResourceNotFoundException if the server is not found
|
||||||
* @see Image
|
* @see Image
|
||||||
*/
|
*/
|
||||||
Image createImageFromServer(String imageName, int serverId);
|
Image createImageFromServer(String imageName, int serverId);
|
||||||
|
@ -312,7 +312,7 @@ public interface CloudServersClient {
|
||||||
*
|
*
|
||||||
* This operation returns details of the specified shared IP group.
|
* This operation returns details of the specified shared IP group.
|
||||||
*
|
*
|
||||||
* @return {@link SharedIpGroup#NOT_FOUND} if the shared IP group is not found
|
* @throws ResourceNotFoundException if the shared IP group is not found
|
||||||
* @see SharedIpGroup
|
* @see SharedIpGroup
|
||||||
*/
|
*/
|
||||||
SharedIpGroup getSharedIpGroup(int id);
|
SharedIpGroup getSharedIpGroup(int id);
|
||||||
|
|
|
@ -32,8 +32,6 @@ package org.jclouds.rackspace.cloudservers.domain;
|
||||||
*/
|
*/
|
||||||
public class Flavor {
|
public class Flavor {
|
||||||
|
|
||||||
public static final Flavor NOT_FOUND = new Flavor(-1, "NOT_FOUND");
|
|
||||||
|
|
||||||
public Flavor() {
|
public Flavor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,6 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
public class Image {
|
public class Image {
|
||||||
|
|
||||||
public static final Image NOT_FOUND = new Image(-1, "NOT_FOUND");
|
|
||||||
|
|
||||||
private Date created;
|
private Date created;
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
@ -35,7 +35,6 @@ import com.google.inject.internal.Maps;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public class Server {
|
public class Server {
|
||||||
public static final Server NOT_FOUND = new Server(-1, "NOT_FOUND");
|
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,6 @@ import com.google.inject.internal.Lists;
|
||||||
*/
|
*/
|
||||||
public class SharedIpGroup {
|
public class SharedIpGroup {
|
||||||
|
|
||||||
public static final SharedIpGroup NOT_FOUND = new SharedIpGroup(-1, "NOT_FOUND");
|
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* 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.rackspace.cloudservers.functions;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.rackspace.cloudservers.domain.Flavor;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ReturnFlavorNotFoundOn404 implements Function<Exception, Flavor> {
|
|
||||||
|
|
||||||
public Flavor apply(Exception from) {
|
|
||||||
if (from instanceof HttpResponseException) {
|
|
||||||
HttpResponseException responseException = (HttpResponseException) from;
|
|
||||||
if (responseException.getResponse().getStatusCode() == 404) {
|
|
||||||
return Flavor.NOT_FOUND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* 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.rackspace.cloudservers.functions;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.rackspace.cloudservers.domain.Image;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ReturnImageNotFoundOn404 implements Function<Exception, Image> {
|
|
||||||
|
|
||||||
public Image apply(Exception from) {
|
|
||||||
if (from instanceof HttpResponseException) {
|
|
||||||
HttpResponseException responseException = (HttpResponseException) from;
|
|
||||||
if (responseException.getResponse().getStatusCode() == 404) {
|
|
||||||
return Image.NOT_FOUND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* 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.rackspace.cloudservers.functions;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.rackspace.cloudservers.domain.Server;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ReturnServerNotFoundOn404 implements Function<Exception, Server> {
|
|
||||||
|
|
||||||
public Server apply(Exception from) {
|
|
||||||
if (from instanceof HttpResponseException) {
|
|
||||||
HttpResponseException responseException = (HttpResponseException) from;
|
|
||||||
if (responseException.getResponse().getStatusCode() == 404) {
|
|
||||||
return Server.NOT_FOUND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* 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.rackspace.cloudservers.functions;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.rackspace.cloudservers.domain.SharedIpGroup;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ReturnSharedIpGroupNotFoundOn404 implements Function<Exception, SharedIpGroup> {
|
|
||||||
|
|
||||||
public SharedIpGroup apply(Exception from) {
|
|
||||||
if (from instanceof HttpResponseException) {
|
|
||||||
HttpResponseException responseException = (HttpResponseException) from;
|
|
||||||
if (responseException.getResponse().getStatusCode() == 404) {
|
|
||||||
return SharedIpGroup.NOT_FOUND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -57,6 +57,7 @@ import org.jclouds.rackspace.cloudservers.domain.ServerStatus;
|
||||||
import org.jclouds.rackspace.cloudservers.domain.SharedIpGroup;
|
import org.jclouds.rackspace.cloudservers.domain.SharedIpGroup;
|
||||||
import org.jclouds.rackspace.cloudservers.domain.WeeklyBackup;
|
import org.jclouds.rackspace.cloudservers.domain.WeeklyBackup;
|
||||||
import org.jclouds.rackspace.cloudservers.options.RebuildServerOptions;
|
import org.jclouds.rackspace.cloudservers.options.RebuildServerOptions;
|
||||||
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
import org.jclouds.ssh.ExecResponse;
|
import org.jclouds.ssh.ExecResponse;
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
import org.jclouds.ssh.SshException;
|
import org.jclouds.ssh.SshException;
|
||||||
|
@ -152,19 +153,19 @@ public class CloudServersClientLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||||
public void testGetImageDetailsNotFound() throws Exception {
|
public void testGetImageDetailsNotFound() throws Exception {
|
||||||
try {
|
try {
|
||||||
Image newDetails = client.getImage(12312987);
|
client.getImage(12312987);
|
||||||
assertEquals(Image.NOT_FOUND, newDetails);
|
|
||||||
} catch (HttpResponseException e) {// Ticket #9867
|
} catch (HttpResponseException e) {// Ticket #9867
|
||||||
if (e.getResponse().getStatusCode() != 400)
|
if (e.getResponse().getStatusCode() != 400)
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||||
public void testGetServerDetailsNotFound() throws Exception {
|
public void testGetServerDetailsNotFound() throws Exception {
|
||||||
Server newDetails = client.getServer(12312987);
|
client.getServer(12312987);
|
||||||
assertEquals(Server.NOT_FOUND, newDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetServersDetail() throws Exception {
|
public void testGetServersDetail() throws Exception {
|
||||||
|
@ -214,9 +215,9 @@ public class CloudServersClientLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||||
public void testGetFlavorDetailsNotFound() throws Exception {
|
public void testGetFlavorDetailsNotFound() throws Exception {
|
||||||
Flavor newDetails = client.getFlavor(12312987);
|
client.getFlavor(12312987);
|
||||||
assertEquals(Flavor.NOT_FOUND, newDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListSharedIpGroups() throws Exception {
|
public void testListSharedIpGroups() throws Exception {
|
||||||
|
@ -254,9 +255,9 @@ public class CloudServersClientLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||||
public void testGetSharedIpGroupDetailsNotFound() throws Exception {
|
public void testGetSharedIpGroupDetailsNotFound() throws Exception {
|
||||||
SharedIpGroup newDetails = client.getSharedIpGroup(12312987);
|
client.getSharedIpGroup(12312987);
|
||||||
assertEquals(SharedIpGroup.NOT_FOUND, newDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateServer")
|
@Test(timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateServer")
|
||||||
|
@ -571,39 +572,35 @@ public class CloudServersClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = { "testRebootSoft", "testRevertResize",
|
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = { "testRebootSoft", "testRevertResize",
|
||||||
"testConfirmResize" })
|
"testConfirmResize" }, expectedExceptions = ResourceNotFoundException.class)
|
||||||
void deleteServer2() {
|
void deleteServer2() {
|
||||||
if (serverId2 > 0) {
|
if (serverId2 > 0) {
|
||||||
client.deleteServer(serverId2);
|
client.deleteServer(serverId2);
|
||||||
Server server = client.getServer(serverId2);
|
client.getServer(serverId2);
|
||||||
assertEquals(server, Server.NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "deleteServer2")
|
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "deleteServer2", expectedExceptions = ResourceNotFoundException.class)
|
||||||
void testDeleteImage() {
|
void testDeleteImage() {
|
||||||
if (imageId > 0) {
|
if (imageId > 0) {
|
||||||
client.deleteImage(imageId);
|
client.deleteImage(imageId);
|
||||||
Image image = client.getImage(imageId);
|
client.getImage(imageId);
|
||||||
assertEquals(image, Image.NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testDeleteImage")
|
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = "testDeleteImage", expectedExceptions = ResourceNotFoundException.class)
|
||||||
void deleteServer1() {
|
void deleteServer1() {
|
||||||
if (serverId > 0) {
|
if (serverId > 0) {
|
||||||
client.deleteServer(serverId);
|
client.deleteServer(serverId);
|
||||||
Server server = client.getServer(serverId);
|
client.getServer(serverId);
|
||||||
assertEquals(server, Server.NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = { "deleteServer1" })
|
@Test(timeOut = 10 * 60 * 1000, dependsOnMethods = { "deleteServer1" }, expectedExceptions = ResourceNotFoundException.class)
|
||||||
void testDeleteSharedIpGroup() {
|
void testDeleteSharedIpGroup() {
|
||||||
if (sharedIpGroupId > 0) {
|
if (sharedIpGroupId > 0) {
|
||||||
client.deleteSharedIpGroup(sharedIpGroupId);
|
client.deleteSharedIpGroup(sharedIpGroupId);
|
||||||
SharedIpGroup server = client.getSharedIpGroup(sharedIpGroupId);
|
client.getSharedIpGroup(sharedIpGroupId);
|
||||||
assertEquals(server, SharedIpGroup.NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,6 @@ import org.jclouds.rackspace.cloudservers.functions.ParseServerFromJsonResponse;
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ParseServerListFromJsonResponse;
|
import org.jclouds.rackspace.cloudservers.functions.ParseServerListFromJsonResponse;
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ParseSharedIpGroupFromJsonResponse;
|
import org.jclouds.rackspace.cloudservers.functions.ParseSharedIpGroupFromJsonResponse;
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ParseSharedIpGroupListFromJsonResponse;
|
import org.jclouds.rackspace.cloudservers.functions.ParseSharedIpGroupListFromJsonResponse;
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ReturnFlavorNotFoundOn404;
|
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ReturnImageNotFoundOn404;
|
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ReturnServerNotFoundOn404;
|
|
||||||
import org.jclouds.rackspace.cloudservers.functions.ReturnSharedIpGroupNotFoundOn404;
|
|
||||||
import org.jclouds.rackspace.cloudservers.options.CreateServerOptions;
|
import org.jclouds.rackspace.cloudservers.options.CreateServerOptions;
|
||||||
import org.jclouds.rackspace.cloudservers.options.CreateSharedIpGroupOptions;
|
import org.jclouds.rackspace.cloudservers.options.CreateSharedIpGroupOptions;
|
||||||
import org.jclouds.rackspace.cloudservers.options.ListOptions;
|
import org.jclouds.rackspace.cloudservers.options.ListOptions;
|
||||||
|
@ -183,7 +179,9 @@ public class CloudServersClientTest {
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseServerFromJsonResponse.class);
|
ParseServerFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
assertNotNull(processor.getMapPayloadBinderOrNull(method, new Object[] { "", 1, 2,
|
assertNotNull(processor.getMapPayloadBinderOrNull(method, new Object[] { "", 1, 2,
|
||||||
new CreateServerOptions[] { CreateServerOptions.Builder.withSharedIpGroup(1) } }));
|
new CreateServerOptions[] { CreateServerOptions.Builder.withSharedIpGroup(1) } }));
|
||||||
}
|
}
|
||||||
|
@ -197,7 +195,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getEndpoint().getPath(), "/images/2");
|
assertEquals(httpMethod.getEndpoint().getPath(), "/images/2");
|
||||||
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -216,7 +215,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseServerListFromJsonResponse.class);
|
ParseServerListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
|
@ -235,7 +236,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseServerListFromJsonResponse.class);
|
ParseServerListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListServersDetail() throws SecurityException, NoSuchMethodException {
|
public void testListServersDetail() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -251,7 +254,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseServerListFromJsonResponse.class);
|
ParseServerListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetServer() throws SecurityException, NoSuchMethodException {
|
public void testGetServer() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -266,8 +271,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseServerFromJsonResponse.class);
|
ParseServerFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
ReturnServerNotFoundOn404.class);
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListFlavors() throws SecurityException, NoSuchMethodException {
|
public void testListFlavors() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -283,7 +289,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseFlavorListFromJsonResponse.class);
|
ParseFlavorListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListFlavorsOptions() throws SecurityException, NoSuchMethodException {
|
public void testListFlavorsOptions() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -300,7 +308,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseFlavorListFromJsonResponse.class);
|
ParseFlavorListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListFlavorsDetail() throws SecurityException, NoSuchMethodException {
|
public void testListFlavorsDetail() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -316,7 +326,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseFlavorListFromJsonResponse.class);
|
ParseFlavorListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListFlavorsDetailOptions() throws SecurityException, NoSuchMethodException {
|
public void testListFlavorsDetailOptions() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -333,7 +345,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseFlavorListFromJsonResponse.class);
|
ParseFlavorListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetFlavor() throws SecurityException, NoSuchMethodException {
|
public void testGetFlavor() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -348,8 +362,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseFlavorFromJsonResponse.class);
|
ParseFlavorFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
ReturnFlavorNotFoundOn404.class);
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListImages() throws SecurityException, NoSuchMethodException {
|
public void testListImages() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -365,7 +380,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseImageListFromJsonResponse.class);
|
ParseImageListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListImagesDetail() throws SecurityException, NoSuchMethodException {
|
public void testListImagesDetail() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -381,7 +398,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseImageListFromJsonResponse.class);
|
ParseImageListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListImagesOptions() throws SecurityException, NoSuchMethodException {
|
public void testListImagesOptions() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -398,7 +417,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseImageListFromJsonResponse.class);
|
ParseImageListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListImagesDetailOptions() throws SecurityException, NoSuchMethodException {
|
public void testListImagesDetailOptions() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -415,7 +436,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseImageListFromJsonResponse.class);
|
ParseImageListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetImage() throws SecurityException, NoSuchMethodException {
|
public void testGetImage() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -430,8 +453,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseImageFromJsonResponse.class);
|
ParseImageFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
ReturnImageNotFoundOn404.class);
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeleteServer() throws SecurityException, NoSuchMethodException {
|
public void testDeleteServer() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -443,7 +467,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getEndpoint().getPath(), "/servers/2");
|
assertEquals(httpMethod.getEndpoint().getPath(), "/servers/2");
|
||||||
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -466,7 +491,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals("{\"shareIp\":{\"sharedIpGroupId\":3}}", httpMethod.getPayload().getRawContent());
|
assertEquals("{\"shareIp\":{\"sharedIpGroupId\":3}}", httpMethod.getPayload().getRawContent());
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -490,7 +516,8 @@ public class CloudServersClientTest {
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals("{\"shareIp\":{\"sharedIpGroupId\":3,\"configureServer\":true}}", httpMethod
|
assertEquals("{\"shareIp\":{\"sharedIpGroupId\":3,\"configureServer\":true}}", httpMethod
|
||||||
.getPayload().getRawContent());
|
.getPayload().getRawContent());
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -507,7 +534,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getEndpoint().getPath(), "/servers/2/ips/public/127.0.0.1");
|
assertEquals(httpMethod.getEndpoint().getPath(), "/servers/2/ips/public/127.0.0.1");
|
||||||
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -531,7 +559,8 @@ public class CloudServersClientTest {
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals(httpMethod.getPayload().getRawContent(),
|
assertEquals(httpMethod.getPayload().getRawContent(),
|
||||||
"{\"backupSchedule\":{\"daily\":\"H_0800_1000\",\"enabled\":true,\"weekly\":\"MONDAY\"}}");
|
"{\"backupSchedule\":{\"daily\":\"H_0800_1000\",\"enabled\":true,\"weekly\":\"MONDAY\"}}");
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -546,7 +575,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getEndpoint().getPath(), "/servers/2/backup_schedule");
|
assertEquals(httpMethod.getEndpoint().getPath(), "/servers/2/backup_schedule");
|
||||||
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -568,7 +598,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals("{\"server\":{\"adminPass\":\"foo\"}}", httpMethod.getPayload().getRawContent());
|
assertEquals("{\"server\":{\"adminPass\":\"foo\"}}", httpMethod.getPayload().getRawContent());
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -590,7 +621,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals("{\"server\":{\"name\":\"foo\"}}", httpMethod.getPayload().getRawContent());
|
assertEquals("{\"server\":{\"name\":\"foo\"}}", httpMethod.getPayload().getRawContent());
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -609,7 +641,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseSharedIpGroupListFromJsonResponse.class);
|
ParseSharedIpGroupListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListSharedIpGroupsOptions() throws SecurityException, NoSuchMethodException {
|
public void testListSharedIpGroupsOptions() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -626,7 +660,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseSharedIpGroupListFromJsonResponse.class);
|
ParseSharedIpGroupListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListSharedIpGroupsDetail() throws SecurityException, NoSuchMethodException {
|
public void testListSharedIpGroupsDetail() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -642,7 +678,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseSharedIpGroupListFromJsonResponse.class);
|
ParseSharedIpGroupListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListSharedIpGroupsDetailOptions() throws SecurityException,
|
public void testListSharedIpGroupsDetailOptions() throws SecurityException,
|
||||||
|
@ -660,7 +698,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseSharedIpGroupListFromJsonResponse.class);
|
ParseSharedIpGroupListFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetSharedIpGroup() throws SecurityException, NoSuchMethodException {
|
public void testGetSharedIpGroup() throws SecurityException, NoSuchMethodException {
|
||||||
|
@ -675,8 +715,9 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseSharedIpGroupFromJsonResponse.class);
|
ParseSharedIpGroupFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
ReturnSharedIpGroupNotFoundOn404.class);
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<? extends CreateSharedIpGroupOptions[]> createSharedIpGroupOptionsVarargsClass = new CreateSharedIpGroupOptions[] {}
|
private static final Class<? extends CreateSharedIpGroupOptions[]> createSharedIpGroupOptionsVarargsClass = new CreateSharedIpGroupOptions[] {}
|
||||||
|
@ -718,7 +759,9 @@ public class CloudServersClientTest {
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseSharedIpGroupFromJsonResponse.class);
|
ParseSharedIpGroupFromJsonResponse.class);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(), ThrowResourceNotFoundOn404.class);
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
|
ThrowResourceNotFoundOn404.class);
|
||||||
assertNotNull(processor.getMapPayloadBinderOrNull(method, new Object[] { "",
|
assertNotNull(processor.getMapPayloadBinderOrNull(method, new Object[] { "",
|
||||||
new CreateSharedIpGroupOptions[] { withServer(2) } }));
|
new CreateSharedIpGroupOptions[] { withServer(2) } }));
|
||||||
}
|
}
|
||||||
|
@ -732,7 +775,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getEndpoint().getPath(), "/shared_ip_groups/2");
|
assertEquals(httpMethod.getEndpoint().getPath(), "/shared_ip_groups/2");
|
||||||
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
assertEquals(httpMethod.getMethod(), HttpMethod.DELETE);
|
||||||
assertEquals(httpMethod.getHeaders().size(), 0);
|
assertEquals(httpMethod.getHeaders().size(), 0);
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -814,7 +858,8 @@ public class CloudServersClientTest {
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ParseImageFromJsonResponse.class);
|
ParseImageFromJsonResponse.class);
|
||||||
assertNotNull(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method));
|
assertNotNull(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method));
|
||||||
assertNotNull(processor.getMapPayloadBinderOrNull(method, new Object[] { "", 2 }));
|
assertNotNull(processor.getMapPayloadBinderOrNull(method, new Object[] { "", 2 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,7 +898,8 @@ public class CloudServersClientTest {
|
||||||
+ ""));
|
+ ""));
|
||||||
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -877,7 +923,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals("{\"reboot\":{\"type\":\"HARD\"}}", httpMethod.getPayload().getRawContent());
|
assertEquals("{\"reboot\":{\"type\":\"HARD\"}}", httpMethod.getPayload().getRawContent());
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -898,7 +945,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals("{\"resize\":{\"flavorId\":3}}", httpMethod.getPayload().getRawContent());
|
assertEquals("{\"resize\":{\"flavorId\":3}}", httpMethod.getPayload().getRawContent());
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -919,7 +967,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals("{\"confirmResize\":null}", httpMethod.getPayload().getRawContent());
|
assertEquals("{\"confirmResize\":null}", httpMethod.getPayload().getRawContent());
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
@ -939,7 +988,8 @@ public class CloudServersClientTest {
|
||||||
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
assertEquals(httpMethod.getHeaders().get(HttpHeaders.CONTENT_TYPE), Collections
|
||||||
.singletonList(MediaType.APPLICATION_JSON));
|
.singletonList(MediaType.APPLICATION_JSON));
|
||||||
assertEquals("{\"revertResize\":null}", httpMethod.getPayload().getRawContent());
|
assertEquals("{\"revertResize\":null}", httpMethod.getPayload().getRawContent());
|
||||||
assertEquals(processor.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
assertEquals(processor
|
||||||
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method).getClass(),
|
||||||
ReturnFalseOn404.class);
|
ReturnFalseOn404.class);
|
||||||
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
assertEquals(processor.createResponseParser(method, httpMethod).getClass(),
|
||||||
ReturnTrueIf2xx.class);
|
ReturnTrueIf2xx.class);
|
||||||
|
|
Loading…
Reference in New Issue