From 1137e552aee9fbcb1a211cdf54668b3104fa48bf Mon Sep 17 00:00:00 2001 From: Dmitri Babaev Date: Sun, 10 Apr 2011 21:19:07 +0400 Subject: [PATCH] Shared IP groups is removed Backup management is removed --- .../openstack/nova/NovaAsyncClient.java | 91 ------ .../jclouds/openstack/nova/NovaClient.java | 96 ------ .../BindBackupScheduleToJsonPayload.java | 53 ---- .../openstack/nova/domain/BackupSchedule.java | 104 ------- .../openstack/nova/domain/DailyBackup.java | 37 --- .../openstack/nova/domain/ShareIp.java | 42 --- .../openstack/nova/domain/SharedIpGroup.java | 111 ------- .../openstack/nova/domain/Version.java | 59 ---- .../openstack/nova/domain/VersionStatus.java | 37 --- .../openstack/nova/domain/WeeklyBackup.java | 37 --- .../openstack/nova/NovaAsyncClientTest.java | 276 ------------------ .../openstack/nova/NovaClientLiveTest.java | 142 --------- ...rseBackupScheduleFromJsonResponseTest.java | 68 ----- ...arseSharedIpGroupFromJsonResponseTest.java | 61 ---- ...SharedIpGroupListFromJsonResponseTest.java | 83 ------ .../test_get_sharedipgroup_details.json | 7 - .../resources/test_list_backupschedule.json | 7 - .../resources/test_list_sharedipgroups.json | 12 - .../test_list_sharedipgroups_detail.json | 14 - 19 files changed, 1337 deletions(-) delete mode 100644 sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/binders/BindBackupScheduleToJsonPayload.java delete mode 100644 sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/BackupSchedule.java delete mode 100644 sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/DailyBackup.java delete mode 100644 sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/ShareIp.java delete mode 100644 sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/SharedIpGroup.java delete mode 100644 sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Version.java delete mode 100644 sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/VersionStatus.java delete mode 100644 sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/WeeklyBackup.java delete mode 100644 sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseBackupScheduleFromJsonResponseTest.java delete mode 100644 sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseSharedIpGroupFromJsonResponseTest.java delete mode 100644 sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseSharedIpGroupListFromJsonResponseTest.java delete mode 100644 sandbox-apis/nova/src/test/resources/test_get_sharedipgroup_details.json delete mode 100644 sandbox-apis/nova/src/test/resources/test_list_backupschedule.json delete mode 100644 sandbox-apis/nova/src/test/resources/test_list_sharedipgroups.json delete mode 100644 sandbox-apis/nova/src/test/resources/test_list_sharedipgroups_detail.json diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaAsyncClient.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaAsyncClient.java index 73bbab0d57..9dec5dfe32 100644 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaAsyncClient.java +++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaAsyncClient.java @@ -31,14 +31,11 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import org.jclouds.openstack.nova.binders.BindBackupScheduleToJsonPayload; import org.jclouds.openstack.nova.domain.Addresses; -import org.jclouds.openstack.nova.domain.BackupSchedule; import org.jclouds.openstack.nova.domain.Flavor; import org.jclouds.openstack.nova.domain.Image; import org.jclouds.openstack.nova.domain.RebootType; import org.jclouds.openstack.nova.domain.Server; -import org.jclouds.openstack.nova.domain.SharedIpGroup; import org.jclouds.openstack.nova.options.CreateServerOptions; import org.jclouds.openstack.nova.options.CreateSharedIpGroupOptions; import org.jclouds.openstack.nova.options.ListOptions; @@ -170,25 +167,6 @@ public interface NovaAsyncClient { @MapBinder(RebuildServerOptions.class) ListenableFuture rebuildServer(@PathParam("id") int id, RebuildServerOptions... options); - /** - * @see NovaClient#shareIp - */ - @PUT - @Path("/servers/{id}/ips/public/{address}") - @Produces(MediaType.APPLICATION_JSON) - @Payload("%7B\"shareIp\":%7B\"sharedIpGroupId\":{sharedIpGroupId},\"configureServer\":{configureServer}%7D%7D") - ListenableFuture shareIp(@PathParam("address") String addressToShare, - @PathParam("id") int serverToTosignBindressTo, @PayloadParam("sharedIpGroupId") int sharedIpGroup, - @PayloadParam("configureServer") boolean configureServer); - - /** - * @see NovaClient#unshareIp - */ - @DELETE - @Path("/servers/{id}/ips/public/{address}") - @ExceptionParser(ReturnVoidOnNotFoundOr404.class) - ListenableFuture unshareIp(@PathParam("address") String addressToShare, - @PathParam("id") int serverToTosignBindressTo); /** * @see NovaClient#changeAdminPass @@ -273,75 +251,6 @@ public interface NovaAsyncClient { ListenableFuture createImageFromServer(@PayloadParam("name") String imageName, @PayloadParam("serverId") int serverId); - /** - * @see NovaClient#listSharedIpGroups - */ - @GET - @Unwrap - @Consumes(MediaType.APPLICATION_JSON) - @QueryParams(keys = "format", values = "json") - @Path("/shared_ip_groups") - @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listSharedIpGroups(ListOptions... options); - - /** - * @see NovaClient#getSharedIpGroup - */ - @GET - @Unwrap - @Consumes(MediaType.APPLICATION_JSON) - @QueryParams(keys = "format", values = "json") - @Path("/shared_ip_groups/{id}") - @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getSharedIpGroup(@PathParam("id") int id); - - /** - * @see NovaClient#createSharedIpGroup - */ - @POST - @Unwrap - @Consumes(MediaType.APPLICATION_JSON) - @QueryParams(keys = "format", values = "json") - @Path("/shared_ip_groups") - @MapBinder(CreateSharedIpGroupOptions.class) - ListenableFuture createSharedIpGroup(@PayloadParam("name") String name, - CreateSharedIpGroupOptions... options); - - /** - * @see NovaClient#deleteSharedIpGroup - */ - @DELETE - @ExceptionParser(ReturnFalseOnNotFoundOr404.class) - @Path("/shared_ip_groups/{id}") - ListenableFuture deleteSharedIpGroup(@PathParam("id") int id); - - /** - * @see NovaClient#listBackupSchedule - */ - @GET - @Unwrap - @Consumes(MediaType.APPLICATION_JSON) - @QueryParams(keys = "format", values = "json") - @Path("/servers/{id}/backup_schedule") - ListenableFuture getBackupSchedule(@PathParam("id") int serverId); - - /** - * @see NovaClient#deleteBackupSchedule - */ - @DELETE - @ExceptionParser(ReturnFalseOnNotFoundOr404.class) - @Path("/servers/{id}/backup_schedule") - ListenableFuture deleteBackupSchedule(@PathParam("id") int serverId); - - /** - * @see NovaClient#replaceBackupSchedule - */ - @POST - @ExceptionParser(ReturnFalseOn404.class) - @Path("/servers/{id}/backup_schedule") - ListenableFuture replaceBackupSchedule(@PathParam("id") int id, - @BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule); - /** * @see NovaClient#listAddresses */ diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaClient.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaClient.java index 22acaf2ce6..01e3f7a4a3 100644 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaClient.java +++ b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/NovaClient.java @@ -26,12 +26,10 @@ import javax.ws.rs.PathParam; import org.jclouds.concurrent.Timeout; import org.jclouds.openstack.nova.domain.Addresses; -import org.jclouds.openstack.nova.domain.BackupSchedule; import org.jclouds.openstack.nova.domain.Flavor; import org.jclouds.openstack.nova.domain.Image; import org.jclouds.openstack.nova.domain.RebootType; import org.jclouds.openstack.nova.domain.Server; -import org.jclouds.openstack.nova.domain.SharedIpGroup; import org.jclouds.openstack.nova.options.CreateServerOptions; import org.jclouds.openstack.nova.options.CreateSharedIpGroupOptions; import org.jclouds.openstack.nova.options.ListOptions; @@ -173,40 +171,6 @@ public interface NovaClient { */ void rebuildServer(int id, RebuildServerOptions... options); - /** - * /** This operation allows you share an IP address to the specified server - *

- * This operation shares an IP from an existing server in the specified shared IP group to - * another specified server in the same group. The operation modifies cloud network restrictions - * to allow IP traffic for the given IP to/from the server specified. - * - *

- * Status Transition: ACTIVE - SHARE_IP - ACTIVE (if configureServer is true) ACTIVE - - * SHARE_IP_NO_CONFIG - ACTIVE - * - * @param configureServer - *

- * if set to true, the server is configured with the new address, though the address is - * not enabled. Note that configuring the server does require a reboot. - *

- * If set to false, does not bind the IP to the server itself. A heartbeat facility - * (e.g. keepalived) can then be used within the servers to perform health checks and - * manage IP failover. - */ - void shareIp(String addressToShare, int serverToTosignBindressTo, int sharedIpGroup, - boolean configureServer); - - /** - * This operation removes a shared IP address from the specified server. - *

- * Status Transition: ACTIVE - DELETE_IP - ACTIVE - * - * @param addressToShare - * @param serverToTosignBindressTo - * @return - */ - void unshareIp(String addressToShare, int serverToTosignBindressTo); - /** * This operation allows you to change the administrative password. *

@@ -295,66 +259,6 @@ public interface NovaClient { */ Image createImageFromServer(String imageName, int serverId); - /** - * - * List shared IP groups (IDs and names only) - * - * in order to retrieve all details, pass the option {@link ListOptions#withDetails() - * withDetails()} - */ - Set listSharedIpGroups(ListOptions... options); - - /** - * - * This operation returns details of the specified shared IP group. - * - * @return null, if the shared ip group is not found - * - * @see SharedIpGroup - */ - SharedIpGroup getSharedIpGroup(int id); - - /** - * This operation creates a new shared IP group. Please note, all responses to requests for - * shared_ip_groups return an array of servers. However, on a create request, the shared IP group - * can be created empty or can be initially populated with a single server. Use - * {@link CreateSharedIpGroupOptions} to specify an server. - */ - SharedIpGroup createSharedIpGroup(String name, CreateSharedIpGroupOptions... options); - - /** - * This operation deletes the specified shared IP group. This operation will ONLY succeed if 1) - * there are no active servers in the group (i.e. they have all been terminated) or 2) no servers - * in the group are actively sharing IPs. - * - * @return false if the shared ip group is not found - * @see SharedIpGroup - */ - boolean deleteSharedIpGroup(int id); - - /** - * List the backup schedule for the specified server - * - * @throws ResourceNotFoundException - * , if the server doesn't exist - */ - BackupSchedule getBackupSchedule(int serverId); - - /** - * Delete backup schedule for the specified server. - *

- * Web Hosting #119571 currently disables the schedule, not deletes it. - * - * @return false if the schedule is not found - */ - boolean deleteBackupSchedule(int serverId); - - /** - * Enable/update the backup schedule for the specified server - * - */ - void replaceBackupSchedule(int id, BackupSchedule backupSchedule); - /** * List all server addresses * diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/binders/BindBackupScheduleToJsonPayload.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/binders/BindBackupScheduleToJsonPayload.java deleted file mode 100644 index 30b2916f6e..0000000000 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/binders/BindBackupScheduleToJsonPayload.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.binders; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Map; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpRequest; -import org.jclouds.openstack.nova.domain.BackupSchedule; -import org.jclouds.rest.binders.BindToJsonPayload; - -import com.google.common.collect.ImmutableMap; - -/** - * - * @author Adrian Cole - * - */ -@Singleton -public class BindBackupScheduleToJsonPayload extends BindToJsonPayload { - - @Override - public R bindToRequest(R request, Map postParams) { - throw new IllegalStateException( - "Replace Backup Schedule needs an BackupSchedule object, not a Map"); - } - - @Override - public R bindToRequest(R request, Object toBind) { - checkArgument(toBind instanceof BackupSchedule, - "this binder is only valid for BackupSchedules!"); - return super.bindToRequest(request, ImmutableMap.of("backupSchedule", toBind)); - } -} diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/BackupSchedule.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/BackupSchedule.java deleted file mode 100644 index 18087b0318..0000000000 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/BackupSchedule.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.domain; - -/** - * A backup schedule can be defined to create server images at regular intervals (daily and weekly). - * Backup schedules are configurable per server. - * - * @author Adrian Cole - */ -public class BackupSchedule { - protected DailyBackup daily = DailyBackup.DISABLED; - protected boolean enabled; - protected WeeklyBackup weekly = WeeklyBackup.DISABLED; - - public BackupSchedule() { - } - - public BackupSchedule(WeeklyBackup weekly, DailyBackup daily, boolean enabled) { - this.weekly = weekly; - this.daily = daily; - this.enabled = enabled; - } - - public DailyBackup getDaily() { - return daily; - } - - public void setDaily(DailyBackup value) { - this.daily = value; - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean value) { - this.enabled = value; - } - - public WeeklyBackup getWeekly() { - return weekly; - } - - public void setWeekly(WeeklyBackup value) { - this.weekly = value; - } - - @Override - public String toString() { - return "[daily=" + daily + ", enabled=" + enabled + ", weekly=" + weekly + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((daily == null) ? 0 : daily.hashCode()); - result = prime * result + (enabled ? 1231 : 1237); - result = prime * result + ((weekly == null) ? 0 : weekly.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BackupSchedule other = (BackupSchedule) obj; - if (daily == null) { - if (other.daily != null) - return false; - } else if (!daily.equals(other.daily)) - return false; - if (enabled != other.enabled) - return false; - if (weekly == null) { - if (other.weekly != null) - return false; - } else if (!weekly.equals(other.weekly)) - return false; - return true; - } - -} diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/DailyBackup.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/DailyBackup.java deleted file mode 100644 index 6a6518bdc6..0000000000 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/DailyBackup.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.domain; - -public enum DailyBackup { - - DISABLED, H_0000_0200, H_0200_0400, H_0400_0600, H_0600_0800, H_0800_1000, H_1000_1200, H_1200_1400, H_1400_1600, H_1600_1800, H_1800_2000, H_2000_2200, H_2200_0000, UNRECOGNIZED; - - public String value() { - return name(); - } - - public static DailyBackup fromValue(String v) { - try { - return valueOf(v); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - -} diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/ShareIp.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/ShareIp.java deleted file mode 100644 index d8284f6aad..0000000000 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/ShareIp.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.domain; - -public class ShareIp { - - private boolean configureServer; - private int sharedIpGroupId; - - public void setConfigureServer(boolean configureServer) { - this.configureServer = configureServer; - } - - public boolean isConfigureServer() { - return configureServer; - } - - public void setSharedIpGroupId(int sharedIpGroupId) { - this.sharedIpGroupId = sharedIpGroupId; - } - - public int getSharedIpGroupId() { - return sharedIpGroupId; - } - -} diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/SharedIpGroup.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/SharedIpGroup.java deleted file mode 100644 index f46690013c..0000000000 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/SharedIpGroup.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.domain; - -import java.util.List; - -import com.google.common.collect.Lists; - -/** - * A shared IP group is a collection of servers that can share IPs with other members of the group. - * Any server in a group can share one or more public IPs with any other server in the group. With - * the exception of the first server in a shared IP group, servers must be launched into shared IP - * groups. A server may only be a member of one shared IP group. - * - * @author Adrian Cole - */ -public class SharedIpGroup { - - private int id; - private String name; - - private List servers = Lists.newArrayList(); - - public SharedIpGroup() { - } - - public SharedIpGroup(int id, String name) { - this.id = id; - this.name = name; - } - - public void setId(int id) { - this.id = id; - } - - public int getId() { - return id; - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setServers(List servers) { - this.servers = servers; - } - - public List getServers() { - return servers; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + id; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((servers == null) ? 0 : servers.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SharedIpGroup other = (SharedIpGroup) obj; - if (id != other.id) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (servers == null) { - if (other.servers != null) - return false; - } else if (!servers.equals(other.servers)) - return false; - return true; - } - - @Override - public String toString() { - return "SharedIpGroup [id=" + id + ", name=" + name + ", servers=" + servers + "]"; - } - -} diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Version.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Version.java deleted file mode 100644 index d2fa91f94d..0000000000 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/Version.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.domain; - -public class Version { - - private String docURL; - private String id = "v1.0"; - private VersionStatus status; - private String wadl; - - public void setDocURL(String docURL) { - this.docURL = docURL; - } - - public String getDocURL() { - return docURL; - } - - public void setId(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - public void setStatus(VersionStatus status) { - this.status = status; - } - - public VersionStatus getStatus() { - return status; - } - - public void setWadl(String wadl) { - this.wadl = wadl; - } - - public String getWadl() { - return wadl; - } -} diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/VersionStatus.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/VersionStatus.java deleted file mode 100644 index f3270887dd..0000000000 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/VersionStatus.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.domain; - -public enum VersionStatus { - - BETA, CURRENT, DEPRECATED, UNRECOGNIZED; - - public String value() { - return name(); - } - - public static VersionStatus fromValue(String v) { - try { - return valueOf(v); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - -} diff --git a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/WeeklyBackup.java b/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/WeeklyBackup.java deleted file mode 100644 index f637b366ac..0000000000 --- a/sandbox-apis/nova/src/main/java/org/jclouds/openstack/nova/domain/WeeklyBackup.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.domain; - -public enum WeeklyBackup { - - DISABLED, SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, UNRECOGNIZED; - - public String value() { - return name(); - } - - public static WeeklyBackup fromValue(String v) { - try { - return valueOf(v); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - -} diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/NovaAsyncClientTest.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/NovaAsyncClientTest.java index 07052ec444..2da320c57a 100644 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/NovaAsyncClientTest.java +++ b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/NovaAsyncClientTest.java @@ -32,10 +32,7 @@ import org.jclouds.openstack.TestOpenStackAuthenticationModule; import org.jclouds.openstack.filters.AddTimestampQuery; import org.jclouds.openstack.filters.AuthenticateRequest; import org.jclouds.openstack.nova.config.NovaRestClientModule; -import org.jclouds.openstack.nova.domain.BackupSchedule; -import org.jclouds.openstack.nova.domain.DailyBackup; import org.jclouds.openstack.nova.domain.RebootType; -import org.jclouds.openstack.nova.domain.WeeklyBackup; import org.jclouds.openstack.nova.options.CreateServerOptions; import org.jclouds.openstack.nova.options.CreateSharedIpGroupOptions; import org.jclouds.openstack.nova.options.ListOptions; @@ -96,25 +93,6 @@ public class NovaAsyncClientTest extends RestClientTest { } - @Test - public void testCreateServerWithIpGroup() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("createServer", String.class, int.class, int.class, - createServerOptionsVarargsClass); - HttpRequest request = processor.createRequest(method, "ralphie", 2, 1, withSharedIpGroup(2)); - - assertRequestLineEquals(request, "POST http://endpoint/vapiversion/servers?format=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, - "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"sharedIpGroupId\":2}}", - "application/json", false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - @Test public void testCreateServerWithFile() throws IOException, SecurityException, NoSuchMethodException { Method method = NovaAsyncClient.class.getMethod("createServer", String.class, int.class, int.class, @@ -158,27 +136,6 @@ public class NovaAsyncClientTest extends RestClientTest { } - public void testCreateServerWithIpGroupAndSharedIp() throws IOException, SecurityException, NoSuchMethodException, - UnknownHostException { - Method method = NovaAsyncClient.class.getMethod("createServer", String.class, int.class, int.class, - createServerOptionsVarargsClass); - HttpRequest request = processor.createRequest(method, "ralphie", 2, 1, - withSharedIpGroup(2).withSharedIp("127.0.0.1")); - - assertRequestLineEquals(request, "POST http://endpoint/vapiversion/servers?format=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals( - request, - "{\"server\":{\"name\":\"ralphie\",\"imageId\":2,\"flavorId\":1,\"sharedIpGroupId\":2,\"addresses\":{\"public\":[\"127.0.0.1\"]}}}", - "application/json", false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - public void testDeleteImage() throws IOException, SecurityException, NoSuchMethodException { Method method = NovaAsyncClient.class.getMethod("deleteImage", int.class); HttpRequest request = processor.createRequest(method, 2); @@ -426,94 +383,6 @@ public class NovaAsyncClientTest extends RestClientTest { checkFilters(request); } - public void testShareIpNoConfig() throws IOException, SecurityException, NoSuchMethodException, UnknownHostException { - Method method = NovaAsyncClient.class.getMethod("shareIp", String.class, int.class, int.class, - boolean.class); - HttpRequest request = processor.createRequest(method, "127.0.0.1", 2, 3, false); - - assertRequestLineEquals(request, "PUT http://endpoint/vapiversion/servers/2/ips/public/127.0.0.1 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, "{\"shareIp\":{\"sharedIpGroupId\":3,\"configureServer\":false}}", - MediaType.APPLICATION_JSON, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - - } - - public void testShareIpConfig() throws IOException, SecurityException, NoSuchMethodException, UnknownHostException { - Method method = NovaAsyncClient.class.getMethod("shareIp", String.class, int.class, int.class, - boolean.class); - HttpRequest request = processor.createRequest(method, "127.0.0.1", 2, 3, true); - - assertRequestLineEquals(request, "PUT http://endpoint/vapiversion/servers/2/ips/public/127.0.0.1 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, "{\"shareIp\":{\"sharedIpGroupId\":3,\"configureServer\":true}}", - MediaType.APPLICATION_JSON, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - - } - - public void testUnshareIpNoConfig() throws IOException, SecurityException, NoSuchMethodException, - UnknownHostException { - Method method = NovaAsyncClient.class.getMethod("unshareIp", String.class, int.class); - HttpRequest request = processor.createRequest(method, "127.0.0.1", 2, 3, false); - - assertRequestLineEquals(request, "DELETE http://endpoint/vapiversion/servers/2/ips/public/127.0.0.1 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); - - checkFilters(request); - - } - - public void testReplaceBackupSchedule() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("replaceBackupSchedule", int.class, BackupSchedule.class); - HttpRequest request = processor.createRequest(method, 2, new BackupSchedule(WeeklyBackup.MONDAY, - DailyBackup.H_0800_1000, true)); - - assertRequestLineEquals(request, "POST http://endpoint/vapiversion/servers/2/backup_schedule HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, - "{\"backupSchedule\":{\"daily\":\"H_0800_1000\",\"enabled\":true,\"weekly\":\"MONDAY\"}}", - MediaType.APPLICATION_JSON, false); - - assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnFalseOn404.class); - - checkFilters(request); - - } - - public void testDeleteBackupSchedule() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("deleteBackupSchedule", int.class); - HttpRequest request = processor.createRequest(method, 2); - - assertRequestLineEquals(request, "DELETE http://endpoint/vapiversion/servers/2/backup_schedule HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, MediaType.APPLICATION_JSON, false); - - assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class); - - checkFilters(request); - - } - public void testChangeAdminPass() throws IOException, SecurityException, NoSuchMethodException { Method method = NovaAsyncClient.class.getMethod("changeAdminPass", int.class, String.class); HttpRequest request = processor.createRequest(method, 2, "foo"); @@ -546,135 +415,6 @@ public class NovaAsyncClientTest extends RestClientTest { } - public void testListSharedIpGroups() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("listSharedIpGroups", listOptionsVarargsClass); - HttpRequest request = processor.createRequest(method); - - assertRequestLineEquals(request, "GET http://endpoint/vapiversion/shared_ip_groups?format=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(request); - } - - public void testListSharedIpGroupsOptions() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("listSharedIpGroups", listOptionsVarargsClass); - HttpRequest request = processor.createRequest(method, changesSince(now).maxResults(1).startAt(2)); - - assertRequestLineEquals(request, - "GET http://endpoint/vapiversion/shared_ip_groups?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(request); - } - - public void testListSharedIpGroupsDetail() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("listSharedIpGroups", listOptionsVarargsClass); - HttpRequest request = processor.createRequest(method, withDetails()); - - assertRequestLineEquals(request, "GET http://endpoint/vapiversion/shared_ip_groups/detail?format=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(request); - } - - public void testListSharedIpGroupsDetailOptions() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("listSharedIpGroups", listOptionsVarargsClass); - HttpRequest request = processor.createRequest(method, withDetails().changesSince(now).maxResults(1).startAt(2)); - - assertRequestLineEquals(request, - "GET http://endpoint/vapiversion/shared_ip_groups/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); - - checkFilters(request); - } - - public void testGetSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("getSharedIpGroup", int.class); - HttpRequest request = processor.createRequest(method, 2); - - assertRequestLineEquals(request, "GET http://endpoint/vapiversion/shared_ip_groups/2?format=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); - - checkFilters(request); - } - - private static final Class createSharedIpGroupOptionsVarargsClass = new CreateSharedIpGroupOptions[]{} - .getClass(); - - public void testCreateSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("createSharedIpGroup", String.class, - createSharedIpGroupOptionsVarargsClass); - HttpRequest request = processor.createRequest(method, "ralphie"); - - assertRequestLineEquals(request, "POST http://endpoint/vapiversion/shared_ip_groups?format=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, "{\"sharedIpGroup\":{\"name\":\"ralphie\"}}", MediaType.APPLICATION_JSON, false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - - } - - public void testCreateSharedIpGroupWithIpGroup() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("createSharedIpGroup", String.class, - createSharedIpGroupOptionsVarargsClass); - HttpRequest request = processor.createRequest(method, "ralphie", withServer(2)); - - assertRequestLineEquals(request, "POST http://endpoint/vapiversion/shared_ip_groups?format=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, "{\"sharedIpGroup\":{\"name\":\"ralphie\",\"server\":2}}", - MediaType.APPLICATION_JSON, false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, null); - - checkFilters(request); - } - - public void testDeleteSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("deleteSharedIpGroup", int.class); - HttpRequest request = processor.createRequest(method, 2); - - assertRequestLineEquals(request, "DELETE http://endpoint/vapiversion/shared_ip_groups/2 HTTP/1.1"); - assertNonPayloadHeadersEqual(request, ""); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class); - - checkFilters(request); - } - public void testListAddresses() throws IOException, SecurityException, NoSuchMethodException { Method method = NovaAsyncClient.class.getMethod("getAddresses", int.class); HttpRequest request = processor.createRequest(method, 2); @@ -721,22 +461,6 @@ public class NovaAsyncClientTest extends RestClientTest { checkFilters(request); } - @Test - public void testListBackupSchedule() throws IOException, SecurityException, NoSuchMethodException { - Method method = NovaAsyncClient.class.getMethod("getBackupSchedule", int.class); - HttpRequest request = processor.createRequest(method, 2); - - assertRequestLineEquals(request, "GET http://endpoint/vapiversion/servers/2/backup_schedule?format=json HTTP/1.1"); - assertNonPayloadHeadersEqual(request, "Accept: application/json\n"); - assertPayloadEquals(request, null, null, false); - - assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); - assertSaxResponseParserClassEquals(method, null); - assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); - - checkFilters(request); - } - @Test public void testCreateImageWithIpGroup() throws IOException, SecurityException, NoSuchMethodException { Method method = NovaAsyncClient.class.getMethod("createImageFromServer", String.class, int.class); diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/NovaClientLiveTest.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/NovaClientLiveTest.java index e23449bd10..47375f4e8e 100644 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/NovaClientLiveTest.java +++ b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/NovaClientLiveTest.java @@ -260,68 +260,6 @@ public class NovaClientLiveTest { assert client.getFlavor(12312987) == null; } - public void testListSharedIpGroups() throws Exception { - Set response = client.listSharedIpGroups(); - assert null != response; - long sharedIpGroupCount = response.size(); - assertTrue(sharedIpGroupCount >= 0); - for (SharedIpGroup sharedIpGroup : response) { - assertTrue(sharedIpGroup.getId() >= 0); - assert null != sharedIpGroup.getName() : sharedIpGroup; - } - - } - - public void testListSharedIpGroupsDetail() throws Exception { - Set response = client.listSharedIpGroups(withDetails()); - assert null != response; - long sharedIpGroupCount = response.size(); - assertTrue(sharedIpGroupCount >= 0); - for (SharedIpGroup sharedIpGroup : response) { - assertTrue(sharedIpGroup.getId() >= 1); - assert null != sharedIpGroup.getName() : sharedIpGroup; - assert null != sharedIpGroup.getServers() : sharedIpGroup; - } - } - - public void testGetSharedIpGroupsDetail() throws Exception { - Set response = client.listSharedIpGroups(withDetails()); - assert null != response; - long sharedIpGroupCount = response.size(); - assertTrue(sharedIpGroupCount >= 0); - for (SharedIpGroup sharedIpGroup : response) { - SharedIpGroup newDetails = client.getSharedIpGroup(sharedIpGroup.getId()); - assertEquals(sharedIpGroup, newDetails); - } - } - - @Test - public void testGetSharedIpGroupDetailsNotFound() throws Exception { - assert client.getSharedIpGroup(12312987) == null; - } - - @Test(enabled = false, timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateServer") - public void testCreateSharedIpGroup() throws Exception { - SharedIpGroup sharedIpGroup = null; - while (sharedIpGroup == null) { - String sharedIpGroupName = serverPrefix + "createSharedIpGroup" + new SecureRandom().nextInt(); - try { - sharedIpGroup = client.createSharedIpGroup(sharedIpGroupName, withServer(serverId)); - } catch (UndeclaredThrowableException e) { - HttpResponseException htpe = (HttpResponseException) e.getCause().getCause(); - if (htpe.getResponse().getStatusCode() == 400) - continue; - throw e; - } - } - assertNotNull(sharedIpGroup.getName()); - sharedIpGroupId = sharedIpGroup.getId(); - // Response doesn't include the server id Web Hosting #119311 - // assertEquals(sharedIpGroup.getServers(), ImmutableList.of(serverId)); - } - - private int sharedIpGroupId; - private String serverPrefix = System.getProperty("user.name") + ".cs"; private int serverId; private String adminPass; @@ -468,33 +406,6 @@ public class NovaClientLiveTest { this.adminPass = "elmo"; } - @Test(enabled = false, timeOut = 5 * 60 * 1000, dependsOnMethods = "testCreateSharedIpGroup") - public void testCreateServerIp() throws Exception { - int imageId = 14362; - int flavorId = 1; - Server server = null; - while (server == null) { - String serverName = serverPrefix + "createserver" + new SecureRandom().nextInt(); - try { - server = client - .createServer(serverName, imageId, flavorId, withFile("/etc/jclouds.txt", "rackspace".getBytes()) - .withMetadata(metadata).withSharedIpGroup(sharedIpGroupId).withSharedIp(ip)); - } catch (UndeclaredThrowableException e) { - HttpResponseException htpe = (HttpResponseException) e.getCause().getCause(); - if (htpe.getResponse().getStatusCode() == 400) - continue; - throw e; - } - } - assertNotNull(server.getAdminPass()); - serverId2 = server.getId(); - adminPass2 = server.getAdminPass(); - blockUntilServerActive(serverId2); - assertIpConfigured(server, adminPass2); - assert server.getAddresses().getPublicAddresses().contains(ip) : server.getAddresses() + " doesn't contain " + ip; - assertEquals(server.getSharedIpGroupId(), new Integer(sharedIpGroupId)); - } - private void assertIpConfigured(Server server, String password) { try { ExecResponse response = exec(server, password, "ifconfig -a"); @@ -507,15 +418,6 @@ public class NovaClientLiveTest { } } - @Test(enabled = false, timeOut = 10 * 60 * 1000, dependsOnMethods = "testCreateServerIp") - public void testUnshare() throws Exception { - client.unshareIp(ip, serverId2); - blockUntilServerActive(serverId2); - Server server = client.getServer(serverId2); - assert !server.getAddresses().getPublicAddresses().contains(ip) : server.getAddresses(); - assertIpNotConfigured(server, adminPass2); - } - private void assertIpNotConfigured(Server server, String password) { try { ExecResponse response = exec(server, password, "ifconfig -a"); @@ -528,39 +430,6 @@ public class NovaClientLiveTest { } } - @Test(enabled = false, timeOut = 10 * 60 * 1000, dependsOnMethods = "testUnshare") - public void testShareConfig() throws Exception { - client.shareIp(ip, serverId2, sharedIpGroupId, true); - blockUntilServerActive(serverId2); - Server server = client.getServer(serverId2); - assert server.getAddresses().getPublicAddresses().contains(ip) : server.getAddresses(); - assertIpConfigured(server, adminPass2); - testUnshare(); - } - - @Test(enabled = false, timeOut = 10 * 60 * 1000, dependsOnMethods = "testShareConfig") - public void testShareNoConfig() throws Exception { - client.shareIp(ip, serverId2, sharedIpGroupId, false); - blockUntilServerActive(serverId2); - Server server = client.getServer(serverId2); - assert server.getAddresses().getPublicAddresses().contains(ip) : server.getAddresses(); - assertIpNotConfigured(server, adminPass2); - testUnshare(); - } - - @Test(enabled = false, timeOut = 10 * 60 * 1000, dependsOnMethods = "testShareNoConfig") - public void testBackup() throws Exception { - assertEquals(new BackupSchedule(), client.getBackupSchedule(serverId)); - BackupSchedule dailyWeekly = new BackupSchedule(); - dailyWeekly.setEnabled(true); - dailyWeekly.setWeekly(WeeklyBackup.FRIDAY); - dailyWeekly.setDaily(DailyBackup.H_0400_0600); - client.replaceBackupSchedule(serverId, dailyWeekly); - client.deleteBackupSchedule(serverId); - // disables, doesn't delete: Web Hosting #119571 - assertEquals(client.getBackupSchedule(serverId).isEnabled(), false); - } - @Test(enabled = false, timeOut = 10 * 60 * 1000, dependsOnMethods = "testBackup") public void testCreateImage() throws Exception { Image image = client.createImageFromServer("hoofie", serverId); @@ -633,14 +502,6 @@ public class NovaClientLiveTest { } } - @Test(enabled = false, timeOut = 10 * 60 * 1000, dependsOnMethods = {"deleteServer1"}) - void testDeleteSharedIpGroup() { - if (sharedIpGroupId > 0) { - client.deleteSharedIpGroup(sharedIpGroupId); - assert client.getSharedIpGroup(sharedIpGroupId) == null; - } - } - @AfterTest void deleteServersOnEnd() { if (serverId > 0) { @@ -649,8 +510,5 @@ public class NovaClientLiveTest { if (serverId2 > 0) { client.deleteServer(serverId2); } - if (sharedIpGroupId > 0) { - client.deleteSharedIpGroup(sharedIpGroupId); - } } } diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseBackupScheduleFromJsonResponseTest.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseBackupScheduleFromJsonResponseTest.java deleted file mode 100644 index 868531c5e7..0000000000 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseBackupScheduleFromJsonResponseTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.functions; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.UnknownHostException; - -import org.jclouds.openstack.nova.domain.BackupSchedule; -import org.jclouds.openstack.nova.domain.DailyBackup; -import org.jclouds.openstack.nova.domain.WeeklyBackup; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.functions.UnwrapOnlyJsonValue; -import org.jclouds.io.Payloads; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code ParseBackupScheduleFromJsonResponse} - * - * @author Adrian Cole - */ -@Test(groups = "unit") -public class ParseBackupScheduleFromJsonResponseTest { - Injector i = Guice.createInjector(new GsonModule()); - - public void testApplyInputStreamDetails() throws UnknownHostException { - InputStream is = getClass().getResourceAsStream("/test_list_backupschedule.json"); - - UnwrapOnlyJsonValue parser = i.getInstance(Key - .get(new TypeLiteral>() { - })); - BackupSchedule response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); - assertEquals(new BackupSchedule(WeeklyBackup.THURSDAY, DailyBackup.H_0400_0600, true), response); - } - - public void testNoSchedule() throws UnknownHostException { - - UnwrapOnlyJsonValue parser = i.getInstance(Key - .get(new TypeLiteral>() { - })); - BackupSchedule response = parser.apply(new HttpResponse(200, "ok", Payloads - .newStringPayload("{\"backupSchedule\":{\"enabled\" : false}}"))); - assertEquals(new BackupSchedule(), response); - } -} diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseSharedIpGroupFromJsonResponseTest.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseSharedIpGroupFromJsonResponseTest.java deleted file mode 100644 index a1c3ad7c77..0000000000 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseSharedIpGroupFromJsonResponseTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.functions; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.UnknownHostException; - -import org.jclouds.openstack.nova.domain.SharedIpGroup; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.functions.UnwrapOnlyJsonValue; -import org.jclouds.io.Payloads; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code ParseSharedIpGroupFromJsonResponse} - * - * @author Adrian Cole - */ -@Test(groups = "unit") -public class ParseSharedIpGroupFromJsonResponseTest { - - Injector i = Guice.createInjector(new GsonModule()); - - public void testApplyInputStreamDetails() throws UnknownHostException { - InputStream is = getClass().getResourceAsStream("/test_get_sharedipgroup_details.json"); - - UnwrapOnlyJsonValue parser = i.getInstance(Key - .get(new TypeLiteral>() { - })); - SharedIpGroup response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); - - assertEquals(response.getId(), 1234); - assertEquals(response.getName(), "Shared IP Group 1"); - assertEquals(response.getServers(), ImmutableList.of(422)); - } -} diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseSharedIpGroupListFromJsonResponseTest.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseSharedIpGroupListFromJsonResponseTest.java deleted file mode 100644 index 3d92b1415c..0000000000 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseSharedIpGroupListFromJsonResponseTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * - * Copyright (C) 2011 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.functions; - -import static org.testng.Assert.assertEquals; - -import java.io.InputStream; -import java.net.UnknownHostException; -import java.util.List; - -import org.jclouds.openstack.nova.domain.SharedIpGroup; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.functions.UnwrapOnlyJsonValue; -import org.jclouds.io.Payloads; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.TypeLiteral; - -/** - * Tests behavior of {@code ParseSharedIpGroupListFromJsonResponse} - * - * @author Adrian Cole - */ -@Test(groups = "unit") -public class ParseSharedIpGroupListFromJsonResponseTest { - - Injector i = Guice.createInjector(new GsonModule()); - - public void testApplyInputStream() { - InputStream is = getClass().getResourceAsStream("/test_list_sharedipgroups.json"); - - List expects = ImmutableList.of(new SharedIpGroup(1234, "Shared IP Group 1"), new SharedIpGroup( - 5678, "Shared IP Group 2")); - - UnwrapOnlyJsonValue> parser = i.getInstance(Key - .get(new TypeLiteral>>() { - })); - List response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); - - assertEquals(response, expects); - - } - - public void testApplyInputStreamDetails() throws UnknownHostException { - InputStream is = getClass().getResourceAsStream("/test_list_sharedipgroups_detail.json"); - - UnwrapOnlyJsonValue> parser = i.getInstance(Key - .get(new TypeLiteral>>() { - })); - List response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))); - - assertEquals(response.get(0).getId(), 1234); - assertEquals(response.get(0).getName(), "Shared IP Group 1"); - assertEquals(response.get(0).getServers(), ImmutableList.of(422, 3445)); - - assertEquals(response.get(1).getId(), 5678); - assertEquals(response.get(1).getName(), "Shared IP Group 2"); - assertEquals(response.get(1).getServers(), ImmutableList.of(23203, 2456, 9891)); - - } - -} diff --git a/sandbox-apis/nova/src/test/resources/test_get_sharedipgroup_details.json b/sandbox-apis/nova/src/test/resources/test_get_sharedipgroup_details.json deleted file mode 100644 index d10f33d656..0000000000 --- a/sandbox-apis/nova/src/test/resources/test_get_sharedipgroup_details.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sharedIpGroup" : { - "id" : 1234, - "name" : "Shared IP Group 1", - "servers" : [422] - } -} \ No newline at end of file diff --git a/sandbox-apis/nova/src/test/resources/test_list_backupschedule.json b/sandbox-apis/nova/src/test/resources/test_list_backupschedule.json deleted file mode 100644 index c2f893a506..0000000000 --- a/sandbox-apis/nova/src/test/resources/test_list_backupschedule.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "backupSchedule" : { - "enabled" : true, - "weekly" : "THURSDAY", - "daily" : "H_0400_0600" - } -} \ No newline at end of file diff --git a/sandbox-apis/nova/src/test/resources/test_list_sharedipgroups.json b/sandbox-apis/nova/src/test/resources/test_list_sharedipgroups.json deleted file mode 100644 index 73717c4a76..0000000000 --- a/sandbox-apis/nova/src/test/resources/test_list_sharedipgroups.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "sharedIpGroups" : [ - { - "id" : 1234, - "name" : "Shared IP Group 1" - }, - { - "id" : 5678, - "name" : "Shared IP Group 2" - } - ] -} \ No newline at end of file diff --git a/sandbox-apis/nova/src/test/resources/test_list_sharedipgroups_detail.json b/sandbox-apis/nova/src/test/resources/test_list_sharedipgroups_detail.json deleted file mode 100644 index de6e37336b..0000000000 --- a/sandbox-apis/nova/src/test/resources/test_list_sharedipgroups_detail.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "sharedIpGroups" : [ - { - "id" : 1234, - "name" : "Shared IP Group 1", - "servers" : [422, 3445] - }, - { - "id" : 5678, - "name" : "Shared IP Group 2", - "servers" : [23203, 2456, 9891] - } - ] -} \ No newline at end of file