From 3f9a0c3183480d150089c0d5a6e507c877f7d121 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steve (ss835w)" Date: Thu, 2 May 2019 09:42:55 -0400 Subject: Enhance Openstack Client Update Openstack Client to support additional fields Updat all formatting issues Issue-ID: SO-1844 Change-Id: I1369e0c18cc25274db8df7e12855a020b8da38da Signed-off-by: Smokowski, Steve (ss835w) --- nova-client/pom.xml | 101 +++++++++++---------- .../woorea/openstack/nova/api/ImagesResource.java | 3 +- .../woorea/openstack/nova/api/ServersResource.java | 83 ++++++++--------- .../nova/api/extensions/AggregatesExtension.java | 80 +++++----------- .../nova/api/extensions/CloudpipesExtension.java | 2 +- .../nova/api/extensions/CredentialsExtension.java | 11 ++- .../api/extensions/FloatingIpDnsExtension.java | 11 ++- .../api/extensions/FloatingIpPoolsExtension.java | 2 +- .../nova/api/extensions/FloatingIpsExtension.java | 11 +-- .../nova/api/extensions/HostsExtension.java | 2 +- .../nova/api/extensions/HypervisorsExtension.java | 2 +- .../nova/api/extensions/KeyPairsExtension.java | 5 +- .../nova/api/extensions/NetworksExtension.java | 12 ++- .../api/extensions/SecurityGroupsExtension.java | 69 ++++++++------ .../nova/api/extensions/SnapshotsExtension.java | 9 +- .../nova/api/extensions/VolumesExtension.java | 23 ++--- .../java/com/woorea/openstack/nova/NovaTest.java | 81 ++++++++--------- .../openstack/nova/api/ImagesResourceTest.java | 3 +- .../openstack/nova/api/ServersResourceTest.java | 54 +++++++---- .../api/extensions/AggregatesExtensionTest.java | 2 +- .../api/extensions/CloudpipesExtensionTest.java | 2 +- .../api/extensions/CredentialsExtensionTest.java | 2 +- .../api/extensions/FloatingIpDnsExtensionTest.java | 2 +- .../extensions/FloatingIpPoolsExtensionTest.java | 2 +- .../api/extensions/FloatingIpsExtensionTest.java | 2 +- .../nova/api/extensions/HostsExtensionTest.java | 2 +- .../nova/api/extensions/KeyPairsExtensionTest.java | 2 +- .../nova/api/extensions/NetworksExtensionTest.java | 2 +- .../extensions/SecurityGroupsExtensionTest.java | 14 +-- .../api/extensions/SnapshotsExtensionTest.java | 2 +- .../nova/api/extensions/VolumesExtensionTest.java | 2 +- 31 files changed, 288 insertions(+), 312 deletions(-) (limited to 'nova-client') diff --git a/nova-client/pom.xml b/nova-client/pom.xml index 14af9d9..0d4d34c 100644 --- a/nova-client/pom.xml +++ b/nova-client/pom.xml @@ -1,51 +1,52 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - nova-client - OpenStack Nova Client - OpenStack Nova Client - - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - - - org.onap.so.libs.openstack-java-sdk - nova-model - ${project.version} - - - org.jmockit - jmockit - 1.19 - test - - - org.onap.so.libs.openstack-java-sdk - openstack-client - test-jar - test - - - junit - junit - test - - - org.mockito - mockito-all - test - - - org.powermock - powermock-module-junit4 - test - - + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + nova-client + OpenStack Nova Client + OpenStack Nova Client + + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + + + org.onap.so.libs.openstack-java-sdk + nova-model + ${project.version} + + + org.jmockit + jmockit + 1.19 + test + + + org.onap.so.libs.openstack-java-sdk + openstack-client + test-jar + test + + + junit + junit + test + + + org.mockito + mockito-all + test + + + org.powermock + powermock-module-junit4 + test + + diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java index cca80e6..16145b5 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java @@ -81,8 +81,7 @@ public class ImagesResource { public class ShowMetadata extends OpenStackRequest { public ShowMetadata(String id) { - super(client, HttpMethod.GET, "/images/" + id + "/metadata", null, - Metadata.class); + super(client, HttpMethod.GET, "/images/" + id + "/metadata", null, Metadata.class); } } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java index c5ff796..5bdd2bb 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java @@ -123,7 +123,7 @@ public class ServersResource { public ShowMetadata(String id) { super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id).append("/metadata"), null, - Metadata.class); + Metadata.class); } } @@ -131,7 +131,7 @@ public class ServersResource { public CreateOrUpdateMetadata(String id, Metadata metadata) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append("/metadata"), - Entity.json(metadata), Metadata.class); + Entity.json(metadata), Metadata.class); } } @@ -139,7 +139,7 @@ public class ServersResource { public ReplaceMetadata(String id, Metadata metadata) { super(client, HttpMethod.PUT, new StringBuilder(SERVERS).append(id).append("/metadata"), - Entity.json(metadata), Metadata.class); + Entity.json(metadata), Metadata.class); } } @@ -147,7 +147,7 @@ public class ServersResource { public DeleteMetadata(String id, String key) { super(client, HttpMethod.DELETE, new StringBuilder(SERVERS).append(id).append("/metadata/").append(key), - null, Void.class); + null, Void.class); } } @@ -162,8 +162,7 @@ public class ServersResource { public class ShowServerAddresses extends OpenStackRequest { public ShowServerAddresses(String id) { - super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id).append("/ips"), null, - Addresses.class); + super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id).append("/ips"), null, Addresses.class); } } @@ -186,8 +185,7 @@ public class ServersResource { public abstract class Action extends OpenStackRequest { public Action(String id, Entity entity, Class returnType) { - super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), entity, - returnType); + super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), entity, returnType); } } @@ -294,7 +292,7 @@ public class ServersResource { public StartServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Start()), Void.class); + Entity.json(new Start()), Void.class); } } @@ -306,7 +304,7 @@ public class ServersResource { public StopServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Stop()), Void.class); + Entity.json(new Stop()), Void.class); } } @@ -325,8 +323,8 @@ public class ServersResource { private String id; public GetVncConsoleServer(String id, GetVncConsole action) { - super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(action), VncConsole.class); + super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action), + VncConsole.class); } } @@ -338,8 +336,8 @@ public class ServersResource { public class GetConsoleOutputServer extends OpenStackRequest { public GetConsoleOutputServer(String id, GetConsoleOutput action) { - super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(action), ConsoleOutput.class); + super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action), + ConsoleOutput.class); } } @@ -352,7 +350,7 @@ public class ServersResource { public PauseServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Pause()), Void.class); + Entity.json(new Pause()), Void.class); } } @@ -360,7 +358,7 @@ public class ServersResource { public UnpauseServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Unpause()), Void.class); + Entity.json(new Unpause()), Void.class); } } @@ -372,7 +370,7 @@ public class ServersResource { public LockServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Lock()), Void.class); + Entity.json(new Lock()), Void.class); } } @@ -384,7 +382,7 @@ public class ServersResource { public UnlockServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Unlock()), Void.class); + Entity.json(new Unlock()), Void.class); } } @@ -392,7 +390,7 @@ public class ServersResource { public SuspendServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Suspend()), Void.class); + Entity.json(new Suspend()), Void.class); } } @@ -400,15 +398,15 @@ public class ServersResource { public ResumeServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Resume()), Void.class); + Entity.json(new Resume()), Void.class); } } public class CreateBackupServer extends OpenStackRequest { public CreateBackupServer(String id, CreateBackup action) { - super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(action), Void.class); + super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action), + Void.class); } } @@ -443,8 +441,8 @@ public class ServersResource { public class RescueServer extends OpenStackRequest { public RescueServer(String id, Rescue action) { - super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(action), Void.class); + super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action), + Void.class); } } @@ -452,7 +450,7 @@ public class ServersResource { public UnrescueServer(String id) { super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(new Unrescue()), Void.class); + Entity.json(new Unrescue()), Void.class); } } @@ -468,38 +466,37 @@ public class ServersResource { public class AssociateFloatingIp extends OpenStackRequest { public AssociateFloatingIp(String id, com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action) { - super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(action), Void.class); + super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action), + Void.class); } } public class DisassociateFloatingIp extends OpenStackRequest { public DisassociateFloatingIp(String id, - com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action) { - super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), - Entity.json(action), Void.class); + com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action) { + super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action), + Void.class); } } public AssociateFloatingIp associateFloatingIp(String serverId, String floatingIpAddress) { - com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp( - floatingIpAddress); + com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action = + new com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp(floatingIpAddress); return new AssociateFloatingIp(serverId, action); } public DisassociateFloatingIp disassociateFloatingIp(String serverId, String floatingIpAddress) { - com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp( - floatingIpAddress); + com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action = + new com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp(floatingIpAddress); return new DisassociateFloatingIp(serverId, action); } public class AttachVolume extends OpenStackRequest { public AttachVolume(String serverId, final VolumeAttachment volumeAttachment) { - super(client, HttpMethod.POST, - new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments"), - Entity.json(volumeAttachment), Void.class); + super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments"), + Entity.json(volumeAttachment), Void.class); } } @@ -507,25 +504,23 @@ public class ServersResource { public DetachVolume(String serverId, String volumeId) { super(client, HttpMethod.DELETE, - new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments/").append(volumeId), - null, Void.class); + new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments/").append(volumeId), + null, Void.class); } } public class ListVolumeAttachments extends OpenStackRequest { public ListVolumeAttachments(String serverId) { - super(client, HttpMethod.GET, - new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments"), null, - VolumeAttachments.class); + super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments"), + null, VolumeAttachments.class); } } public class ShowVolumeAttachment extends OpenStackRequest { public ShowVolumeAttachment(String serverId, String volumeAttachmentId) { - super(client, HttpMethod.GET, - new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments/") + super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments/") .append(volumeAttachmentId), null, VolumeAttachment.class); } } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java index 0a23d8b..3977344 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java @@ -39,13 +39,11 @@ public class AggregatesExtension { return new ShowAggregate(id); } - public UpdateAggregateMetadata updateAggregateMetadata(String id, - String name, String availabilityZone) { + public UpdateAggregateMetadata updateAggregateMetadata(String id, String name, String availabilityZone) { return new UpdateAggregateMetadata(id, name, availabilityZone); } - public CreateAggregate createAggregate(String aggregateName, - String availabilityZoneName) { + public CreateAggregate createAggregate(String aggregateName, String availabilityZoneName) { return new CreateAggregate(aggregateName, availabilityZoneName); } @@ -61,17 +59,14 @@ public class AggregatesExtension { return new RemoveHost(hostId, aggregateId); } - public SetMetadata setMetadata(String aggregateId, - String key, String value) { + public SetMetadata setMetadata(String aggregateId, String key, String value) { return new SetMetadata(aggregateId, key, value); } public class List extends OpenStackRequest { public List() { - super(CLIENT, HttpMethod.GET, "/os-aggregates", - null, - HostAggregates.class); + super(CLIENT, HttpMethod.GET, "/os-aggregates", null, HostAggregates.class); } } @@ -79,27 +74,17 @@ public class AggregatesExtension { public class ShowAggregate extends OpenStackRequest { public ShowAggregate(String id) { - super(CLIENT, HttpMethod.GET, - new StringBuffer("/os-aggregates/").append(id), - null, - HostAggregate.class); + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-aggregates/").append(id), null, HostAggregate.class); } } public class UpdateAggregateMetadata extends OpenStackRequest { - public UpdateAggregateMetadata(String id, - String name, String availabilityZone) { - super(CLIENT, HttpMethod.PUT, - new StringBuffer("/os-aggregates/").append(id), - availabilityZone == null ? - Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}") - : - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": \"" + - availabilityZone + - "\" }}"), + public UpdateAggregateMetadata(String id, String name, String availabilityZone) { + super(CLIENT, HttpMethod.PUT, new StringBuffer("/os-aggregates/").append(id), + availabilityZone == null ? Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}") + : Entity.json("{\"aggregate\": {\"name\": \"" + name + "\", \"availability_zone\": \"" + + availabilityZone + "\" }}"), HostAggregate.class); } @@ -108,18 +93,11 @@ public class AggregatesExtension { public class CreateAggregate extends OpenStackRequest { public CreateAggregate(String name, String availabilityZone) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates"), - availabilityZone == null ? - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": null }}") - : - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": \"" + - availabilityZone + - "\" }}"), + super(CLIENT, HttpMethod.POST, new StringBuffer("/os-aggregates"), + availabilityZone == null + ? Entity.json("{\"aggregate\": {\"name\": \"" + name + "\", \"availability_zone\": null }}") + : Entity.json("{\"aggregate\": {\"name\": \"" + name + "\", \"availability_zone\": \"" + + availabilityZone + "\" }}"), HostAggregate.class); } @@ -128,22 +106,15 @@ public class AggregatesExtension { public class DeleteAggregate extends OpenStackRequest { public DeleteAggregate(String id) { - super(CLIENT, HttpMethod.DELETE, - new StringBuffer("/os-aggregates/").append(id), - null, - null); + super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-aggregates/").append(id), null, null); } } public class AddHost extends OpenStackRequest { public AddHost(String aggregateId, String hostId) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"add_host\": {\"host\": \"" + - hostId + "\" }}"), - HostAggregate.class); + super(CLIENT, HttpMethod.POST, new StringBuffer("/os-aggregates/").append(aggregateId).append("/action"), + Entity.json("{\"add_host\": {\"host\": \"" + hostId + "\" }}"), HostAggregate.class); } } @@ -151,12 +122,8 @@ public class AggregatesExtension { public class RemoveHost extends OpenStackRequest { public RemoveHost(String hostId, String aggregateId) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"remove_host\": {\"host\": \"" + - hostId + "\" }}"), - HostAggregate.class); + super(CLIENT, HttpMethod.POST, new StringBuffer("/os-aggregates/").append(aggregateId).append("/action"), + Entity.json("{\"remove_host\": {\"host\": \"" + hostId + "\" }}"), HostAggregate.class); } } @@ -164,11 +131,8 @@ public class AggregatesExtension { public class SetMetadata extends OpenStackRequest { public SetMetadata(String aggregateId, String key, String value) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"set_metadata\": {\"metadata\": { \"" + - key + "\": \"" + value + "\" }}}"), + super(CLIENT, HttpMethod.POST, new StringBuffer("/os-aggregates/").append(aggregateId).append("/action"), + Entity.json("{\"set_metadata\": {\"metadata\": { \"" + key + "\": \"" + value + "\" }}}"), HostAggregate.class); } } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java index d176bb1..768f73b 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java @@ -62,4 +62,4 @@ public class CloudpipesExtension { -} \ No newline at end of file +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java index 6950827..2ebbd08 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java @@ -23,13 +23,13 @@ import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.nova.model.Certificate; public class CredentialsExtension { - + private final OpenStackClient CLIENT; - + public CredentialsExtension(OpenStackClient client) { CLIENT = client; } - + public Create createCertificate(String id) { return new Create(id); } @@ -41,7 +41,8 @@ public class CredentialsExtension { public class Create extends OpenStackRequest { public Create(String id) { - super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, Certificate.class); + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, + Certificate.class); } } @@ -54,6 +55,6 @@ public class CredentialsExtension { } - + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java index 8442e3d..15f7eba 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java @@ -65,7 +65,8 @@ public class FloatingIpDnsExtension { public CreateDomain(FloatingIpDomain floatingIpDomain) { - super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain), FloatingIpDomain.class); + super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain), + FloatingIpDomain.class); } @@ -74,7 +75,8 @@ public class FloatingIpDnsExtension { public class ShowDomain extends OpenStackRequest { public ShowDomain(String id) { - super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, FloatingIpDomain.class); + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, + FloatingIpDomain.class); } } @@ -95,11 +97,12 @@ public class FloatingIpDnsExtension { public class DeleteDomain extends OpenStackRequest { public DeleteDomain(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, + Void.class); } } -} \ No newline at end of file +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java index c6325d4..62fbf59 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java @@ -44,4 +44,4 @@ public class FloatingIpPoolsExtension { -} \ No newline at end of file +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java index d1ae7f4..716266c 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java @@ -18,8 +18,6 @@ package com.woorea.openstack.nova.api.extensions; import java.util.HashMap; import java.util.Map; - - import com.woorea.openstack.base.client.Entity; import com.woorea.openstack.base.client.HttpMethod; import com.woorea.openstack.base.client.OpenStackClient; @@ -54,7 +52,8 @@ public class FloatingIpsExtension { public class Deallocate extends OpenStackRequest { public Deallocate(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null, + Void.class); } } @@ -64,11 +63,11 @@ public class FloatingIpsExtension { } public Allocate allocate(String pool) { - Entity entity=null; - if(pool!=null) { + Entity entity = null; + if (pool != null) { Map body = new HashMap<>(); body.put("pool", pool); - entity=Entity.json(body); + entity = Entity.json(body); } return new Allocate(entity); } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java index b9c6db4..c042a12 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java @@ -57,4 +57,4 @@ public class HostsExtension { -} \ No newline at end of file +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java index 8331f1f..b092b0c 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java @@ -18,4 +18,4 @@ package com.woorea.openstack.nova.api.extensions; public interface HypervisorsExtension { -} \ No newline at end of file +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java index 4ebbe21..41fca78 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java @@ -65,7 +65,8 @@ public class KeyPairsExtension { public Delete(String name) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null, + Void.class); } } @@ -78,4 +79,4 @@ public class KeyPairsExtension { } -} \ No newline at end of file +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java index d920a06..21f9212 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java @@ -71,7 +71,8 @@ public class NetworksExtension { public class Show extends OpenStackRequest { public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null, Network.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null, + Network.class); } } @@ -79,8 +80,8 @@ public class NetworksExtension { public class Disassociate extends OpenStackRequest { public Disassociate(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(), Entity.json("{\"action\":\"disassociate\"}"), Void.class); - ; + super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(), + Entity.json("{\"action\":\"disassociate\"}"), Void.class);; } } @@ -88,11 +89,12 @@ public class NetworksExtension { public class Delete extends OpenStackRequest { public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null, + Void.class); } } -} \ No newline at end of file +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java index fb9bdc4..5971db6 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java @@ -47,7 +47,8 @@ public class SecurityGroupsExtension { private SecurityGroupForCreate securityGroupForCreate; public Create(SecurityGroupForCreate securityGroupForCreate) { - super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class); + super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), + SecurityGroup.class); this.securityGroupForCreate = securityGroupForCreate; } @@ -61,10 +62,13 @@ public class SecurityGroupsExtension { */ @Deprecated public Show(Integer id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, + SecurityGroup.class); } + public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, + SecurityGroup.class); } } @@ -78,10 +82,13 @@ public class SecurityGroupsExtension { */ @Deprecated public Delete(Integer id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, + new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class); } + public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, + Void.class); } } @@ -91,7 +98,8 @@ public class SecurityGroupsExtension { private SecurityGroupRuleForCreate securityGroupRuleForCreate; public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) { - super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class); + super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), + SecurityGroup.Rule.class); this.securityGroupRuleForCreate = securityGroupRuleForCreate; } } @@ -105,11 +113,15 @@ public class SecurityGroupsExtension { */ @Deprecated public DeleteRule(Integer id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, + new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, + Void.class); } public DeleteRule(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, + new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, + Void.class); } } @@ -117,8 +129,7 @@ public class SecurityGroupsExtension { return new List(); } - public Create createSecurityGroup(String name, - String description) { + public Create createSecurityGroup(String name, String description) { return new Create(new SecurityGroupForCreate(name, description)); } @@ -133,6 +144,7 @@ public class SecurityGroupsExtension { public Show showSecurityGroup(String id) { return new Show(id); } + public Delete deleteSecurityGroup(Integer id) { return new Delete(String.valueOf(id)); } @@ -152,13 +164,13 @@ public class SecurityGroupsExtension { * @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)} */ @Deprecated - public CreateRule createSecurityGroupRule( - Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + public CreateRule createSecurityGroupRule(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, Integer toPort, String cidr) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); + SecurityGroupRuleForCreate securityGroupRuleForCreate = + new SecurityGroupRuleForCreate(parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); return new CreateRule(securityGroupRuleForCreate); } + /** * * @param parentSecurityGroupId @@ -170,36 +182,33 @@ public class SecurityGroupsExtension { * @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)} */ @Deprecated - public CreateRule createSecurityGroupRule( - Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + public CreateRule createSecurityGroupRule(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, Integer toPort, Integer sourceGroupId) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, - sourceGroupId); + SecurityGroupRuleForCreate securityGroupRuleForCreate = + new SecurityGroupRuleForCreate(parentSecurityGroupId, ipProtocol, fromPort, toPort, sourceGroupId); return new CreateRule(securityGroupRuleForCreate); } - public CreateRule createSecurityGroupRule( - String parentSecurityGroupId, String ipProtocol, Integer fromPort, + public CreateRule createSecurityGroupRule(String parentSecurityGroupId, String ipProtocol, Integer fromPort, Integer toPort, String cidr) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); + SecurityGroupRuleForCreate securityGroupRuleForCreate = + new SecurityGroupRuleForCreate(parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); return new CreateRule(securityGroupRuleForCreate); } - public CreateRule createSecurityGroupRule( - String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort, - Integer toPort) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort - ); + public CreateRule createSecurityGroupRule(String parentSecurityGroupId, String sourceGroupId, String ipProtocol, + Integer fromPort, Integer toPort) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = + new SecurityGroupRuleForCreate(parentSecurityGroupId, sourceGroupId, ipProtocol, fromPort, toPort); return new CreateRule(securityGroupRuleForCreate); } + public DeleteRule deleteSecurityGroupRule(String id) { return new DeleteRule(id); } + public DeleteRule deleteSecurityGroupRule(Integer id) { return new DeleteRule(String.valueOf(id)); } -} \ No newline at end of file +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java index 252e55b..dd54e44 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java @@ -77,7 +77,8 @@ public class SnapshotsExtension { public class Show extends OpenStackRequest { public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null, Snapshot.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null, + Snapshot.class); } } @@ -85,7 +86,8 @@ public class SnapshotsExtension { public class ShowMetadata extends OpenStackRequest { public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(), null, Metadata.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(), + null, Metadata.class); } } @@ -93,7 +95,8 @@ public class SnapshotsExtension { public class Delete extends OpenStackRequest { public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null, + Void.class); } } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java index f154b5f..9cc243e 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java @@ -61,8 +61,7 @@ public class VolumesExtension { public class List extends OpenStackRequest { public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail" - : "/os-volumes", null, Volumes.class); + super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail" : "/os-volumes", null, Volumes.class); } } @@ -72,8 +71,7 @@ public class VolumesExtension { public Create(VolumeForCreate volume) { - super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume), - Volume.class); + super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume), Volume.class); } @@ -84,8 +82,8 @@ public class VolumesExtension { public class UploadToImage extends OpenStackRequest { public UploadToImage(VolumeForImageCreate volumeForImageCreate) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") - .append(volumeForImageCreate.getVolumeId() + "/action"), + super(CLIENT, HttpMethod.POST, + new StringBuilder("/volumes/").append(volumeForImageCreate.getVolumeId() + "/action"), Entity.json(volumeForImageCreate), Void.class); } @@ -94,8 +92,7 @@ public class VolumesExtension { public class Show extends OpenStackRequest { public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") - .append(id).toString(), null, Volume.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/").append(id).toString(), null, Volume.class); } } @@ -103,9 +100,8 @@ public class VolumesExtension { public class ShowMetadata extends OpenStackRequest { public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") - .append(id).append("/metadata").toString(), null, - Metadata.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/").append(id).append("/metadata").toString(), + null, Metadata.class); } } @@ -113,10 +109,9 @@ public class VolumesExtension { public class Delete extends OpenStackRequest { public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/") - .append(id).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/").append(id).toString(), null, Void.class); } } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/NovaTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/NovaTest.java index 05314f6..5e8bc61 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/NovaTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/NovaTest.java @@ -1,42 +1,39 @@ -/*- - * ONAP-SO - * ============LICENSE_START======================================================= - * Copyright 2018 Huawei Intellectual Property. All rights reserved. - * ================================================================= - * 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. - * ============LICENSE_END========================================================= - */ -package com.woorea.openstack.nova; - - - -import static org.junit.Assert.fail; - -import org.junit.Test; -public class NovaTest { - - @Test - public void test() { - try - { - Nova nova = new Nova(null); - } - catch(Exception ex) - { - fail("Exception while creating Nova"); - } - - - } - -} +/*- + * ONAP-SO + * ============LICENSE_START======================================================= + * Copyright 2018 Huawei Intellectual Property. All rights reserved. + * ================================================================= + * 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. + * ============LICENSE_END========================================================= + */ +package com.woorea.openstack.nova; + + + +import static org.junit.Assert.fail; +import org.junit.Test; + +public class NovaTest { + + @Test + public void test() { + try { + Nova nova = new Nova(null); + } catch (Exception ex) { + fail("Exception while creating Nova"); + } + + + } + +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/ImagesResourceTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/ImagesResourceTest.java index 4ddc398..57e737b 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/ImagesResourceTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/ImagesResourceTest.java @@ -85,8 +85,7 @@ public class ImagesResourceTest { public class ShowMetadata extends OpenStackRequest { public ShowMetadata(String id) { - super(client, HttpMethod.GET, "/images/" + id + "/metadata", null, - Metadata.class); + super(client, HttpMethod.GET, "/images/" + id + "/metadata", null, Metadata.class); } } diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/ServersResourceTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/ServersResourceTest.java index 094a633..7468801 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/ServersResourceTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/ServersResourceTest.java @@ -27,7 +27,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; - import java.util.Collections; public class ServersResourceTest { @@ -93,7 +92,8 @@ public class ServersResourceTest { final Metadata expectedServer = Mockito.mock(Metadata.class); OpenStackClientMockUtils.getInstance().mockRequestResponse(Metadata.class, expectedServer); Metadata metadata = Mockito.mock(Metadata.class); - final ServersResource.CreateOrUpdateMetadata metadataCreateUpdate = serversResource.createOrUpdateMetadata(SERVER_KEY, metadata); + final ServersResource.CreateOrUpdateMetadata metadataCreateUpdate = + serversResource.createOrUpdateMetadata(SERVER_KEY, metadata); final Metadata actualServer = metadataCreateUpdate.execute(); Assert.assertEquals(expectedServer, actualServer); } @@ -103,14 +103,16 @@ public class ServersResourceTest { final Metadata expectedServer = Mockito.mock(Metadata.class); OpenStackClientMockUtils.getInstance().mockRequestResponse(Metadata.class, expectedServer); Metadata metadata = Mockito.mock(Metadata.class); - final ServersResource.ReplaceMetadata metadataCreateUpdate = serversResource.replaceMetadata(SERVER_KEY, metadata); + final ServersResource.ReplaceMetadata metadataCreateUpdate = + serversResource.replaceMetadata(SERVER_KEY, metadata); final Metadata actualServer = metadataCreateUpdate.execute(); Assert.assertEquals(expectedServer, actualServer); } @Test public void deleteMetadata() { - final ServersResource.DeleteMetadata metadataCreateUpdate = serversResource.deleteMetadata(SERVER_NAME, SERVER_KEY); + final ServersResource.DeleteMetadata metadataCreateUpdate = + serversResource.deleteMetadata(SERVER_NAME, SERVER_KEY); metadataCreateUpdate.execute(); } @@ -124,7 +126,8 @@ public class ServersResourceTest { public void update() { final Server expectedServer = Mockito.mock(Server.class); OpenStackClientMockUtils.getInstance().mockRequestResponse(Server.class, expectedServer); - final ServersResource.UpdateServer metadataCreateUpdate = serversResource.update(SERVER_NAME, SERVER_KEY, I_PV_4, ""); + final ServersResource.UpdateServer metadataCreateUpdate = + serversResource.update(SERVER_NAME, SERVER_KEY, I_PV_4, ""); final Server actualServer = metadataCreateUpdate.execute(); Assert.assertEquals(expectedServer, actualServer); } @@ -133,7 +136,8 @@ public class ServersResourceTest { public void changePassword() { final Server expectedServer = Mockito.mock(Server.class); OpenStackClientMockUtils.getInstance().mockRequestResponse(Server.class, expectedServer); - final ServersResource.ChangePasswordAction metadataCreateUpdate = serversResource.changePassword(SERVER_NAME, SERVER_NAME); + final ServersResource.ChangePasswordAction metadataCreateUpdate = + serversResource.changePassword(SERVER_NAME, SERVER_NAME); final Server actualServer = metadataCreateUpdate.execute(); Assert.assertEquals(expectedServer, actualServer); } @@ -158,7 +162,8 @@ public class ServersResourceTest { public void resize() { final Server expectedServer = Mockito.mock(Server.class); OpenStackClientMockUtils.getInstance().mockRequestResponse(Server.class, expectedServer); - final ServersResource.ResizeAction metadataCreateUpdate = serversResource.resize(SERVER_NAME, SERVER_FLAVOR, DISK_CONFIG); + final ServersResource.ResizeAction metadataCreateUpdate = + serversResource.resize(SERVER_NAME, SERVER_FLAVOR, DISK_CONFIG); final Server actualServer = metadataCreateUpdate.execute(); Assert.assertEquals(expectedServer, actualServer); } @@ -183,7 +188,8 @@ public class ServersResourceTest { @Test public void createImage() { - final ServersResource.CreateImageAction metadataCreateUpdate = serversResource.createImage(SERVER_NAME, SERVER_KEY, Collections.emptyMap()); + final ServersResource.CreateImageAction metadataCreateUpdate = + serversResource.createImage(SERVER_NAME, SERVER_KEY, Collections.emptyMap()); metadataCreateUpdate.execute(); } @@ -203,7 +209,8 @@ public class ServersResourceTest { public void getVncConsole() { final ServerAction.VncConsole console = new ServerAction.VncConsole(); OpenStackClientMockUtils.getInstance().mockRequestResponse(ServerAction.VncConsole.class, console); - final ServersResource.GetVncConsoleServer metadataCreateUpdate = serversResource.getVncConsole(SERVER_NAME, CONSOLE_TYPE); + final ServersResource.GetVncConsoleServer metadataCreateUpdate = + serversResource.getVncConsole(SERVER_NAME, CONSOLE_TYPE); final ServerAction.VncConsole actualConsole = metadataCreateUpdate.execute(); Assert.assertEquals(console, actualConsole); } @@ -212,7 +219,8 @@ public class ServersResourceTest { public void getConsoleOutput() { final ServerAction.ConsoleOutput console = new ServerAction.ConsoleOutput(); OpenStackClientMockUtils.getInstance().mockRequestResponse(ServerAction.ConsoleOutput.class, console); - final ServersResource.GetConsoleOutputServer metadataCreateUpdate = serversResource.getConsoleOutput(SERVER_NAME, Integer.MAX_VALUE); + final ServersResource.GetConsoleOutputServer metadataCreateUpdate = + serversResource.getConsoleOutput(SERVER_NAME, Integer.MAX_VALUE); final ServerAction.ConsoleOutput actualConsole = metadataCreateUpdate.execute(); Assert.assertEquals(console, actualConsole); } @@ -256,14 +264,16 @@ public class ServersResourceTest { @Test public void createBackup() { ServerAction.CreateBackup backup = new ServerAction.CreateBackup(); - final ServersResource.CreateBackupServer metadataCreateUpdate = serversResource.createBackup(SERVER_NAME, backup); + final ServersResource.CreateBackupServer metadataCreateUpdate = + serversResource.createBackup(SERVER_NAME, backup); metadataCreateUpdate.execute(); } @Test public void rescue() { final ServerAction.CreateBackup console = new ServerAction.CreateBackup(); - final ServersResource.CreateBackupServer metadataCreateUpdate = serversResource.createBackup(SERVER_NAME, console); + final ServersResource.CreateBackupServer metadataCreateUpdate = + serversResource.createBackup(SERVER_NAME, console); metadataCreateUpdate.execute(); } @@ -275,25 +285,29 @@ public class ServersResourceTest { @Test public void associateFloatingIp() { - final ServersResource.AssociateFloatingIp metadataCreateUpdate = serversResource.associateFloatingIp(SERVER_NAME, I_PV_4); + final ServersResource.AssociateFloatingIp metadataCreateUpdate = + serversResource.associateFloatingIp(SERVER_NAME, I_PV_4); metadataCreateUpdate.execute(); } @Test public void disassociateFloatingIp() { - final ServersResource.DisassociateFloatingIp metadataCreateUpdate = serversResource.disassociateFloatingIp(SERVER_NAME, I_PV_4); + final ServersResource.DisassociateFloatingIp metadataCreateUpdate = + serversResource.disassociateFloatingIp(SERVER_NAME, I_PV_4); metadataCreateUpdate.execute(); } @Test public void attachVolume() { - final ServersResource.AttachVolume metadataCreateUpdate = serversResource.attachVolume(SERVER_NAME, "volume_id", "device"); + final ServersResource.AttachVolume metadataCreateUpdate = + serversResource.attachVolume(SERVER_NAME, "volume_id", "device"); metadataCreateUpdate.execute(); } @Test public void detachVolume() { - final ServersResource.DetachVolume metadataCreateUpdate = serversResource.detachVolume(SERVER_NAME, "volume_id"); + final ServersResource.DetachVolume metadataCreateUpdate = + serversResource.detachVolume(SERVER_NAME, "volume_id"); metadataCreateUpdate.execute(); } @@ -301,7 +315,8 @@ public class ServersResourceTest { public void listVolumeAttachments() { final VolumeAttachments volumeAttachments = new VolumeAttachments(); OpenStackClientMockUtils.getInstance().mockRequestResponse(VolumeAttachments.class, volumeAttachments); - final ServersResource.ListVolumeAttachments metadataCreateUpdate = serversResource.listVolumeAttachments(SERVER_NAME); + final ServersResource.ListVolumeAttachments metadataCreateUpdate = + serversResource.listVolumeAttachments(SERVER_NAME); final VolumeAttachments actualVolumeAttachments = metadataCreateUpdate.execute(); Assert.assertEquals(volumeAttachments, actualVolumeAttachments); } @@ -310,7 +325,8 @@ public class ServersResourceTest { public void showVolumeAttachment() { final VolumeAttachment volumeAttachment = new VolumeAttachment(); OpenStackClientMockUtils.getInstance().mockRequestResponse(VolumeAttachment.class, volumeAttachment); - final ServersResource.ShowVolumeAttachment metadataCreateUpdate = serversResource.showVolumeAttachment(SERVER_NAME, "volume_id"); + final ServersResource.ShowVolumeAttachment metadataCreateUpdate = + serversResource.showVolumeAttachment(SERVER_NAME, "volume_id"); final VolumeAttachment actualVolumeAttachment = metadataCreateUpdate.execute(); Assert.assertEquals(volumeAttachment, actualVolumeAttachment); } @@ -326,4 +342,4 @@ public class ServersResourceTest { server.setUserData(SERVER_USER_DATA); return server; } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/AggregatesExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/AggregatesExtensionTest.java index c59c1a4..7a990a4 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/AggregatesExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/AggregatesExtensionTest.java @@ -65,4 +65,4 @@ public class AggregatesExtensionTest { aggregatesExtension.setMetadata("test", "test", "test"); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtensionTest.java index b2782d4..1482f4e 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtensionTest.java @@ -36,4 +36,4 @@ public class CloudpipesExtensionTest { cloudpipesExtension.create(new Cloudpipe()); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/CredentialsExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/CredentialsExtensionTest.java index df575fe..c53fb8b 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/CredentialsExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/CredentialsExtensionTest.java @@ -35,4 +35,4 @@ public class CredentialsExtensionTest { credentialsExtension.showCertificate("id"); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtensionTest.java index 5441a7d..1bc4d7c 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtensionTest.java @@ -51,4 +51,4 @@ public class FloatingIpDnsExtensionTest { floatingIpDnsExtension.delete("id"); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtensionTest.java index e40fe5f..0b67b05 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtensionTest.java @@ -30,4 +30,4 @@ public class FloatingIpPoolsExtensionTest { floatingIpPoolsExtension.list(); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtensionTest.java index 48dc825..2cbe224 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtensionTest.java @@ -40,4 +40,4 @@ public class FloatingIpsExtensionTest { floatingIpPoolsExtension.deallocate("test"); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/HostsExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/HostsExtensionTest.java index 3592286..a7d8752 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/HostsExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/HostsExtensionTest.java @@ -35,4 +35,4 @@ public class HostsExtensionTest { hostsExtension.show("test"); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtensionTest.java index 691e149..a04b08c 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtensionTest.java @@ -45,4 +45,4 @@ public class KeyPairsExtensionTest { keyPairsExtension.delete("test"); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/NetworksExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/NetworksExtensionTest.java index 571c51a..15f7f1b 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/NetworksExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/NetworksExtensionTest.java @@ -45,4 +45,4 @@ public class NetworksExtensionTest { networksExtension.disassociate("test"); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtensionTest.java index 1f3c979..650181d 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtensionTest.java @@ -72,20 +72,12 @@ public class SecurityGroupsExtensionTest { @Test public void createSecurityGroupRule2() throws Exception { - securityGroupsExtension.createSecurityGroupRule(12, - "test", - 1, - 1, - "test"); + securityGroupsExtension.createSecurityGroupRule(12, "test", 1, 1, "test"); } @Test public void createSecurityGroupRule3() throws Exception { - securityGroupsExtension.createSecurityGroupRule(1, - "test", - 1, - 1, - 1); + securityGroupsExtension.createSecurityGroupRule(1, "test", 1, 1, 1); } @Test @@ -98,4 +90,4 @@ public class SecurityGroupsExtensionTest { securityGroupsExtension.deleteSecurityGroup(1); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtensionTest.java index 3ceb2ca..8ad61ae 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtensionTest.java @@ -51,4 +51,4 @@ public class SnapshotsExtensionTest { snapshotsExtension.delete("test"); } -} \ No newline at end of file +} diff --git a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/VolumesExtensionTest.java b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/VolumesExtensionTest.java index 7713a70..b7785cf 100644 --- a/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/VolumesExtensionTest.java +++ b/nova-client/src/test/java/com/woorea/openstack/nova/api/extensions/VolumesExtensionTest.java @@ -56,4 +56,4 @@ public class VolumesExtensionTest { volumesExtension.delete("test"); } -} \ No newline at end of file +} -- cgit 1.2.3-korg