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) --- basepath_marker | 1 + ceilometer-client/pom.xml | 47 +- .../woorea/openstack/ceilometer/Ceilometer.java | 16 +- .../ceilometer/QueriableCeilometerCommand.java | 5 +- .../ceilometer/v2/api/MetersResource.java | 2 +- .../ceilometer/v2/api/ResourcesResource.java | 3 +- ceilometer-model/pom.xml | 47 +- .../openstack/ceilometer/v2/model/Meter.java | 17 +- .../openstack/ceilometer/v2/model/Resource.java | 18 +- .../openstack/ceilometer/v2/model/Sample.java | 31 +- .../openstack/ceilometer/v2/model/Statistics.java | 33 +- .../openstack/ceilometer/v2/model/MeterTest.java | 32 +- .../ceilometer/v2/model/ResourceTest.java | 36 +- .../openstack/ceilometer/v2/model/SampleTest.java | 60 +- .../ceilometer/v2/model/StatisticsTest.java | 52 +- cinder-client/pom.xml | 46 +- .../java/com/woorea/openstack/cinder/Cinder.java | 4 +- .../woorea/openstack/cinder/LimitsExtension.java | 4 +- .../openstack/cinder/SchedulerStatsExtension.java | 8 +- .../openstack/cinder/SnapshotsExtension.java | 21 +- .../openstack/cinder/VolumeTypesExtension.java | 4 +- .../woorea/openstack/cinder/VolumesExtension.java | 35 +- cinder-model/pom.xml | 23 +- .../openstack/cinder/model/BaseConnection.java | 8 +- .../openstack/cinder/model/Capabilities.java | 50 +- .../cinder/model/ConnectionForInitialize.java | 5 +- .../cinder/model/ConnectionForTerminate.java | 5 +- .../openstack/cinder/model/ConnectionInfo.java | 14 +- .../com/woorea/openstack/cinder/model/Limits.java | 464 ++++++++------- .../com/woorea/openstack/cinder/model/Link.java | 48 ++ .../woorea/openstack/cinder/model/Metadata.java | 4 +- .../com/woorea/openstack/cinder/model/Pool.java | 9 +- .../com/woorea/openstack/cinder/model/Pools.java | 4 +- .../woorea/openstack/cinder/model/Snapshot.java | 12 +- .../openstack/cinder/model/SnapshotForCreate.java | 21 +- .../openstack/cinder/model/SnapshotForUpdate.java | 11 +- .../woorea/openstack/cinder/model/Snapshots.java | 5 +- .../com/woorea/openstack/cinder/model/Volume.java | 157 +++-- .../openstack/cinder/model/VolumeForCreate.java | 49 +- .../openstack/cinder/model/VolumeForExtend.java | 8 +- .../cinder/model/VolumeForImageCreate.java | 5 +- .../openstack/cinder/model/VolumeForUpdate.java | 11 +- .../woorea/openstack/cinder/model/VolumeType.java | 5 +- .../cinder/model/VolumeTypeForCreate.java | 11 +- .../woorea/openstack/cinder/model/VolumeTypes.java | 5 +- .../com/woorea/openstack/cinder/model/Volumes.java | 16 +- glance-client/pom.xml | 23 +- .../woorea/openstack/glance/ImagesResource.java | 21 +- .../openstack/glance/SharedImagesResource.java | 4 +- glance-model/pom.xml | 47 +- .../com/woorea/openstack/glance/model/Image.java | 182 +++++- .../openstack/glance/model/ImageDownload.java | 4 +- .../woorea/openstack/glance/model/ImageMember.java | 5 +- .../openstack/glance/model/ImageMembers.java | 3 +- .../woorea/openstack/glance/model/ImageUpload.java | 2 +- .../com/woorea/openstack/glance/model/Images.java | 36 +- .../woorea/openstack/glance/model/SharedImage.java | 4 +- .../openstack/glance/model/SharedImages.java | 3 +- .../openstack/glance/model/ImageDownloadTest.java | 3 +- .../openstack/glance/model/ImageMemberTest.java | 17 +- .../openstack/glance/model/ImageMembersTest.java | 29 +- .../woorea/openstack/glance/model/ImageTest.java | 87 ++- .../openstack/glance/model/ImageUploadTest.java | 3 +- .../woorea/openstack/glance/model/ImagesTest.java | 89 +-- .../openstack/glance/model/SharedImageTest.java | 11 +- .../openstack/glance/model/SharedImagesTest.java | 23 +- heat-client/pom.xml | 35 +- .../main/java/com/woorea/openstack/heat/Heat.java | 2 +- .../com/woorea/openstack/heat/StackEvents.java | 30 +- .../java/com/woorea/openstack/heat/HeatTest.java | 2 +- .../openstack/heat/ResourcesResourceTest.java | 2 +- .../woorea/openstack/heat/StackResourceTest.java | 3 +- heat-model/pom.xml | 47 +- .../openstack/heat/model/CreateStackParam.java | 23 +- .../com/woorea/openstack/heat/model/Event.java | 197 ++++--- .../com/woorea/openstack/heat/model/Events.java | 17 +- .../woorea/openstack/heat/model/Explanation.java | 30 +- .../java/com/woorea/openstack/heat/model/Link.java | 5 +- .../com/woorea/openstack/heat/model/Resource.java | 27 +- .../com/woorea/openstack/heat/model/Resources.java | 5 +- .../com/woorea/openstack/heat/model/Stack.java | 160 +++-- .../com/woorea/openstack/heat/model/Stacks.java | 12 +- .../openstack/heat/model/UpdateStackParam.java | 18 +- .../openstack/heat/model/CreateStackParamTest.java | 54 +- .../com/woorea/openstack/heat/model/ErrorTest.java | 27 +- .../openstack/heat/model/ExplanationTest.java | 31 +- .../com/woorea/openstack/heat/model/LinkTest.java | 19 +- .../woorea/openstack/heat/model/OutputTest.java | 22 +- .../woorea/openstack/heat/model/ResourceTest.java | 55 +- .../woorea/openstack/heat/model/ResourcesTest.java | 69 +-- .../com/woorea/openstack/heat/model/StackTest.java | 91 ++- .../woorea/openstack/heat/model/StacksTest.java | 109 ++-- .../openstack/heat/model/UpdateStackParamTest.java | 49 +- keystone-client/pom.xml | 47 +- .../openstack/keystone/api/EndpointsResource.java | 32 +- .../openstack/keystone/api/RolesResource.java | 29 +- .../openstack/keystone/api/ServicesResource.java | 38 +- .../openstack/keystone/api/TenantsResource.java | 38 +- .../openstack/keystone/api/UsersResource.java | 3 +- .../keystone/utils/KeystoneTokenProvider.java | 8 +- .../openstack/keystone/utils/KeystoneUtils.java | 3 +- .../keystone/v3/api/DomainUserRolesResource.java | 8 +- .../openstack/keystone/v3/api/DomainsResource.java | 10 +- .../openstack/keystone/v3/api/GenericResource.java | 27 +- .../openstack/keystone/v3/api/GroupsResource.java | 5 +- .../keystone/v3/api/PoliciesResource.java | 1 - .../keystone/v3/api/ProjectRolesResource.java | 14 +- .../keystone/v3/api/ProjectUserRolesResource.java | 10 +- .../keystone/v3/api/ProjectsResource.java | 15 +- .../openstack/keystone/v3/api/RolesResource.java | 5 +- .../openstack/keystone/v3/api/TokensResource.java | 18 +- .../openstack/keystone/v3/api/UsersResource.java | 15 +- .../woorea/openstack/keystone/KeystoneTest.java | 4 +- .../keystone/api/EndpointsResourceTest.java | 3 +- .../openstack/keystone/api/RolesResourceTest.java | 3 +- .../keystone/api/ServicesResourceTest.java | 3 +- .../keystone/api/TenantsResourceTest.java | 3 +- .../openstack/keystone/api/TokensResourceTest.java | 3 +- .../openstack/keystone/api/UsersResourceTest.java | 3 +- .../keystone/utils/KeystoneTokenProviderTest.java | 7 +- .../keystone/utils/KeystoneUtilsTest.java | 4 +- .../woorea/openstack/keystone/v3/KeystoneTest.java | 3 +- .../keystone/v3/api/DomainsResourceTest.java | 2 +- .../keystone/v3/api/GenericResourceTest.java | 3 +- .../keystone/v3/api/GroupsResourceTest.java | 2 +- .../v3/api/ProjectGroupRolesResourceTest.java | 2 +- .../keystone/v3/api/ProjectRolesResourceTest.java | 2 +- .../v3/api/ProjectUserRolesResourceTest.java | 2 +- .../keystone/v3/api/ProjectsResourceTest.java | 2 +- .../keystone/v3/api/RolesResourceTest.java | 2 +- .../keystone/v3/api/TokensResourceTest.java | 2 +- .../keystone/v3/api/UsersResourceTest.java | 2 +- keystone-model/pom.xml | 47 +- .../woorea/openstack/keystone/model/Access.java | 95 +-- .../openstack/keystone/model/Authentication.java | 4 +- .../woorea/openstack/keystone/model/Endpoint.java | 22 +- .../woorea/openstack/keystone/model/Endpoints.java | 9 +- .../com/woorea/openstack/keystone/model/Error.java | 14 +- .../com/woorea/openstack/keystone/model/Link.java | 10 +- .../woorea/openstack/keystone/model/Metadata.java | 5 +- .../com/woorea/openstack/keystone/model/Role.java | 7 +- .../com/woorea/openstack/keystone/model/Roles.java | 9 +- .../woorea/openstack/keystone/model/Service.java | 16 +- .../woorea/openstack/keystone/model/Services.java | 11 +- .../woorea/openstack/keystone/model/Tenant.java | 29 +- .../woorea/openstack/keystone/model/Tenants.java | 9 +- .../com/woorea/openstack/keystone/model/Token.java | 11 +- .../com/woorea/openstack/keystone/model/User.java | 28 +- .../com/woorea/openstack/keystone/model/Users.java | 9 +- .../keystone/model/authentication/AccessKey.java | 21 +- .../model/authentication/TokenAuthentication.java | 12 +- .../model/authentication/UsernamePassword.java | 18 +- .../keystone/v3/model/Authentication.java | 87 +-- .../openstack/keystone/v3/model/Credential.java | 11 +- .../openstack/keystone/v3/model/Credentials.java | 11 +- .../woorea/openstack/keystone/v3/model/Domain.java | 10 +- .../openstack/keystone/v3/model/Domains.java | 11 +- .../openstack/keystone/v3/model/Endpoint.java | 8 +- .../openstack/keystone/v3/model/Endpoints.java | 11 +- .../woorea/openstack/keystone/v3/model/Group.java | 8 +- .../woorea/openstack/keystone/v3/model/Groups.java | 11 +- .../openstack/keystone/v3/model/Policies.java | 11 +- .../woorea/openstack/keystone/v3/model/Policy.java | 11 +- .../openstack/keystone/v3/model/Project.java | 10 +- .../openstack/keystone/v3/model/Projects.java | 11 +- .../woorea/openstack/keystone/v3/model/Role.java | 7 +- .../woorea/openstack/keystone/v3/model/Roles.java | 9 +- .../openstack/keystone/v3/model/Service.java | 8 +- .../openstack/keystone/v3/model/Services.java | 11 +- .../woorea/openstack/keystone/v3/model/Token.java | 108 ++-- .../woorea/openstack/keystone/v3/model/User.java | 16 +- .../woorea/openstack/keystone/v3/model/Users.java | 11 +- .../openstack/keystone/model/AccessTest.java | 141 ++--- .../openstack/keystone/model/EndpointTest.java | 38 +- .../openstack/keystone/model/EndpointsTest.java | 41 +- .../woorea/openstack/keystone/model/ErrorTest.java | 27 +- .../woorea/openstack/keystone/model/LinkTest.java | 22 +- .../openstack/keystone/model/MetadataTest.java | 2 +- .../woorea/openstack/keystone/model/RoleTest.java | 31 +- .../woorea/openstack/keystone/model/RolesTest.java | 35 +- .../openstack/keystone/model/ServiceTest.java | 31 +- .../openstack/keystone/model/ServicesTest.java | 35 +- .../openstack/keystone/model/TenantTest.java | 31 +- .../openstack/keystone/model/TenantsTest.java | 49 +- .../woorea/openstack/keystone/model/TokenTest.java | 33 +- .../woorea/openstack/keystone/model/UserTest.java | 41 +- .../woorea/openstack/keystone/model/UsersTest.java | 43 +- .../model/authentication/AccessKeyTest.java | 32 +- .../ApiAccessKeyCredentialsTest.java | 25 +- .../authentication/PasswordCredentialsTest.java | 19 +- .../keystone/model/authentication/TokenTest.java | 15 +- .../model/authentication/UsernamePasswordTest.java | 32 +- .../keystone/v3/model/AuthenticationTest.java | 57 +- .../keystone/v3/model/CredentialTest.java | 41 +- .../keystone/v3/model/CredentialsTest.java | 45 +- .../openstack/keystone/v3/model/DomainTest.java | 21 +- .../openstack/keystone/v3/model/DomainsTest.java | 35 +- .../openstack/keystone/v3/model/EndpointTest.java | 32 +- .../openstack/keystone/v3/model/EndpointsTest.java | 35 +- .../openstack/keystone/v3/model/GroupTest.java | 31 +- .../openstack/keystone/v3/model/GroupsTest.java | 35 +- .../openstack/keystone/v3/model/IdentityTest.java | 39 +- .../openstack/keystone/v3/model/PasswordTest.java | 26 +- .../openstack/keystone/v3/model/PoliciesTest.java | 45 +- .../openstack/keystone/v3/model/PolicyTest.java | 41 +- .../openstack/keystone/v3/model/ProjectTest.java | 26 +- .../openstack/keystone/v3/model/ProjectsTest.java | 34 +- .../openstack/keystone/v3/model/RoleTest.java | 9 +- .../openstack/keystone/v3/model/RolesTest.java | 35 +- .../openstack/keystone/v3/model/ScopeTest.java | 24 +- .../openstack/keystone/v3/model/ServiceTest.java | 43 +- .../openstack/keystone/v3/model/ServicesTest.java | 35 +- .../openstack/keystone/v3/model/TokenTest.java | 118 ++-- .../openstack/keystone/v3/model/UserTest.java | 47 +- .../openstack/keystone/v3/model/UsersTest.java | 43 +- 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 +- nova-model/pom.xml | 47 +- .../woorea/openstack/nova/model/Certificate.java | 8 +- .../com/woorea/openstack/nova/model/Cloudpipe.java | 28 +- .../woorea/openstack/nova/model/Cloudpipes.java | 9 +- .../com/woorea/openstack/nova/model/Extension.java | 21 +- .../woorea/openstack/nova/model/Extensions.java | 9 +- .../com/woorea/openstack/nova/model/Flavor.java | 47 +- .../openstack/nova/model/FlavorForCreate.java | 18 +- .../com/woorea/openstack/nova/model/Flavors.java | 13 +- .../woorea/openstack/nova/model/FloatingIp.java | 19 +- .../openstack/nova/model/FloatingIpDomain.java | 18 +- .../openstack/nova/model/FloatingIpDomains.java | 7 +- .../openstack/nova/model/FloatingIpPools.java | 17 +- .../woorea/openstack/nova/model/FloatingIps.java | 9 +- .../java/com/woorea/openstack/nova/model/Host.java | 38 +- .../woorea/openstack/nova/model/HostAggregate.java | 37 +- .../openstack/nova/model/HostAggregates.java | 9 +- .../com/woorea/openstack/nova/model/Hosts.java | 29 +- .../com/woorea/openstack/nova/model/Image.java | 52 +- .../openstack/nova/model/ImageFromVolume.java | 1 - .../com/woorea/openstack/nova/model/Images.java | 11 +- .../com/woorea/openstack/nova/model/KeyPair.java | 26 +- .../com/woorea/openstack/nova/model/KeyPairs.java | 17 +- .../com/woorea/openstack/nova/model/Limits.java | 21 +- .../java/com/woorea/openstack/nova/model/Link.java | 10 +- .../com/woorea/openstack/nova/model/Metadata.java | 5 +- .../com/woorea/openstack/nova/model/Network.java | 78 ++- .../com/woorea/openstack/nova/model/Networks.java | 9 +- .../openstack/nova/model/PersonalityFile.java | 6 +- .../com/woorea/openstack/nova/model/QuotaSet.java | 55 +- .../woorea/openstack/nova/model/SecurityGroup.java | 41 +- .../nova/model/SecurityGroupForCreate.java | 16 +- .../nova/model/SecurityGroupRuleForCreate.java | 53 +- .../openstack/nova/model/SecurityGroups.java | 9 +- .../com/woorea/openstack/nova/model/Server.java | 143 +++-- .../woorea/openstack/nova/model/ServerAction.java | 159 +++-- .../openstack/nova/model/ServerForCreate.java | 49 +- .../com/woorea/openstack/nova/model/Servers.java | 9 +- .../openstack/nova/model/SimpleTenantUsage.java | 27 +- .../openstack/nova/model/SimpleTenantUsages.java | 7 +- .../com/woorea/openstack/nova/model/Snapshot.java | 25 +- .../openstack/nova/model/SnapshotForCreate.java | 15 +- .../com/woorea/openstack/nova/model/Snapshots.java | 9 +- .../com/woorea/openstack/nova/model/Volume.java | 23 +- .../openstack/nova/model/VolumeAttachment.java | 9 +- .../openstack/nova/model/VolumeAttachments.java | 7 +- .../openstack/nova/model/VolumeForCreate.java | 11 +- .../openstack/nova/model/VolumeForImageCreate.java | 1 - .../woorea/openstack/nova/model/VolumeType.java | 1 - .../woorea/openstack/nova/model/VolumeTypes.java | 9 +- .../com/woorea/openstack/nova/model/Volumes.java | 9 +- .../openstack/nova/model/AbsoluteLimitTest.java | 103 ++-- .../woorea/openstack/nova/model/AddressTest.java | 26 +- .../woorea/openstack/nova/model/AddressesTest.java | 50 +- .../nova/model/AssociateFloatingIpTest.java | 21 +- .../openstack/nova/model/CertificateTest.java | 24 +- .../openstack/nova/model/ChangePasswordTest.java | 21 +- .../woorea/openstack/nova/model/CloudpipeTest.java | 43 +- .../openstack/nova/model/CloudpipesTest.java | 40 +- .../openstack/nova/model/ConfirmResizeTest.java | 16 +- .../openstack/nova/model/ConsoleOutputTest.java | 15 +- .../openstack/nova/model/CreateBackupTest.java | 38 +- .../openstack/nova/model/CreateImageTest.java | 31 +- .../nova/model/DisassociateFloatingIpTest.java | 21 +- .../woorea/openstack/nova/model/ExtensionTest.java | 50 +- .../openstack/nova/model/ExtensionsTest.java | 62 +- .../com/woorea/openstack/nova/model/FaultTest.java | 26 +- .../openstack/nova/model/FlavorForCreateTest.java | 46 +- .../woorea/openstack/nova/model/FlavorTest.java | 74 +-- .../woorea/openstack/nova/model/FlavorsTest.java | 84 +-- .../openstack/nova/model/FloatingIpDomainTest.java | 32 +- .../nova/model/FloatingIpDomainsTest.java | 36 +- .../openstack/nova/model/FloatingIpPoolTest.java | 15 +- .../openstack/nova/model/FloatingIpPoolsTest.java | 26 +- .../openstack/nova/model/FloatingIpTest.java | 34 +- .../openstack/nova/model/FloatingIpsTest.java | 37 +- .../openstack/nova/model/ForceDeleteTest.java | 16 +- .../openstack/nova/model/GetConsoleOutputTest.java | 21 +- .../openstack/nova/model/GetVncConsoleTest.java | 21 +- .../com/woorea/openstack/nova/model/GroupTest.java | 19 +- .../openstack/nova/model/HostAggregateTest.java | 60 +- .../openstack/nova/model/HostAggregatesTest.java | 59 +- .../com/woorea/openstack/nova/model/HostTest.java | 22 +- .../com/woorea/openstack/nova/model/HostsTest.java | 32 +- .../openstack/nova/model/ImageFromVolumeTest.java | 55 +- .../com/woorea/openstack/nova/model/ImageTest.java | 92 +-- .../woorea/openstack/nova/model/ImagesTest.java | 115 +--- .../woorea/openstack/nova/model/IpRangeTest.java | 15 +- .../woorea/openstack/nova/model/KeyPairTest.java | 35 +- .../openstack/nova/model/KeyPairWrapperTest.java | 22 +- .../woorea/openstack/nova/model/KeyPairsTest.java | 41 +- .../openstack/nova/model/LimitEntryTest.java | 33 +- .../woorea/openstack/nova/model/LimitsTest.java | 115 ++-- .../com/woorea/openstack/nova/model/LinkTest.java | 22 +- .../com/woorea/openstack/nova/model/LockTest.java | 16 +- .../woorea/openstack/nova/model/MetadataTest.java | 4 +- .../openstack/nova/model/NetworkForCreateTest.java | 19 +- .../woorea/openstack/nova/model/NetworkTest.java | 115 ++-- .../woorea/openstack/nova/model/NetworksTest.java | 106 ++-- .../com/woorea/openstack/nova/model/PauseTest.java | 16 +- .../openstack/nova/model/PersonalityFileTest.java | 19 +- .../woorea/openstack/nova/model/QuotaSetTest.java | 67 +-- .../woorea/openstack/nova/model/RateLimitTest.java | 41 +- .../woorea/openstack/nova/model/RebootTest.java | 21 +- .../woorea/openstack/nova/model/RebuildTest.java | 62 +- .../openstack/nova/model/RescueResponseTest.java | 15 +- .../woorea/openstack/nova/model/RescueTest.java | 21 +- .../woorea/openstack/nova/model/ResizeTest.java | 24 +- .../woorea/openstack/nova/model/ResourceTest.java | 28 +- .../openstack/nova/model/ResourceWrapperTest.java | 23 +- .../woorea/openstack/nova/model/RestoreTest.java | 16 +- .../woorea/openstack/nova/model/ResumeTest.java | 16 +- .../openstack/nova/model/RevertResizeTest.java | 16 +- .../com/woorea/openstack/nova/model/RuleTest.java | 53 +- .../nova/model/SecurityGroupForCreateTest.java | 24 +- .../nova/model/SecurityGroupRuleForCreateTest.java | 44 +- .../openstack/nova/model/SecurityGroupTest.java | 15 +- .../openstack/nova/model/SecurityGroupsTest.java | 138 ++--- .../openstack/nova/model/ServerActionTest.java | 154 +++-- .../openstack/nova/model/ServerForCreateTest.java | 104 ++-- .../woorea/openstack/nova/model/ServerTest.java | 398 +++++-------- .../openstack/nova/model/ServerUsageTest.java | 55 +- .../woorea/openstack/nova/model/ServersTest.java | 25 +- .../nova/model/SimpleTenantUsageTest.java | 85 +-- .../nova/model/SimpleTenantUsagesTest.java | 120 ++-- .../nova/model/SnapshotForCreateTest.java | 31 +- .../woorea/openstack/nova/model/SnapshotTest.java | 41 +- .../woorea/openstack/nova/model/SnapshotsTest.java | 43 +- .../com/woorea/openstack/nova/model/StartTest.java | 16 +- .../com/woorea/openstack/nova/model/StopTest.java | 16 +- .../woorea/openstack/nova/model/SuspendTest.java | 16 +- .../woorea/openstack/nova/model/UnlockTest.java | 16 +- .../woorea/openstack/nova/model/UnpauseTest.java | 16 +- .../woorea/openstack/nova/model/UnrescueTest.java | 16 +- .../openstack/nova/model/VncConsoleTest.java | 24 +- .../openstack/nova/model/VolumeAttachmentTest.java | 31 +- .../nova/model/VolumeAttachmentsTest.java | 35 +- .../openstack/nova/model/VolumeForCreateTest.java | 46 +- .../nova/model/VolumeForImageCreateTest.java | 39 +- .../woorea/openstack/nova/model/VolumeTest.java | 77 +-- .../openstack/nova/model/VolumeTypeTest.java | 18 +- .../openstack/nova/model/VolumeTypesTest.java | 21 +- .../woorea/openstack/nova/model/VolumesTest.java | 83 +-- openstack-client-connectors/http-connector/pom.xml | 62 +- .../openstack/connector/HttpClientConnector.java | 89 ++- .../openstack/connector/HttpClientException.java | 78 +-- .../connector/HttpClientRedirectStrategy.java | 195 +++---- .../openstack/connector/HttpClientResponse.java | 21 +- openstack-client-connectors/pom.xml | 61 +- openstack-client/pom.xml | 96 +-- .../base/client/OpenStackBaseException.java | 79 ++- .../openstack/base/client/OpenStackClient.java | 15 +- .../base/client/OpenStackConnectException.java | 7 +- .../openstack/base/client/OpenStackRequest.java | 254 ++++---- .../openstack/base/client/OpenStackResponse.java | 4 +- .../base/client/OpenStackResponseException.java | 2 +- .../base/client/OpenStackResponseStatus.java | 4 +- .../base/client/OpenStackSimpleTokenProvider.java | 3 +- .../openstack/common/session/OpenStackSession.java | 2 +- .../common/session/OpenStackSessionHolder.java | 2 +- .../base/client/OpenStackClientMockUtils.java | 6 +- .../openstack/base/client/OpenStackClientTest.java | 8 +- pom.xml | 645 ++++++++++++--------- .../code-tools/findbugs_include_filter.xml | 5 + project-configs/code-tools/oap_checkstyle_1.0.xml | 98 ++++ .../code-tools/oap_codetemplates_1.0.xml | 53 ++ project-configs/code-tools/onap-eclipse-format.xml | 313 ++++++++++ project-configs/code-tools/pom-format.properties | 5 + quantum-client/pom.xml | 59 +- .../java/com/woorea/openstack/quantum/Quantum.java | 26 +- .../openstack/quantum/api/NetworksResource.java | 8 +- .../openstack/quantum/api/PortsResource.java | 17 +- .../openstack/quantum/api/RoutersResource.java | 108 ++-- .../openstack/quantum/api/SubnetsResource.java | 9 +- .../quantum/api/query/AbsOpenStackCmd.java | 10 +- quantum-model/pom.xml | 47 +- .../openstack/quantum/model/GatewayInfo.java | 4 +- .../woorea/openstack/quantum/model/HostRoute.java | 5 +- .../com/woorea/openstack/quantum/model/Link.java | 48 ++ .../woorea/openstack/quantum/model/Network.java | 150 +++-- .../woorea/openstack/quantum/model/Networks.java | 18 +- .../openstack/quantum/model/NeutronError.java | 14 +- .../com/woorea/openstack/quantum/model/Pool.java | 13 +- .../com/woorea/openstack/quantum/model/Port.java | 63 +- .../com/woorea/openstack/quantum/model/Ports.java | 4 +- .../com/woorea/openstack/quantum/model/Router.java | 17 +- .../quantum/model/RouterForAddInterface.java | 31 +- .../openstack/quantum/model/RouterForCreate.java | 16 +- .../openstack/quantum/model/RouterInterface.java | 1 - .../woorea/openstack/quantum/model/Routers.java | 7 +- .../woorea/openstack/quantum/model/Segment.java | 8 +- .../com/woorea/openstack/quantum/model/Subnet.java | 71 +-- .../openstack/quantum/model/SubnetForCreate.java | 4 +- .../woorea/openstack/quantum/model/Subnets.java | 7 +- .../openstack/quantum/model/BindingTest.java | 43 +- .../openstack/quantum/model/GatewayInfoTest.java | 15 +- .../openstack/quantum/model/HostRouteTest.java | 19 +- .../com/woorea/openstack/quantum/model/IpTest.java | 19 +- .../openstack/quantum/model/IpVersionTest.java | 9 +- .../openstack/quantum/model/NetworkTest.java | 71 +-- .../openstack/quantum/model/NetworksTest.java | 80 +-- .../openstack/quantum/model/NeutronErrorTest.java | 27 +- .../woorea/openstack/quantum/model/PoolTest.java | 19 +- .../woorea/openstack/quantum/model/PortTest.java | 78 +-- .../woorea/openstack/quantum/model/PortsTest.java | 99 +--- .../quantum/model/RouterForAddInterfaceTest.java | 19 +- .../quantum/model/RouterForCreateTest.java | 54 +- .../quantum/model/RouterInterfaceTest.java | 17 +- .../woorea/openstack/quantum/model/RouterTest.java | 53 +- .../openstack/quantum/model/RoutersTest.java | 65 +-- .../openstack/quantum/model/SegmentTest.java | 23 +- .../woorea/openstack/quantum/model/SubnetTest.java | 63 +- .../openstack/quantum/model/SubnetsTest.java | 69 +-- swift-client/pom.xml | 47 +- .../java/com/woorea/openstack/swift/Swift.java | 12 +- .../openstack/swift/api/AccountResource.java | 4 +- .../openstack/swift/api/ContainerResource.java | 56 +- .../openstack/swift/api/ContainersResource.java | 31 +- swift-model/pom.xml | 47 +- .../com/woorea/openstack/swift/model/Account.java | 14 +- .../woorea/openstack/swift/model/Container.java | 18 +- .../com/woorea/openstack/swift/model/Object.java | 15 +- .../openstack/swift/model/ObjectDownload.java | 2 +- .../openstack/swift/model/ObjectForUpload.java | 10 +- .../openstack/swift/model/ContainerTest.java | 22 +- .../woorea/openstack/swift/model/ObjectTest.java | 36 +- 472 files changed, 7405 insertions(+), 8719 deletions(-) create mode 100644 basepath_marker create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Link.java create mode 100644 project-configs/code-tools/findbugs_include_filter.xml create mode 100644 project-configs/code-tools/oap_checkstyle_1.0.xml create mode 100644 project-configs/code-tools/oap_codetemplates_1.0.xml create mode 100644 project-configs/code-tools/onap-eclipse-format.xml create mode 100644 project-configs/code-tools/pom-format.properties create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Link.java diff --git a/basepath_marker b/basepath_marker new file mode 100644 index 0000000..89ec07c --- /dev/null +++ b/basepath_marker @@ -0,0 +1 @@ +//required for groovy base path script in pom.xml \ No newline at end of file diff --git a/ceilometer-client/pom.xml b/ceilometer-client/pom.xml index 4a255f4..4a9fedb 100644 --- a/ceilometer-client/pom.xml +++ b/ceilometer-client/pom.xml @@ -1,24 +1,25 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - ceilometer-client - OpenStack Ceilometer Client - OpenStack Ceilometer Client - - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - - - org.onap.so.libs.openstack-java-sdk - ceilometer-model - ${project.version} - - + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + ceilometer-client + OpenStack Ceilometer Client + OpenStack Ceilometer Client + + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + + + org.onap.so.libs.openstack-java-sdk + ceilometer-model + ${project.version} + + diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java index 6c18858..654d5c2 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java @@ -23,28 +23,28 @@ import com.woorea.openstack.ceilometer.v2.api.MetersResource; import com.woorea.openstack.ceilometer.v2.api.ResourcesResource; public class Ceilometer extends OpenStackClient { - + private final MetersResource meters; - + private final ResourcesResource resources; - + public Ceilometer(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); meters = new MetersResource(this); resources = new ResourcesResource(this); } - + public Ceilometer(String endpoint) { this(endpoint, null); - + } - + public ResourcesResource resources() { return resources; } - + public MetersResource meters() { return meters; } - + } diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java index d8c0ead..8c9b813 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java @@ -19,10 +19,9 @@ package com.woorea.openstack.ceilometer; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import com.woorea.openstack.base.client.OpenStackRequest; -public abstract class QueriableCeilometerCommand extends OpenStackRequest { +public abstract class QueriableCeilometerCommand extends OpenStackRequest { protected List fields = new ArrayList<>(); @@ -61,4 +60,4 @@ public abstract class QueriableCeilometerCommand extends OpenStackRequest - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - ceilometer-model - OpenStack Ceilometer Model - OpenStack Ceilometer Model + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + ceilometer-model + OpenStack Ceilometer Model + OpenStack Ceilometer Model - - - junit - junit - test - - - org.skyscreamer - jsonassert - test - - + + + junit + junit + test + + + org.skyscreamer + jsonassert + test + + diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java index 6faafc0..7041a78 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java @@ -22,18 +22,18 @@ public class Meter { @JsonProperty("user_id") private String user; - - + + private String name; - + @JsonProperty("resource_id") private String resource; - + @JsonProperty("project_id") private String project; - + private String type; - + private String unit; public String getUser() { @@ -62,9 +62,8 @@ public class Meter { @Override public String toString() { - return "Meter [user=" + user + ", name=" + name + ", resource=" - + resource + ", project=" + project + ", type=" + type - + ", unit=" + unit + "]"; + return "Meter [user=" + user + ", name=" + name + ", resource=" + resource + ", project=" + project + ", type=" + + type + ", unit=" + unit + "]"; } } diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java index 2a2c0de..6b8988b 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java @@ -17,22 +17,21 @@ package com.woorea.openstack.ceilometer.v2.model; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; public class Resource { - + @JsonProperty("resource_id") private String resource; - + private String timestamp; - + @JsonProperty("project_id") private String project; - + @JsonProperty("user_id") private String user; - + private Map metadata; public String getResource() { @@ -57,9 +56,8 @@ public class Resource { @Override public String toString() { - return "Resource [resource=" + resource + ", timestamp=" + timestamp - + ", project=" + project + ", user=" + user + ", metadata=" - + metadata + "]"; + return "Resource [resource=" + resource + ", timestamp=" + timestamp + ", project=" + project + ", user=" + user + + ", metadata=" + metadata + "]"; } - + } diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java index 2808113..aad3359 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java @@ -17,7 +17,6 @@ package com.woorea.openstack.ceilometer.v2.model; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; public class Sample { @@ -27,29 +26,29 @@ public class Sample { @JsonProperty("counter_name") private String counterName; - + @JsonProperty("counter_unit") private String counterUnit; - + @JsonProperty("counter_volume") private String counterVolume; - + private String source; - + @JsonProperty("project_id") private String project; - + @JsonProperty("user_id") private String user; - + @JsonProperty("resource_id") private String resource; - + private String timestamp; - + @JsonProperty("message_id") private String message; - + @JsonProperty("resource_metadata") private Map metadata; @@ -99,12 +98,10 @@ public class Sample { @Override public String toString() { - return "Sample [counterType=" + counterType + ", counterName=" - + counterName + ", counterUnit=" + counterUnit - + ", counterVolume=" + counterVolume + ", source=" + source - + ", project=" + project + ", user=" + user + ", resource=" - + resource + ", timestamp=" + timestamp + ", message=" - + message + ", metadata=" + metadata + "]"; + return "Sample [counterType=" + counterType + ", counterName=" + counterName + ", counterUnit=" + counterUnit + + ", counterVolume=" + counterVolume + ", source=" + source + ", project=" + project + ", user=" + user + + ", resource=" + resource + ", timestamp=" + timestamp + ", message=" + message + ", metadata=" + + metadata + "]"; } - + } diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java index 747c9f0..2fd7b3e 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java @@ -17,35 +17,34 @@ package com.woorea.openstack.ceilometer.v2.model; import java.math.BigDecimal; - import com.fasterxml.jackson.annotation.JsonProperty; public class Statistics { - + private BigDecimal avg; - + private BigDecimal count; - + private BigDecimal duration; - + @JsonProperty("duration_start") private String durationStart; - + @JsonProperty("duration_end") private String durationEnd; - + private BigDecimal max; - + private BigDecimal min; - + private BigDecimal period; - + @JsonProperty("period_start") private String periodStart; - + @JsonProperty("period_end") private String periodEnd; - + private BigDecimal sum; public BigDecimal getAvg() { @@ -94,11 +93,9 @@ public class Statistics { @Override public String toString() { - return "Statistics [avg=" + avg + ", count=" + count + ", duration=" - + duration + ", durationStart=" + durationStart - + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" - + min + ", period=" + period + ", periodStart=" + periodStart - + ", periodEnd=" + periodEnd + ", sum=" + sum + "]"; + return "Statistics [avg=" + avg + ", count=" + count + ", duration=" + duration + ", durationStart=" + + durationStart + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" + min + ", period=" + + period + ", periodStart=" + periodStart + ", periodEnd=" + periodEnd + ", sum=" + sum + "]"; } - + } diff --git a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java index 361bf9c..953ef03 100644 --- a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java +++ b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,20 +33,13 @@ public class MeterTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"user_id\" : \"user\"," + EOL - + " \"resource_id\" : \"resource\"," + EOL - + " \"project_id\" : \"project\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"unit\" : \"unit\"," + EOL + " \"user_id\" : \"user\"," + EOL + " \"resource_id\" : \"resource\"," + + EOL + " \"project_id\" : \"project\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,22 +55,22 @@ public class MeterTest { public void testMethods() throws Exception { Meter meter = objectMapper.readValue(JSON_FULL, Meter.class); meter.toString(); - + String unit = meter.getUnit(); Assert.assertNotNull(unit); - + String resource = meter.getResource(); Assert.assertNotNull(resource); - + String name = meter.getName(); Assert.assertNotNull(name); - + String project = meter.getProject(); Assert.assertNotNull(project); - + String type = meter.getType(); Assert.assertNotNull(type); - + String user = meter.getUser(); Assert.assertNotNull(user); } diff --git a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java index 08cbcd5..7605321 100644 --- a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java +++ b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,22 +34,14 @@ public class ResourceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"timestamp\" : \"timestamp\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"resource_id\" : \"resource\"," + EOL - + " \"project_id\" : \"project\"," + EOL - + " \"user_id\" : \"user\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"timestamp\" : \"timestamp\"," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"resource_id\" : \"resource\"," + EOL + " \"project_id\" : \"project\"," + EOL + + " \"user_id\" : \"user\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -67,20 +57,20 @@ public class ResourceTest { public void testMethods() throws Exception { Resource resource = objectMapper.readValue(JSON_FULL, Resource.class); resource.toString(); - - Map metadata = resource.getMetadata(); + + Map metadata = resource.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + String resourceProperty = resource.getResource(); Assert.assertNotNull(resourceProperty); - + String project = resource.getProject(); Assert.assertNotNull(project); - + String user = resource.getUser(); Assert.assertNotNull(user); - + String timestamp = resource.getTimestamp(); Assert.assertNotNull(timestamp); } diff --git a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java index e647f42..5084c93 100644 --- a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java +++ b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,28 +34,18 @@ public class SampleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"source\" : \"source\"," + EOL - + " \"timestamp\" : \"timestamp\"," + EOL - + " \"counter_type\" : \"countertype\"," + EOL - + " \"counter_name\" : \"countername\"," + EOL - + " \"counter_unit\" : \"counterunit\"," + EOL - + " \"counter_volume\" : \"countervolume\"," + EOL - + " \"project_id\" : \"project\"," + EOL - + " \"user_id\" : \"user\"," + EOL - + " \"resource_id\" : \"resource\"," + EOL - + " \"message_id\" : \"message\"," + EOL - + " \"resource_metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = + "{" + EOL + " \"source\" : \"source\"," + EOL + " \"timestamp\" : \"timestamp\"," + EOL + + " \"counter_type\" : \"countertype\"," + EOL + " \"counter_name\" : \"countername\"," + EOL + + " \"counter_unit\" : \"counterunit\"," + EOL + " \"counter_volume\" : \"countervolume\"," + EOL + + " \"project_id\" : \"project\"," + EOL + " \"user_id\" : \"user\"," + EOL + + " \"resource_id\" : \"resource\"," + EOL + " \"message_id\" : \"message\"," + EOL + + " \"resource_metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -73,38 +61,38 @@ public class SampleTest { public void testMethods() throws Exception { Sample sample = objectMapper.readValue(JSON_FULL, Sample.class); sample.toString(); - + String counterName = sample.getCounterName(); Assert.assertNotNull(counterName); - - Map metadata = sample.getMetadata(); + + Map metadata = sample.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + String resource = sample.getResource(); Assert.assertNotNull(resource); - + String counterVolume = sample.getCounterVolume(); Assert.assertNotNull(counterVolume); - + String project = sample.getProject(); Assert.assertNotNull(project); - + String counterUnit = sample.getCounterUnit(); Assert.assertNotNull(counterUnit); - + String source = sample.getSource(); Assert.assertNotNull(source); - + String counterType = sample.getCounterType(); Assert.assertNotNull(counterType); - + String message = sample.getMessage(); Assert.assertNotNull(message); - + String user = sample.getUser(); Assert.assertNotNull(user); - + String timestamp = sample.getTimestamp(); Assert.assertNotNull(timestamp); } diff --git a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java index 741e53b..78b4293 100644 --- a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java +++ b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.math.BigDecimal; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class StatisticsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"avg\" : 79," + EOL - + " \"count\" : 14," + EOL - + " \"duration\" : 31," + EOL - + " \"max\" : 87," + EOL - + " \"min\" : 85," + EOL - + " \"period\" : 4," + EOL - + " \"sum\" : 2," + EOL - + " \"duration_start\" : \"durationstart\"," + EOL - + " \"duration_end\" : \"durationend\"," + EOL - + " \"period_start\" : \"periodstart\"," + EOL - + " \"period_end\" : \"periodend\"" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"avg\" : 79," + EOL + " \"count\" : 14," + EOL + + " \"duration\" : 31," + EOL + " \"max\" : 87," + EOL + " \"min\" : 85," + EOL + " \"period\" : 4," + + EOL + " \"sum\" : 2," + EOL + " \"duration_start\" : \"durationstart\"," + EOL + + " \"duration_end\" : \"durationend\"," + EOL + " \"period_start\" : \"periodstart\"," + EOL + + " \"period_end\" : \"periodend\"" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,37 +58,37 @@ public class StatisticsTest { public void testMethods() throws Exception { Statistics statistics = objectMapper.readValue(JSON_FULL, Statistics.class); statistics.toString(); - + BigDecimal duration = statistics.getDuration(); Assert.assertNotNull(duration); - + BigDecimal period = statistics.getPeriod(); Assert.assertNotNull(period); - + BigDecimal avg = statistics.getAvg(); Assert.assertNotNull(avg); - + BigDecimal min = statistics.getMin(); Assert.assertNotNull(min); - + String durationStart = statistics.getDurationStart(); Assert.assertNotNull(durationStart); - + BigDecimal max = statistics.getMax(); Assert.assertNotNull(max); - + String durationEnd = statistics.getDurationEnd(); Assert.assertNotNull(durationEnd); - + BigDecimal count = statistics.getCount(); Assert.assertNotNull(count); - + BigDecimal sum = statistics.getSum(); Assert.assertNotNull(sum); - + String periodStart = statistics.getPeriodStart(); Assert.assertNotNull(periodStart); - + String periodEnd = statistics.getPeriodEnd(); Assert.assertNotNull(periodEnd); } diff --git a/cinder-client/pom.xml b/cinder-client/pom.xml index 47978ac..61f5959 100755 --- a/cinder-client/pom.xml +++ b/cinder-client/pom.xml @@ -1,26 +1,26 @@ - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - cinder-client - OpenStack Cinder Client - OpenStack Cinder Client - - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + cinder-client + OpenStack Cinder Client + OpenStack Cinder Client + + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + - - org.onap.so.libs.openstack-java-sdk - cinder-model - ${project.version} - - - org.onap.so.libs.openstack-java-sdk + + org.onap.so.libs.openstack-java-sdk + cinder-model + ${project.version} + + + org.onap.so.libs.openstack-java-sdk \ No newline at end of file diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java index ca65d3f..beb1570 100755 --- a/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -13,6 +14,7 @@ * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder; import com.woorea.openstack.base.client.OpenStackClient; diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/LimitsExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/LimitsExtension.java index 32c05d7..58256c1 100755 --- a/cinder-client/src/main/java/com/woorea/openstack/cinder/LimitsExtension.java +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/LimitsExtension.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder; import com.woorea.openstack.base.client.HttpMethod; diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/SchedulerStatsExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/SchedulerStatsExtension.java index 09ad3ac..36ea91d 100755 --- a/cinder-client/src/main/java/com/woorea/openstack/cinder/SchedulerStatsExtension.java +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/SchedulerStatsExtension.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder; import com.woorea.openstack.base.client.HttpMethod; @@ -37,7 +39,9 @@ public class SchedulerStatsExtension { public class List extends OpenStackRequest { public List(boolean detail) { - super(CLIENT, HttpMethod.GET, (new StringBuilder("/scheduler-stats/get_pools")).append(detail ? "?detail=True":""), null, Pools.class); + super(CLIENT, HttpMethod.GET, + (new StringBuilder("/scheduler-stats/get_pools")).append(detail ? "?detail=True" : ""), null, + Pools.class); } } diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/SnapshotsExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/SnapshotsExtension.java index d01bdc9..a7b0cb8 100755 --- a/cinder-client/src/main/java/com/woorea/openstack/cinder/SnapshotsExtension.java +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/SnapshotsExtension.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder; import com.woorea.openstack.base.client.Entity; @@ -95,8 +97,8 @@ public class SnapshotsExtension { public class Update extends OpenStackRequest { public Update(String id, SnapshotForUpdate snapshot) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/snapshots/").append(id).toString(), - Entity.json(snapshot), Void.class); + super(CLIENT, HttpMethod.PUT, new StringBuilder("/snapshots/").append(id).toString(), Entity.json(snapshot), + Void.class); } } @@ -104,11 +106,8 @@ public class SnapshotsExtension { public class ShowMetadata extends OpenStackRequest { public ShowMetadata(String id) { - super(CLIENT, - HttpMethod.GET, - new StringBuilder("/snapshots/").append(id).append("/metadata").toString(), - null, - Metadata.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/snapshots/").append(id).append("/metadata").toString(), + null, Metadata.class); } } @@ -116,9 +115,9 @@ public class SnapshotsExtension { public class UpdateMetadata extends OpenStackRequest { public UpdateMetadata(String snapshotId, Metadata metadata) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/snapshots/").append(snapshotId) - .append("/metadata") - .toString(), Entity.json(metadata), Void.class); + super(CLIENT, HttpMethod.PUT, + new StringBuilder("/snapshots/").append(snapshotId).append("/metadata").toString(), + Entity.json(metadata), Void.class); } } diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumeTypesExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumeTypesExtension.java index ded5768..7514771 100755 --- a/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumeTypesExtension.java +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumeTypesExtension.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder; import com.woorea.openstack.base.client.Entity; diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumesExtension.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumesExtension.java index 3e6bf97..e8026ef 100755 --- a/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumesExtension.java +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/VolumesExtension.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder; import com.woorea.openstack.base.client.Entity; @@ -82,8 +84,7 @@ public class VolumesExtension { public class List extends OpenStackRequest { public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/volumes/detail" - : "/volumes", null, Volumes.class); + super(CLIENT, HttpMethod.GET, detail ? "/volumes/detail" : "/volumes", null, Volumes.class); } } @@ -91,8 +92,7 @@ public class VolumesExtension { public class Create extends OpenStackRequest { public Create(VolumeForCreate volume) { - super(CLIENT, HttpMethod.POST, "/volumes", Entity.json(volume), - Volume.class); + super(CLIENT, HttpMethod.POST, "/volumes", Entity.json(volume), Volume.class); } } @@ -102,8 +102,8 @@ public class VolumesExtension { public class UploadToImage extends OpenStackRequest { public UploadToImage(VolumeForImageCreate volumeForImageCreate) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") - .append(volumeForImageCreate.getVolumeId() + "/action").toString(), + super(CLIENT, HttpMethod.POST, + new StringBuilder("/volumes/").append(volumeForImageCreate.getVolumeId() + "/action").toString(), Entity.json(volumeForImageCreate), Void.class); } @@ -112,8 +112,7 @@ public class VolumesExtension { public class Show extends OpenStackRequest { public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/") - .append(id).toString(), null, Volume.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/").append(id).toString(), null, Volume.class); } } @@ -121,9 +120,8 @@ public class VolumesExtension { public class ShowMetadata extends OpenStackRequest { public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/") - .append(id).append("/metadata").toString(), null, - Metadata.class); + super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/").append(id).append("/metadata").toString(), + null, Metadata.class); } } @@ -131,8 +129,7 @@ public class VolumesExtension { public class Delete extends OpenStackRequest { public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/volumes/") - .append(id).toString(), null, Void.class); + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/volumes/").append(id).toString(), null, Void.class); } } @@ -140,8 +137,8 @@ public class VolumesExtension { public class Update extends OpenStackRequest { public Update(String id, VolumeForUpdate volume) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/volumes/").append(id).toString(), - Entity.json(volume), Void.class); + super(CLIENT, HttpMethod.PUT, new StringBuilder("/volumes/").append(id).toString(), Entity.json(volume), + Void.class); } } @@ -158,8 +155,7 @@ public class VolumesExtension { public class InitializeConnection extends OpenStackRequest { public InitializeConnection(String id, ConnectionForInitialize connectionForInitialize) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") - .append(id).append("/action").toString(), + super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/").append(id).append("/action").toString(), Entity.json(connectionForInitialize), ConnectionInfo.class); } @@ -168,8 +164,7 @@ public class VolumesExtension { public class TerminateConnection extends OpenStackRequest { public TerminateConnection(String id, ConnectionForTerminate connectionForTerminate) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") - .append(id).append("/action").toString(), + super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/").append(id).append("/action").toString(), Entity.json(connectionForTerminate), Void.class); } diff --git a/cinder-model/pom.xml b/cinder-model/pom.xml index a739859..69a8da4 100755 --- a/cinder-model/pom.xml +++ b/cinder-model/pom.xml @@ -1,12 +1,13 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - cinder-model - OpenStack Cinder Model - OpenStack Cinder Model + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + cinder-model + OpenStack Cinder Model + OpenStack Cinder Model \ No newline at end of file diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BaseConnection.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BaseConnection.java index 16be17b..bc35c69 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BaseConnection.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BaseConnection.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,12 +13,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; public abstract class BaseConnection implements Serializable { @@ -32,8 +33,7 @@ public abstract class BaseConnection implements Serializable { } /** - * @param connector - * the connector to set + * @param connector the connector to set */ public void setConnector(Map connector) { this.connector = connector; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Capabilities.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Capabilities.java index 7a1609c..1140a24 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Capabilities.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Capabilities.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; @@ -56,98 +58,114 @@ public class Capabilities implements Serializable { public String getPoolName() { return poolName; } + public void setPoolName(String poolName) { this.poolName = poolName; } + public boolean isQosSupport() { return qosSupport; } + public void setQosSupport(boolean qosSupport) { this.qosSupport = qosSupport; } + public Long getAllocatedCapacityGb() { return allocatedCapacityGb; } + public void setAllocatedCapacityGb(Long allocatedCapacityGb) { this.allocatedCapacityGb = allocatedCapacityGb; } + public String getDriverVersion() { return driverVersion; } + public void setDriverVersion(String driverVersion) { this.driverVersion = driverVersion; } + public Long getFreeCapacityGb() { return freeCapacityGb; } + public void setFreeCapacityGb(Long freeCapacityGb) { this.freeCapacityGb = freeCapacityGb; } + public String getLocationInfo() { return locationInfo; } + public void setLocationInfo(String locationInfo) { this.locationInfo = locationInfo; } + public String getTimestamp() { return timestamp; } + public void setTimestamp(String timestamp) { this.timestamp = timestamp; } + public String getVolumeBackendName() { return volumeBackendName; } + public void setVolumeBackendName(String volumeBackendName) { this.volumeBackendName = volumeBackendName; } + public Long getTotalCapacityGb() { return totalCapacityGb; } + public void setTotalCapacityGb(Long totalCapacityGb) { this.totalCapacityGb = totalCapacityGb; } + public Integer getReservedPercentage() { return reservedPercentage; } + public void setReservedPercentage(Integer reservedPercentage) { this.reservedPercentage = reservedPercentage; } + public String getVendorName() { return vendorName; } + public void setVendorName(String vendorName) { this.vendorName = vendorName; } + public String getStorageProtocol() { return storageProtocol; } + public void setStorageProtocol(String storageProtocol) { this.storageProtocol = storageProtocol; } + public Map getExtraSpecs() { return extraSpecs; } + public void setExtraSpecs(Map extraSpecs) { this.extraSpecs = extraSpecs; } @Override public String toString() { - return "Capabilities{" - + "poolName='" + poolName - + ", qosSupport='" + qosSupport - + ", allocatedCapacityGb='" + allocatedCapacityGb - + ", driverVersion='" + driverVersion - + ", freeCapacityGb='" + freeCapacityGb - + ", locationInfo='" + locationInfo - + ", timestamp='" + timestamp - + ", volumeBackendName='" + volumeBackendName - + ", totalCapacityGb='" + totalCapacityGb - + ", reservedPercentage='" + reservedPercentage - + ", vendorName='" + vendorName - + ", storageProtocol='" + storageProtocol - + ", extraSpecs='" + extraSpecs - + '}'; + return "Capabilities{" + "poolName='" + poolName + ", qosSupport='" + qosSupport + ", allocatedCapacityGb='" + + allocatedCapacityGb + ", driverVersion='" + driverVersion + ", freeCapacityGb='" + freeCapacityGb + + ", locationInfo='" + locationInfo + ", timestamp='" + timestamp + ", volumeBackendName='" + + volumeBackendName + ", totalCapacityGb='" + totalCapacityGb + ", reservedPercentage='" + + reservedPercentage + ", vendorName='" + vendorName + ", storageProtocol='" + storageProtocol + + ", extraSpecs='" + extraSpecs + '}'; } } diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForInitialize.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForInitialize.java index 7406eea..85ca34b 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForInitialize.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForInitialize.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,10 +13,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import com.fasterxml.jackson.annotation.JsonRootName; - import java.io.Serializable; @JsonRootName("os-initialize_connection") diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForTerminate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForTerminate.java index 208fc54..83ad8f5 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForTerminate.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionForTerminate.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,10 +13,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import com.fasterxml.jackson.annotation.JsonRootName; - import java.io.Serializable; @JsonRootName("os-terminate_connection") diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionInfo.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionInfo.java index 1bf9677..3a6502f 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionInfo.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/ConnectionInfo.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,11 +13,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -36,8 +37,7 @@ public class ConnectionInfo implements Serializable { } /** - * @param driverVolumeType - * the driverVolumeType to set + * @param driverVolumeType the driverVolumeType to set */ public void setDriverVolumeType(String driverVolumeType) { this.driverVolumeType = driverVolumeType; @@ -51,8 +51,7 @@ public class ConnectionInfo implements Serializable { } /** - * @param data - * the data to set + * @param data the data to set */ public void setData(Map data) { this.data = data; @@ -65,8 +64,7 @@ public class ConnectionInfo implements Serializable { */ @Override public String toString() { - return "ConnectionInfo [driverVolumeType=" + driverVolumeType + "," + - " data=" + data + "]"; + return "ConnectionInfo [driverVolumeType=" + driverVolumeType + "," + " data=" + data + "]"; } } diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Limits.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Limits.java index 6c83845..cffe0c7 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Limits.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Limits.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,11 +13,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - import java.io.Serializable; import java.util.Calendar; import java.util.List; @@ -24,237 +25,232 @@ import java.util.List; @JsonRootName("limits") public class Limits implements Serializable { - public static final class RateLimit implements Serializable { - - public static final class LimitEntry implements Serializable { - - @JsonProperty("next-available") - private Calendar nextAvailable; - - private String unit; - - private String verb; - - private Integer remaining; - - private Integer available; - - private Integer value; - - /** - * @return the nextAvailable - */ - public Calendar getNextAvailable() { - return nextAvailable; - } - - /** - * @return the unit - */ - public String getUnit() { - return unit; - } - - /** - * @return the verb - */ - public String getVerb() { - return verb; - } - - /** - * @return the remaining - */ - public Integer getRemaining() { - return remaining; - } - - /** - * @return the available - */ - public Integer getAvailable() { - return available; - } - - /** - * @return the value - */ - public Integer getValue() { - return value; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" - + unit + ", verb=" + verb + ", remaining=" + remaining - + ", available=" + available + ", value=" + value + "]"; - } - - } - - private String regex; - - private String uri; - - private List limit; - - /** - * @return the regex - */ - public String getRegex() { - return regex; - } - - /** - * @return the uri - */ - public String getUri() { - return uri; - } - - /** - * @return the limit - */ - public List getLimit() { - return limit; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" - + limit + "]"; - } - - } - - public static final class AbsoluteLimit { - - private Integer maxTotalVolumes; - private Integer totalVolumesUsed; - - private Integer maxTotalSnapshots; - private Integer totalSnapshotsUsed; - - private Integer maxTotalVolumeGigabytes; - private Integer totalGigabytesUsed; - - private Integer maxTotalBackups; - private Integer totalBackupsUsed; - - private Integer maxTotalBackupGigabytes; - private Integer totalBackupGigabytesUsed; - - /** - * @return the maxTotalVolumes - */ - public Integer getMaxTotalVolumes() { - return maxTotalVolumes; - } - - /** - * @return the totalVolumesUsed - */ - public Integer getTotalVolumesUsed() { - return totalVolumesUsed; - } - - /** - * @return the maxTotalSnapshots - */ - public Integer getMaxTotalSnapshots() { - return maxTotalSnapshots; - } - - /** - * @return the totalSnapshotsUsed - */ - public Integer getTotalSnapshotsUsed() { - return totalSnapshotsUsed; - } - - /** - * @return the maxTotalVolumeGigabytes - */ - public Integer getMaxTotalVolumeGigabytes() { - return maxTotalVolumeGigabytes; - } - - /** - * @return the totalGigabytesUsed - */ - public Integer getTotalGigabytesUsed() { - return totalGigabytesUsed; - } - - /** - * @return the maxTotalBackupGigabytes - */ - public Integer getMaxTotalBackupGigabytes() { - return maxTotalBackupGigabytes; - } - - /** - * @return the totalBackupGigabytesUsed - */ - public Integer getTotalBackupGigabytesUsed() { - return totalBackupGigabytesUsed; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AbsoluteLimit [maxTotalVolumes=" + maxTotalVolumes + - ", totalVolumesUsed=" + totalVolumesUsed + - ", maxTotalSnapshots=" + maxTotalSnapshots + - ", totalSnapshotsUsed=" + totalSnapshotsUsed + - ", maxTotalVolumeGigabytes=" + maxTotalVolumeGigabytes + - ", totalGigabytesUsed=" + totalGigabytesUsed + - ", maxTotalBackupGigabytes=" + maxTotalBackupGigabytes + - ", totalBackupGigabytesUsed=" + totalBackupGigabytesUsed +"]"; - } - - } - - private List rate; - - private AbsoluteLimit absolute; - - /** - * @return the rate - */ - public List getRate() { - return rate; - } - - /** - * @return the absolute - */ - public AbsoluteLimit getAbsolute() { - return absolute; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Limits [rate=" + rate + ", absolute=" + absolute + "]"; - } + public static final class RateLimit implements Serializable { + + public static final class LimitEntry implements Serializable { + + @JsonProperty("next-available") + private Calendar nextAvailable; + + private String unit; + + private String verb; + + private Integer remaining; + + private Integer available; + + private Integer value; + + /** + * @return the nextAvailable + */ + public Calendar getNextAvailable() { + return nextAvailable; + } + + /** + * @return the unit + */ + public String getUnit() { + return unit; + } + + /** + * @return the verb + */ + public String getVerb() { + return verb; + } + + /** + * @return the remaining + */ + public Integer getRemaining() { + return remaining; + } + + /** + * @return the available + */ + public Integer getAvailable() { + return available; + } + + /** + * @return the value + */ + public Integer getValue() { + return value; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" + unit + ", verb=" + verb + + ", remaining=" + remaining + ", available=" + available + ", value=" + value + "]"; + } + + } + + private String regex; + + private String uri; + + private List limit; + + /** + * @return the regex + */ + public String getRegex() { + return regex; + } + + /** + * @return the uri + */ + public String getUri() { + return uri; + } + + /** + * @return the limit + */ + public List getLimit() { + return limit; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" + limit + "]"; + } + + } + + public static final class AbsoluteLimit { + + private Integer maxTotalVolumes; + private Integer totalVolumesUsed; + + private Integer maxTotalSnapshots; + private Integer totalSnapshotsUsed; + + private Integer maxTotalVolumeGigabytes; + private Integer totalGigabytesUsed; + + private Integer maxTotalBackups; + private Integer totalBackupsUsed; + + private Integer maxTotalBackupGigabytes; + private Integer totalBackupGigabytesUsed; + + /** + * @return the maxTotalVolumes + */ + public Integer getMaxTotalVolumes() { + return maxTotalVolumes; + } + + /** + * @return the totalVolumesUsed + */ + public Integer getTotalVolumesUsed() { + return totalVolumesUsed; + } + + /** + * @return the maxTotalSnapshots + */ + public Integer getMaxTotalSnapshots() { + return maxTotalSnapshots; + } + + /** + * @return the totalSnapshotsUsed + */ + public Integer getTotalSnapshotsUsed() { + return totalSnapshotsUsed; + } + + /** + * @return the maxTotalVolumeGigabytes + */ + public Integer getMaxTotalVolumeGigabytes() { + return maxTotalVolumeGigabytes; + } + + /** + * @return the totalGigabytesUsed + */ + public Integer getTotalGigabytesUsed() { + return totalGigabytesUsed; + } + + /** + * @return the maxTotalBackupGigabytes + */ + public Integer getMaxTotalBackupGigabytes() { + return maxTotalBackupGigabytes; + } + + /** + * @return the totalBackupGigabytesUsed + */ + public Integer getTotalBackupGigabytesUsed() { + return totalBackupGigabytesUsed; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "AbsoluteLimit [maxTotalVolumes=" + maxTotalVolumes + ", totalVolumesUsed=" + totalVolumesUsed + + ", maxTotalSnapshots=" + maxTotalSnapshots + ", totalSnapshotsUsed=" + totalSnapshotsUsed + + ", maxTotalVolumeGigabytes=" + maxTotalVolumeGigabytes + ", totalGigabytesUsed=" + + totalGigabytesUsed + ", maxTotalBackupGigabytes=" + maxTotalBackupGigabytes + + ", totalBackupGigabytesUsed=" + totalBackupGigabytesUsed + "]"; + } + + } + + private List rate; + + private AbsoluteLimit absolute; + + /** + * @return the rate + */ + public List getRate() { + return rate; + } + + /** + * @return the absolute + */ + public AbsoluteLimit getAbsolute() { + return absolute; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Limits [rate=" + rate + ", absolute=" + absolute + "]"; + } } diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Link.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Link.java new file mode 100644 index 0000000..7bfab0c --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Link.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * 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.cinder.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Link { + @JsonProperty("href") + private String href; + + @JsonProperty("rel") + private String rel; + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getRel() { + return rel; + } + + public void setRel(String rel) { + this.rel = rel; + } + + @Override + public String toString() { + return "Link{" + "href='" + href + '\'' + ", rel='" + rel + '\'' + '}'; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Metadata.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Metadata.java index b8ed1df..e20f8b2 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Metadata.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Metadata.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.util.Map; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pool.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pool.java index 4f292c4..e1b5c14 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pool.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pool.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; @@ -48,9 +50,6 @@ public class Pool implements Serializable { @Override public String toString() { - return "Pool{" - + "name='" + name - + ", capabilities='" + capabilities - + '}'; + return "Pool{" + "name='" + name + ", capabilities='" + capabilities + '}'; } } diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pools.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pools.java index 771b0ac..72c934b 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pools.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Pools.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,6 +13,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java index 6f78c8f..49fd15d 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,11 +13,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -104,10 +105,9 @@ public class Snapshot implements Serializable { */ @Override public String toString() { - return "Snapshot [id=" + id + ", status=" + status + - ", name=" + name + ", description=" + description + - ", volumeId=" + volumeId + ", size=" + size + - ", createdAt=" + createdAt + ", metadata=" + metadata + "]"; + return "Snapshot [id=" + id + ", status=" + status + ", name=" + name + ", description=" + description + + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" + createdAt + ", metadata=" + metadata + + "]"; } } diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java index e2896b8..4e343b1 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,10 +13,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -39,8 +40,7 @@ public class SnapshotForCreate implements Serializable { } /** - * @param volumeId - * the volumeId to set + * @param volumeId the volumeId to set */ public void setVolumeId(String volumeId) { this.volumeId = volumeId; @@ -54,8 +54,7 @@ public class SnapshotForCreate implements Serializable { } /** - * @param force - * the force to set + * @param force the force to set */ public void setForce(Boolean force) { this.force = force; @@ -69,8 +68,7 @@ public class SnapshotForCreate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -84,8 +82,7 @@ public class SnapshotForCreate implements Serializable { } /** - * @param description - * the description to set + * @param description the description to set */ public void setDescription(String description) { this.description = description; @@ -98,8 +95,8 @@ public class SnapshotForCreate implements Serializable { */ @Override public String toString() { - return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force - + ", name=" + name + ", description=" + description + "]"; + return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force + ", name=" + name + ", description=" + + description + "]"; } } diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForUpdate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForUpdate.java index dd16b55..dfb3dc8 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForUpdate.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForUpdate.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,10 +13,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("snapshot") @@ -33,8 +34,7 @@ public class SnapshotForUpdate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -48,8 +48,7 @@ public class SnapshotForUpdate implements Serializable { } /** - * @param description - * the description to set + * @param description the description to set */ public void setDescription(String description) { this.description = description; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java index aec991a..6cf465e 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,12 +13,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Snapshots implements Iterable, Serializable { diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java index 6d0068c..c7f6382 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,14 +13,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package com.woorea.openstack.cinder.model; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; + +package com.woorea.openstack.cinder.model; import java.io.Serializable; +import java.util.Date; import java.util.List; import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("volume") public class Volume implements Serializable { @@ -28,8 +31,10 @@ public class Volume implements Serializable { private String status; + @JsonProperty("name") private String name; + @JsonProperty("description") private String description; @JsonProperty("availability_zone") @@ -38,24 +43,116 @@ public class Volume implements Serializable { @JsonProperty("volume_type") private String volumeType; + @JsonProperty("bootable") + private String bootable; + + @JsonProperty("os-vol-host-attr:host") + private String osVolhostAttribute; + + @JsonProperty("os-vol-tenant-attr:tenant_id") + private String tenantId; + @JsonProperty("snapshot_id") private String snapshotId; @JsonProperty("source_volid") private String sourceVolid; - @JsonProperty("bootable") - private Boolean bootable; + private List links; private List> attachments; private Map metadata; @JsonProperty("created_at") - private String createdAt; + private Date createdAt; private Integer size; + public String getBootable() { + return bootable; + } + + public void setBootable(String bootable) { + this.bootable = bootable; + } + + public String getOsVolhostAttribute() { + return osVolhostAttribute; + } + + public void setOsVolhostAttribute(String osVolhostAttribute) { + this.osVolhostAttribute = osVolhostAttribute; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getSourceVolid() { + return sourceVolid; + } + + public void setSourceVolid(String sourceVolid) { + this.sourceVolid = sourceVolid; + } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + + public void setId(String id) { + this.id = id; + } + + public void setStatus(String status) { + this.status = status; + } + + public void setName(String name) { + this.name = name; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public void setVolumeType(String volumeType) { + this.volumeType = volumeType; + } + + public void setSnapshotId(String snapshotId) { + this.snapshotId = snapshotId; + } + + public void setAttachments(List> attachments) { + this.attachments = attachments; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public void setSize(Integer size) { + this.size = size; + } + /** * @return the id */ @@ -105,36 +202,6 @@ public class Volume implements Serializable { return snapshotId; } - /** - * @return the ID of an existing volume (specify in order to create a volume from an existing volume) - */ - public String getSourceVolid() { - return sourceVolid; - } - - /** - * @param sourceVolid - * to set - */ - public void setSourceVolid(String sourceVolid) { - this.sourceVolid = sourceVolid; - } - - /** - * @param volumeType - * to set - */ - public void setVolumeType(String volumeType) { - this.volumeType = volumeType; - } - - /** - * @return the bootable flag to set - */ - public Boolean getBootable() { - return bootable; - } - /** * @return the attachments */ @@ -152,7 +219,7 @@ public class Volume implements Serializable { /** * @return the createdAt */ - public String getCreatedAt() { + public Date getCreatedAt() { return createdAt; } @@ -163,18 +230,6 @@ public class Volume implements Serializable { return size; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Volume [id=" + id + ", status=" + status + - ", name=" + name + ", description=" + description + - ", availabilityZone=" + availabilityZone + ", volumeType=" + volumeType + - ", snapshotId=" + snapshotId + ", attachments=" + attachments + - ", metadata=" + metadata + ", createdAt=" + createdAt + ", size=" + size + "]"; - } + } diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForCreate.java index dd70820..b6a65b9 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForCreate.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForCreate.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,11 +13,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -59,8 +60,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param size - * the size to set + * @param size the size to set */ public void setSize(Integer size) { this.size = size; @@ -74,8 +74,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param availabilityZone - * the availabilityZone to set + * @param availabilityZone the availabilityZone to set */ public void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; @@ -89,8 +88,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -104,8 +102,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param description - * the description to set + * @param description the description to set */ public void setDescription(String description) { this.description = description; @@ -119,8 +116,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param snapshotId - * the snapshotId to set + * @param snapshotId the snapshotId to set */ public void setSnapshotId(String snapshotId) { this.snapshotId = snapshotId; @@ -134,8 +130,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param sourceVolid - * to set + * @param sourceVolid to set */ public void setSourceVolid(String sourceVolid) { this.sourceVolid = sourceVolid; @@ -149,8 +144,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param imageRef - * to set + * @param imageRef to set */ public void setImageRef(String imageRef) { this.imageRef = imageRef; @@ -164,8 +158,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param volumeType - * to set + * @param volumeType to set */ public void setVolumeType(String volumeType) { this.volumeType = volumeType; @@ -181,8 +174,7 @@ public class VolumeForCreate implements Serializable { /** * Enables or disables the bootable attribute. You can boot an instance from a bootable volume. * - * @param bootable - * flag + * @param bootable flag */ public void setBootable(Boolean bootable) { this.bootable = bootable; @@ -196,8 +188,7 @@ public class VolumeForCreate implements Serializable { } /** - * @param metadata - * the metadata to set + * @param metadata the metadata to set */ public void setMetadata(Map metadata) { this.metadata = metadata; @@ -210,16 +201,10 @@ public class VolumeForCreate implements Serializable { */ @Override public String toString() { - return "VolumeForCreate [size=" + size + - ", availabilityZone=" + availabilityZone + - ", name=" + name + - ", description=" + description + - ", snapshotId=" + snapshotId + - ", source_volid=" + sourceVolid + - ", imageRef=" + imageRef + - ", volume_type=" + volumeType + - ", bootable=" + bootable + - ", metadata=" + metadata + "]"; + return "VolumeForCreate [size=" + size + ", availabilityZone=" + availabilityZone + ", name=" + name + + ", description=" + description + ", snapshotId=" + snapshotId + ", source_volid=" + sourceVolid + + ", imageRef=" + imageRef + ", volume_type=" + volumeType + ", bootable=" + bootable + ", metadata=" + + metadata + "]"; } } diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForExtend.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForExtend.java index 75eee2d..f8c9a3c 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForExtend.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForExtend.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,10 +13,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -33,8 +34,7 @@ public class VolumeForExtend implements Serializable { } /** - * @param size - * the size to set + * @param size the size to set */ public void setSize(Integer size) { this.size = size; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForImageCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForImageCreate.java index 916892f..46bb034 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForImageCreate.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForImageCreate.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,10 +13,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForUpdate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForUpdate.java index 5746f49..8553148 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForUpdate.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeForUpdate.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,10 +13,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("volume") @@ -33,8 +34,7 @@ public class VolumeForUpdate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -48,8 +48,7 @@ public class VolumeForUpdate implements Serializable { } /** - * @param description - * the description to set + * @param description the description to set */ public void setDescription(String description) { this.description = description; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeType.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeType.java index 73fdfe1..ade7191 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeType.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeType.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,11 +13,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypeForCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypeForCreate.java index e228c27..5be1c8f 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypeForCreate.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypeForCreate.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,11 +13,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -36,8 +37,7 @@ public class VolumeTypeForCreate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -51,8 +51,7 @@ public class VolumeTypeForCreate implements Serializable { } /** - * @param extraSpecs - * the extra_specs to set + * @param extraSpecs the extra_specs to set */ public void setExtraSpecs(Map extraSpecs) { this.extraSpecs = extraSpecs; diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypes.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypes.java index 761a702..76b950b 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypes.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/VolumeTypes.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,12 +13,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class VolumeTypes implements Iterable, Serializable { diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java index 096bf9a..937b28f 100755 --- a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java @@ -1,4 +1,5 @@ -/* ============LICENSE_START======================================================= +/*- + * ============LICENSE_START======================================================= * 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 @@ -12,12 +13,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package com.woorea.openstack.cinder.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Volumes implements Iterable, Serializable { @@ -32,6 +33,17 @@ public class Volumes implements Iterable, Serializable { return list; } + @JsonProperty("volumes_links") + private List links; + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + /* * (non-Javadoc) * diff --git a/glance-client/pom.xml b/glance-client/pom.xml index 6e6530a..d0fb9a0 100644 --- a/glance-client/pom.xml +++ b/glance-client/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.onap.so.libs @@ -10,16 +11,16 @@ OpenStack Glance Client OpenStack Glance Client - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + - - org.onap.so.libs.openstack-java-sdk - glance-model - ${project.version} - + + org.onap.so.libs.openstack-java-sdk + glance-model + ${project.version} + diff --git a/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java b/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java index 2dc1b9c..a34980d 100644 --- a/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java +++ b/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java @@ -112,7 +112,7 @@ public class ImagesResource { public Update(String id, Image image) { super(client, HttpMethod.PUT, new StringBuilder(IMAGES).append(id).toString(), Entity.json(image), - Image.class); + Image.class); } } @@ -140,7 +140,7 @@ public class ImagesResource { public Upload(String id, ImageUpload imageUpload) { super(client, HttpMethod.PUT, new StringBuilder(IMAGES).append(id).toString(), - Entity.stream(imageUpload.getInputStream()), Image.class); + Entity.stream(imageUpload.getInputStream()), Image.class); } public Upload(ImageUpload imageUpload) { @@ -150,7 +150,7 @@ public class ImagesResource { header(entry.getKey(), entry.getValue()); } - //file,s3,swift + // file,s3,swift header("x-image-meta-store", imageUpload.getStore()); } } @@ -158,8 +158,7 @@ public class ImagesResource { public class Download extends OpenStackRequest { public Download(String id) { - super(client, HttpMethod.GET, new StringBuilder(IMAGES).append(id).toString(), null, - ImageDownload.class); + super(client, HttpMethod.GET, new StringBuilder(IMAGES).append(id).toString(), null, ImageDownload.class); header("Accept", "application/octet-stream"); } @@ -178,7 +177,7 @@ public class ImagesResource { public ListMembers(String id) { super(client, HttpMethod.GET, new StringBuilder(IMAGES).append(id).append(MEMBERS).toString(), null, - ImageMembers.class); + ImageMembers.class); } } @@ -186,7 +185,7 @@ public class ImagesResource { public ReplaceMembers(String id, Collection members) { super(client, HttpMethod.PUT, new StringBuilder(IMAGES).append(id).append(MEMBERS).toString(), - Entity.json(new Memberships(members)), Void.class); + Entity.json(new Memberships(members)), Void.class); } } @@ -194,8 +193,8 @@ public class ImagesResource { public AddMember(String id, String tenantId) { super(client, HttpMethod.PUT, - new StringBuilder(IMAGES).append(id).append(MEMBERS).append(tenantId).toString(), null, - ImageMember.class); + new StringBuilder(IMAGES).append(id).append(MEMBERS).append(tenantId).toString(), null, + ImageMember.class); } } @@ -203,8 +202,8 @@ public class ImagesResource { public RemoveMember(String id, String tenantId) { super(client, HttpMethod.DELETE, - new StringBuilder(IMAGES).append(id).append("/members/").append(tenantId).toString(), null, - Void.class); + new StringBuilder(IMAGES).append(id).append("/members/").append(tenantId).toString(), null, + Void.class); } } diff --git a/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java b/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java index b17aae2..da9aabc 100644 --- a/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java +++ b/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java @@ -38,8 +38,8 @@ public class SharedImagesResource { public List(String tenantId, boolean detail) { super(client, HttpMethod.GET, - new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(), - null, SharedImages.class); + new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(), + null, SharedImages.class); } } } diff --git a/glance-model/pom.xml b/glance-model/pom.xml index d207b66..94111ea 100644 --- a/glance-model/pom.xml +++ b/glance-model/pom.xml @@ -1,25 +1,26 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - glance-model - OpenStack Glance Model - OpenStack Glance Model + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + glance-model + OpenStack Glance Model + OpenStack Glance Model - - - junit - junit - test - - - org.skyscreamer - jsonassert - test - - + + + junit + junit + test + + + org.skyscreamer + jsonassert + test + + diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java index aa7be87..b4b4c41 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java @@ -19,8 +19,8 @@ package com.woorea.openstack.glance.model; import java.io.Serializable; import java.util.Calendar; import java.util.HashMap; +import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -29,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonIgnoreProperties(ignoreUnknown = true) public class Image implements Serializable { + @JsonProperty("id") private String id; private String uri; @@ -46,6 +47,7 @@ public class Image implements Serializable { @JsonProperty("virtual_size") private Long virtualSize; + @JsonProperty("checksum") private String checksum; @JsonProperty("created_at") @@ -68,6 +70,7 @@ public class Image implements Serializable { @JsonProperty("min_disk") private Integer minDisk; + @JsonProperty("owner") private String owner; @JsonProperty("deleted") @@ -76,8 +79,174 @@ public class Image implements Serializable { @JsonProperty("protected") private boolean isProtected; + @JsonProperty("visibility") + private String visibility; + + @JsonProperty("file") + private String file; + + @JsonProperty("schema") + private String schema; + + @JsonProperty("self") + private String self; + + @JsonProperty("hw_cdrom_bus") + private String hwCDROMBus; + + @JsonProperty("hw_disk_bus") + private String hwDiskBus; + + @JsonProperty("hw_vif_mode") + private String hwVIFMode; + + @JsonProperty("post_processing_networking") + private String postProcessingNetworking; + + @JsonProperty("post_processing_tools") + private String postProccesingTools; + + @JsonProperty("bypass_meta_validation") + private String bypassMetaValidation; + + @JsonProperty("application_name") + private String applicationName; + + @JsonProperty("application_type") + private String applicationType; + + @JsonProperty("application_version") + private String applicationVersion; + + @JsonProperty("application_vendor") + private String applicationVendor; + + @JsonProperty("hw_scsi_model") + private String hwSCSIModel; + + @JsonProperty("description") + private String description; + + @JsonProperty("meta") + private String meta; + + @JsonProperty("tags") + private List tags; + private Map properties; + public String getHwCDROMBus() { + return hwCDROMBus; + } + + public void setHwCDROMBus(String hwCDROMBus) { + this.hwCDROMBus = hwCDROMBus; + } + + public String getHwDiskBus() { + return hwDiskBus; + } + + public void setHwDiskBus(String hwDiskBus) { + this.hwDiskBus = hwDiskBus; + } + + public String getHwVIFMode() { + return hwVIFMode; + } + + public void setHwVIFMode(String hwVIFMode) { + this.hwVIFMode = hwVIFMode; + } + + public String getPostProcessingNetworking() { + return postProcessingNetworking; + } + + public void setPostProcessingNetworking(String postProcessingNetworking) { + this.postProcessingNetworking = postProcessingNetworking; + } + + public String getPostProccesingTools() { + return postProccesingTools; + } + + public void setPostProccesingTools(String postProccesingTools) { + this.postProccesingTools = postProccesingTools; + } + + public String getBypassMetaValidation() { + return bypassMetaValidation; + } + + public void setBypassMetaValidation(String bypassMetaValidation) { + this.bypassMetaValidation = bypassMetaValidation; + } + + public String getApplicationName() { + return applicationName; + } + + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + public String getApplicationVersion() { + return applicationVersion; + } + + public void setApplicationVersion(String applicationVersion) { + this.applicationVersion = applicationVersion; + } + + public String getApplicationVendor() { + return applicationVendor; + } + + public void setApplicationVendor(String applicationVendor) { + this.applicationVendor = applicationVendor; + } + + public String getVisibility() { + return visibility; + } + + public void setVisibility(String visibility) { + this.visibility = visibility; + } + + public String getFile() { + return file; + } + + public void setFile(String file) { + this.file = file; + } + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + public String getSelf() { + return self; + } + + public void setSelf(String self) { + this.self = self; + } + + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + /** * @return the id */ @@ -340,16 +509,17 @@ public class Image implements Serializable { return properties; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return String.format("Image [id=%s, uri=%s, name=%s, diskFormat=%s containerFormat=%s, size=%d, checksum=%s," + " createdAt=%s, updatedAt=%s, deletedAt=%s, status=%s, isPublic=%s, minRam=%d, minDisk=%d, owner=%s," - + " isDeleted=%s, isProtected=%s, properties=%s]", - id, uri, name, diskFormat, containerFormat, size, checksum, - createdAt, updatedAt, deletedAt, status, isPublic, minRam, minDisk, owner, - isDeleted, isProtected, properties); + + " isDeleted=%s, isProtected=%s, properties=%s]", id, uri, name, diskFormat, containerFormat, size, + checksum, createdAt, updatedAt, deletedAt, status, isPublic, minRam, minDisk, owner, isDeleted, + isProtected, properties); } } diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java index eb286ff..83935f8 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java @@ -19,9 +19,9 @@ package com.woorea.openstack.glance.model; import java.io.InputStream; public class ImageDownload { - + private Image image; - + private InputStream inputStream; /** diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java index 8cecda9..e4b89d5 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java @@ -17,19 +17,18 @@ package com.woorea.openstack.glance.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class ImageMember implements Serializable { @JsonProperty("can_share") private boolean canShare; - + @JsonProperty("member_id") private String memberId; public ImageMember() { - + } public ImageMember(boolean canShare, String memberId) { diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java index fd977ed..750b196 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java @@ -19,7 +19,6 @@ package com.woorea.openstack.glance.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class ImageMembers implements Iterable, Serializable { @@ -38,5 +37,5 @@ public class ImageMembers implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java index 428a5d2..a384214 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java @@ -60,7 +60,7 @@ public class ImageUpload { * @return the properties */ public Map getProperties() { - if(properties == null) { + if (properties == null) { properties = new HashMap<>(); } return properties; diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java index b3b278c..baedb22 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java @@ -19,7 +19,6 @@ package com.woorea.openstack.glance.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Images implements Iterable, Serializable { @@ -27,6 +26,15 @@ public class Images implements Iterable, Serializable { @JsonProperty("images") private List list; + @JsonProperty("next") + private String next; + + @JsonProperty("first") + private String first; + + @JsonProperty("schema") + private String schema; + /** * @return the list */ @@ -34,9 +42,33 @@ public class Images implements Iterable, Serializable { return list; } + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public String getFirst() { + return first; + } + + public void setFirst(String first) { + this.first = first; + } + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + @Override public Iterator iterator() { return list.iterator(); } - + } diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java index b16897c..c4ddfdd 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java @@ -17,5 +17,5 @@ package com.woorea.openstack.glance.model; public class SharedImage { - -} \ No newline at end of file + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java index 6239a2b..be3f77f 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java @@ -19,7 +19,6 @@ package com.woorea.openstack.glance.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class SharedImages implements Iterable, Serializable { @@ -38,5 +37,5 @@ public class SharedImages implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageDownloadTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageDownloadTest.java index 15120ce..acfb6d6 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageDownloadTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageDownloadTest.java @@ -20,7 +20,6 @@ package com.woorea.openstack.glance.model; import org.junit.Test; - import java.io.IOException; import java.io.InputStream; @@ -53,4 +52,4 @@ public class ImageDownloadTest { }); } -} \ No newline at end of file +} diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMemberTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMemberTest.java index e8323d9..acb55d6 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMemberTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMemberTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class ImageMemberTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"can_share\" : false," + EOL - + " \"member_id\" : \"memberid\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"can_share\" : false," + EOL + " \"member_id\" : \"memberid\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class ImageMemberTest { public void testMethods() throws Exception { ImageMember imagemember = objectMapper.readValue(JSON_FULL, ImageMember.class); imagemember.toString(); - + String memberId = imagemember.getMemberId(); Assert.assertNotNull(memberId); imagemember.setMemberId(memberId); diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMembersTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMembersTest.java index 513791a..22fd432 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMembersTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMembersTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,21 +34,13 @@ public class ImageMembersTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"members\" : [ {" + EOL - + " \"can_share\" : false," + EOL - + " \"member_id\" : \"memberid\"" + EOL - + " }, {" + EOL - + " \"can_share\" : false," + EOL - + " \"member_id\" : \"memberid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"members\" : [ {" + EOL + " \"can_share\" : false," + EOL + + " \"member_id\" : \"memberid\"" + EOL + " }, {" + EOL + " \"can_share\" : false," + EOL + + " \"member_id\" : \"memberid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,13 +56,14 @@ public class ImageMembersTest { public void testMethods() throws Exception { ImageMembers imagemembers = objectMapper.readValue(JSON_FULL, ImageMembers.class); imagemembers.toString(); - + List list = imagemembers.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") ImageMember x : imagemembers) { + for (@SuppressWarnings("unused") + ImageMember x : imagemembers) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageTest.java index 8e8914c..d6a2d8d 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageTest.java @@ -24,10 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Calendar; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,41 +35,22 @@ public class ImageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"size\" : 43," + EOL - + " \"checksum\" : \"checksum\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"owner\" : \"owner\"," + EOL - + " \"properties\" : {" + EOL - + " \"properties-k1\" : \"properties-v1\"," + EOL - + " \"properties-k2\" : \"properties-v2\"" + EOL - + " }," + EOL - + " \"public\" : false," + EOL - + " \"deleted\" : false," + EOL - + " \"protected\" : true," + EOL - + " \"disk_format\" : \"diskformat\"," + EOL - + " \"container_format\" : \"containerformat\"," + EOL - + " \"virtual_size\" : 18," + EOL - + " \"created_at\" : 1486296000000," + EOL - + " \"updated_at\" : 1487592000000," + EOL - + " \"deleted_at\" : 1486209600000," + EOL - + " \"is_public\" : false," + EOL - + " \"min_ram\" : 62," + EOL - + " \"min_disk\" : 69" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"uri\" : \"uri\"," + EOL + " \"name\" : \"name\"," + EOL + " \"size\" : 43," + EOL + + " \"checksum\" : \"checksum\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"owner\" : \"owner\"," + EOL + " \"properties\" : {" + EOL + + " \"properties-k1\" : \"properties-v1\"," + EOL + " \"properties-k2\" : \"properties-v2\"" + EOL + + " }," + EOL + " \"public\" : false," + EOL + " \"deleted\" : false," + EOL + + " \"protected\" : true," + EOL + " \"disk_format\" : \"diskformat\"," + EOL + + " \"container_format\" : \"containerformat\"," + EOL + " \"virtual_size\" : 18," + EOL + + " \"created_at\" : 1486296000000," + EOL + " \"updated_at\" : 1487592000000," + EOL + + " \"deleted_at\" : 1486209600000," + EOL + " \"is_public\" : false," + EOL + " \"min_ram\" : 62," + + EOL + " \"min_disk\" : 69" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -87,67 +66,67 @@ public class ImageTest { public void testMethods() throws Exception { Image image = objectMapper.readValue(JSON_FULL, Image.class); image.toString(); - + String owner = image.getOwner(); Assert.assertNotNull(owner); image.setOwner(owner); - + String containerFormat = image.getContainerFormat(); Assert.assertNotNull(containerFormat); image.setContainerFormat(containerFormat); - + String uri = image.getUri(); Assert.assertNotNull(uri); image.setUri(uri); - + Calendar createdAt = image.getCreatedAt(); Assert.assertNotNull(createdAt); image.setCreatedAt(createdAt); - + Calendar deletedAt = image.getDeletedAt(); Assert.assertNotNull(deletedAt); image.setDeletedAt(deletedAt); - + Long size = image.getSize(); Assert.assertNotNull(size); image.setSize(size); - + Integer minRam = image.getMinRam(); Assert.assertNotNull(minRam); image.setMinRam(minRam); - + String diskFormat = image.getDiskFormat(); Assert.assertNotNull(diskFormat); image.setDiskFormat(diskFormat); - + String checksum = image.getChecksum(); Assert.assertNotNull(checksum); image.setChecksum(checksum); - + String name = image.getName(); Assert.assertNotNull(name); image.setName(name); - + String id = image.getId(); Assert.assertNotNull(id); image.setId(id); - + Long virtualSize = image.getVirtualSize(); Assert.assertNotNull(virtualSize); image.setVirtualSize(virtualSize); - - Map properties = image.getProperties(); + + Map properties = image.getProperties(); Assert.assertNotNull(properties); Assert.assertEquals(2, properties.size()); - + Integer minDisk = image.getMinDisk(); Assert.assertNotNull(minDisk); image.setMinDisk(minDisk); - + String status = image.getStatus(); Assert.assertNotNull(status); image.setStatus(status); - + Calendar updatedAt = image.getUpdatedAt(); Assert.assertNotNull(updatedAt); image.setUpdatedAt(updatedAt); diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageUploadTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageUploadTest.java index d18fee9..dd97040 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageUploadTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageUploadTest.java @@ -20,7 +20,6 @@ package com.woorea.openstack.glance.model; import org.junit.Test; - import java.io.IOException; import java.io.InputStream; @@ -68,4 +67,4 @@ public class ImageUploadTest { }); } -} \ No newline at end of file +} diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImagesTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImagesTest.java index 1ba0907..f72e1cf 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImagesTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImagesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,63 +34,31 @@ public class ImagesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"images\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"size\" : 43," + EOL - + " \"checksum\" : \"checksum\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"owner\" : \"owner\"," + EOL - + " \"properties\" : {" + EOL - + " \"properties-k1\" : \"properties-v1\"," + EOL - + " \"properties-k2\" : \"properties-v2\"" + EOL - + " }," + EOL - + " \"public\" : false," + EOL - + " \"deleted\" : false," + EOL - + " \"protected\" : true," + EOL - + " \"disk_format\" : \"diskformat\"," + EOL - + " \"container_format\" : \"containerformat\"," + EOL - + " \"virtual_size\" : 18," + EOL - + " \"created_at\" : 1486296000000," + EOL - + " \"updated_at\" : 1487592000000," + EOL - + " \"deleted_at\" : 1486209600000," + EOL - + " \"is_public\" : false," + EOL - + " \"min_ram\" : 62," + EOL - + " \"min_disk\" : 69" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"size\" : 43," + EOL - + " \"checksum\" : \"checksum\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"owner\" : \"owner\"," + EOL - + " \"properties\" : {" + EOL - + " \"properties-k1\" : \"properties-v1\"," + EOL - + " \"properties-k2\" : \"properties-v2\"" + EOL - + " }," + EOL - + " \"public\" : false," + EOL - + " \"deleted\" : false," + EOL - + " \"protected\" : true," + EOL - + " \"disk_format\" : \"diskformat\"," + EOL - + " \"container_format\" : \"containerformat\"," + EOL - + " \"virtual_size\" : 18," + EOL - + " \"created_at\" : 1486296000000," + EOL - + " \"updated_at\" : 1487592000000," + EOL - + " \"deleted_at\" : 1486209600000," + EOL - + " \"is_public\" : false," + EOL - + " \"min_ram\" : 62," + EOL - + " \"min_disk\" : 69" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"images\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"uri\" : \"uri\"," + EOL + " \"name\" : \"name\"," + EOL + " \"size\" : 43," + EOL + + " \"checksum\" : \"checksum\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"owner\" : \"owner\"," + EOL + " \"properties\" : {" + EOL + + " \"properties-k1\" : \"properties-v1\"," + EOL + " \"properties-k2\" : \"properties-v2\"" + EOL + + " }," + EOL + " \"public\" : false," + EOL + " \"deleted\" : false," + EOL + + " \"protected\" : true," + EOL + " \"disk_format\" : \"diskformat\"," + EOL + + " \"container_format\" : \"containerformat\"," + EOL + " \"virtual_size\" : 18," + EOL + + " \"created_at\" : 1486296000000," + EOL + " \"updated_at\" : 1487592000000," + EOL + + " \"deleted_at\" : 1486209600000," + EOL + " \"is_public\" : false," + EOL + " \"min_ram\" : 62," + + EOL + " \"min_disk\" : 69" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"uri\" : \"uri\"," + EOL + " \"name\" : \"name\"," + EOL + " \"size\" : 43," + EOL + + " \"checksum\" : \"checksum\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"owner\" : \"owner\"," + EOL + " \"properties\" : {" + EOL + + " \"properties-k1\" : \"properties-v1\"," + EOL + " \"properties-k2\" : \"properties-v2\"" + EOL + + " }," + EOL + " \"public\" : false," + EOL + " \"deleted\" : false," + EOL + + " \"protected\" : true," + EOL + " \"disk_format\" : \"diskformat\"," + EOL + + " \"container_format\" : \"containerformat\"," + EOL + " \"virtual_size\" : 18," + EOL + + " \"created_at\" : 1486296000000," + EOL + " \"updated_at\" : 1487592000000," + EOL + + " \"deleted_at\" : 1486209600000," + EOL + " \"is_public\" : false," + EOL + " \"min_ram\" : 62," + + EOL + " \"min_disk\" : 69" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -108,13 +74,14 @@ public class ImagesTest { public void testMethods() throws Exception { Images images = objectMapper.readValue(JSON_FULL, Images.class); images.toString(); - + List list = images.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Image x : images) { + for (@SuppressWarnings("unused") + Image x : images) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImageTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImageTest.java index 41805cb..d758165 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImageTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImageTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,12 +33,10 @@ public class SharedImageTest { private static final String JSON_FULL = "{ }"; // FAIL_ON_EMPTY_BEANS set to false to conform to legacy behavior - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImagesTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImagesTest.java index 7695f54..1f8fd9e 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImagesTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImagesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,17 +34,13 @@ public class SharedImagesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"shared_images\" : [ { }, { } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"shared_images\" : [ { }, { } ]" + EOL + "}"; // FAIL_ON_EMPTY_BEANS set to false to conform to legacy behavior - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -62,13 +56,14 @@ public class SharedImagesTest { public void testMethods() throws Exception { SharedImages sharedimages = objectMapper.readValue(JSON_FULL, SharedImages.class); sharedimages.toString(); - + List list = sharedimages.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") SharedImage x : sharedimages) { + for (@SuppressWarnings("unused") + SharedImage x : sharedimages) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/heat-client/pom.xml b/heat-client/pom.xml index 1393249..ebfc8f8 100644 --- a/heat-client/pom.xml +++ b/heat-client/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.onap.so.libs @@ -10,23 +11,23 @@ OpenStack Heat Client OpenStack Heat Client - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + - - org.onap.so.libs.openstack-java-sdk - heat-model - ${project.version} - - - junit - junit - 4.12 - test - + + org.onap.so.libs.openstack-java-sdk + heat-model + ${project.version} + + + junit + junit + 4.12 + test + diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java index e12f9f7..76991e1 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java @@ -47,7 +47,7 @@ public class Heat extends OpenStackClient { public ResourcesResource getResources() { return resources; } - + public StackEvents getEvents() { return events; } diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/StackEvents.java b/heat-client/src/main/java/com/woorea/openstack/heat/StackEvents.java index ca54d73..cf680b9 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/StackEvents.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/StackEvents.java @@ -25,22 +25,22 @@ import com.woorea.openstack.heat.model.Events; * v1/{tenant_id}/stacks/{stack_name}/{stack_id}/events */ public class StackEvents { - private final OpenStackClient client; + private final OpenStackClient client; - public StackEvents(OpenStackClient client) { - this.client = client; - } + public StackEvents(OpenStackClient client) { + this.client = client; + } - public ListEvents listEvents(String name, String id) { - return new ListEvents(name, id); - } + public ListEvents listEvents(String name, String id) { + return new ListEvents(name, id); + } - /** - * v1/​{tenant_id}​/stacks/​{stack_name}​/resources - */ - public class ListEvents extends OpenStackRequest { - public ListEvents(String name, String id) { - super(client, HttpMethod.GET, "/stacks/" + name + "/" + id + "/events", null, Events.class); - } - } + /** + * v1/​{tenant_id}​/stacks/​{stack_name}​/resources + */ + public class ListEvents extends OpenStackRequest { + public ListEvents(String name, String id) { + super(client, HttpMethod.GET, "/stacks/" + name + "/" + id + "/events", null, Events.class); + } + } } diff --git a/heat-client/src/test/java/com/woorea/openstack/heat/HeatTest.java b/heat-client/src/test/java/com/woorea/openstack/heat/HeatTest.java index 9aff4cc..e0b1134 100644 --- a/heat-client/src/test/java/com/woorea/openstack/heat/HeatTest.java +++ b/heat-client/src/test/java/com/woorea/openstack/heat/HeatTest.java @@ -35,4 +35,4 @@ public class HeatTest { heat.getResources(); } -} \ No newline at end of file +} diff --git a/heat-client/src/test/java/com/woorea/openstack/heat/ResourcesResourceTest.java b/heat-client/src/test/java/com/woorea/openstack/heat/ResourcesResourceTest.java index 380b016..7093c57 100644 --- a/heat-client/src/test/java/com/woorea/openstack/heat/ResourcesResourceTest.java +++ b/heat-client/src/test/java/com/woorea/openstack/heat/ResourcesResourceTest.java @@ -31,4 +31,4 @@ public class ResourcesResourceTest { resourcesResource.listResources("resource"); } -} \ No newline at end of file +} diff --git a/heat-client/src/test/java/com/woorea/openstack/heat/StackResourceTest.java b/heat-client/src/test/java/com/woorea/openstack/heat/StackResourceTest.java index 8831c76..c280132 100644 --- a/heat-client/src/test/java/com/woorea/openstack/heat/StackResourceTest.java +++ b/heat-client/src/test/java/com/woorea/openstack/heat/StackResourceTest.java @@ -27,6 +27,7 @@ import org.junit.Test; public class StackResourceTest { StackResource stackResource = new StackResource(new OpenStackClient("os")); + @Test public void create() throws Exception { stackResource.create(new CreateStackParam()); @@ -52,4 +53,4 @@ public class StackResourceTest { stackResource.deleteByName("test"); } -} \ No newline at end of file +} diff --git a/heat-model/pom.xml b/heat-model/pom.xml index 8f9aad5..5e969e8 100644 --- a/heat-model/pom.xml +++ b/heat-model/pom.xml @@ -1,24 +1,25 @@ - - 4.0.0 - - - junit - junit - test - - - org.skyscreamer - jsonassert - test - - - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - heat-model - OpenStack Heat Model - OpenStack Heat Model + + 4.0.0 + + + junit + junit + test + + + org.skyscreamer + jsonassert + test + + + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + heat-model + OpenStack Heat Model + OpenStack Heat Model diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java index 09bb14c..9781184 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java @@ -21,7 +21,6 @@ package com.woorea.openstack.heat.model; */ import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; public class CreateStackParam { @@ -131,23 +130,9 @@ public class CreateStackParam { @Override public String toString() { - return String.format("CreateStackParam{" - + "stackName='%s'," - + " templateUrl='%s'," - + " template='%s'," - + " parameters=%s," - + " timeoutMinutes=%d," - + " environment='%s'," - + " disableRollback='%s'," - + " files=%s" - + "}", - stackName, - templateUrl, - template, - parameters, - timeoutMinutes, - environment, - disableRollback, - files); + return String.format( + "CreateStackParam{" + "stackName='%s'," + " templateUrl='%s'," + " template='%s'," + " parameters=%s," + + " timeoutMinutes=%d," + " environment='%s'," + " disableRollback='%s'," + " files=%s" + "}", + stackName, templateUrl, template, parameters, timeoutMinutes, environment, disableRollback, files); } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Event.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Event.java index 8abcdd5..c346ce3 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Event.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Event.java @@ -17,111 +17,110 @@ import java.util.List; * limitations under the License. * ============LICENSE_END========================================================= */ - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "event_time", "id", "links", "logical_resource_id", "physical_resource_id", "resource_name", - "resource_status", "resource_status_reason" }) +@JsonPropertyOrder({"event_time", "id", "links", "logical_resource_id", "physical_resource_id", "resource_name", + "resource_status", "resource_status_reason"}) public class Event { - @JsonProperty("event_time") - private String eventTime; - @JsonProperty("id") - private String id; - @JsonProperty("links") - private List links = null; - @JsonProperty("logical_resource_id") - private String logicalResourceId; - @JsonProperty("physical_resource_id") - private Object physicalResourceId; - @JsonProperty("resource_name") - private String resourceName; - @JsonProperty("resource_status") - private String resourceStatus; - @JsonProperty("resource_status_reason") - private String resourceStatusReason; - - @JsonProperty("event_time") - public String getEventTime() { - return eventTime; - } - - @JsonProperty("event_time") - public void setEventTime(String eventTime) { - this.eventTime = eventTime; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("links") - public List getLinks() { - return links; - } - - @JsonProperty("links") - public void setLinks(List links) { - this.links = links; - } - - @JsonProperty("logical_resource_id") - public String getLogicalResourceId() { - return logicalResourceId; - } - - @JsonProperty("logical_resource_id") - public void setLogicalResourceId(String logicalResourceId) { - this.logicalResourceId = logicalResourceId; - } - - @JsonProperty("physical_resource_id") - public Object getPhysicalResourceId() { - return physicalResourceId; - } - - @JsonProperty("physical_resource_id") - public void setPhysicalResourceId(Object physicalResourceId) { - this.physicalResourceId = physicalResourceId; - } - - @JsonProperty("resource_name") - public String getResourceName() { - return resourceName; - } - - @JsonProperty("resource_name") - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - @JsonProperty("resource_status") - public String getResourceStatus() { - return resourceStatus; - } - - @JsonProperty("resource_status") - public void setResourceStatus(String resourceStatus) { - this.resourceStatus = resourceStatus; - } - - @JsonProperty("resource_status_reason") - public String getResourceStatusReason() { - return resourceStatusReason; - } - - @JsonProperty("resource_status_reason") - public void setResourceStatusReason(String resourceStatusReason) { - this.resourceStatusReason = resourceStatusReason; - } + @JsonProperty("event_time") + private String eventTime; + @JsonProperty("id") + private String id; + @JsonProperty("links") + private List links = null; + @JsonProperty("logical_resource_id") + private String logicalResourceId; + @JsonProperty("physical_resource_id") + private Object physicalResourceId; + @JsonProperty("resource_name") + private String resourceName; + @JsonProperty("resource_status") + private String resourceStatus; + @JsonProperty("resource_status_reason") + private String resourceStatusReason; + + @JsonProperty("event_time") + public String getEventTime() { + return eventTime; + } + + @JsonProperty("event_time") + public void setEventTime(String eventTime) { + this.eventTime = eventTime; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("links") + public List getLinks() { + return links; + } + + @JsonProperty("links") + public void setLinks(List links) { + this.links = links; + } + + @JsonProperty("logical_resource_id") + public String getLogicalResourceId() { + return logicalResourceId; + } + + @JsonProperty("logical_resource_id") + public void setLogicalResourceId(String logicalResourceId) { + this.logicalResourceId = logicalResourceId; + } + + @JsonProperty("physical_resource_id") + public Object getPhysicalResourceId() { + return physicalResourceId; + } + + @JsonProperty("physical_resource_id") + public void setPhysicalResourceId(Object physicalResourceId) { + this.physicalResourceId = physicalResourceId; + } + + @JsonProperty("resource_name") + public String getResourceName() { + return resourceName; + } + + @JsonProperty("resource_name") + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + @JsonProperty("resource_status") + public String getResourceStatus() { + return resourceStatus; + } + + @JsonProperty("resource_status") + public void setResourceStatus(String resourceStatus) { + this.resourceStatus = resourceStatus; + } + + @JsonProperty("resource_status_reason") + public String getResourceStatusReason() { + return resourceStatusReason; + } + + @JsonProperty("resource_status_reason") + public void setResourceStatusReason(String resourceStatusReason) { + this.resourceStatusReason = resourceStatusReason; + } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Events.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Events.java index ca4fdff..4363129 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Events.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Events.java @@ -20,25 +20,24 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Events implements Iterable, Serializable { - /** - * - */ - private static final long serialVersionUID = 3598543745379474704L; - - @JsonProperty("events") - private List events = new ArrayList<>(); + /** + * + */ + private static final long serialVersionUID = 3598543745379474704L; + + @JsonProperty("events") + private List events = new ArrayList<>(); public List getEvents() { return events; } - + @Override public Iterator iterator() { return events.iterator(); diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java index 2b1628b..178ae0e 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java @@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; */ // There is no Root element for the Explanation return -//@JsonRootName("error") +// @JsonRootName("error") public class Explanation { @JsonProperty("explanation") private String explanation; @@ -34,7 +34,7 @@ public class Explanation { @JsonProperty("title") private String title; - + @JsonRootName("error") public static class Error { @JsonProperty("message") @@ -49,45 +49,43 @@ public class Explanation { public String getMessage() { return message; } - + public String getTraceback() { return traceback; } - + public String getType() { return type; } } - + private Error error; - + public String getExplanation() { return explanation; } - + public int getCode() { return code; } - + public String getTitle() { return title; } - + public Error getError() { return error; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Explanation [ " + - "code='" + code + - "', title='" + title + - "', explanation='" + explanation + - "', Error [type='" + error.type + - "', message='" + error.message + "' ] ]"; + return "Explanation [ " + "code='" + code + "', title='" + title + "', explanation='" + explanation + + "', Error [type='" + error.type + "', message='" + error.message + "' ] ]"; } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java index f70229e..d326e72 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java @@ -43,9 +43,6 @@ public class Link { @Override public String toString() { - return "Link{" + - "href='" + href + '\'' + - ", rel='" + rel + '\'' + - '}'; + return "Link{" + "href='" + href + '\'' + ", rel='" + rel + '\'' + '}'; } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java index df8ef01..5f2468d 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java @@ -18,7 +18,6 @@ package com.woorea.openstack.heat.model; import java.util.Date; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Resource { @@ -43,6 +42,9 @@ public class Resource { @JsonProperty("updated_time") private Date updatedTime; + @JsonProperty("creation_time") + private Date creationTime; + @JsonProperty("resource_type") private String type; @@ -53,6 +55,14 @@ public class Resource { return statusReason; } + public Date getCreationTime() { + return creationTime; + } + + public void setCreationTime(Date creationTime) { + this.creationTime = creationTime; + } + public void setStatusReason(String statusReason) { this.statusReason = statusReason; } @@ -123,16 +133,9 @@ public class Resource { @Override public String toString() { - return "Resource{" + - "name='" + name + '\'' + - ", links=" + links + - ", status='" + status + '\'' + - ", physicalResourceId='" + physicalResourceId + '\'' + - ", logicalResourceId='" + logicalResourceId + '\'' + - ", requiredBy=" + requiredBy + - ", updatedTime=" + updatedTime + - ", type='" + type + '\'' + - ", statusReason='" + statusReason + '\'' + - '}'; + return "Resource{" + "name='" + name + '\'' + ", links=" + links + ", status='" + status + '\'' + + ", physicalResourceId='" + physicalResourceId + '\'' + ", logicalResourceId='" + logicalResourceId + + '\'' + ", requiredBy=" + requiredBy + ", updatedTime=" + updatedTime + ", type='" + type + '\'' + + ", statusReason='" + statusReason + '\'' + '}'; } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java index db99f04..80069d5 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java @@ -19,7 +19,6 @@ package com.woorea.openstack.heat.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -39,8 +38,6 @@ public class Resources implements Iterable, Serializable { @Override public String toString() { - return "Resources{" + - "list=" + list + - '}'; + return "Resources{" + "list=" + list + '}'; } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java index 340f3d1..cb2d254 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java @@ -26,7 +26,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -42,6 +41,7 @@ public class Stack { @JsonProperty("links") private List links; + @JsonProperty("stack_status_reason") private String stackStatusReason; @@ -59,10 +59,76 @@ public class Stack { @JsonProperty("id") private String id; - + + @JsonProperty("template_description") + private String templateDescription; + + @JsonProperty("stack_owner") + private String stackOwner; + + @JsonProperty("disable_rollback") + private boolean disableRollback; + + @JsonProperty("stack_user_project_id") + private String userProjectId; + + @JsonProperty("timeout_mins") + private int timeouteMinutes; + + public String getTemplateDescription() { + return templateDescription; + } + + public void setTemplateDescription(String templateDescription) { + this.templateDescription = templateDescription; + } + + public String getStackOwner() { + return stackOwner; + } + + public void setStackOwner(String stackOwner) { + this.stackOwner = stackOwner; + } + + public boolean isDisableRollback() { + return disableRollback; + } + + public void setDisableRollback(boolean disableRollback) { + this.disableRollback = disableRollback; + } + + public String getUserProjectId() { + return userProjectId; + } + + public void setUserProjectId(String userProjectId) { + this.userProjectId = userProjectId; + } + + public int getTimeouteMinutes() { + return timeouteMinutes; + } + + public void setTimeouteMinutes(int timeouteMinutes) { + this.timeouteMinutes = timeouteMinutes; + } + + public String getProject() { + return project; + } + + public void setProject(String project) { + this.project = project; + } + + @JsonProperty("project") + private String project; + @JsonProperty("files") private Map files = null; - + // ObjectMapper instance to parse Json stack outputs @JsonIgnore private static ObjectMapper mapper = new ObjectMapper(); @@ -131,10 +197,11 @@ public class Stack { public void setDescription(String description) { this.description = description; } - + public Map getFiles() { return this.files; } + public void setFiles(Map files) { this.files = files; } @@ -142,31 +209,23 @@ public class Stack { @Override public String toString() { - return "Stack{" + - "description='" + description + '\'' + - ", links=" + links + - ", stackStatusReason='" + stackStatusReason + '\'' + - ", stackName='" + stackName + '\'' + - ", updatedTime=" + updatedTime + - ", creationTime=" + creationTime + - ", stackStatus='" + stackStatus + '\'' + - ", id='" + id + '\'' + - ", outputs='" + outputs + '\'' + - ", parameters='" + parameters + '\'' + - ", files='" + files + '\'' + - '}'; - } - - @JsonIgnoreProperties(ignoreUnknown=true) + return "Stack{" + "description='" + description + '\'' + ", links=" + links + ", stackStatusReason='" + + stackStatusReason + '\'' + ", stackName='" + stackName + '\'' + ", updatedTime=" + updatedTime + + ", creationTime=" + creationTime + ", stackStatus='" + stackStatus + '\'' + ", id='" + id + '\'' + + ", outputs='" + outputs + '\'' + ", parameters='" + parameters + '\'' + ", files='" + files + '\'' + + '}'; + } + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Output { @JsonProperty("output_value") private Object outputValue; - + private String description; - + @JsonProperty("output_key") private String outputKey; - + public Object getOutputValue() { return outputValue; } @@ -179,23 +238,24 @@ public class Stack { return outputKey; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Output [key=" + outputKey + ", value=" - + outputValue + "]"; + return "Output [key=" + outputKey + ", value=" + outputValue + "]"; } } - + private List outputs; public List getOutputs() { return outputs; } - - private Object _findOutputValue (String key) { + + private Object _findOutputValue(String key) { for (Output o : outputs) { if (o.getOutputKey().equals(key)) { return o.getOutputValue(); @@ -203,57 +263,49 @@ public class Stack { } return null; } - + /* - * Return a stack output as a String. - * Generally speaking, most outputs will be Strings. + * Return a stack output as a String. Generally speaking, most outputs will be Strings. */ - public String getOutputValue (String key) - { + public String getOutputValue(String key) { Object value = _findOutputValue(key); if (value != null) return value.toString(); else return null; } - + /* - * Return a stack output as a Json-mapped Object of the provided type. - * This is useful for json-object stack outputs. + * Return a stack output as a Json-mapped Object of the provided type. This is useful for json-object stack outputs. */ - public T getOutputValue (String key, Class type) - { + public T getOutputValue(String key, Class type) { try { String s = mapper.writeValueAsString(_findOutputValue(key)); return mapper.readValue(s, type); - } - catch (IOException e) { + } catch (IOException e) { return null; } } - + @JsonProperty("parameters") - private Map parameters = new HashMap<>(); - - public void setParameters (Map params) - { + private Map parameters = new HashMap<>(); + + public void setParameters(Map params) { // Need to "fix" comma-delimited-list parameters for pre-Juno Heat // (see https://bugs.launchpad.net/heat/+bug/1367393) parameters = params; - - for (Entry param : parameters.entrySet()) - { + + for (Entry param : parameters.entrySet()) { // CDL params are returned as a string with format: // "[u'',u'',...]" String value = param.getValue().toString(); - if (value.startsWith("[") && value.endsWith("]")) - { - param.setValue(value.substring(1,value.length()-1).replaceAll("u'([^\']+)'","$1")); + if (value.startsWith("[") && value.endsWith("]")) { + param.setValue(value.substring(1, value.length() - 1).replaceAll("u'([^\']+)'", "$1")); } } } - - public Map getParameters() { + + public Map getParameters() { return parameters; } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java index d4b11d6..59ff5dd 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java @@ -19,13 +19,23 @@ package com.woorea.openstack.heat.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Stacks implements Iterable, Serializable { @JsonProperty("stacks") private List list; + @JsonProperty("links") + private List links; + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + @Override public Iterator iterator() { return list.iterator(); diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java index 220e400..9a7c719 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java @@ -16,7 +16,6 @@ package com.woorea.openstack.heat.model; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; public class UpdateStackParam { @@ -37,7 +36,7 @@ public class UpdateStackParam { @JsonProperty("disable_rollback") private boolean disableRollback = true; - + @JsonProperty("files") private Map files; @@ -85,11 +84,12 @@ public class UpdateStackParam { public String getEnvironment() { return environment; - } + } public void setFiles(Map files) { this.files = files; } + public Map getFiles() { return this.files; } @@ -113,14 +113,8 @@ public class UpdateStackParam { @Override public String toString() { - return "UpdateStackParam{" + - " templateUrl='" + templateUrl + '\'' + - ", template='" + template + '\'' + - ", parameters=" + parameters + - ", timeoutMinutes=" + timeoutMinutes + - ", environment='" + environment + '\'' + - ", disableRollback='" + disableRollback + '\'' + - ", files=" + files + - '}'; + return "UpdateStackParam{" + " templateUrl='" + templateUrl + '\'' + ", template='" + template + '\'' + + ", parameters=" + parameters + ", timeoutMinutes=" + timeoutMinutes + ", environment='" + environment + + '\'' + ", disableRollback='" + disableRollback + '\'' + ", files=" + files + '}'; } } diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/CreateStackParamTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/CreateStackParamTest.java index a57eced..d740a15 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/CreateStackParamTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/CreateStackParamTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,28 +34,16 @@ public class CreateStackParamTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"template\" : \"template\"," + EOL - + " \"parameters\" : {" + EOL - + " \"parameters-k1\" : \"parameters-v1\"," + EOL - + " \"parameters-k2\" : \"parameters-v2\"" + EOL - + " }," + EOL - + " \"environment\" : \"environment\"," + EOL - + " \"files\" : {" + EOL - + " \"files-k1\" : \"files-v1\"," + EOL - + " \"files-k2\" : \"files-v2\"" + EOL - + " }," + EOL - + " \"stack_name\" : \"stackname\"," + EOL - + " \"template_url\" : \"templateurl\"," + EOL - + " \"timeout_mins\" : 79," + EOL - + " \"disable_rollback\" : true" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"template\" : \"template\"," + EOL + " \"parameters\" : {" + + EOL + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\"" + + EOL + " }," + EOL + " \"environment\" : \"environment\"," + EOL + " \"files\" : {" + EOL + + " \"files-k1\" : \"files-v1\"," + EOL + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL + + " \"stack_name\" : \"stackname\"," + EOL + " \"template_url\" : \"templateurl\"," + EOL + + " \"timeout_mins\" : 79," + EOL + " \"disable_rollback\" : true" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -73,37 +59,37 @@ public class CreateStackParamTest { public void testMethods() throws Exception { CreateStackParam createstackparam = objectMapper.readValue(JSON_FULL, CreateStackParam.class); createstackparam.toString(); - + String template = createstackparam.getTemplate(); Assert.assertNotNull(template); createstackparam.setTemplate(template); - + String environment = createstackparam.getEnvironment(); Assert.assertNotNull(environment); createstackparam.setEnvironment(environment); - + int timeoutMinutes = createstackparam.getTimeoutMinutes(); Assert.assertNotNull(timeoutMinutes); createstackparam.setTimeoutMinutes(timeoutMinutes); - + boolean disableRollback = createstackparam.getDisableRollback(); Assert.assertNotNull(disableRollback); createstackparam.setDisableRollback(disableRollback); - - Map files = createstackparam.getFiles(); + + Map files = createstackparam.getFiles(); Assert.assertNotNull(files); Assert.assertEquals(2, files.size()); createstackparam.setFiles(files); - + String stackName = createstackparam.getStackName(); Assert.assertNotNull(stackName); createstackparam.setStackName(stackName); - - Map parameters = createstackparam.getParameters(); + + Map parameters = createstackparam.getParameters(); Assert.assertNotNull(parameters); Assert.assertEquals(2, parameters.size()); createstackparam.setParameters(parameters); - + String templateUrl = createstackparam.getTemplateUrl(); Assert.assertNotNull(templateUrl); createstackparam.setTemplateUrl(templateUrl); diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/ErrorTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/ErrorTest.java index 084fd26..cd3aeaa 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/ErrorTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/ErrorTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.heat.model.Explanation.Error; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,21 +34,13 @@ public class ErrorTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"error\" : {" + EOL - + " \"message\" : \"message\"," + EOL - + " \"traceback\" : \"traceback\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"error\" : {" + EOL + " \"message\" : \"message\"," + EOL + + " \"traceback\" : \"traceback\"," + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,13 +56,13 @@ public class ErrorTest { public void testMethods() throws Exception { Error error = objectMapper.readValue(JSON_FULL, Error.class); error.toString(); - + String type = error.getType(); Assert.assertNotNull(type); - + String message = error.getMessage(); Assert.assertNotNull(message); - + String traceback = error.getTraceback(); Assert.assertNotNull(traceback); } diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/ExplanationTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/ExplanationTest.java index ff8ebb2..0fc507f 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/ExplanationTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/ExplanationTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.heat.model.Explanation.Error; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,22 +34,14 @@ public class ExplanationTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"explanation\" : \"explanation\"," + EOL - + " \"code\" : 42," + EOL - + " \"title\" : \"title\"," + EOL - + " \"error\" : {" + EOL - + " \"message\" : \"message\"," + EOL - + " \"traceback\" : \"traceback\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"explanation\" : \"explanation\"," + EOL + + " \"code\" : 42," + EOL + " \"title\" : \"title\"," + EOL + " \"error\" : {" + EOL + + " \"message\" : \"message\"," + EOL + " \"traceback\" : \"traceback\"," + EOL + + " \"type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,16 +57,16 @@ public class ExplanationTest { public void testMethods() throws Exception { Explanation explanation = objectMapper.readValue(JSON_FULL, Explanation.class); explanation.toString(); - + int code = explanation.getCode(); Assert.assertNotNull(code); - + String explanationProperty = explanation.getExplanation(); Assert.assertNotNull(explanationProperty); - + String title = explanation.getTitle(); Assert.assertNotNull(title); - + Error error = explanation.getError(); Assert.assertNotNull(error); } diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/LinkTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/LinkTest.java index 4565fe8..27f1226 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/LinkTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/LinkTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class LinkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,11 +54,11 @@ public class LinkTest { public void testMethods() throws Exception { Link link = objectMapper.readValue(JSON_FULL, Link.class); link.toString(); - + String rel = link.getRel(); Assert.assertNotNull(rel); link.setRel(rel); - + String href = link.getHref(); Assert.assertNotNull(href); link.setHref(href); diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/OutputTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/OutputTest.java index a91eeff..a001548 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/OutputTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/OutputTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.heat.model.Stack.Output; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,17 +34,12 @@ public class OutputTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"description\" : \"description\"," + EOL - + " \"output_value\" : \"outputvalue\"," + EOL - + " \"output_key\" : \"outputkey\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"description\" : \"description\"," + EOL + + " \"output_value\" : \"outputvalue\"," + EOL + " \"output_key\" : \"outputkey\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -61,13 +55,13 @@ public class OutputTest { public void testMethods() throws Exception { Output output = objectMapper.readValue(JSON_FULL, Output.class); output.toString(); - + String outputKey = output.getOutputKey(); Assert.assertNotNull(outputKey); - + Object outputValue = output.getOutputValue(); Assert.assertNotNull(outputValue); - + String description = output.getDescription(); Assert.assertNotNull(description); } diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/ResourceTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/ResourceTest.java index 0079ef3..07b8c73 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/ResourceTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/ResourceTest.java @@ -24,10 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Date; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,29 +35,18 @@ public class ResourceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"links\" : [ {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " }, {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " } ]," + EOL - + " \"resource_name\" : \"name\"," + EOL - + " \"resource_status\" : \"status\"," + EOL - + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL - + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL - + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL - + " \"updated_time\" : 1488110400000," + EOL - + " \"resource_type\" : \"type\"," + EOL - + " \"resource_status_reason\" : \"statusreason\"" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"links\" : [ {" + EOL + " \"href\" : \"href\"," + EOL + + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL + " \"href\" : \"href\"," + EOL + + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL + " \"resource_name\" : \"name\"," + EOL + + " \"resource_status\" : \"status\"," + EOL + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL + + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL + + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL + + " \"updated_time\" : 1488110400000," + EOL + " \"resource_type\" : \"type\"," + EOL + + " \"resource_status_reason\" : \"statusreason\"" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -75,41 +62,41 @@ public class ResourceTest { public void testMethods() throws Exception { Resource resource = objectMapper.readValue(JSON_FULL, Resource.class); resource.toString(); - + Date updatedTime = resource.getUpdatedTime(); Assert.assertNotNull(updatedTime); resource.setUpdatedTime(updatedTime); - + String physicalResourceId = resource.getPhysicalResourceId(); Assert.assertNotNull(physicalResourceId); resource.setPhysicalResourceId(physicalResourceId); - + List requiredBy = resource.getRequiredBy(); Assert.assertNotNull(requiredBy); Assert.assertEquals(2, requiredBy.size()); resource.setRequiredBy(requiredBy); - + String statusReason = resource.getStatusReason(); Assert.assertNotNull(statusReason); resource.setStatusReason(statusReason); - + String name = resource.getName(); Assert.assertNotNull(name); resource.setName(name); - + List links = resource.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); resource.setLinks(links); - + String logicalResourceId = resource.getLogicalResourceId(); Assert.assertNotNull(logicalResourceId); resource.setLogicalResourceId(logicalResourceId); - + String type = resource.getType(); Assert.assertNotNull(type); resource.setType(type); - + String status = resource.getStatus(); Assert.assertNotNull(status); resource.setStatus(status); diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/ResourcesTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/ResourcesTest.java index 37c5e72..6845ee8 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/ResourcesTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/ResourcesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,47 +34,27 @@ public class ResourcesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resources\" : [ {" + EOL - + " \"links\" : [ {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " }, {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " } ]," + EOL - + " \"resource_name\" : \"name\"," + EOL - + " \"resource_status\" : \"status\"," + EOL - + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL - + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL - + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL - + " \"updated_time\" : 1488110400000," + EOL - + " \"resource_type\" : \"type\"," + EOL - + " \"resource_status_reason\" : \"statusreason\"" + EOL - + " }, {" + EOL - + " \"links\" : [ {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " }, {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " } ]," + EOL - + " \"resource_name\" : \"name\"," + EOL - + " \"resource_status\" : \"status\"," + EOL - + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL - + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL - + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL - + " \"updated_time\" : 1488110400000," + EOL - + " \"resource_type\" : \"type\"," + EOL - + " \"resource_status_reason\" : \"statusreason\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resources\" : [ {" + EOL + " \"links\" : [ {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL + + " \"resource_name\" : \"name\"," + EOL + " \"resource_status\" : \"status\"," + EOL + + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL + + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL + + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL + + " \"updated_time\" : 1488110400000," + EOL + " \"resource_type\" : \"type\"," + EOL + + " \"resource_status_reason\" : \"statusreason\"" + EOL + " }, {" + EOL + " \"links\" : [ {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL + + " \"resource_name\" : \"name\"," + EOL + " \"resource_status\" : \"status\"," + EOL + + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL + + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL + + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL + + " \"updated_time\" : 1488110400000," + EOL + " \"resource_type\" : \"type\"," + EOL + + " \"resource_status_reason\" : \"statusreason\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -92,13 +70,14 @@ public class ResourcesTest { public void testMethods() throws Exception { Resources resources = objectMapper.readValue(JSON_FULL, Resources.class); resources.toString(); - + List list = resources.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Resource x : resources) { + for (@SuppressWarnings("unused") + Resource x : resources) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/StackTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/StackTest.java index ea38918..19d3373 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/StackTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/StackTest.java @@ -25,11 +25,9 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.heat.model.Stack.Output; - import java.util.Date; import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,49 +37,26 @@ public class StackTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"stack\" : {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"links\" : [ {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " }, {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " } ]," + EOL - + " \"id\" : \"id\"," + EOL - + " \"files\" : {" + EOL - + " \"files-k1\" : \"files-v1\"," + EOL - + " \"files-k2\" : \"files-v2\"" + EOL - + " }," + EOL - + " \"outputs\" : [ {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"output_value\" : \"outputvalue\"," + EOL - + " \"output_key\" : \"outputkey\"" + EOL - + " }, {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"output_value\" : \"outputvalue\"," + EOL - + " \"output_key\" : \"outputkey\"" + EOL - + " } ]," + EOL - + " \"parameters\" : {" + EOL - + " \"parameters-k1\" : \"parameters-v1\"," + EOL - + " \"parameters-k2\" : \"parameters-v2\"" + EOL - + " }," + EOL - + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL - + " \"stack_name\" : \"stackname\"," + EOL - + " \"updated_time\" : 1488110400000," + EOL - + " \"creation_time\" : 1488974400000," + EOL - + " \"stack_status\" : \"stackstatus\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"stack\" : {" + EOL + + " \"description\" : \"description\"," + EOL + " \"links\" : [ {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL + + " \"id\" : \"id\"," + EOL + " \"files\" : {" + EOL + " \"files-k1\" : \"files-v1\"," + EOL + + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL + " \"outputs\" : [ {" + EOL + + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL + + " \"output_key\" : \"outputkey\"" + EOL + " }, {" + EOL + + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL + + " \"output_key\" : \"outputkey\"" + EOL + " } ]," + EOL + " \"parameters\" : {" + EOL + + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\"" + EOL + + " }," + EOL + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL + + " \"stack_name\" : \"stackname\"," + EOL + " \"updated_time\" : 1488110400000," + EOL + + " \"creation_time\" : 1488974400000," + EOL + " \"stack_status\" : \"stackstatus\"" + EOL + " }" + + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -97,50 +72,50 @@ public class StackTest { public void testMethods() throws Exception { Stack stack = objectMapper.readValue(JSON_FULL, Stack.class); stack.toString(); - + Date updatedTime = stack.getUpdatedTime(); Assert.assertNotNull(updatedTime); stack.setUpdatedTime(updatedTime); - + List outputs = stack.getOutputs(); Assert.assertNotNull(outputs); Assert.assertEquals(2, outputs.size()); - + String stackStatus = stack.getStackStatus(); Assert.assertNotNull(stackStatus); stack.setStackStatus(stackStatus); - + String description = stack.getDescription(); Assert.assertNotNull(description); stack.setDescription(description); - - Map files = stack.getFiles(); + + Map files = stack.getFiles(); Assert.assertNotNull(files); Assert.assertEquals(2, files.size()); stack.setFiles(files); - + List links = stack.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); stack.setLinks(links); - + String stackName = stack.getStackName(); Assert.assertNotNull(stackName); stack.setStackName(stackName); - + String id = stack.getId(); Assert.assertNotNull(id); stack.setId(id); - + Date creationTime = stack.getCreationTime(); Assert.assertNotNull(creationTime); stack.setCreationTime(creationTime); - - Map parameters = stack.getParameters(); + + Map parameters = stack.getParameters(); Assert.assertNotNull(parameters); Assert.assertEquals(2, parameters.size()); stack.setParameters(parameters); - + String stackStatusReason = stack.getStackStatusReason(); Assert.assertNotNull(stackStatusReason); stack.setStackStatusReason(stackStatusReason); diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/StacksTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/StacksTest.java index 880c482..003ba17 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/StacksTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/StacksTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,79 +33,38 @@ public class StacksTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"stacks\" : [ {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"links\" : [ {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " }, {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " } ]," + EOL - + " \"id\" : \"id\"," + EOL - + " \"files\" : {" + EOL - + " \"files-k1\" : \"files-v1\"," + EOL - + " \"files-k2\" : \"files-v2\"" + EOL - + " }," + EOL - + " \"outputs\" : [ {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"output_value\" : \"outputvalue\"," + EOL - + " \"output_key\" : \"outputkey\"" + EOL - + " }, {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"output_value\" : \"outputvalue\"," + EOL - + " \"output_key\" : \"outputkey\"" + EOL - + " } ]," + EOL - + " \"parameters\" : {" + EOL - + " \"parameters-k1\" : \"parameters-v1\"," + EOL - + " \"parameters-k2\" : \"parameters-v2\"" + EOL - + " }," + EOL - + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL - + " \"stack_name\" : \"stackname\"," + EOL - + " \"updated_time\" : 1488110400000," + EOL - + " \"creation_time\" : 1488974400000," + EOL - + " \"stack_status\" : \"stackstatus\"" + EOL - + " }, {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"links\" : [ {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " }, {" + EOL - + " \"href\" : \"href\"," + EOL - + " \"rel\" : \"rel\"" + EOL - + " } ]," + EOL - + " \"id\" : \"id\"," + EOL - + " \"files\" : {" + EOL - + " \"files-k1\" : \"files-v1\"," + EOL - + " \"files-k2\" : \"files-v2\"" + EOL - + " }," + EOL - + " \"outputs\" : [ {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"output_value\" : \"outputvalue\"," + EOL - + " \"output_key\" : \"outputkey\"" + EOL - + " }, {" + EOL - + " \"description\" : \"description\"," + EOL - + " \"output_value\" : \"outputvalue\"," + EOL - + " \"output_key\" : \"outputkey\"" + EOL - + " } ]," + EOL - + " \"parameters\" : {" + EOL - + " \"parameters-k1\" : \"parameters-v1\"," + EOL - + " \"parameters-k2\" : \"parameters-v2\"" + EOL - + " }," + EOL - + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL - + " \"stack_name\" : \"stackname\"," + EOL - + " \"updated_time\" : 1488110400000," + EOL - + " \"creation_time\" : 1488974400000," + EOL - + " \"stack_status\" : \"stackstatus\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"stacks\" : [ {" + EOL + + " \"description\" : \"description\"," + EOL + " \"links\" : [ {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL + + " \"id\" : \"id\"," + EOL + " \"files\" : {" + EOL + " \"files-k1\" : \"files-v1\"," + EOL + + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL + " \"outputs\" : [ {" + EOL + + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL + + " \"output_key\" : \"outputkey\"" + EOL + " }, {" + EOL + + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL + + " \"output_key\" : \"outputkey\"" + EOL + " } ]," + EOL + " \"parameters\" : {" + EOL + + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\"" + EOL + + " }," + EOL + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL + + " \"stack_name\" : \"stackname\"," + EOL + " \"updated_time\" : 1488110400000," + EOL + + " \"creation_time\" : 1488974400000," + EOL + " \"stack_status\" : \"stackstatus\"" + EOL + " }, {" + + EOL + " \"description\" : \"description\"," + EOL + " \"links\" : [ {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL + + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL + + " \"id\" : \"id\"," + EOL + " \"files\" : {" + EOL + " \"files-k1\" : \"files-v1\"," + EOL + + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL + " \"outputs\" : [ {" + EOL + + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL + + " \"output_key\" : \"outputkey\"" + EOL + " }, {" + EOL + + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL + + " \"output_key\" : \"outputkey\"" + EOL + " } ]," + EOL + " \"parameters\" : {" + EOL + + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\"" + EOL + + " }," + EOL + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL + + " \"stack_name\" : \"stackname\"," + EOL + " \"updated_time\" : 1488110400000," + EOL + + " \"creation_time\" : 1488974400000," + EOL + " \"stack_status\" : \"stackstatus\"" + EOL + " } ]" + + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -122,9 +80,10 @@ public class StacksTest { public void testMethods() throws Exception { Stacks stacks = objectMapper.readValue(JSON_FULL, Stacks.class); stacks.toString(); - + int cnt = 0; - for (@SuppressWarnings("unused") Stack x : stacks) { + for (@SuppressWarnings("unused") + Stack x : stacks) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/heat-model/src/test/java/com/woorea/openstack/heat/model/UpdateStackParamTest.java b/heat-model/src/test/java/com/woorea/openstack/heat/model/UpdateStackParamTest.java index 5eb99c3..33daa6c 100644 --- a/heat-model/src/test/java/com/woorea/openstack/heat/model/UpdateStackParamTest.java +++ b/heat-model/src/test/java/com/woorea/openstack/heat/model/UpdateStackParamTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,27 +34,16 @@ public class UpdateStackParamTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"template\" : \"template\"," + EOL - + " \"parameters\" : {" + EOL - + " \"parameters-k1\" : \"parameters-v1\"," + EOL - + " \"parameters-k2\" : \"parameters-v2\"" + EOL - + " }," + EOL - + " \"environment\" : \"environment\"," + EOL - + " \"files\" : {" + EOL - + " \"files-k1\" : \"files-v1\"," + EOL - + " \"files-k2\" : \"files-v2\"" + EOL - + " }," + EOL - + " \"template_url\" : \"templateurl\"," + EOL - + " \"timeout_mins\" : 79," + EOL - + " \"disable_rollback\" : true" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"template\" : \"template\"," + EOL + " \"parameters\" : {" + + EOL + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\"" + + EOL + " }," + EOL + " \"environment\" : \"environment\"," + EOL + " \"files\" : {" + EOL + + " \"files-k1\" : \"files-v1\"," + EOL + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL + + " \"template_url\" : \"templateurl\"," + EOL + " \"timeout_mins\" : 79," + EOL + + " \"disable_rollback\" : true" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -72,33 +59,33 @@ public class UpdateStackParamTest { public void testMethods() throws Exception { UpdateStackParam updatestackparam = objectMapper.readValue(JSON_FULL, UpdateStackParam.class); updatestackparam.toString(); - + String template = updatestackparam.getTemplate(); Assert.assertNotNull(template); updatestackparam.setTemplate(template); - + String environment = updatestackparam.getEnvironment(); Assert.assertNotNull(environment); updatestackparam.setEnvironment(environment); - + int timeoutMinutes = updatestackparam.getTimeoutMinutes(); Assert.assertNotNull(timeoutMinutes); updatestackparam.setTimeoutMinutes(timeoutMinutes); - + boolean disableRollback = updatestackparam.getDisableRollback(); Assert.assertNotNull(disableRollback); updatestackparam.setDisableRollback(disableRollback); - - Map files = updatestackparam.getFiles(); + + Map files = updatestackparam.getFiles(); Assert.assertNotNull(files); Assert.assertEquals(2, files.size()); updatestackparam.setFiles(files); - - Map parameters = updatestackparam.getParameters(); + + Map parameters = updatestackparam.getParameters(); Assert.assertNotNull(parameters); Assert.assertEquals(2, parameters.size()); updatestackparam.setParameters(parameters); - + String templateUrl = updatestackparam.getTemplateUrl(); Assert.assertNotNull(templateUrl); updatestackparam.setTemplateUrl(templateUrl); diff --git a/keystone-client/pom.xml b/keystone-client/pom.xml index 4bd7cd1..d0d4f2d 100644 --- a/keystone-client/pom.xml +++ b/keystone-client/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.onap.so.libs @@ -10,28 +11,28 @@ OpenStack Keystone Client OpenStack Keystone Client - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - - - org.onap.so.libs.openstack-java-sdk - keystone-model - ${project.version} - - - org.jmockit - jmockit - 1.19 - test - - - junit - junit - 4.12 - test - + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + + + org.onap.so.libs.openstack-java-sdk + keystone-model + ${project.version} + + + org.jmockit + jmockit + 1.19 + test + + + junit + junit + 4.12 + test + diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java index db970a5..cf1909c 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java @@ -25,63 +25,63 @@ import com.woorea.openstack.keystone.model.Endpoint; import com.woorea.openstack.keystone.model.Endpoints; public class EndpointsResource { - + private OpenStackClient client; - + public EndpointsResource(OpenStackClient client) { this.client = client; } - + public List list() { return new List(); } - + public Create create(Endpoint endpoint) { return new Create(endpoint); } - + public Show show(String id) { return new Show(id); } - + public Delete delete(String id) { return new Delete(id); } public class List extends OpenStackRequest { - + public List() { super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); } } - + public class Create extends OpenStackRequest { private Endpoint endpoint; - + public Create(Endpoint endpoint) { super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); this.endpoint = endpoint; } - + } - + public class Show extends OpenStackRequest { - + public Show(String id) { super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); } } - + public class Delete extends OpenStackRequest { - + public Delete(String id) { super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); } - + } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java index 71641fb..e7193b5 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java @@ -25,50 +25,51 @@ import com.woorea.openstack.keystone.model.Role; import com.woorea.openstack.keystone.model.Roles; public class RolesResource { - + private OpenStackClient client; - + public RolesResource(OpenStackClient client) { this.client = client; } - + public List list() { return new List(); } - + public Create create(Role role) { return new Create(role); } - + public Delete delete(String id) { return new Delete(id); } public class List extends OpenStackRequest { - + public List() { super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); } } - + public class Create extends OpenStackRequest { private Role role; - + public Create(Role role) { super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); this.role = role; } - + } - + public class Delete extends OpenStackRequest { - + public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, + Void.class); } - + } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java index 315d2be..033846f 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java @@ -25,62 +25,64 @@ import com.woorea.openstack.keystone.model.Service; import com.woorea.openstack.keystone.model.Services; public class ServicesResource { - + private OpenStackClient client; - + public ServicesResource(OpenStackClient client) { this.client = client; } - + public List list() { return new List(); } - + public Create create(Service service) { return new Create(service); } - + public Show show(String id) { return new Show(id); } - + public Delete delete(String id) { return new Delete(id); } public class List extends OpenStackRequest { - + public List() { super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); } } - + public class Create extends OpenStackRequest { private Service service; - + public Create(Service service) { super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); this.service = service; } - + } - + public class Show extends OpenStackRequest { - + public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); + super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, + Service.class); } } - + public class Delete extends OpenStackRequest { - + public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, + Void.class); } - + } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java index 0d0a027..3fbf545 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java @@ -130,8 +130,7 @@ public class TenantsResource { private Tenant tenant; public Update(String id, Tenant tenant) { - super(client, HttpMethod.PUT, getTenantsString(id).toString(), Entity.json(tenant), - Tenant.class); + super(client, HttpMethod.PUT, getTenantsString(id).toString(), Entity.json(tenant), Tenant.class); this.tenant = tenant; } } @@ -146,16 +145,14 @@ public class TenantsResource { public class ListUsers extends OpenStackRequest { public ListUsers(String tenantId) { - super(client, HttpMethod.GET,getTenantsString(tenantId).append("/users").toString(), - null, Users.class); + super(client, HttpMethod.GET, getTenantsString(tenantId).append("/users").toString(), null, Users.class); } } public class AddUser extends OpenStackRequest { public AddUser(String tenantId, String userId, String roleId) { - super(client, HttpMethod.PUT, - getTenantsString(tenantId).append(USERS).append(userId) + super(client, HttpMethod.PUT, getTenantsString(tenantId).append(USERS).append(userId) .append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); } } @@ -163,8 +160,7 @@ public class TenantsResource { public class RemoveUser extends OpenStackRequest { public RemoveUser(String tenantId, String userId, String roleId) { - super(client, HttpMethod.DELETE, - getTenantsString(tenantId).append(USERS).append(userId) + super(client, HttpMethod.DELETE, getTenantsString(tenantId).append(USERS).append(userId) .append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); } } @@ -173,15 +169,14 @@ public class TenantsResource { public ListUserRoles(String tenantId, String userId) { super(client, HttpMethod.GET, - getTenantsString(tenantId).append(USERS).append(userId).append("/roles") - .toString(), null, Roles.class); + getTenantsString(tenantId).append(USERS).append(userId).append("/roles").toString(), null, + Roles.class); } } /** - * The following APIs support Tenant-level metadata. This is a feature supported - * by the DCP/LCP (i.e. AIC cloud), but not native Openstack. The full API as - * documented by AIC is implemented below. + * The following APIs support Tenant-level metadata. This is a feature supported by the DCP/LCP (i.e. AIC cloud), + * but not native Openstack. The full API as documented by AIC is implemented below. */ public class ShowMetadata extends OpenStackRequest { @@ -194,7 +189,7 @@ public class TenantsResource { public CreateOrUpdateMetadata(String tenantId, Metadata metadata) { super(client, HttpMethod.POST, getTenantsString(tenantId).append(METADATA), Entity.json(metadata), - Metadata.class); + Metadata.class); } } @@ -202,32 +197,31 @@ public class TenantsResource { public ReplaceMetadata(String tenantId, Metadata metadata) { super(client, HttpMethod.PUT, getTenantsString(tenantId).append(METADATA), Entity.json(metadata), - Metadata.class); + Metadata.class); } } public class ShowMetadataItem extends OpenStackRequest { public ShowMetadataItem(String tenantId, String key) { - super(client, HttpMethod.GET, - getTenantsString(tenantId).append(METADATA).append(key), null, Metadata.class); + super(client, HttpMethod.GET, getTenantsString(tenantId).append(METADATA).append(key), null, + Metadata.class); } } public class CreateOrUpdateMetadataItem extends OpenStackRequest { public CreateOrUpdateMetadataItem(String tenantId, String key, Metadata metadata) { - super(client, HttpMethod.POST, - getTenantsString(tenantId).append(METADATA).append(key), Entity.json(metadata), - Metadata.class); + super(client, HttpMethod.POST, getTenantsString(tenantId).append(METADATA).append(key), + Entity.json(metadata), Metadata.class); } } public class DeleteMetadataItem extends OpenStackRequest { public DeleteMetadataItem(String tenantId, String key) { - super(client, HttpMethod.DELETE, - getTenantsString(tenantId).append("/metadata/").append(key), null, Void.class); + super(client, HttpMethod.DELETE, getTenantsString(tenantId).append("/metadata/").append(key), null, + Void.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java index 87b7a46..bb02043 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java @@ -82,8 +82,7 @@ public class UsersResource { private User user; public Update(String id, User user) { - super(client, HttpMethod.PUT, getUserString(id), Entity.json(user), - User.class); + super(client, HttpMethod.PUT, getUserString(id), Entity.json(user), User.class); this.user = user; } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java index c3f52e6..97973fd 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java @@ -42,9 +42,8 @@ public class KeystoneTokenProvider { public Access getAccessByTenant(String tenantName) { Access access = hashTenantAccess.get(tenantName); if (access == null) { - access = keystone.tokens().authenticate(new UsernamePassword(username, password)) - .withTenantName(tenantName) - .execute(); + access = keystone.tokens().authenticate(new UsernamePassword(username, password)).withTenantName(tenantName) + .execute(); hashTenantAccess.put(tenantName, access); } return access; @@ -59,8 +58,7 @@ public class KeystoneTokenProvider { return new OpenStackTokenProvider() { @Override public String getToken() { - return keystoneTokenProvider.getAccessByTenant(tenantName) - .getToken().getId(); + return keystoneTokenProvider.getAccessByTenant(tenantName).getToken().getId(); } @Override diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java index 6f81781..29f41df 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java @@ -21,8 +21,7 @@ import java.util.List; public class KeystoneUtils { - private KeystoneUtils() { - } + private KeystoneUtils() {} public static String findEndpointURL(List serviceCatalog, String type, String region, String facing) { for (Service service : serviceCatalog) { diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java index 44ffb2d..c7d547b 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java @@ -30,11 +30,13 @@ public class DomainUserRolesResource extends GenericResource { } public OpenStackRequest add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, + new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); } - + public OpenStackRequest remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, + new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java index c04aba0..d0e5665 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java @@ -25,13 +25,15 @@ public class DomainsResource extends GenericResource { public DomainsResource(OpenStackClient client) { super(client, "/domains", Domain.class, Domains.class); } - + public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId) + .append("/users/").append(userId).append("/roles").toString()); } - + public DomainUserRolesResource groupRoles(String domainId, String groupId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId) + .append("/groups/").append(groupId).append("/roles").toString()); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java index c27ab8b..1c1b4fa 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java @@ -24,37 +24,40 @@ import com.woorea.openstack.base.client.OpenStackRequest; public class GenericResource { protected final OpenStackClient CLIENT; - + protected CharSequence path; - + protected Class oneClass; protected Class manyClass; - + public GenericResource(OpenStackClient client, CharSequence path, Class oneClass, Class manyClass) { CLIENT = client; this.path = path; this.oneClass = oneClass; this.manyClass = manyClass; } - + public OpenStackRequest list() { return new OpenStackRequest<>(CLIENT, HttpMethod.GET, path, null, manyClass); } - + public OpenStackRequest create(One one) { return new OpenStackRequest<>(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass); } - + public OpenStackRequest show(String id) { - return new OpenStackRequest<>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + return new OpenStackRequest<>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), + null, oneClass); } - + public OpenStackRequest update(String id, One one) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); + return new OpenStackRequest<>(CLIENT, HttpMethod.PATCH, + new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); } - + public OpenStackRequest delete(String id) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, + new StringBuilder(path).append("/").append(id).toString(), null, oneClass); } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java index c3b760f..6514ae6 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java @@ -25,9 +25,10 @@ public class GroupsResource extends GenericResource { public GroupsResource(OpenStackClient client) { super(client, "/groups", Group.class, Groups.class); } - + public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId) + .append("/users/").append(userId).append("/roles").toString()); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java index d22416d..1a8fb42 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java @@ -17,7 +17,6 @@ package com.woorea.openstack.keystone.v3.api; import com.woorea.openstack.base.client.OpenStackClient; - import com.woorea.openstack.keystone.v3.model.Policies; import com.woorea.openstack.keystone.v3.model.Policy; diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java index a2cd01c..4e26d88 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java @@ -22,22 +22,24 @@ import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackRequest; public class ProjectRolesResource { - + private final OpenStackClient CLIENT; - + private final String PATH; public ProjectRolesResource(OpenStackClient client, String path) { this.CLIENT = client; this.PATH = path; } - + public OpenStackRequest add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, + new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); } - + public OpenStackRequest remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, + new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java index 95f5d0c..9868882 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java @@ -28,13 +28,15 @@ public class ProjectUserRolesResource extends GenericResource { public ProjectUserRolesResource(OpenStackClient client, String path) { super(client, path, Role.class, Roles.class); } - + public OpenStackRequest add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, + new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); } - + public OpenStackRequest remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, + new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java index 900ce20..a5cb8f2 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java @@ -27,17 +27,20 @@ public class ProjectsResource extends GenericResource { public ProjectsResource(OpenStackClient client) { super(client, "/projects", Project.class, Projects.class); } - + public OpenStackRequest users(String projectId) { - return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class); + return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), + Users.class); } - + public ProjectUserRolesResource userRoles(String projectId, String userId) { - return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString()); + return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId) + .append("/users/").append(userId).append("/roles").toString()); } - + public ProjectUserRolesResource groupRoles(String projectId, String groupId) { - return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString()); + return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId) + .append("/groups/").append(groupId).append("/roles").toString()); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java index ae8fc60..864764d 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java @@ -27,9 +27,10 @@ public class RolesResource extends GenericResource { public RolesResource(OpenStackClient client) { super(client, "/roles", Role.class, Roles.class); } - + public OpenStackRequest users(String domainId, String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class); + return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId) + .append("/roles").toString(), Users.class); } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java index 9d176d7..fda51f2 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java @@ -24,35 +24,35 @@ import com.woorea.openstack.keystone.v3.model.Authentication; import com.woorea.openstack.keystone.v3.model.Token; public class TokensResource { - + private final OpenStackClient CLIENT; - + public TokensResource(OpenStackClient client) { CLIENT = client; } - + public Authenticate authenticate(Authentication authentication) { return new Authenticate(authentication); } - + public OpenStackRequest show() { return CLIENT.get("/auth/tokens", Token.class); } public class Authenticate extends OpenStackRequest { - + private Authentication authentication; - + public Authenticate() { - + } - + public Authenticate(Authentication authentication) { super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class); this.authentication = authentication; } } - + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java index 0e1e609..dc6894a 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java @@ -27,17 +27,20 @@ public class UsersResource extends GenericResource { public UsersResource(OpenStackClient client) { super(client, "/users", User.class, Users.class); } - + public OpenStackRequest groups(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class); + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), + Services.class); } - + public OpenStackRequest projects(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class); + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), + Services.class); } - + public OpenStackRequest roles(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class); + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), + Services.class); } } diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java index 7a00fd4..ae61d98 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/KeystoneTest.java @@ -21,9 +21,7 @@ package com.woorea.openstack.keystone; import com.woorea.openstack.base.client.OpenStackClientConnector; import org.junit.Test; - import javax.swing.table.TableStringConverter; - import static org.junit.Assert.*; public class KeystoneTest { @@ -60,4 +58,4 @@ public class KeystoneTest { keystone.endpoints(); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java index 324dc3c..08886a7 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/EndpointsResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Endpoint; import org.junit.Test; - import static org.junit.Assert.*; public class EndpointsResourceTest { @@ -48,4 +47,4 @@ public class EndpointsResourceTest { endpointsResource.delete("123"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java index d8d851a..8031ce0 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/RolesResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Role; import org.junit.Test; - import static org.junit.Assert.*; public class RolesResourceTest { @@ -43,4 +42,4 @@ public class RolesResourceTest { rolesResource.delete("123"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java index 25de26e..a74f376 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/ServicesResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Service; import org.junit.Test; - import static org.junit.Assert.*; public class ServicesResourceTest { @@ -48,4 +47,4 @@ public class ServicesResourceTest { servicesResource.delete("123"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java index 8d208f9..5323f27 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TenantsResourceTest.java @@ -22,7 +22,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Metadata; import com.woorea.openstack.keystone.model.Tenant; import org.junit.Test; - import static org.junit.Assert.*; public class TenantsResourceTest { @@ -104,4 +103,4 @@ public class TenantsResourceTest { tenantsResource.deleteMetadataItem("123", "key"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java index 9ad711e..77c26a9 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/TokensResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.Authentication; import org.junit.Test; - import static org.junit.Assert.*; public class TokensResourceTest { @@ -63,4 +62,4 @@ public class TokensResourceTest { public void withTenantNameTest() { authenticate.withTenantName("123"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java index 547458b..881eb92 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/api/UsersResourceTest.java @@ -21,7 +21,6 @@ package com.woorea.openstack.keystone.api; import com.woorea.openstack.keystone.model.User; import org.junit.Test; - import static org.junit.Assert.*; public class UsersResourceTest { @@ -53,4 +52,4 @@ public class UsersResourceTest { usersResource.delete("123"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneTokenProviderTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneTokenProviderTest.java index 0523f2f..5e51ebc 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneTokenProviderTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneTokenProviderTest.java @@ -20,14 +20,11 @@ package com.woorea.openstack.keystone.utils; import org.junit.Test; - import static org.junit.Assert.*; public class KeystoneTokenProviderTest { - KeystoneTokenProvider keystoneTokenProvider = new KeystoneTokenProvider("endpoint", - "username", - "password"); + KeystoneTokenProvider keystoneTokenProvider = new KeystoneTokenProvider("endpoint", "username", "password"); @Test(expected = NullPointerException.class) public void getAccessByTenant() throws Exception { @@ -44,4 +41,4 @@ public class KeystoneTokenProviderTest { keystoneTokenProvider.getProviderByTenant("id-123"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneUtilsTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneUtilsTest.java index 2b65a91..2a7a8e1 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneUtilsTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/utils/KeystoneUtilsTest.java @@ -21,10 +21,8 @@ package com.woorea.openstack.keystone.utils; import com.woorea.openstack.keystone.model.Access.Service; import org.junit.Test; - import java.util.Arrays; import java.util.List; - import static org.junit.Assert.*; public class KeystoneUtilsTest { @@ -35,4 +33,4 @@ public class KeystoneUtilsTest { KeystoneUtils.findEndpointURL(services, "type", "region", "facing"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/KeystoneTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/KeystoneTest.java index 0be1a9e..a8e5dee 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/KeystoneTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/KeystoneTest.java @@ -23,7 +23,6 @@ import com.woorea.openstack.base.client.OpenStackClientConnector; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.base.client.OpenStackResponse; import org.junit.Test; - import static org.junit.Assert.*; public class KeystoneTest { @@ -70,4 +69,4 @@ public class KeystoneTest { keystone.endpoints(); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/DomainsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/DomainsResourceTest.java index 1ba5b4f..0f83a4f 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/DomainsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/DomainsResourceTest.java @@ -35,4 +35,4 @@ public class DomainsResourceTest { domainsResource.groupRoles("test", "test"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GenericResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GenericResourceTest.java index 4cd1959..75e8bd5 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GenericResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GenericResourceTest.java @@ -22,7 +22,6 @@ package com.woorea.openstack.keystone.v3.api; import com.woorea.openstack.keystone.v3.model.User; import com.woorea.openstack.keystone.v3.model.Users; import org.junit.Test; - import static org.junit.Assert.*; public class GenericResourceTest { @@ -54,4 +53,4 @@ public class GenericResourceTest { genericResource.delete("123"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GroupsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GroupsResourceTest.java index 8864758..8ce7cd3 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GroupsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/GroupsResourceTest.java @@ -30,4 +30,4 @@ public class GroupsResourceTest { groupsResource.userRoles("test", "test"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResourceTest.java index dda74d2..58dfeab 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResourceTest.java @@ -46,4 +46,4 @@ public class ProjectGroupRolesResourceTest { projectGroupRolesResource.delete("test"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResourceTest.java index b529579..4b0d70e 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResourceTest.java @@ -35,4 +35,4 @@ public class ProjectRolesResourceTest { projectRolesResource.remove("test"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResourceTest.java index e0aed69..23518a2 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResourceTest.java @@ -35,4 +35,4 @@ public class ProjectUserRolesResourceTest { projectUserRolesResource.remove("roleid"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectsResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectsResourceTest.java index 8759ed3..2e6cb67 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectsResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/ProjectsResourceTest.java @@ -40,4 +40,4 @@ public class ProjectsResourceTest { projectsResource.groupRoles("pid", "gid"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/RolesResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/RolesResourceTest.java index c45e2ed..a8b0ee9 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/RolesResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/RolesResourceTest.java @@ -30,4 +30,4 @@ public class RolesResourceTest { rolesResource.users("domainid", "userid"); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/TokensResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/TokensResourceTest.java index d06c823..ddcfc6c 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/TokensResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/TokensResourceTest.java @@ -36,4 +36,4 @@ public class TokensResourceTest { tokensResource.show(); } -} \ No newline at end of file +} diff --git a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/UsersResourceTest.java b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/UsersResourceTest.java index 2c64f06..247101c 100644 --- a/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/UsersResourceTest.java +++ b/keystone-client/src/test/java/com/woorea/openstack/keystone/v3/api/UsersResourceTest.java @@ -40,4 +40,4 @@ public class UsersResourceTest { usersResource.roles("uid"); } -} \ No newline at end of file +} diff --git a/keystone-model/pom.xml b/keystone-model/pom.xml index 7b3f806..58816a0 100644 --- a/keystone-model/pom.xml +++ b/keystone-model/pom.xml @@ -1,26 +1,27 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - keystone-model - OpenStack Keystone Model - OpenStack Keystone Model + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + keystone-model + OpenStack Keystone Model + OpenStack Keystone Model - - - junit - junit - test - - - org.skyscreamer - jsonassert - test - - + + + junit + junit + test + + + org.skyscreamer + jsonassert + test + + diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java index 0ec9a1c..b78296a 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -28,16 +27,16 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Access implements Serializable { public static final class Service { - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Endpoint { - + private String region; - + private String publicURL; - + private String internalURL; - + private String adminURL; /** @@ -68,24 +67,25 @@ public class Access implements Serializable { return adminURL; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Endpoint [region=" + region + ", publicURL=" - + publicURL + ", internalURL=" + internalURL + return "Endpoint [region=" + region + ", publicURL=" + publicURL + ", internalURL=" + internalURL + ", adminURL=" + adminURL + "]"; } - + } - + private String type; - + private String name; - + private List endpoints; - + @JsonProperty("endpoints_links") private List endpointsLinks; @@ -117,25 +117,27 @@ public class Access implements Serializable { return endpointsLinks; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Service [type=" + type + ", name=" + name + ", endpoints=" - + endpoints + ", endpointsLinks=" + endpointsLinks + "]"; + return "Service [type=" + type + ", name=" + name + ", endpoints=" + endpoints + ", endpointsLinks=" + + endpointsLinks + "]"; } - + } - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class User { - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Role { - + private String id; - + private String name; /** @@ -152,24 +154,26 @@ public class Access implements Serializable { return name; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Role [id=" + id + ", name=" + name + "]"; } - + } - + private String id; - + private String name; - + private String username; - + private List roles; - + @JsonProperty("roles_links") private List rolesLinks; @@ -208,24 +212,25 @@ public class Access implements Serializable { return rolesLinks; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "User [id=" + id + ", name=" + name + ", username=" - + username + ", roles=" + roles + ", rolesLinks=" + return "User [id=" + id + ", name=" + name + ", username=" + username + ", roles=" + roles + ", rolesLinks=" + rolesLinks + "]"; } - + } - + private Token token; - + private List serviceCatalog; - + private User user; - + private Map metadata; /** @@ -256,13 +261,15 @@ public class Access implements Serializable { return metadata; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog - + ", user=" + user + ", metadata=" + metadata + "]"; + return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog + ", user=" + user + ", metadata=" + + metadata + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java index 6c6b536..6193ede 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java @@ -21,7 +21,7 @@ import java.io.Serializable; public abstract class Authentication implements Serializable { private String tenantId; - + private String tenantName; /** @@ -51,5 +51,5 @@ public abstract class Authentication implements Serializable { public void setTenantName(String tenantName) { this.tenantName = tenantName; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java index 87c93ec..fe38cda 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java @@ -17,7 +17,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,18 +24,18 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Endpoint implements Serializable { private String id; - + @JsonProperty("service_id") private String serviceId; - + private String region; - + @JsonProperty("publicurl") private String publicURL; - + @JsonProperty("internalurl") private String internalURL; - + @JsonProperty("adminurl") private String adminURL; @@ -124,14 +123,15 @@ public class Endpoint implements Serializable { this.adminURL = adminURL; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" - + region + ", publicURL=" + publicURL + ", internalURL=" - + internalURL + ", adminURL=" + adminURL + "]"; + return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" + region + ", publicURL=" + publicURL + + ", internalURL=" + internalURL + ", adminURL=" + adminURL + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java index 68ed95c..b92b552 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Endpoints implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class Endpoints implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Endpoints implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java index 2da9408..a907871 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java @@ -17,16 +17,15 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("error") public class Error implements Serializable { private Integer code; - + private String title; - + private String message; /** @@ -50,13 +49,14 @@ public class Error implements Serializable { return message; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Error [code=" + code + ", title=" + title + ", message=" - + message + "]"; + return "Error [code=" + code + ", title=" + title + ", message=" + message + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java index 4b94558..525fa32 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java @@ -21,9 +21,9 @@ import java.io.Serializable; public class Link implements Serializable { private String rel; - + private String href; - + private String type; /** @@ -47,12 +47,14 @@ public class Link implements Serializable { return type; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java index 9f2a6ca..5e46b2e 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java @@ -36,12 +36,13 @@ public class Metadata { /** * Set the metadata + * * @param metadata */ public void setMetadata(Map metadata) { this.metadata = metadata; } - - + + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java index 8885d51..9f9bb80 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java @@ -17,18 +17,17 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("role") public class Role implements Serializable { private String id; - + private String name; - + private String description; - + private String enabled; /** diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java index bc9e6a5..2e8ca6a 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Roles implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class Roles implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Roles implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java index 40cdfae..3f65961 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java @@ -17,18 +17,17 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("OS-KSADM:service") public class Service implements Serializable { private String id; - + private String type; - + private String name; - + private String description; /** @@ -80,13 +79,14 @@ public class Service implements Serializable { this.description = description; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Service [id=" + id + ", type=" + type + ", name=" + name - + ", description=" + description + "]"; + return "Service [id=" + id + ", type=" + type + ", name=" + name + ", description=" + description + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java index a0ba675..6e47645 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Services implements Iterable, Serializable { +public class Services implements Iterable, Serializable { @JsonProperty("OS-KSADM:services") private List list; @@ -33,8 +32,10 @@ public class Services implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Services implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java index a8a84fd..ee195de 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java @@ -17,38 +17,36 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("tenant") -@JsonIgnoreProperties(ignoreUnknown=true) +@JsonIgnoreProperties(ignoreUnknown = true) public class Tenant implements Serializable { private String id; - + private String name; - + private String description; - + private Boolean enabled; - + public Tenant(String name, String description, Boolean enabled) { this.name = name; this.description = description; this.enabled = enabled; } - + public Tenant(String name, String description) { this(name, description, Boolean.TRUE); } - + public Tenant(String name) { this(name, null); } - - public Tenant() { - } + + public Tenant() {} /** * @return the id @@ -106,13 +104,14 @@ public class Tenant implements Serializable { this.enabled = enabled; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Tenant [id=" + id + ", name=" + name + ", description=" - + description + ", enabled=" + enabled + "]"; + return "Tenant [id=" + id + ", name=" + name + ", description=" + description + ", enabled=" + enabled + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java index 7ebb1f5..688252d 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java @@ -19,14 +19,13 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Tenants implements Iterable, Serializable { @JsonProperty("tenants") private List list; - + @JsonProperty("tenants_links") private List links; @@ -44,7 +43,9 @@ public class Tenants implements Iterable, Serializable { return links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -56,5 +57,5 @@ public class Tenants implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java index 73d92fa..a9aade7 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java @@ -39,7 +39,7 @@ public final class Token { * @return the issued_at */ public Calendar getIssued_at() { - return issued_at; + return issued_at; } /** @@ -56,13 +56,14 @@ public final class Token { return tenant; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" - + tenant + "]"; + return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" + tenant + "]"; } -} \ No newline at end of file +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java index bd1652e..046e669 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java @@ -21,26 +21,25 @@ package com.woorea.openstack.keystone.model; */ import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("user") public class User implements Serializable { private String id; - + private String username; - -// @JsonProperty("OS-KSADM:password") -// @JsonProperty("OS_KSADM_password") + + // @JsonProperty("OS-KSADM:password") + // @JsonProperty("OS_KSADM_password") private String password; - + private String tenantId; - + private String name; - + private String email; - + private Boolean enabled; /** @@ -141,14 +140,15 @@ public class User implements Serializable { this.enabled = enabled; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "User [id=" + id + ", username=" + username + ", password=" - + password + ", tenantId=" + tenantId + ", name=" + name - + ", email=" + email + ", enabled=" + enabled + "]"; + return "User [id=" + id + ", username=" + username + ", password=" + password + ", tenantId=" + tenantId + + ", name=" + name + ", email=" + email + ", enabled=" + enabled + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java index 4f511c1..a6e4f14 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Users implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class Users implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Users implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java index 99c776a..2167ca2 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java @@ -21,11 +21,11 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class AccessKey extends Authentication { - + public static final class ApiAccessKeyCredentials { - + private String accessKey; - + private String secretKey; /** @@ -55,15 +55,15 @@ public class AccessKey extends Authentication { public void setSecretKey(String secretKey) { this.secretKey = secretKey; } - + } - + private ApiAccessKeyCredentials apiAccessKeyCredentials = new ApiAccessKeyCredentials(); - + public AccessKey() { - + } - + public AccessKey(String accessKey, String secretKey) { apiAccessKeyCredentials.setAccessKey(accessKey); apiAccessKeyCredentials.setSecretKey(secretKey); @@ -79,9 +79,8 @@ public class AccessKey extends Authentication { /** * @param apiAccessKeyCredentials the apiAccessKeyCredentials to set */ - public void setApiAccessKeyCredentials( - ApiAccessKeyCredentials apiAccessKeyCredentials) { + public void setApiAccessKeyCredentials(ApiAccessKeyCredentials apiAccessKeyCredentials) { this.apiAccessKeyCredentials = apiAccessKeyCredentials; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java index f730fc0..2c33519 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java @@ -21,9 +21,9 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class TokenAuthentication extends Authentication { - + public static final class Token { - + private String id; /** @@ -39,11 +39,11 @@ public class TokenAuthentication extends Authentication { public void setId(String id) { this.id = id; } - + } - + private Token token = new Token(); - + public TokenAuthentication(String token) { this.token.id = token; } @@ -61,5 +61,5 @@ public class TokenAuthentication extends Authentication { public void setToken(Token token) { this.token = token; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java index 1c07283..3cdb03c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java @@ -21,11 +21,11 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class UsernamePassword extends Authentication { - + public static final class PasswordCredentials { - + private String username; - + private String password; /** @@ -55,15 +55,15 @@ public class UsernamePassword extends Authentication { public void setPassword(String password) { this.password = password; } - + } - + private PasswordCredentials passwordCredentials = new PasswordCredentials(); - + public UsernamePassword() { - + } - + public UsernamePassword(String username, String password) { passwordCredentials.setUsername(username); passwordCredentials.setPassword(password); @@ -82,5 +82,5 @@ public class UsernamePassword extends Authentication { public void setPasswordCredentials(PasswordCredentials passwordCredentials) { this.passwordCredentials = passwordCredentials; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java index c92d1da..428b3ed 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java @@ -19,14 +19,13 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("auth") public class Authentication implements Serializable { - + public static final class Identity { - + public static final Identity password(String userId, String password) { Identity identity = new Identity(); identity.getMethods().add("password"); @@ -36,12 +35,13 @@ public class Authentication implements Serializable { identity.setPassword(method); return identity; } - + public static final Identity password(String domainName, String username, String password) { Identity identity = new Identity(); identity.getMethods().add("password"); Password method = new Password(); - com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain(); + com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = + new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain(); domain.setName(domainName); method.getUser().setDomain(domain); method.getUser().setName(username); @@ -49,7 +49,7 @@ public class Authentication implements Serializable { identity.setPassword(method); return identity; } - + public static final Identity token(String token) { Identity identity = new Identity(); identity.getMethods().add("token"); @@ -58,17 +58,17 @@ public class Authentication implements Serializable { identity.setToken(method); return identity; } - + private List methods = new ArrayList<>(); - + public static final class Password { - + public static final class User { - + public static final class Domain { - + private String id; - + private String name; public String getId() { @@ -87,13 +87,13 @@ public class Authentication implements Serializable { this.name = name; } } - + private Domain domain; - + private String id; - + private String name; - + private String password; public Domain getDomain() { @@ -127,9 +127,9 @@ public class Authentication implements Serializable { public void setPassword(String password) { this.password = password; } - + } - + private User user = new User(); public User getUser() { @@ -139,13 +139,13 @@ public class Authentication implements Serializable { public void setUser(User user) { this.user = user; } - + } - + private Password password; - + public static final class Token { - + private String id; public String getId() { @@ -155,9 +155,9 @@ public class Authentication implements Serializable { public void setId(String id) { this.id = id; } - + } - + private Token token; public List getMethods() { @@ -183,13 +183,13 @@ public class Authentication implements Serializable { public void setToken(Token token) { this.token = token; } - + } - + private Identity identity; - + public static final class Scope { - + public static Scope project(String id) { Scope scope = new Scope(); Project project = new Project(); @@ -197,10 +197,11 @@ public class Authentication implements Serializable { scope.setProject(project); return scope; } - + public static Scope project(String domainName, String projectName) { Scope scope = new Scope(); - com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain(); + com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = + new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain(); domain.setName(domainName); Project project = new Project(); project.setDomain(domain); @@ -208,13 +209,13 @@ public class Authentication implements Serializable { scope.setProject(project); return scope; } - + public static final class Project { - + public static final class Domain { - + private String id; - + private String name; public String getId() { @@ -233,13 +234,13 @@ public class Authentication implements Serializable { this.name = name; } } - + private String id; - + private Domain domain; - + private String name; - + public String getId() { return id; @@ -264,9 +265,9 @@ public class Authentication implements Serializable { public void setName(String name) { this.name = name; } - + } - + private Project project; public Project getProject() { @@ -276,9 +277,9 @@ public class Authentication implements Serializable { public void setProject(Project project) { this.project = project; } - + } - + private Scope scope; public Identity getIdentity() { @@ -296,5 +297,5 @@ public class Authentication implements Serializable { public void setScope(Scope scope) { this.scope = scope; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java index 26d0b89..280b78d 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java @@ -18,20 +18,19 @@ package com.woorea.openstack.keystone.v3.model; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("credential") public class Credential { - + private String id; private String projectId; - + private String type; - + private String userId; - + private Map blob = new HashMap<>(); public String getId() { @@ -73,5 +72,5 @@ public class Credential { public void setBlob(Map blob) { this.blob = blob; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java index b0e6944..c29b8f6 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Credentials implements Iterable, Serializable { +public class Credentials implements Iterable, Serializable { @JsonProperty("credentials") private List list; @@ -33,8 +32,10 @@ public class Credentials implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Credentials implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java index 6509f79..821bdc2 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java @@ -22,11 +22,11 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Domain { private String id; - + private String name; - + private String description; - + private Boolean enabled; public String getId() { @@ -52,7 +52,7 @@ public class Domain { public void setDescription(String description) { this.description = description; } - + public Boolean getEnabled() { return enabled; } @@ -60,5 +60,5 @@ public class Domain { public void setEnabled(Boolean enabled) { this.enabled = enabled; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java index 32a5442..4880edc 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Domains implements Iterable, Serializable { +public class Domains implements Iterable, Serializable { @JsonProperty("domains") private List list; @@ -33,8 +32,10 @@ public class Domains implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Domains implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java index 5a60998..e3c19c3 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java @@ -23,12 +23,12 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Endpoint { private String id; - + @JsonProperty("interface") private String iface; - + private String name; - + @JsonProperty("service_id") private String serviceId; @@ -63,5 +63,5 @@ public class Endpoint { public void setServiceId(String serviceId) { this.serviceId = serviceId; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java index b8711d6..5383e75 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Endpoints implements Iterable, Serializable { +public class Endpoints implements Iterable, Serializable { @JsonProperty("endpoints") private List list; @@ -33,8 +32,10 @@ public class Endpoints implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Endpoints implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java index 7573119..808b7b5 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java @@ -23,12 +23,12 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Group { private String id; - + @JsonProperty("domain_id") private String domainId; - + private String name; - + private String description; public String getId() { @@ -62,5 +62,5 @@ public class Group { public void setDescription(String description) { this.description = description; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java index 2929030..f4b5b62 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Groups implements Iterable, Serializable { +public class Groups implements Iterable, Serializable { @JsonProperty("groups") private List list; @@ -33,8 +32,10 @@ public class Groups implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Groups implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java index 1d51d64..2064550 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Policies implements Iterable, Serializable { +public class Policies implements Iterable, Serializable { @JsonProperty("policies") private List list; @@ -33,8 +32,10 @@ public class Policies implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Policies implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java index 777ff67..466a300 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java @@ -18,20 +18,19 @@ package com.woorea.openstack.keystone.v3.model; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("policy") public class Policy { - + private String id; private String projectId; - + private String type; - + private String userId; - + private Map blob = new HashMap<>(); public String getId() { @@ -73,5 +72,5 @@ public class Policy { public void setBlob(Map blob) { this.blob = blob; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java index 5345cb8..2f76faf 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java @@ -23,12 +23,12 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Project { private String id; - + @JsonProperty("domain_id") private String domainId; - + private String name; - + private Boolean enabled; public String getId() { @@ -54,7 +54,7 @@ public class Project { public void setName(String name) { this.name = name; } - + public Boolean getEnabled() { return enabled; } @@ -62,5 +62,5 @@ public class Project { public void setEnabled(Boolean enabled) { this.enabled = enabled; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java index bc11b9d..c78df70 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Projects implements Iterable, Serializable { +public class Projects implements Iterable, Serializable { @JsonProperty("projects") private List list; @@ -33,8 +32,10 @@ public class Projects implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Projects implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java index 4407bba..98ff8e0 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java @@ -17,18 +17,17 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("role") public class Role implements Serializable { private String id; - + private String name; - + private String description; - + private String enabled; /** diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java index ed0d21f..c7f13ae 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Roles implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class Roles implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Roles implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java index 713a370..a0a3508 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java @@ -22,11 +22,11 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Service { private String id; - + private String type; - + private String name; - + private String description; public String getId() { @@ -60,5 +60,5 @@ public class Service { public void setDescription(String description) { this.description = description; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java index d9e23f1..25da795 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java @@ -19,11 +19,10 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.woorea.openstack.keystone.model.Service; -public class Services implements Iterable, Serializable { +public class Services implements Iterable, Serializable { @JsonProperty("services") private List list; @@ -34,8 +33,10 @@ public class Services implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -47,5 +48,5 @@ public class Services implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java index ce38ff0..e85bc67 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java @@ -19,30 +19,29 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Calendar; import java.util.List; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("token") -@JsonIgnoreProperties(ignoreUnknown=true) +@JsonIgnoreProperties(ignoreUnknown = true) public class Token implements Serializable { - + private String id; - + @JsonProperty("expires_at") private Calendar expiresAt; - + @JsonProperty("issued_at") private Calendar issuedAt; - + private List methods; - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Domain { - + private String id; - + private String name; public String getId() { @@ -60,18 +59,18 @@ public class Token implements Serializable { public void setName(String name) { this.name = name; } - + } - + private Domain domain; - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Project { - + private Domain domain; - + private String id; - + private String name; public Domain getDomain() { @@ -97,19 +96,19 @@ public class Token implements Serializable { public void setName(String name) { this.name = name; } - + } - + private Project project; - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class User { - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) private static final class Domain { - + private String id; - + private String name; public String getId() { @@ -127,11 +126,11 @@ public class Token implements Serializable { public void setName(String name) { this.name = name; } - + } - + private String id; - + private String name; public String getId() { @@ -149,37 +148,37 @@ public class Token implements Serializable { public void setName(String name) { this.name = name; } - + } - + private User user; - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Role { - + private String id; - + private String name; - + } - + private List roles; - + public static final class Service { - + public static final class Endpoint { - + private String id; - + private String url; - + private String region; - + private Boolean enabled; - + @JsonProperty("legacy_endpoint_id") private String legacyEndpointId; - + @JsonProperty("interface") private String iface; @@ -230,13 +229,13 @@ public class Token implements Serializable { public void setInterface(String iface) { this.iface = iface; } - + } - + private String id; - + private String type; - + private List endpoints; public String getId() { @@ -262,9 +261,9 @@ public class Token implements Serializable { public void setEndpoints(List endpoints) { this.endpoints = endpoints; } - + } - + private List catalog; @@ -374,13 +373,12 @@ public class Token implements Serializable { this.catalog = catalog; } - + @Override public String toString() { - return "Token [id=" + id + ", expiresAt=" + expiresAt + ", issuedAt=" - + issuedAt + ", methods=" + methods + ", domain=" + domain - + ", project=" + project + ", user=" + user + ", roles=" - + roles + ", catalog=" + catalog + "]"; + return "Token [id=" + id + ", expiresAt=" + expiresAt + ", issuedAt=" + issuedAt + ", methods=" + methods + + ", domain=" + domain + ", project=" + project + ", user=" + user + ", roles=" + roles + ", catalog=" + + catalog + "]"; } } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java index 91a6230..6724213 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java @@ -23,21 +23,21 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class User { private String id; - + @JsonProperty("domain_id") private String domainId; - + @JsonProperty("default_project_id") private String defaultProjectId; - + private String name; - + private String password; - + private String email; - + private String description; - + private Boolean enabled; public String getId() { @@ -103,5 +103,5 @@ public class User { public void setEnabled(Boolean enabled) { this.enabled = enabled; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java index a371018..41e9b0e 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java @@ -19,11 +19,10 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.woorea.openstack.keystone.model.User; -public class Users implements Iterable, Serializable { +public class Users implements Iterable, Serializable { @JsonProperty("users") private List list; @@ -34,8 +33,10 @@ public class Users implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -47,5 +48,5 @@ public class Users implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/AccessTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/AccessTest.java index 807c528..85e40d9 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/AccessTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/AccessTest.java @@ -26,10 +26,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.Access.Service; import com.woorea.openstack.keystone.model.Access.User; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,101 +37,42 @@ public class AccessTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"access\" : {" + EOL - + " \"token\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"issued_at\" : 1488024000000," + EOL - + " \"expires\" : 1488628800000," + EOL - + " \"tenant\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }" + EOL - + " }," + EOL - + " \"serviceCatalog\" : [ {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"region\" : \"region\"," + EOL - + " \"publicURL\" : \"publicurl\"," + EOL - + " \"internalURL\" : \"internalurl\"," + EOL - + " \"adminURL\" : \"adminurl\"" + EOL - + " }, {" + EOL - + " \"region\" : \"region\"," + EOL - + " \"publicURL\" : \"publicurl\"," + EOL - + " \"internalURL\" : \"internalurl\"," + EOL - + " \"adminURL\" : \"adminurl\"" + EOL - + " } ]," + EOL - + " \"endpoints_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"region\" : \"region\"," + EOL - + " \"publicURL\" : \"publicurl\"," + EOL - + " \"internalURL\" : \"internalurl\"," + EOL - + " \"adminURL\" : \"adminurl\"" + EOL - + " }, {" + EOL - + " \"region\" : \"region\"," + EOL - + " \"publicURL\" : \"publicurl\"," + EOL - + " \"internalURL\" : \"internalurl\"," + EOL - + " \"adminURL\" : \"adminurl\"" + EOL - + " } ]," + EOL - + " \"endpoints_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " } ]," + EOL - + " \"user\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"roles\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " } ]," + EOL - + " \"roles_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"access\" : {" + EOL + " \"token\" : {" + EOL + + " \"id\" : \"id\"," + EOL + " \"issued_at\" : 1488024000000," + EOL + + " \"expires\" : 1488628800000," + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : false" + EOL + " }" + EOL + " }," + EOL + " \"serviceCatalog\" : [ {" + + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"endpoints\" : [ {" + EOL + " \"region\" : \"region\"," + EOL + + " \"publicURL\" : \"publicurl\"," + EOL + " \"internalURL\" : \"internalurl\"," + EOL + + " \"adminURL\" : \"adminurl\"" + EOL + " }, {" + EOL + " \"region\" : \"region\"," + + EOL + " \"publicURL\" : \"publicurl\"," + EOL + " \"internalURL\" : \"internalurl\"," + EOL + + " \"adminURL\" : \"adminurl\"" + EOL + " } ]," + EOL + " \"endpoints_links\" : [ {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }, {" + EOL + " \"type\" : \"type\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"endpoints\" : [ {" + EOL + + " \"region\" : \"region\"," + EOL + " \"publicURL\" : \"publicurl\"," + EOL + + " \"internalURL\" : \"internalurl\"," + EOL + " \"adminURL\" : \"adminurl\"" + EOL + + " }, {" + EOL + " \"region\" : \"region\"," + EOL + " \"publicURL\" : \"publicurl\"," + + EOL + " \"internalURL\" : \"internalurl\"," + EOL + " \"adminURL\" : \"adminurl\"" + EOL + + " } ]," + EOL + " \"endpoints_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]" + EOL + " } ]," + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"username\" : \"username\"," + EOL + " \"roles\" : [ {" + + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " } ]," + EOL + + " \"roles_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -149,18 +88,18 @@ public class AccessTest { public void testMethods() throws Exception { Access access = objectMapper.readValue(JSON_FULL, Access.class); access.toString(); - + List serviceCatalog = access.getServiceCatalog(); Assert.assertNotNull(serviceCatalog); Assert.assertEquals(2, serviceCatalog.size()); - - Map metadata = access.getMetadata(); + + Map metadata = access.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + User user = access.getUser(); Assert.assertNotNull(user); - + Token token = access.getToken(); Assert.assertNotNull(token); } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointTest.java index 5d94b2b..73c2122 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,24 +33,15 @@ public class EndpointTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"endpoint\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"service_id\" : \"serviceid\"," + EOL - + " \"publicurl\" : \"publicurl\"," + EOL - + " \"internalurl\" : \"internalurl\"," + EOL - + " \"adminurl\" : \"adminurl\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"endpoint\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL + + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL + + " \"adminurl\" : \"adminurl\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -67,27 +57,27 @@ public class EndpointTest { public void testMethods() throws Exception { Endpoint endpoint = objectMapper.readValue(JSON_FULL, Endpoint.class); endpoint.toString(); - + String publicURL = endpoint.getPublicURL(); Assert.assertNotNull(publicURL); endpoint.setPublicURL(publicURL); - + String internalURL = endpoint.getInternalURL(); Assert.assertNotNull(internalURL); endpoint.setInternalURL(internalURL); - + String id = endpoint.getId(); Assert.assertNotNull(id); endpoint.setId(id); - + String region = endpoint.getRegion(); Assert.assertNotNull(region); endpoint.setRegion(region); - + String serviceId = endpoint.getServiceId(); Assert.assertNotNull(serviceId); endpoint.setServiceId(serviceId); - + String adminURL = endpoint.getAdminURL(); Assert.assertNotNull(adminURL); endpoint.setAdminURL(adminURL); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointsTest.java index a20e058..a8f8063 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,29 +34,17 @@ public class EndpointsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"service_id\" : \"serviceid\"," + EOL - + " \"publicurl\" : \"publicurl\"," + EOL - + " \"internalurl\" : \"internalurl\"," + EOL - + " \"adminurl\" : \"adminurl\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"service_id\" : \"serviceid\"," + EOL - + " \"publicurl\" : \"publicurl\"," + EOL - + " \"internalurl\" : \"internalurl\"," + EOL - + " \"adminurl\" : \"adminurl\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL + + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL + + " \"adminurl\" : \"adminurl\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL + + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL + + " \"adminurl\" : \"adminurl\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -74,13 +60,14 @@ public class EndpointsTest { public void testMethods() throws Exception { Endpoints endpoints = objectMapper.readValue(JSON_FULL, Endpoints.class); endpoints.toString(); - + List list = endpoints.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Endpoint x : endpoints) { + for (@SuppressWarnings("unused") + Endpoint x : endpoints) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ErrorTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ErrorTest.java index c9903b9..a5c2aef 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ErrorTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ErrorTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,21 +33,13 @@ public class ErrorTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"error\" : {" + EOL - + " \"code\" : 29," + EOL - + " \"title\" : \"title\"," + EOL - + " \"message\" : \"message\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"error\" : {" + EOL + " \"code\" : 29," + EOL + + " \"title\" : \"title\"," + EOL + " \"message\" : \"message\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,13 +55,13 @@ public class ErrorTest { public void testMethods() throws Exception { Error error = objectMapper.readValue(JSON_FULL, Error.class); error.toString(); - + Integer code = error.getCode(); Assert.assertNotNull(code); - + String title = error.getTitle(); Assert.assertNotNull(title); - + String message = error.getMessage(); Assert.assertNotNull(message); } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/LinkTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/LinkTest.java index 493abb4..f568530 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/LinkTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/LinkTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,17 +33,12 @@ public class LinkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,13 +54,13 @@ public class LinkTest { public void testMethods() throws Exception { Link link = objectMapper.readValue(JSON_FULL, Link.class); link.toString(); - + String rel = link.getRel(); Assert.assertNotNull(rel); - + String href = link.getHref(); Assert.assertNotNull(href); - + String type = link.getType(); Assert.assertNotNull(type); } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/MetadataTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/MetadataTest.java index c07826b..aad5d77 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/MetadataTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/MetadataTest.java @@ -35,4 +35,4 @@ public class MetadataTest { metadata.setMetadata(null); } -} \ No newline at end of file +} diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RoleTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RoleTest.java index 739767b..6a32304 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RoleTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RoleTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,14 @@ public class RoleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"role\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"role\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,18 +56,18 @@ public class RoleTest { public void testMethods() throws Exception { Role role = objectMapper.readValue(JSON_FULL, Role.class); role.toString(); - + String name = role.getName(); Assert.assertNotNull(name); role.setName(name); - + String description = role.getDescription(); Assert.assertNotNull(description); role.setDescription(description); - + String id = role.getId(); Assert.assertNotNull(id); - + String enabled = role.getEnabled(); Assert.assertNotNull(enabled); role.setEnabled(enabled); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RolesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RolesTest.java index 86f64df..9536a97 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RolesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RolesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class RolesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"roles\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"roles\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +58,14 @@ public class RolesTest { public void testMethods() throws Exception { Roles roles = objectMapper.readValue(JSON_FULL, Roles.class); roles.toString(); - + List list = roles.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Role x : roles) { + for (@SuppressWarnings("unused") + Role x : roles) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServiceTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServiceTest.java index fec059e..c285b84 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServiceTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServiceTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,14 @@ public class ServiceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"OS-KSADM:service\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"OS-KSADM:service\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,18 +56,18 @@ public class ServiceTest { public void testMethods() throws Exception { Service service = objectMapper.readValue(JSON_FULL, Service.class); service.toString(); - + String name = service.getName(); Assert.assertNotNull(name); service.setName(name); - + String description = service.getDescription(); Assert.assertNotNull(description); service.setDescription(description); - + String id = service.getId(); Assert.assertNotNull(id); - + String type = service.getType(); Assert.assertNotNull(type); service.setType(type); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServicesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServicesTest.java index 6c60bcc..84b77fa 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServicesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServicesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class ServicesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"OS-KSADM:services\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"OS-KSADM:services\" : [ {" + EOL + " \"id\" : \"id\"," + + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +58,14 @@ public class ServicesTest { public void testMethods() throws Exception { Services services = objectMapper.readValue(JSON_FULL, Services.class); services.toString(); - + List list = services.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Service x : services) { + for (@SuppressWarnings("unused") + Service x : services) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantTest.java index 6ddc765..a1d1dde 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,14 @@ public class TenantTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenant\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : false" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,19 +56,19 @@ public class TenantTest { public void testMethods() throws Exception { Tenant tenant = objectMapper.readValue(JSON_FULL, Tenant.class); tenant.toString(); - + String name = tenant.getName(); Assert.assertNotNull(name); tenant.setName(name); - + String description = tenant.getDescription(); Assert.assertNotNull(description); tenant.setDescription(description); - + String id = tenant.getId(); Assert.assertNotNull(id); tenant.setId(id); - + Boolean enabled = tenant.getEnabled(); Assert.assertNotNull(enabled); tenant.setEnabled(enabled); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java index e79394e..246fa75 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,34 +34,18 @@ public class TenantsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenants\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]," + EOL - + " \"tenants_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"tenants\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"enabled\" : false" + EOL + " } ]," + EOL + + " \"tenants_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -79,17 +61,18 @@ public class TenantsTest { public void testMethods() throws Exception { Tenants tenants = objectMapper.readValue(JSON_FULL, Tenants.class); tenants.toString(); - + List links = tenants.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + List list = tenants.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Tenant x : tenants) { + for (@SuppressWarnings("unused") + Tenant x : tenants) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TokenTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TokenTest.java index f91b97a..06dc2a6 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TokenTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TokenTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,23 +34,14 @@ public class TokenTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"issued_at\" : 1488024000000," + EOL - + " \"expires\" : 1488628800000," + EOL - + " \"tenant\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"issued_at\" : 1488024000000," + + EOL + " \"expires\" : 1488628800000," + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : false" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -68,16 +57,16 @@ public class TokenTest { public void testMethods() throws Exception { Token token = objectMapper.readValue(JSON_FULL, Token.class); token.toString(); - + Calendar expires = token.getExpires(); Assert.assertNotNull(expires); - + String id = token.getId(); Assert.assertNotNull(id); - + Calendar issued_at = token.getIssued_at(); Assert.assertNotNull(issued_at); - + Tenant tenant = token.getTenant(); Assert.assertNotNull(tenant); } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UserTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UserTest.java index 0b7b9c1..2b33632 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UserTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UserTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,25 +33,15 @@ public class UserTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"user\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : false" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -68,31 +57,31 @@ public class UserTest { public void testMethods() throws Exception { User user = objectMapper.readValue(JSON_FULL, User.class); user.toString(); - + String password = user.getPassword(); Assert.assertNotNull(password); user.setPassword(password); - + String name = user.getName(); Assert.assertNotNull(name); user.setName(name); - + String tenantId = user.getTenantId(); Assert.assertNotNull(tenantId); user.setTenantId(tenantId); - + String id = user.getId(); Assert.assertNotNull(id); user.setId(id); - + String email = user.getEmail(); Assert.assertNotNull(email); user.setEmail(email); - + Boolean enabled = user.getEnabled(); Assert.assertNotNull(enabled); user.setEnabled(enabled); - + String username = user.getUsername(); Assert.assertNotNull(username); user.setUsername(username); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UsersTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UsersTest.java index eea318b..c9d09cb 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UsersTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UsersTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,31 +34,17 @@ public class UsersTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"users\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"users\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : false" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -76,13 +60,14 @@ public class UsersTest { public void testMethods() throws Exception { Users users = objectMapper.readValue(JSON_FULL, Users.class); users.toString(); - + List list = users.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") User x : users) { + for (@SuppressWarnings("unused") + User x : users) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/AccessKeyTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/AccessKeyTest.java index ffaae7e..f7dcd2d 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/AccessKeyTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/AccessKeyTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.authentication.AccessKey.ApiAccessKeyCredentials; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,24 +34,15 @@ public class AccessKeyTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"auth\" : {" + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"tenantName\" : \"tenantname\"," + EOL - + " \"apiAccessKeyCredentials\" : {" + EOL - + " \"accessKey\" : \"accesskey\"," + EOL - + " \"secretKey\" : \"secretkey\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"tenantId\" : \"tenantid\"," + + EOL + " \"tenantName\" : \"tenantname\"," + EOL + " \"apiAccessKeyCredentials\" : {" + EOL + + " \"accessKey\" : \"accesskey\"," + EOL + " \"secretKey\" : \"secretkey\"" + EOL + " }" + EOL + + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -68,15 +58,15 @@ public class AccessKeyTest { public void testMethods() throws Exception { AccessKey accesskey = objectMapper.readValue(JSON_FULL, AccessKey.class); accesskey.toString(); - + ApiAccessKeyCredentials apiAccessKeyCredentials = accesskey.getApiAccessKeyCredentials(); Assert.assertNotNull(apiAccessKeyCredentials); accesskey.setApiAccessKeyCredentials(apiAccessKeyCredentials); - + String tenantId = accesskey.getTenantId(); Assert.assertNotNull(tenantId); accesskey.setTenantId(tenantId); - + String tenantName = accesskey.getTenantName(); Assert.assertNotNull(tenantName); accesskey.setTenantName(tenantName); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/ApiAccessKeyCredentialsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/ApiAccessKeyCredentialsTest.java index 4a0534c..b06eeac 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/ApiAccessKeyCredentialsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/ApiAccessKeyCredentialsTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.authentication.AccessKey.ApiAccessKeyCredentials; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,22 +34,19 @@ public class ApiAccessKeyCredentialsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"accessKey\" : \"accesskey\"," + EOL - + " \"secretKey\" : \"secretkey\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"accessKey\" : \"accesskey\"," + EOL + " \"secretKey\" : \"secretkey\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { System.out.println("CLASS: " + ApiAccessKeyCredentials.class.getName()); System.out.println("TEST JSON: " + JSON_FULL); - ApiAccessKeyCredentials apiaccesskeycredentials = objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class); + ApiAccessKeyCredentials apiaccesskeycredentials = + objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class); String json = objectMapper.writeValueAsString(apiaccesskeycredentials); System.out.println("RE-SERIALIZED OBJECT: " + json); JSONAssert.assertEquals(JSON_FULL, json, JSONCompareMode.LENIENT); @@ -58,13 +54,14 @@ public class ApiAccessKeyCredentialsTest { @Test public void testMethods() throws Exception { - ApiAccessKeyCredentials apiaccesskeycredentials = objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class); + ApiAccessKeyCredentials apiaccesskeycredentials = + objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class); apiaccesskeycredentials.toString(); - + String secretKey = apiaccesskeycredentials.getSecretKey(); Assert.assertNotNull(secretKey); apiaccesskeycredentials.setSecretKey(secretKey); - + String accessKey = apiaccesskeycredentials.getAccessKey(); Assert.assertNotNull(accessKey); apiaccesskeycredentials.setAccessKey(accessKey); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/PasswordCredentialsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/PasswordCredentialsTest.java index 02adcaa..f629150 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/PasswordCredentialsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/PasswordCredentialsTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.authentication.UsernamePassword.PasswordCredentials; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class PasswordCredentialsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,11 +55,11 @@ public class PasswordCredentialsTest { public void testMethods() throws Exception { PasswordCredentials passwordcredentials = objectMapper.readValue(JSON_FULL, PasswordCredentials.class); passwordcredentials.toString(); - + String password = passwordcredentials.getPassword(); Assert.assertNotNull(password); passwordcredentials.setPassword(password); - + String username = passwordcredentials.getUsername(); Assert.assertNotNull(username); passwordcredentials.setUsername(username); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/TokenTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/TokenTest.java index 5fd13ef..057760a 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/TokenTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/TokenTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.authentication.TokenAuthentication.Token; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class TokenTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class TokenTest { public void testMethods() throws Exception { Token token = objectMapper.readValue(JSON_FULL, Token.class); token.toString(); - + String id = token.getId(); Assert.assertNotNull(id); token.setId(id); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/UsernamePasswordTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/UsernamePasswordTest.java index 60d5385..c691484 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/UsernamePasswordTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/UsernamePasswordTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.authentication.UsernamePassword.PasswordCredentials; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,24 +34,15 @@ public class UsernamePasswordTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"auth\" : {" + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"tenantName\" : \"tenantname\"," + EOL - + " \"passwordCredentials\" : {" + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"tenantId\" : \"tenantid\"," + + EOL + " \"tenantName\" : \"tenantname\"," + EOL + " \"passwordCredentials\" : {" + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL + + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -68,15 +58,15 @@ public class UsernamePasswordTest { public void testMethods() throws Exception { UsernamePassword usernamepassword = objectMapper.readValue(JSON_FULL, UsernamePassword.class); usernamepassword.toString(); - + PasswordCredentials passwordCredentials = usernamepassword.getPasswordCredentials(); Assert.assertNotNull(passwordCredentials); usernamepassword.setPasswordCredentials(passwordCredentials); - + String tenantId = usernamepassword.getTenantId(); Assert.assertNotNull(tenantId); usernamepassword.setTenantId(tenantId); - + String tenantName = usernamepassword.getTenantName(); Assert.assertNotNull(tenantName); usernamepassword.setTenantName(tenantName); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/AuthenticationTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/AuthenticationTest.java index 2779e1b..8fdaf88 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/AuthenticationTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/AuthenticationTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Authentication.Identity; import com.woorea.openstack.keystone.v3.model.Authentication.Scope; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,45 +35,21 @@ public class AuthenticationTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"auth\" : {" + EOL - + " \"identity\" : {" + EOL - + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL - + " \"password\" : {" + EOL - + " \"user\" : {" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"password\" : \"password\"" + EOL - + " }" + EOL - + " }," + EOL - + " \"token\" : {" + EOL - + " \"id\" : \"id\"" + EOL - + " }" + EOL - + " }," + EOL - + " \"scope\" : {" + EOL - + " \"project\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"name\" : \"name\"" + EOL - + " }" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"identity\" : {" + EOL + + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"password\" : {" + EOL + + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL + + " }," + EOL + " \"token\" : {" + EOL + " \"id\" : \"id\"" + EOL + " }" + EOL + + " }," + EOL + " \"scope\" : {" + EOL + " \"project\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"name\" : \"name\"" + EOL + + " }" + EOL + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -90,11 +65,11 @@ public class AuthenticationTest { public void testMethods() throws Exception { Authentication authentication = objectMapper.readValue(JSON_FULL, Authentication.class); authentication.toString(); - + Identity identity = authentication.getIdentity(); Assert.assertNotNull(identity); authentication.setIdentity(identity); - + Scope scope = authentication.getScope(); Assert.assertNotNull(scope); authentication.setScope(scope); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialTest.java index aaa2725..55f4774 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,26 +34,15 @@ public class CredentialTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"credential\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"credential\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -71,24 +58,24 @@ public class CredentialTest { public void testMethods() throws Exception { Credential credential = objectMapper.readValue(JSON_FULL, Credential.class); credential.toString(); - - Map blob = credential.getBlob(); + + Map blob = credential.getBlob(); Assert.assertNotNull(blob); Assert.assertEquals(2, blob.size()); credential.setBlob(blob); - + String id = credential.getId(); Assert.assertNotNull(id); credential.setId(id); - + String type = credential.getType(); Assert.assertNotNull(type); credential.setType(type); - + String userId = credential.getUserId(); Assert.assertNotNull(userId); credential.setUserId(userId); - + String projectId = credential.getProjectId(); Assert.assertNotNull(projectId); credential.setProjectId(projectId); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialsTest.java index a2e2e52..5aca3fc 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,33 +34,17 @@ public class CredentialsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"credentials\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"credentials\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,13 +60,14 @@ public class CredentialsTest { public void testMethods() throws Exception { Credentials credentials = objectMapper.readValue(JSON_FULL, Credentials.class); credentials.toString(); - + List list = credentials.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Credential x : credentials) { + for (@SuppressWarnings("unused") + Credential x : credentials) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainTest.java index f2ea79a..895d2b0 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Token.Domain; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class DomainTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = + "{" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,11 +55,11 @@ public class DomainTest { public void testMethods() throws Exception { Domain domain = objectMapper.readValue(JSON_FULL, Domain.class); domain.toString(); - + String name = domain.getName(); Assert.assertNotNull(name); domain.setName(name); - + String id = domain.getId(); Assert.assertNotNull(id); domain.setId(id); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainsTest.java index e517ff7..0fabf5e 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class DomainsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"domains\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"domains\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : false" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +58,14 @@ public class DomainsTest { public void testMethods() throws Exception { Domains domains = objectMapper.readValue(JSON_FULL, Domains.class); domains.toString(); - + List list = domains.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Domain x : domains) { + for (@SuppressWarnings("unused") + Domain x : domains) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointTest.java index 91807cf..0381510 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Token.Service.Endpoint; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,20 +34,13 @@ public class EndpointTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\"," + + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,27 +56,27 @@ public class EndpointTest { public void testMethods() throws Exception { Endpoint endpoint = objectMapper.readValue(JSON_FULL, Endpoint.class); endpoint.toString(); - + String legacyEndpointId = endpoint.getLegacyEndpointId(); Assert.assertNotNull(legacyEndpointId); endpoint.setLegacyEndpointId(legacyEndpointId); - + String id = endpoint.getId(); Assert.assertNotNull(id); endpoint.setId(id); - + String region = endpoint.getRegion(); Assert.assertNotNull(region); endpoint.setRegion(region); - + String interfaceProperty = endpoint.getInterface(); Assert.assertNotNull(interfaceProperty); endpoint.setInterface(interfaceProperty); - + String url = endpoint.getUrl(); Assert.assertNotNull(url); endpoint.setUrl(url); - + Boolean enabled = endpoint.getEnabled(); Assert.assertNotNull(enabled); endpoint.setEnabled(enabled); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointsTest.java index ef75d1b..df22f86 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class EndpointsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"service_id\" : \"serviceid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"service_id\" : \"serviceid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"interface\" : \"interface\"," + EOL + + " \"service_id\" : \"serviceid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"interface\" : \"interface\"," + EOL + + " \"service_id\" : \"serviceid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +58,14 @@ public class EndpointsTest { public void testMethods() throws Exception { Endpoints endpoints = objectMapper.readValue(JSON_FULL, Endpoints.class); endpoints.toString(); - + List list = endpoints.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Endpoint x : endpoints) { + for (@SuppressWarnings("unused") + Endpoint x : endpoints) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupTest.java index f9ee0a4..4f553f1 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,14 @@ public class GroupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"group\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"group\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"domain_id\" : \"domainid\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,19 +56,19 @@ public class GroupTest { public void testMethods() throws Exception { Group group = objectMapper.readValue(JSON_FULL, Group.class); group.toString(); - + String name = group.getName(); Assert.assertNotNull(name); group.setName(name); - + String description = group.getDescription(); Assert.assertNotNull(description); group.setDescription(description); - + String id = group.getId(); Assert.assertNotNull(id); group.setId(id); - + String domainId = group.getDomainId(); Assert.assertNotNull(domainId); group.setDomainId(domainId); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupsTest.java index eea955d..5d1a9a2 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class GroupsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"groups\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"groups\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"domain_id\" : \"domainid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"domain_id\" : \"domainid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +58,14 @@ public class GroupsTest { public void testMethods() throws Exception { Groups groups = objectMapper.readValue(JSON_FULL, Groups.class); groups.toString(); - + List list = groups.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Group x : groups) { + for (@SuppressWarnings("unused") + Group x : groups) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/IdentityTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/IdentityTest.java index 799708f..0726544 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/IdentityTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/IdentityTest.java @@ -27,9 +27,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Authentication.Identity; import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password; import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Token; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,29 +37,16 @@ public class IdentityTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL - + " \"password\" : {" + EOL - + " \"user\" : {" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"password\" : \"password\"" + EOL - + " }" + EOL - + " }," + EOL - + " \"token\" : {" + EOL - + " \"id\" : \"id\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"password\" : {" + EOL + + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL + + " }," + EOL + " \"token\" : {" + EOL + " \"id\" : \"id\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -77,16 +62,16 @@ public class IdentityTest { public void testMethods() throws Exception { Identity identity = objectMapper.readValue(JSON_FULL, Identity.class); identity.toString(); - + Password password = identity.getPassword(); Assert.assertNotNull(password); identity.setPassword(password); - + List methods = identity.getMethods(); Assert.assertNotNull(methods); Assert.assertEquals(2, methods.size()); identity.setMethods(methods); - + Token token = identity.getToken(); Assert.assertNotNull(token); identity.setToken(token); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PasswordTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PasswordTest.java index 4b2cd04..46ca89a 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PasswordTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PasswordTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password; import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,23 +35,14 @@ public class PasswordTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"user\" : {" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"password\" : \"password\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -68,7 +58,7 @@ public class PasswordTest { public void testMethods() throws Exception { Password password = objectMapper.readValue(JSON_FULL, Password.class); password.toString(); - + User user = password.getUser(); Assert.assertNotNull(user); password.setUser(user); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PoliciesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PoliciesTest.java index 3a8dc83..8d3096b 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PoliciesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PoliciesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,33 +34,17 @@ public class PoliciesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"policies\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"policies\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,13 +60,14 @@ public class PoliciesTest { public void testMethods() throws Exception { Policies policies = objectMapper.readValue(JSON_FULL, Policies.class); policies.toString(); - + List list = policies.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Policy x : policies) { + for (@SuppressWarnings("unused") + Policy x : policies) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PolicyTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PolicyTest.java index c4f7a73..50f7d8e 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PolicyTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PolicyTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,26 +34,15 @@ public class PolicyTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"policy\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"policy\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -71,24 +58,24 @@ public class PolicyTest { public void testMethods() throws Exception { Policy policy = objectMapper.readValue(JSON_FULL, Policy.class); policy.toString(); - - Map blob = policy.getBlob(); + + Map blob = policy.getBlob(); Assert.assertNotNull(blob); Assert.assertEquals(2, blob.size()); policy.setBlob(blob); - + String id = policy.getId(); Assert.assertNotNull(id); policy.setId(id); - + String type = policy.getType(); Assert.assertNotNull(type); policy.setType(type); - + String userId = policy.getUserId(); Assert.assertNotNull(userId); policy.setUserId(userId); - + String projectId = policy.getProjectId(); Assert.assertNotNull(projectId); policy.setProjectId(projectId); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectTest.java index 5526ad1..c040dd0 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Token.Domain; import com.woorea.openstack.keystone.v3.model.Token.Project; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,20 +35,13 @@ public class ProjectTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + + " }," + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,15 +57,15 @@ public class ProjectTest { public void testMethods() throws Exception { Project project = objectMapper.readValue(JSON_FULL, Project.class); project.toString(); - + Domain domain = project.getDomain(); Assert.assertNotNull(domain); project.setDomain(domain); - + String name = project.getName(); Assert.assertNotNull(name); project.setName(name); - + String id = project.getId(); Assert.assertNotNull(id); project.setId(id); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectsTest.java index 3582a4a..f6a267e 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,14 @@ public class ProjectsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"projects\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"enabled\" : false," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"enabled\" : false," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"projects\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"enabled\" : false," + EOL + " \"domain_id\" : \"domainid\"" + + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"enabled\" : false," + EOL + " \"domain_id\" : \"domainid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +57,14 @@ public class ProjectsTest { public void testMethods() throws Exception { Projects projects = objectMapper.readValue(JSON_FULL, Projects.class); projects.toString(); - + List list = projects.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Project x : projects) { + for (@SuppressWarnings("unused") + Project x : projects) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RoleTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RoleTest.java index ad39df2..5d4086f 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RoleTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RoleTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Token.Role; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,11 +33,9 @@ public class RoleTest { private static final String JSON_FULL = "{ }"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RolesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RolesTest.java index cd8fbde..a2d8cee 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RolesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RolesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class RolesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"roles\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"roles\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +58,14 @@ public class RolesTest { public void testMethods() throws Exception { Roles roles = objectMapper.readValue(JSON_FULL, Roles.class); roles.toString(); - + List list = roles.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Role x : roles) { + for (@SuppressWarnings("unused") + Role x : roles) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ScopeTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ScopeTest.java index 6beedb5..e84180a 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ScopeTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ScopeTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Authentication.Scope; import com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,22 +35,13 @@ public class ScopeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"project\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"name\" : \"name\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"project\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " }," + + EOL + " \"name\" : \"name\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -67,7 +57,7 @@ public class ScopeTest { public void testMethods() throws Exception { Scope scope = objectMapper.readValue(JSON_FULL, Scope.class); scope.toString(); - + Project project = scope.getProject(); Assert.assertNotNull(project); scope.setProject(project); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServiceTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServiceTest.java index 5edf7d6..1c48c88 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServiceTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServiceTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Token.Service; import com.woorea.openstack.keystone.v3.model.Token.Service.Endpoint; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,31 +36,18 @@ public class ServiceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + " \"endpoints\" : [ {" + EOL + + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + " \"region\" : \"region\"," + + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\"," + EOL + + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + " \"region\" : \"region\"," + + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\"," + EOL + + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,16 +63,16 @@ public class ServiceTest { public void testMethods() throws Exception { Service service = objectMapper.readValue(JSON_FULL, Service.class); service.toString(); - + List endpoints = service.getEndpoints(); Assert.assertNotNull(endpoints); Assert.assertEquals(2, endpoints.size()); service.setEndpoints(endpoints); - + String id = service.getId(); Assert.assertNotNull(id); service.setId(id); - + String type = service.getType(); Assert.assertNotNull(type); service.setType(type); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServicesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServicesTest.java index 0a88d6a..1f24494 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServicesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServicesTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.Service; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,25 +35,15 @@ public class ServicesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"services\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"services\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -71,13 +59,14 @@ public class ServicesTest { public void testMethods() throws Exception { Services services = objectMapper.readValue(JSON_FULL, Services.class); services.toString(); - + List list = services.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Service x : services) { + for (@SuppressWarnings("unused") + Service x : services) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/TokenTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/TokenTest.java index 4852e61..2677941 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/TokenTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/TokenTest.java @@ -29,10 +29,8 @@ import com.woorea.openstack.keystone.v3.model.Token.Project; import com.woorea.openstack.keystone.v3.model.Token.Role; import com.woorea.openstack.keystone.v3.model.Token.Service; import com.woorea.openstack.keystone.v3.model.Token.User; - import java.util.Calendar; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -42,76 +40,34 @@ public class TokenTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"token\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"project\" : {" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"user\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"roles\" : [ { }, { } ]," + EOL - + " \"catalog\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " } ]" + EOL - + " } ]," + EOL - + " \"expires_at\" : 1489752000000," + EOL - + " \"issued_at\" : 1488456000000" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"token\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"domain\" : {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " }," + EOL + + " \"project\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"roles\" : [ { }, { } ]," + EOL + + " \"catalog\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + + EOL + " } ]" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + + EOL + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + + EOL + " } ]" + EOL + " } ]," + EOL + " \"expires_at\" : 1489752000000," + EOL + + " \"issued_at\" : 1488456000000" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -127,42 +83,42 @@ public class TokenTest { public void testMethods() throws Exception { Token token = objectMapper.readValue(JSON_FULL, Token.class); token.toString(); - + List methods = token.getMethods(); Assert.assertNotNull(methods); Assert.assertEquals(2, methods.size()); token.setMethods(methods); - + List catalog = token.getCatalog(); Assert.assertNotNull(catalog); Assert.assertEquals(2, catalog.size()); token.setCatalog(catalog); - + Domain domain = token.getDomain(); Assert.assertNotNull(domain); token.setDomain(domain); - + List roles = token.getRoles(); Assert.assertNotNull(roles); Assert.assertEquals(2, roles.size()); token.setRoles(roles); - + Project project = token.getProject(); Assert.assertNotNull(project); token.setProject(project); - + Calendar issuedAt = token.getIssuedAt(); Assert.assertNotNull(issuedAt); token.setIssuedAt(issuedAt); - + String id = token.getId(); Assert.assertNotNull(id); token.setId(id); - + User user = token.getUser(); Assert.assertNotNull(user); token.setUser(user); - + Calendar expiresAt = token.getExpiresAt(); Assert.assertNotNull(expiresAt); token.setExpiresAt(expiresAt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UserTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UserTest.java index dc144ed..c751b7d 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UserTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UserTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,26 +33,16 @@ public class UserTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"user\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false," + EOL - + " \"domain_id\" : \"domainid\"," + EOL - + " \"default_project_id\" : \"defaultprojectid\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"description\" : \"description\"," + EOL + " \"enabled\" : false," + EOL + + " \"domain_id\" : \"domainid\"," + EOL + " \"default_project_id\" : \"defaultprojectid\"" + EOL + + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -69,35 +58,35 @@ public class UserTest { public void testMethods() throws Exception { User user = objectMapper.readValue(JSON_FULL, User.class); user.toString(); - + String password = user.getPassword(); Assert.assertNotNull(password); user.setPassword(password); - + String name = user.getName(); Assert.assertNotNull(name); user.setName(name); - + String description = user.getDescription(); Assert.assertNotNull(description); user.setDescription(description); - + String id = user.getId(); Assert.assertNotNull(id); user.setId(id); - + String email = user.getEmail(); Assert.assertNotNull(email); user.setEmail(email); - + String domainId = user.getDomainId(); Assert.assertNotNull(domainId); user.setDomainId(domainId); - + Boolean enabled = user.getEnabled(); Assert.assertNotNull(enabled); user.setEnabled(enabled); - + String defaultProjectId = user.getDefaultProjectId(); Assert.assertNotNull(defaultProjectId); user.setDefaultProjectId(defaultProjectId); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UsersTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UsersTest.java index ab6c557..ceb7df1 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UsersTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UsersTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.User; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,31 +35,17 @@ public class UsersTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"users\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"users\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : false" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -77,13 +61,14 @@ public class UsersTest { public void testMethods() throws Exception { Users users = objectMapper.readValue(JSON_FULL, Users.class); users.toString(); - + List list = users.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") User x : users) { + for (@SuppressWarnings("unused") + User x : users) { ++cnt; } Assert.assertEquals(2, cnt); 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 +} diff --git a/nova-model/pom.xml b/nova-model/pom.xml index 216b507..1de4ff3 100644 --- a/nova-model/pom.xml +++ b/nova-model/pom.xml @@ -1,24 +1,25 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - nova-model - OpenStack Nova Model - OpenStack Nova Model - - - junit - junit - test - - - org.skyscreamer - jsonassert - test - - + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + nova-model + OpenStack Nova Model + OpenStack Nova Model + + + junit + junit + test + + + org.skyscreamer + jsonassert + test + + diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java index 5ff1a2b..41a1d81 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java @@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Certificate { private String data; - + @JsonProperty("private_key") private String privateKey; @@ -41,12 +41,14 @@ public class Certificate { return privateKey; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Certificate [data=" + data + ", privateKey=" + privateKey + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java index 205816f..5da3ffb 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java @@ -18,24 +18,23 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Calendar; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("cloudpipe") public class Cloudpipe implements Serializable { - + private String projectId; - + private String internalIp; - + private String publicIp; - + private String publicPort; - + private String state; - + private String instanceId; - + private Calendar createdAt; /** @@ -136,15 +135,16 @@ public class Cloudpipe implements Serializable { this.createdAt = createdAt; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "CloudPipe [projectId=" + projectId + ", internalIp=" - + internalIp + ", publicIp=" + publicIp + ", publicPort=" - + publicPort + ", state=" + state + ", instanceId=" - + instanceId + ", createdAt=" + createdAt + "]"; + return "CloudPipe [projectId=" + projectId + ", internalIp=" + internalIp + ", publicIp=" + publicIp + + ", publicPort=" + publicPort + ", state=" + state + ", instanceId=" + instanceId + ", createdAt=" + + createdAt + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java index 09e02e0..4218a88 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java @@ -18,7 +18,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Cloudpipes implements Serializable { @@ -32,13 +31,15 @@ public class Cloudpipes implements Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Flavors [list=" + list + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java index 89b1121..8f9b653 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java @@ -19,22 +19,21 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Calendar; import java.util.List; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("extension") public class Extension implements Serializable { private String alias; - + private String description; - + private String name; - + private String namespace; - + private Calendar updated; - + private List links; /** @@ -79,13 +78,15 @@ public class Extension implements Serializable { return links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Extension [alias=" + alias + ", description=" + description - + ", name=" + name + ", namespace=" + namespace + "]"; + return "Extension [alias=" + alias + ", description=" + description + ", name=" + name + ", namespace=" + + namespace + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java index ce13b14..d904ad3 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Extensions implements Iterable, Serializable { @@ -33,13 +32,15 @@ public class Extensions implements Iterable, Serializable { public List getList() { return list; } - + @Override public Iterator iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java index 00740f4..4b42d62 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java @@ -18,42 +18,47 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("flavor") public class Flavor implements Serializable { + @JsonProperty("id") private String id; - + + @JsonProperty("name") private String name; - + + @JsonProperty("vcpus") private Integer vcpus; - + + @JsonProperty("ram") private Integer ram; - + + @JsonProperty("disk") private Integer disk; - + @JsonProperty("OS-FLV-EXT-DATA:ephemeral") private Integer ephemeral; - + + @JsonProperty("swap") private String swap; - + @JsonProperty("rxtx_factor") private Float rxtxFactor; - + @JsonProperty("OS-FLV-DISABLED:disabled") private Boolean disabled; - + @JsonProperty("rxtx_quota") private Integer rxtxQuota; - + @JsonProperty("rxtx_cap") private Integer rxtxCap; - + private List links; - + @JsonProperty("os-flavor-access:is_public") private Boolean isPublic; @@ -210,7 +215,7 @@ public class Flavor implements Serializable { public void setDisabled(Boolean disabled) { this.disabled = disabled; } - + /** * @return the isPublic */ @@ -239,17 +244,17 @@ public class Flavor implements Serializable { this.links = links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus - + ", ram=" + ram + ", disk=" + disk + ", ephemeral=" - + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor - + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota - + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" + return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus + ", ram=" + ram + ", disk=" + disk + + ", ephemeral=" + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor + ", disabled=" + + disabled + ", rxtxQuota=" + rxtxQuota + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" + isPublic + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java index a971f6f..b0fd8a1 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java @@ -22,22 +22,22 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("flavor") public class FlavorForCreate implements Serializable { - + private String id; - + private String name; - + private String vcpus; - + private Integer ram; - + private String disk; - + @JsonProperty("OS-FLV-EXT-DATA:ephemeral") private Integer ephemeral; - + private String swap; - + @JsonProperty("rxtx_factor") private Float rxtxFactor; @@ -152,5 +152,5 @@ public class FlavorForCreate implements Serializable { public void setRxtxFactor(Float rxtxFactor) { this.rxtxFactor = rxtxFactor; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java index 95decf4..e02a0d5 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java @@ -19,27 +19,32 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; + public class Flavors implements Iterable, Serializable { @JsonProperty("flavors") private List list; + @JsonProperty("flavors_links") + private List links; + /** * @return the list */ public List getList() { return list; } - + @Override public Iterator iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java index 990b980..d319385 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,14 +24,14 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class FloatingIp implements Serializable { private String id; - + private String pool; - + private String ip; - + @JsonProperty("fixed_ip") private String fixedIp; - + @JsonProperty("instance_id") private String instanceId; @@ -71,13 +70,15 @@ public class FloatingIp implements Serializable { return instanceId; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip - + ", fixedIp=" + fixedIp + ", instanceId=" + instanceId + "]"; + return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip + ", fixedIp=" + fixedIp + ", instanceId=" + + instanceId + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java index 5f134c2..71f1860 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,11 +24,11 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class FloatingIpDomain implements Serializable { private String domain; - + private String scope; - + private String project; - + @JsonProperty("availabilityZone") private String availabilityZone; @@ -61,14 +60,15 @@ public class FloatingIpDomain implements Serializable { return availabilityZone; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "FloatingIpDomain [domain=" + domain + ", scope=" + scope - + ", project=" + project + ", availabilityZone=" - + availabilityZone + "]"; + return "FloatingIpDomain [domain=" + domain + ", scope=" + scope + ", project=" + project + + ", availabilityZone=" + availabilityZone + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java index 45c7f6e..d156dd0 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class FloatingIpDomains implements Iterable, Serializable { @@ -39,12 +38,14 @@ public class FloatingIpDomains implements Iterable, Serializab return list.iterator(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "FloatingIpDomains [list=" + list + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java index 451bd03..9a0eb90 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java @@ -19,12 +19,11 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; public class FloatingIpPools implements Iterable, Serializable { - + public static class FloatingIpPool implements Serializable { private String name; @@ -36,14 +35,16 @@ public class FloatingIpPools implements Iterable, Serializable { return name; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "FloatingIpPool [name=" + name + "]"; } - + } @JsonProperty("floating_ip_pools") @@ -55,13 +56,15 @@ public class FloatingIpPools implements Iterable, Serializable { public List getList() { return list; } - + @Override public Iterator iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java index 58eb173..6ac0c71 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class FloatingIps implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class FloatingIps implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class FloatingIps implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java index c41eb65..812d02e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java @@ -18,24 +18,23 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Host implements Serializable { - + public static final class ResourceWrapper implements Serializable { - + public static final class Resource implements Serializable { - + private String project; - + @JsonProperty("memory_mb") private Integer memoryMb; - + private String host; - + private Integer cpu; - + @JsonProperty("disk_gb") private Integer diskGb; @@ -74,18 +73,19 @@ public class Host implements Serializable { return diskGb; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Resource [project=" + project + ", memoryMb=" - + memoryMb + ", host=" + host + ", cpu=" + cpu + return "Resource [project=" + project + ", memoryMb=" + memoryMb + ", host=" + host + ", cpu=" + cpu + ", diskGb=" + diskGb + "]"; } - + } - + private Resource resource; /** @@ -95,14 +95,16 @@ public class Host implements Serializable { return resource; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "ResourceWrapper [resource=" + resource + "]"; } - + } private List host; @@ -114,12 +116,14 @@ public class Host implements Serializable { return host; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Host [host=" + host + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java index d08c7f0..341f283 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java @@ -19,39 +19,40 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("aggregate") public class HostAggregate implements Serializable { - - private String id; + @JsonProperty("id") + private Integer id; + + @JsonProperty("name") private String name; - + @JsonProperty("availability_zone") private String availabilityZone; - + @JsonProperty("created_at") private String createdAt; - + @JsonProperty("updated_at") private String updatedAt; - + @JsonProperty("deleted_at") private String deletedAt; - + private Boolean deleted; - + private List hosts; - + private Map metadata; /** * @return the id */ - public String getId() { + public Integer getId() { return id; } @@ -111,16 +112,16 @@ public class HostAggregate implements Serializable { return metadata; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "HostAggregate [id=" + id + ", name=" + name - + ", availabilityZone=" + availabilityZone + ", createdAt=" - + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" - + deletedAt + ", deleted=" + deleted + ", hosts=" + hosts - + ", metadata=" + metadata + "]"; + return "HostAggregate [id=" + id + ", name=" + name + ", availabilityZone=" + availabilityZone + ", createdAt=" + + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" + deletedAt + ", deleted=" + deleted + + ", hosts=" + hosts + ", metadata=" + metadata + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java index fd83d16..5dc88b3 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class HostAggregates implements Iterable, Serializable { @@ -33,13 +32,15 @@ public class HostAggregates implements Iterable, Serializable { public List getList() { return list; } - + @Override public Iterator iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java index 1cdf0ae..67d78c8 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java @@ -19,18 +19,17 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Hosts implements Iterable, Serializable { - + public static final class Host { - + private String zone; - + @JsonProperty("host_name") private String hostName; - + private String service; /** @@ -46,7 +45,7 @@ public class Hosts implements Iterable, Serializable { public String getService() { return service; } - + public String getZone() { return zone; } @@ -55,14 +54,16 @@ public class Hosts implements Iterable, Serializable { this.zone = zone; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Host [hostName=" + hostName + ", service=" + service + "]"; } - + } @JsonProperty("hosts") @@ -74,13 +75,15 @@ public class Hosts implements Iterable, Serializable { public List getList() { return list; } - + @Override public Iterator iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -88,6 +91,6 @@ public class Hosts implements Iterable, Serializable { return "Hosts [list=" + list + "]"; } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java index e29f961..7aac87c 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java @@ -20,63 +20,62 @@ import java.io.Serializable; import java.util.Calendar; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("image") public class Image implements Serializable { - + public static final class Server implements Serializable { - + private String id; - + private List links; - + /** * @return the id */ public String getId() { return id; } - + /** * @return the links */ public List getLinks() { return links; } - + @Override public String toString() { return "Server [id=" + id + ", links=" + links + "]"; } - + } private String id; - + private String status; - + private String name; - + private Integer progress; - + private Integer minRam; - + private Integer minDisk; - + private Calendar created; - + private Calendar updated; - + @JsonProperty("OS-EXT-IMG-SIZE:size") private Long size; - + private Map metadata; - + private Server server; - + private List links; /** @@ -211,7 +210,7 @@ public class Image implements Serializable { public void setMetadata(Map metadata) { this.metadata = metadata; } - + /** * @return the server */ @@ -233,16 +232,17 @@ public class Image implements Serializable { this.links = links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Image [id=" + id + ", status=" + status + ", name=" + name - + ", progress=" + progress + ", minRam=" + minRam - + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null) + return "Image [id=" + id + ", status=" + status + ", name=" + name + ", progress=" + progress + ", minRam=" + + minRam + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null) + ", updated=" + (updated != null ? updated.getTime() : null) + ", size=" + size + ", metadata=" - + metadata + ", server="+server+", links=" + links + "]"; + + metadata + ", server=" + server + ", links=" + links + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java index 9191fa3..38cba08 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java index 2d2ec5d..912f9d7 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Images implements Iterable, Serializable { @@ -33,14 +32,16 @@ public class Images implements Iterable, Serializable { public List getList() { return list; } - + @Override public Iterator iterator() { return list.iterator(); } - - - /* (non-Javadoc) + + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java index fb1a1e1..2824850 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,26 +24,26 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class KeyPair implements Serializable { private String name; - + @JsonProperty("user_id") private String userId; - + @JsonProperty("public_key") private String publicKey; - + @JsonProperty("private_key") private String privateKey; - + private String fingerprint; public KeyPair() { super(); } - + public KeyPair(String name) { this.name = name; } - + public KeyPair(String name, String publicKey) { this(name); this.publicKey = publicKey; @@ -99,16 +98,17 @@ public class KeyPair implements Serializable { return fingerprint; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" - + publicKey + ", privateKey=" + privateKey + ", fingerprint=" - + fingerprint + "]"; + return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" + publicKey + ", privateKey=" + + privateKey + ", fingerprint=" + fingerprint + "]"; } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java index 2095a73..a6e78f2 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java @@ -20,16 +20,15 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class KeyPairs implements Iterable, Serializable { - + public static final class KeyPairWrapper implements Serializable { - + @JsonProperty private KeyPair keypair; - + } @JsonProperty("keypairs") @@ -40,18 +39,20 @@ public class KeyPairs implements Iterable, Serializable { */ public List getList() { List keyPairList = new ArrayList<>(); - for(KeyPairWrapper wrapper : this.list) { + for (KeyPairWrapper wrapper : this.list) { keyPairList.add(wrapper.keypair); } return keyPairList; } - + @Override public Iterator iterator() { return getList().iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java index fd1d113..a5177c4 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Calendar; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -92,9 +91,8 @@ public class Limits implements Serializable { */ @Override public String toString() { - return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" - + unit + ", verb=" + verb + ", remaining=" + remaining - + ", available=" + available + ", value=" + value + "]"; + return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" + unit + ", verb=" + verb + + ", remaining=" + remaining + ", available=" + available + ", value=" + value + "]"; } } @@ -133,8 +131,7 @@ public class Limits implements Serializable { */ @Override public String toString() { - return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" - + limit + "]"; + return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" + limit + "]"; } } @@ -242,7 +239,7 @@ public class Limits implements Serializable { public Integer getMaxSecurityGroupRules() { return maxSecurityGroupRules; } - + /** * @return the maxTotalKeypairs */ @@ -284,7 +281,7 @@ public class Limits implements Serializable { public Integer getMaxSecurityGroups() { return maxSecurityGroups; } - + /** * @return the totalVolumeGigabytesUsed */ @@ -369,11 +366,9 @@ public class Limits implements Serializable { */ @Override public String toString() { - return "AbsoluteLimit [maxServerMeta=" + maxServerMeta - + ", maxPersonality=" + maxPersonality + ", maxImageMeta=" - + maxImageMeta + ", maxPersonalitySize=" - + maxPersonalitySize + ", maxTotalCores=" + maxTotalCores - + ", maxTotalInstances=" + maxTotalInstances + return "AbsoluteLimit [maxServerMeta=" + maxServerMeta + ", maxPersonality=" + maxPersonality + + ", maxImageMeta=" + maxImageMeta + ", maxPersonalitySize=" + maxPersonalitySize + + ", maxTotalCores=" + maxTotalCores + ", maxTotalInstances=" + maxTotalInstances + ", maxTotalRAMSize=" + maxTotalRAMSize + "]"; } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java index 129896c..48bf500 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java @@ -21,9 +21,9 @@ import java.io.Serializable; public class Link implements Serializable { private String rel; - + private String href; - + private String type; /** @@ -47,12 +47,14 @@ public class Link implements Serializable { return type; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java index d254e18..59c117d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java @@ -31,12 +31,13 @@ public class Metadata { /** * Set the metadata + * * @param metadata */ public void setMetadata(Map metadata) { this.metadata = metadata; } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java index 67bfba6..9fdf5e1 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,73 +24,73 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Network implements Serializable { private String id; - + @JsonProperty("vpn_public_address") private String vpnPublicAddress; - + @JsonProperty("vpn_private_address") private String vpnPrivateAddress; - + @JsonProperty("vpn_public_port") private String vpnPublicPort; - + @JsonProperty("dhcp_start") private String dhcpStart; - + private String bridge; - + @JsonProperty("bridge_interface") private String bridgeInterface; - + @JsonProperty("updated_at") private String updatedAt; private Boolean deleted; - + private String vlan; - + private String broadcast; - + private String netmask; - + private Boolean injected; - + private String host; - + @JsonProperty("multi_host") private Boolean multiHost; - + @JsonProperty("created_at") private String createdAt; - + @JsonProperty("deleted_at") private String deletedAt; - + private String cidr; - + @JsonProperty("cidr_v6") private String cidrV6; - + private String gateway; - + @JsonProperty("gateway_v6") private String gatewayV6; - + @JsonProperty("netmask_v6") private String netmaskV6; - + @JsonProperty("project_id") private String projectId; - + @JsonProperty("rxtx_base") private String rxtxBase; - + private String dns1; - + private String dns2; - + private String label; - + private String priority; /** @@ -283,24 +282,21 @@ public class Network implements Serializable { return priority; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress - + ", vpnPublicPort=" + vpnPublicPort + ", dhcpStart=" - + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" - + bridgeInterface + ", updatedAt=" + updatedAt + ", deleted=" - + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast - + ", netmask=" + netmask + ", injected=" + injected + ", host=" - + host + ", multiHost=" + multiHost + ", createdAt=" - + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr - + ", cidrV6=" + cidrV6 + ", gateway=" + gateway - + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 - + ", projectId=" + projectId + ", rxtxBase=" + rxtxBase - + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label + return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress + ", vpnPublicPort=" + vpnPublicPort + + ", dhcpStart=" + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" + bridgeInterface + + ", updatedAt=" + updatedAt + ", deleted=" + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast + + ", netmask=" + netmask + ", injected=" + injected + ", host=" + host + ", multiHost=" + multiHost + + ", createdAt=" + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr + ", cidrV6=" + cidrV6 + + ", gateway=" + gateway + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 + ", projectId=" + + projectId + ", rxtxBase=" + rxtxBase + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label + ", priority=" + priority + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java index 3f86d4f..6011c73 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Networks implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class Networks implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Networks implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java index 0d619df..a9e9826 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java @@ -19,9 +19,9 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; public final class PersonalityFile implements Serializable { - + private String path; - + private String contents; /** @@ -51,5 +51,5 @@ public final class PersonalityFile implements Serializable { public void setContents(String contents) { this.contents = contents; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java index d03bea0..2ee31c3 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java @@ -23,32 +23,32 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class QuotaSet { private String id; - + @JsonProperty("metadata_items") private Integer metadataItems; - + @JsonProperty("injected_file_content_bytes") private Integer injectedFileContentBytes; - + @JsonProperty("injected_files") private Integer injectedFiles; - + private Integer gigabytes; - + private Integer ram; - + @JsonProperty("floating_ips") private Integer floatingIps; - + private Integer instances; - + private Integer volumes; - + private Integer cores; - + @JsonProperty("security_groups") private Integer securityGroups; - + @JsonProperty("security_group_rules") private Integer securityGroupRules; @@ -58,6 +58,15 @@ public class QuotaSet { @JsonProperty("key_pairs") private Integer keyPairs; + @JsonProperty("fixed_ips") + private Integer fixedIps; + + @JsonProperty("server_group_members") + private Integer serverGroupMembers; + + @JsonProperty("server_groups") + private Integer serverGroups; + public String getId() { return id; } @@ -66,6 +75,30 @@ public class QuotaSet { this.id = id; } + public Integer getFixedIps() { + return fixedIps; + } + + public void setFixedIps(Integer fixedIps) { + this.fixedIps = fixedIps; + } + + public Integer getServerGroupMembers() { + return serverGroupMembers; + } + + public void setServerGroupMembers(Integer serverGroupMembers) { + this.serverGroupMembers = serverGroupMembers; + } + + public Integer getServerGroups() { + return serverGroups; + } + + public void setServerGroups(Integer serverGroups) { + this.serverGroups = serverGroups; + } + public Integer getMetadataItems() { return metadataItems; } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java index de1ac85..eb359ac 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java @@ -18,16 +18,15 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("security_group") public class SecurityGroup implements Serializable { - + @JsonRootName("security_group_rule") public static final class Rule implements Serializable { - + public static final class Group implements Serializable { private String name; @@ -38,7 +37,7 @@ public class SecurityGroup implements Serializable { public String getName() { return name; } - + public String getTenantId() { return tenantId; } @@ -142,30 +141,31 @@ public class SecurityGroup implements Serializable { return group; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" - + parentGroupId + ", fromPort=" + fromPort + ", toPort=" - + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" - + ipRange + ", group=" + group + "]"; + return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" + parentGroupId + ", fromPort=" + fromPort + + ", toPort=" + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" + ipRange + ", group=" + group + + "]"; } - + } private String id; - + private String name; - + private String description; - + @JsonProperty("tenant_id") private String tenantId; - + private List rules; - + private List links; /** @@ -210,14 +210,15 @@ public class SecurityGroup implements Serializable { return links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SecurityGroup [id=" + id + ", name=" + name + ", description=" - + description + ", tenantId=" + tenantId + ", rules=" + rules - + ", links=" + links + "]"; + return "SecurityGroup [id=" + id + ", name=" + name + ", description=" + description + ", tenantId=" + tenantId + + ", rules=" + rules + ", links=" + links + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java index ca4ebbe..f99d070 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java @@ -17,20 +17,19 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("security_group") public class SecurityGroupForCreate implements Serializable { - + private String name; - + private String description; public SecurityGroupForCreate() { super(); } - + public SecurityGroupForCreate(String name) { this.name = name; } @@ -68,13 +67,14 @@ public class SecurityGroupForCreate implements Serializable { this.description = description; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SecurityGroupForCreate [name=" + name + ", description=" - + description + "]"; + return "SecurityGroupForCreate [name=" + name + ", description=" + description + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java index 6ddba5f..f998114 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java @@ -17,9 +17,7 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import javax.xml.bind.annotation.XmlElement; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -29,7 +27,7 @@ public class SecurityGroupRuleForCreate implements Serializable { @JsonProperty("parent_group_id") private String parentGroupId; - + @JsonProperty("ip_protocol") private String ipProtocol; @@ -38,17 +36,17 @@ public class SecurityGroupRuleForCreate implements Serializable { @JsonProperty("to_port") private Integer toPort; - + @XmlElement private String cidr; @JsonProperty("group_id") private String groupId; - + public SecurityGroupRuleForCreate() { - + } - + /** * * @param parentSecurityGroupId @@ -56,16 +54,19 @@ public class SecurityGroupRuleForCreate implements Serializable { * @param fromPort * @param toPort * @param cidr - * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)} + * @deprecated Ids in some installs have shown to use strings .Use + * {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)} */ @Deprecated - public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { + public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, String cidr) { this.parentGroupId = String.valueOf(parentSecurityGroupId); this.ipProtocol = ipProtocol; this.fromPort = fromPort; this.toPort = toPort; this.cidr = cidr; } + /** * * @param parentSecurityGroupId @@ -73,26 +74,30 @@ public class SecurityGroupRuleForCreate implements Serializable { * @param fromPort * @param toPort * @param cidr - * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)} + * @deprecated Ids in some installs have shown to use strings .Use + * {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)} */ @Deprecated - public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort,Integer toPort, Integer sourceGroupId) { + public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort, Integer toPort, + Integer sourceGroupId) { this.parentGroupId = String.valueOf(parentGroupId); this.ipProtocol = ipProtocol; this.fromPort = fromPort; this.toPort = toPort; this.groupId = String.valueOf(sourceGroupId); } - - public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { + + public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort, Integer toPort, + String cidr) { this.parentGroupId = parentSecurityGroupId; this.ipProtocol = ipProtocol; this.fromPort = fromPort; this.toPort = toPort; this.cidr = cidr; } - - public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort,Integer toPort) { + + public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort, + Integer toPort) { this.parentGroupId = parentGroupId; this.ipProtocol = ipProtocol; this.fromPort = fromPort; @@ -106,8 +111,8 @@ public class SecurityGroupRuleForCreate implements Serializable { public String getParentGroupId() { return parentGroupId; } - - + + /** * @param parentGroupId the parentGroupId to set * @deprecated Use {@link #setParentGroupId(String)} @@ -117,7 +122,7 @@ public class SecurityGroupRuleForCreate implements Serializable { public void setParentGroupId(Integer parentGroupId) { this.parentGroupId = String.valueOf(parentGroupId); } - + /** * @param parentGroupId the parentGroupId to set */ @@ -197,7 +202,7 @@ public class SecurityGroupRuleForCreate implements Serializable { public void setGroupId(Integer groupId) { this.groupId = String.valueOf(groupId); } - + /** * @param groupId the groupId to set */ @@ -205,15 +210,15 @@ public class SecurityGroupRuleForCreate implements Serializable { this.groupId = groupId; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId - + ", fromPort=" + fromPort + ", toPort=" + toPort - + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr - + ", groupId=" + groupId + "]"; + return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId + ", fromPort=" + fromPort + ", toPort=" + + toPort + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr + ", groupId=" + groupId + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java index 705432b..10a70c2 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class SecurityGroups implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class SecurityGroups implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class SecurityGroups implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java index 4dd6dfa..70b7f88 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java @@ -21,31 +21,30 @@ import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("server") public class Server implements Serializable { - + public static final class Addresses implements Serializable { - + public static final class Address implements Serializable { - + @JsonProperty("OS-EXT-IPS-MAC:mac_addr") private String macAddr; private String version; - + private String addr; - + @JsonProperty("OS-EXT-IPS:type") private String type; - /** - * @return the macAddr - */ + /** + * @return the macAddr + */ public String getMacAddr() { return macAddr; } @@ -63,7 +62,7 @@ public class Server implements Serializable { public String getAddr() { return addr; } - + /** * @return the type @@ -97,7 +96,7 @@ public class Server implements Serializable { * @param macAddr the mac addr to set */ public void setMacAddr(String macAddr) { - this.macAddr= macAddr; + this.macAddr = macAddr; } } @@ -107,6 +106,7 @@ public class Server implements Serializable { public void add(String key, List
value) { addresses.put(key, value); } + /** * @return the ip address List Map */ @@ -114,24 +114,26 @@ public class Server implements Serializable { return addresses; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Addresses List Map [" + addresses + "]"; } - + } - + public static final class Fault { - + private Integer code; - + private String message; - + private String details; - + private Calendar created; /** @@ -162,85 +164,87 @@ public class Server implements Serializable { return created; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Fault [code=" + code + ", message=" + message - + ", details=" + details + ", created=" + created + "]"; + return "Fault [code=" + code + ", message=" + message + ", details=" + details + ", created=" + created + + "]"; } - - + + } - + private String id; - + private String name; - + private Addresses addresses; - + private List links; - + private Image image; - + private Flavor flavor; - + private String accessIPv4; - + private String accessIPv6; - + @JsonProperty("config_drive") private String configDrive; - + private String status; - + private Integer progress; - + private Fault fault; - + @JsonProperty("tenant_id") private String tenantId; - + @JsonProperty("user_id") private String userId; - + @JsonProperty("key_name") private String keyName; - + private String hostId; - + private String updated; - + private String created; - + private Map metadata; - + @JsonProperty("security_groups") private List securityGroups; - + @JsonProperty("OS-EXT-STS:task_state") private String taskState; - + @JsonProperty("OS-EXT-STS:power_state") private String powerState; - + @JsonProperty("OS-EXT-STS:vm_state") private String vmState; - + @JsonProperty("OS-EXT-SRV-ATTR:host") private String host; - + @JsonProperty("OS-EXT-SRV-ATTR:instance_name") private String instanceName; - + @JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname") private String hypervisorHostname; - + @JsonProperty("OS-DCF:diskConfig") private String diskConfig; - + @JsonProperty("OS-EXT-AZ:availability_zone") private String availabilityZone; @@ -252,9 +256,9 @@ public class Server implements Serializable { @JsonProperty("os-extended-volumes:volumes_attached") private List osExtendedVolumesAttached; - + private String uuid; - + private String adminPass; /** @@ -305,7 +309,7 @@ public class Server implements Serializable { public Flavor getFlavor() { return flavor; } - + /** * @param flavor the flavor to set */ @@ -502,28 +506,23 @@ public class Server implements Serializable { return adminPass; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Server [id=" + id + ", name=" + name + ", addresses=" - + addresses + ", links=" + links + ", image=" + image - + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 - + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive - + ", status=" + status + ", progress=" + progress + ", fault=" - + fault + ", tenantId=" + tenantId + ", userId=" + userId - + ", keyName=" + keyName + ", hostId=" + hostId + ", updated=" - + updated + ", created=" + created + ", metadata=" + metadata - + ", securityGroups=" + securityGroups + ", taskState=" - + taskState + ", powerState=" + powerState + ", vmState=" - + vmState + ", host=" + host + ", instanceName=" + instanceName - + ", hypervisorHostname=" + hypervisorHostname - + ", diskConfig=" + diskConfig + ", availabilityZone=" - + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt=" - + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached - + ", uuid=" + uuid + ", adminPass=" - + adminPass + "]"; + return "Server [id=" + id + ", name=" + name + ", addresses=" + addresses + ", links=" + links + ", image=" + + image + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 + ", accessIPv6=" + accessIPv6 + + ", configDrive=" + configDrive + ", status=" + status + ", progress=" + progress + ", fault=" + fault + + ", tenantId=" + tenantId + ", userId=" + userId + ", keyName=" + keyName + ", hostId=" + hostId + + ", updated=" + updated + ", created=" + created + ", metadata=" + metadata + ", securityGroups=" + + securityGroups + ", taskState=" + taskState + ", powerState=" + powerState + ", vmState=" + vmState + + ", host=" + host + ", instanceName=" + instanceName + ", hypervisorHostname=" + hypervisorHostname + + ", diskConfig=" + diskConfig + ", availabilityZone=" + availabilityZone + ", launchedAt=" + launchedAt + + ", terminatedAt=" + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached + ", uuid=" + uuid + + ", adminPass=" + adminPass + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java index c536372..80f31ee 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java @@ -21,15 +21,14 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; public interface ServerAction extends Serializable { - + @JsonRootName("changePassword") public static final class ChangePassword implements ServerAction { - + private String adminPass; public ChangePassword() { @@ -53,12 +52,12 @@ public interface ServerAction extends Serializable { public void setAdminPass(String adminPass) { this.adminPass = adminPass; } - + } - + @JsonRootName("reboot") public static final class Reboot implements ServerAction { - + private String type; /** @@ -74,26 +73,26 @@ public interface ServerAction extends Serializable { public void setType(String type) { this.type = type; } - + } - + @JsonRootName("rebuild") public static final class Rebuild implements ServerAction { - + private String imageRef; - + private String name; - + private String adminPass; - + private String accessIPv4; - + private String accessIPv6; - + private Map metadata = new HashMap<>(); - + private List personality = new ArrayList<>(); - + @JsonProperty("OS-DCF:diskConfig") private String diskConfig; @@ -208,14 +207,14 @@ public interface ServerAction extends Serializable { public void setDiskConfig(String diskConfig) { this.diskConfig = diskConfig; } - + } - + @JsonRootName("resize") public static final class Resize implements ServerAction { - + private String flavorRef; - + @JsonProperty("OS-DCF:diskConfig") private String diskConfig; @@ -246,24 +245,24 @@ public interface ServerAction extends Serializable { public void setDiskConfig(String diskConfig) { this.diskConfig = diskConfig; } - + } - + @JsonRootName("confirmResize") public static final class ConfirmResize implements ServerAction { - + } - + @JsonRootName("revertResize") public static final class RevertResize implements ServerAction { - + } - + @JsonRootName("createImage") public static final class CreateImage implements ServerAction { - + private String name; - + private Map metadata; /** @@ -293,18 +292,18 @@ public interface ServerAction extends Serializable { public void setMetadata(Map metadata) { this.metadata = metadata; } - + } - + @JsonRootName("rescue") public static final class Rescue implements ServerAction { - + private String adminPass; public Rescue() { - + } - + public Rescue(String adminPass) { this.adminPass = adminPass; } @@ -322,11 +321,11 @@ public interface ServerAction extends Serializable { public void setAdminPass(String adminPass) { this.adminPass = adminPass; } - + } - + public static final class RescueResponse implements ServerAction { - + private String adminPass; /** @@ -335,51 +334,51 @@ public interface ServerAction extends Serializable { public String getAdminPass() { return adminPass; } - + } @JsonRootName("unrescue") public static final class Unrescue implements ServerAction { - + } - + @JsonRootName("unpause") public static final class Unpause implements ServerAction { - + } @JsonRootName("pause") public static final class Pause implements ServerAction { - + } - + @JsonRootName("suspend") public static final class Suspend implements ServerAction { - + } @JsonRootName("resume") public static final class Resume implements ServerAction { - + } - + @JsonRootName("lock") public static final class Lock implements ServerAction { - + } @JsonRootName("unlock") public static final class Unlock implements ServerAction { - + } - + @JsonRootName("os-getConsoleOutput") public static final class GetConsoleOutput implements ServerAction { - + private Integer length; - + public GetConsoleOutput() { - + } public GetConsoleOutput(Integer length) { @@ -399,11 +398,11 @@ public interface ServerAction extends Serializable { public void setLength(Integer length) { this.length = length; } - + } - + public static final class ConsoleOutput implements ServerAction { - + private String output; /** @@ -412,18 +411,18 @@ public interface ServerAction extends Serializable { public String getOutput() { return output; } - + } - + @JsonRootName("os-getVNCConsole") public static final class GetVncConsole implements ServerAction { - + private String type; public GetVncConsole() { super(); } - + public GetVncConsole(String type) { super(); @@ -443,14 +442,14 @@ public interface ServerAction extends Serializable { public void setType(String type) { this.type = type; } - + } - + @JsonRootName("console") public static final class VncConsole implements ServerAction { - + private String type; - + private String url; /** @@ -466,32 +465,32 @@ public interface ServerAction extends Serializable { public String getUrl() { return url; } - + } - + @JsonRootName("os-start") public static final class Start implements ServerAction { - + } @JsonRootName("os-stop") public static final class Stop implements ServerAction { - + } - + @JsonRootName("forceDelete") public static final class ForceDelete implements ServerAction { - + } @JsonRootName("restore") public static final class Restore implements ServerAction { - + } - + @JsonRootName("addFloatingIp") public static final class AssociateFloatingIp implements ServerAction { - + private String address; public AssociateFloatingIp() { @@ -516,14 +515,14 @@ public interface ServerAction extends Serializable { public void setAddress(String address) { this.address = address; } - + } - + @JsonRootName("removeFloatingIp") public static final class DisassociateFloatingIp implements ServerAction { - + private String address; - + public DisassociateFloatingIp() { super(); } @@ -546,12 +545,12 @@ public interface ServerAction extends Serializable { public void setAddress(String address) { this.address = address; } - + } - + @JsonRootName("createBackup") public static final class CreateBackup implements ServerAction { - + private String name; @JsonProperty("backup_type") @@ -616,7 +615,7 @@ public interface ServerAction extends Serializable { public void setMetadata(Map metadata) { this.metadata = metadata; } - + } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java index f5fe889..97feed9 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -32,8 +31,7 @@ public class ServerForCreate implements Serializable { private String name; - public SecurityGroup() { - } + public SecurityGroup() {} public SecurityGroup(String name) { this.name = name; @@ -47,8 +45,7 @@ public class ServerForCreate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -104,8 +101,7 @@ public class ServerForCreate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -119,8 +115,7 @@ public class ServerForCreate implements Serializable { } /** - * @param adminPass - * the adminPass to set + * @param adminPass the adminPass to set */ public void setAdminPass(String adminPass) { this.adminPass = adminPass; @@ -134,8 +129,7 @@ public class ServerForCreate implements Serializable { } /** - * @param imageRef - * the imageRef to set + * @param imageRef the imageRef to set */ public void setImageRef(String imageRef) { this.imageRef = imageRef; @@ -149,8 +143,7 @@ public class ServerForCreate implements Serializable { } /** - * @param flavorRef - * the flavorRef to set + * @param flavorRef the flavorRef to set */ public void setFlavorRef(String flavorRef) { this.flavorRef = flavorRef; @@ -164,8 +157,7 @@ public class ServerForCreate implements Serializable { } /** - * @param accessIPv4 - * the accessIPv4 to set + * @param accessIPv4 the accessIPv4 to set */ public void setAccessIPv4(String accessIPv4) { this.accessIPv4 = accessIPv4; @@ -179,8 +171,7 @@ public class ServerForCreate implements Serializable { } /** - * @param accessIPv6 - * the accessIPv6 to set + * @param accessIPv6 the accessIPv6 to set */ public void setAccessIPv6(String accessIPv6) { this.accessIPv6 = accessIPv6; @@ -194,8 +185,7 @@ public class ServerForCreate implements Serializable { } /** - * @param min - * the min to set + * @param min the min to set */ public void setMin(Integer min) { this.min = min; @@ -209,8 +199,7 @@ public class ServerForCreate implements Serializable { } /** - * @param max - * the max to set + * @param max the max to set */ public void setMax(Integer max) { this.max = max; @@ -224,8 +213,7 @@ public class ServerForCreate implements Serializable { } /** - * @param diskConfig - * the diskConfig to set + * @param diskConfig the diskConfig to set */ public void setDiskConfig(String diskConfig) { this.diskConfig = diskConfig; @@ -239,8 +227,7 @@ public class ServerForCreate implements Serializable { } /** - * @param keyName - * the keyName to set + * @param keyName the keyName to set */ public void setKeyName(String keyName) { this.keyName = keyName; @@ -254,8 +241,7 @@ public class ServerForCreate implements Serializable { } /** - * @param personality - * the personality to set + * @param personality the personality to set */ public void setPersonality(List personality) { this.personality = personality; @@ -269,8 +255,7 @@ public class ServerForCreate implements Serializable { } /** - * @param metadata - * the metadata to set + * @param metadata the metadata to set */ public void setMetadata(Map metadata) { this.metadata = metadata; @@ -294,8 +279,7 @@ public class ServerForCreate implements Serializable { } /** - * @param userData - * the userData to set + * @param userData the userData to set */ public void setUserData(String userData) { this.userData = userData; @@ -309,8 +293,7 @@ public class ServerForCreate implements Serializable { } /** - * @param availabilityZone - * the availabilityZone to set + * @param availabilityZone the availabilityZone to set */ public void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java index 772c1fb..fd0b1f2 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Servers implements Iterable, Serializable { @@ -33,13 +32,15 @@ public class Servers implements Iterable, Serializable { public List getList() { return list; } - + @Override public Iterator iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java index bed84dc..8eca842 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java @@ -19,29 +19,28 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("tenant_usage") public class SimpleTenantUsage implements Serializable { - + @JsonProperty("total_memory_mb_usage") private BigDecimal totalMemoryMbUsage; - + @JsonProperty("total_vcpus_usage") private BigDecimal totalVcpusUsage; - + @JsonProperty("total_local_gb_usage") private BigDecimal totalLocalGbUsage; private String start; - + private String stop; - + @JsonProperty("tenant_id") private String tenantId; - + @JsonProperty("total_hours") private String totalHours; @@ -154,16 +153,16 @@ public class SimpleTenantUsage implements Serializable { this.serverUsages = serverUsages; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage - + ", totalVcpusUsage=" + totalVcpusUsage - + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" - + start + ", stop=" + stop + ", tenantId=" + tenantId - + ", totalHours=" + totalHours + "]"; + return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage + ", totalVcpusUsage=" + totalVcpusUsage + + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" + start + ", stop=" + stop + ", tenantId=" + + tenantId + ", totalHours=" + totalHours + "]"; } public static final class ServerUsage implements Serializable { @@ -174,7 +173,7 @@ public class SimpleTenantUsage implements Serializable { @JsonProperty("started_at") private String startedAt; - + @JsonProperty("ended_at") private String endedAt; diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java index 20db05e..aa5d844 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class SimpleTenantUsages implements Iterable, Serializable { @@ -34,7 +33,9 @@ public class SimpleTenantUsages implements Iterable, Serializ return list; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class SimpleTenantUsages implements Iterable, Serializ public Iterator iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java index 9216854..066c381 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,19 +24,19 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Snapshot implements Serializable { private String id; - + private String status; - + @JsonProperty("displayName") private String name; - + @JsonProperty("displayDescription") private String description; - + private String volumeId; - + private Integer size; - + private String createdAt; /** @@ -89,15 +88,15 @@ public class Snapshot implements Serializable { return createdAt; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Snapshot [id=" + id + ", status=" + status + ", displayName=" - + name + ", displayDescription=" + description - + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" - + createdAt + "]"; + return "Snapshot [id=" + id + ", status=" + status + ", displayName=" + name + ", displayDescription=" + + description + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" + createdAt + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java index 5fcd76e..00f3137 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java @@ -17,18 +17,17 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("snapshot") public class SnapshotForCreate implements Serializable { - + @JsonProperty("volume_id") private String volumeId; - + private Boolean force; - + @JsonProperty("display_name") private String name; @@ -91,13 +90,15 @@ public class SnapshotForCreate implements Serializable { this.description = description; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force - + ", name=" + name + ", description=" + description + "]"; + return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force + ", name=" + name + ", description=" + + description + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java index 060ca48..21cc297 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Snapshots implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class Snapshots implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Snapshots implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java index 841d5b5..fdb934d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -27,27 +26,27 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Volume implements Serializable { private String id; - + private String status; - + @JsonProperty("displayName") private String name; - + @JsonProperty("displayDescription") private String description; - + private String availabilityZone; private String volumeType; - + private String snapshotId; - + private List> attachments; - + private Map metadata; - + private String createdAt; - + private Integer size; /** @@ -127,6 +126,6 @@ public class Volume implements Serializable { return size; } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java index 76b0d31..db91e7a 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("volumeAttachment") @@ -63,13 +62,15 @@ public class VolumeAttachment implements Serializable { this.device = device; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId - + ", serverId=" + serverId + ", device=" + device + "]"; + return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId + ", serverId=" + serverId + ", device=" + device + + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java index 7c8355c..f80d60d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class VolumeAttachments implements Iterable, Serializable { @@ -38,8 +37,10 @@ public class VolumeAttachments implements Iterable, Serializab public Iterator iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java index 49feab7..2c2055e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java @@ -18,7 +18,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -125,15 +124,15 @@ public class VolumeForCreate implements Serializable { this.metadata = metadata; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "VolumeForCreate [size=" + size + ", availabilityZone=" - + availabilityZone + ", name=" + name + ", description=" - + description + ", snapshotId=" + snapshotId + ", metadata=" - + metadata + "]"; + return "VolumeForCreate [size=" + size + ", availabilityZone=" + availabilityZone + ", name=" + name + + ", description=" + description + ", snapshotId=" + snapshotId + ", metadata=" + metadata + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java index 95abf39..d003285 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java index 28390d3..2aabef7 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("volume-type") diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java index 351a92a..3b1f71a 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class VolumeTypes implements Iterable, Serializable { @@ -38,13 +37,15 @@ public class VolumeTypes implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "VolumeTypes [list=" + list + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java index 4266e63..5a31968 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Volumes implements Iterable, Serializable { @@ -33,8 +32,10 @@ public class Volumes implements Iterable, Serializable { public List getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Volumes implements Iterable, Serializable { public Iterator iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java index d24531b..80814df 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.AbsoluteLimit; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,40 +34,22 @@ public class AbsoluteLimitTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"maxServerMeta\" : 30," + EOL - + " \"serverMetaUsed\" : 37," + EOL - + " \"maxPersonality\" : 54," + EOL - + " \"personalityUsed\" : 61," + EOL - + " \"maxImageMeta\" : 82," + EOL - + " \"imageMetaUsed\" : 89," + EOL - + " \"maxPersonalitySize\" : 97," + EOL - + " \"personalitySizeUsed\" : 4," + EOL - + " \"maxTotalCores\" : 32," + EOL - + " \"totalCoresUsed\" : 39," + EOL - + " \"maxTotalInstances\" : 60," + EOL - + " \"totalInstancesUsed\" : 67," + EOL - + " \"maxTotalRAMSize\" : 55," + EOL - + " \"totalRAMUsed\" : 19," + EOL - + " \"maxSecurityGroupRules\" : 44," + EOL - + " \"securityGroupRulesUsed\" : 51," + EOL - + " \"maxTotalKeypairs\" : 64," + EOL - + " \"totalKeyPairsUsed\" : 71," + EOL - + " \"maxTotalVolumes\" : 71," + EOL - + " \"totalVolumesUsed\" : 78," + EOL - + " \"maxSecurityGroups\" : 4," + EOL - + " \"totalSecurityGroupsUsed\" : 59," + EOL - + " \"maxTotalFloatingIps\" : 76," + EOL - + " \"totalFloatingIpsUsed\" : 83," + EOL - + " \"maxTotalVolumeGigabytes\" : 15," + EOL - + " \"totalVolumeGigabytesUsed\" : 22" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"maxServerMeta\" : 30," + EOL + " \"serverMetaUsed\" : 37," + + EOL + " \"maxPersonality\" : 54," + EOL + " \"personalityUsed\" : 61," + EOL + + " \"maxImageMeta\" : 82," + EOL + " \"imageMetaUsed\" : 89," + EOL + " \"maxPersonalitySize\" : 97," + + EOL + " \"personalitySizeUsed\" : 4," + EOL + " \"maxTotalCores\" : 32," + EOL + + " \"totalCoresUsed\" : 39," + EOL + " \"maxTotalInstances\" : 60," + EOL + + " \"totalInstancesUsed\" : 67," + EOL + " \"maxTotalRAMSize\" : 55," + EOL + " \"totalRAMUsed\" : 19," + + EOL + " \"maxSecurityGroupRules\" : 44," + EOL + " \"securityGroupRulesUsed\" : 51," + EOL + + " \"maxTotalKeypairs\" : 64," + EOL + " \"totalKeyPairsUsed\" : 71," + EOL + + " \"maxTotalVolumes\" : 71," + EOL + " \"totalVolumesUsed\" : 78," + EOL + + " \"maxSecurityGroups\" : 4," + EOL + " \"totalSecurityGroupsUsed\" : 59," + EOL + + " \"maxTotalFloatingIps\" : 76," + EOL + " \"totalFloatingIpsUsed\" : 83," + EOL + + " \"maxTotalVolumeGigabytes\" : 15," + EOL + " \"totalVolumeGigabytesUsed\" : 22" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -84,82 +65,82 @@ public class AbsoluteLimitTest { public void testMethods() throws Exception { AbsoluteLimit absolutelimit = objectMapper.readValue(JSON_FULL, AbsoluteLimit.class); absolutelimit.toString(); - + Integer maxTotalRAMSize = absolutelimit.getMaxTotalRAMSize(); Assert.assertNotNull(maxTotalRAMSize); - + Integer maxTotalInstances = absolutelimit.getMaxTotalInstances(); Assert.assertNotNull(maxTotalInstances); - + Integer serverMetaUsed = absolutelimit.getServerMetaUsed(); Assert.assertNotNull(serverMetaUsed); - + Integer maxTotalKeypairs = absolutelimit.getMaxTotalKeypairs(); Assert.assertNotNull(maxTotalKeypairs); - + Integer maxTotalVolumeGigabytes = absolutelimit.getMaxTotalVolumeGigabytes(); Assert.assertNotNull(maxTotalVolumeGigabytes); - + Integer totalSecurityGroupsUsed = absolutelimit.getTotalSecurityGroupsUsed(); Assert.assertNotNull(totalSecurityGroupsUsed); - + Integer maxTotalVolumes = absolutelimit.getMaxTotalVolumes(); Assert.assertNotNull(maxTotalVolumes); - + Integer maxImageMeta = absolutelimit.getMaxImageMeta(); Assert.assertNotNull(maxImageMeta); - + Integer imageMetaUsed = absolutelimit.getImageMetaUsed(); Assert.assertNotNull(imageMetaUsed); - + Integer totalVolumeGigabytesUsed = absolutelimit.getTotalVolumeGigabytesUsed(); Assert.assertNotNull(totalVolumeGigabytesUsed); - + Integer maxSecurityGroupRules = absolutelimit.getMaxSecurityGroupRules(); Assert.assertNotNull(maxSecurityGroupRules); - + Integer totalCoresUsed = absolutelimit.getTotalCoresUsed(); Assert.assertNotNull(totalCoresUsed); - + Integer totalVolumesUsed = absolutelimit.getTotalVolumesUsed(); Assert.assertNotNull(totalVolumesUsed); - + Integer maxTotalFloatingIps = absolutelimit.getMaxTotalFloatingIps(); Assert.assertNotNull(maxTotalFloatingIps); - + Integer maxPersonality = absolutelimit.getMaxPersonality(); Assert.assertNotNull(maxPersonality); - + Integer personalityUsed = absolutelimit.getPersonalityUsed(); Assert.assertNotNull(personalityUsed); - + Integer maxSecurityGroups = absolutelimit.getMaxSecurityGroups(); Assert.assertNotNull(maxSecurityGroups); - + Integer securityGroupRulesUsed = absolutelimit.getSecurityGroupRulesUsed(); Assert.assertNotNull(securityGroupRulesUsed); - + Integer maxTotalCores = absolutelimit.getMaxTotalCores(); Assert.assertNotNull(maxTotalCores); - + Integer maxServerMeta = absolutelimit.getMaxServerMeta(); Assert.assertNotNull(maxServerMeta); - + Integer maxPersonalitySize = absolutelimit.getMaxPersonalitySize(); Assert.assertNotNull(maxPersonalitySize); - + Integer personalitySizeUsed = absolutelimit.getPersonalitySizeUsed(); Assert.assertNotNull(personalitySizeUsed); - + Integer totalKeyPairsUsed = absolutelimit.getTotalKeyPairsUsed(); Assert.assertNotNull(totalKeyPairsUsed); - + Integer totalFloatingIpsUsed = absolutelimit.getTotalFloatingIpsUsed(); Assert.assertNotNull(totalFloatingIpsUsed); - + Integer totalInstancesUsed = absolutelimit.getTotalInstancesUsed(); Assert.assertNotNull(totalInstancesUsed); - + Integer totalRAMUsed = absolutelimit.getTotalRAMUsed(); Assert.assertNotNull(totalRAMUsed); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java index 3d34523..b796f7f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses.Address; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,18 +34,13 @@ public class AddressTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -62,19 +56,19 @@ public class AddressTest { public void testMethods() throws Exception { Address address = objectMapper.readValue(JSON_FULL, Address.class); address.toString(); - + String type = address.getType(); Assert.assertNotNull(type); address.setType(type); - + String addr = address.getAddr(); Assert.assertNotNull(addr); address.setAddr(addr); - + String version = address.getVersion(); Assert.assertNotNull(version); address.setVersion(version); - + String macAddr = address.getMacAddr(); Assert.assertNotNull(macAddr); address.setMacAddr(macAddr); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java index 132537d..12dcc15 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java @@ -26,10 +26,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses; import com.woorea.openstack.nova.model.Server.Addresses.Address; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,38 +37,20 @@ public class AddressesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"addresses\" : {" + EOL - + " \"addresses-k1\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"addresses-k2\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"addresses\" : {" + EOL + " \"addresses-k1\" : [ {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + + " }, {" + EOL + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + + " } ]," + EOL + " \"addresses-k2\" : [ {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " }, {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -86,8 +66,8 @@ public class AddressesTest { public void testMethods() throws Exception { Addresses addresses = objectMapper.readValue(JSON_FULL, Addresses.class); addresses.toString(); - - Map> addressesProperty = addresses.getAddresses(); + + Map> addressesProperty = addresses.getAddresses(); Assert.assertNotNull(addressesProperty); Assert.assertEquals(2, addressesProperty.size()); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java index b93912b..5c494e4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class AssociateFloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"addFloatingIp\" : {" + EOL - + " \"address\" : \"address\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"addFloatingIp\" : {" + EOL + " \"address\" : \"address\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class AssociateFloatingIpTest { public void testMethods() throws Exception { AssociateFloatingIp associatefloatingip = objectMapper.readValue(JSON_FULL, AssociateFloatingIp.class); associatefloatingip.toString(); - + String address = associatefloatingip.getAddress(); Assert.assertNotNull(address); associatefloatingip.setAddress(address); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java index bb5dd4d..89679f8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,20 +33,13 @@ public class CertificateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"certificate\" : {" + EOL - + " \"data\" : \"data\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"certificate\" : {" + EOL + " \"data\" : \"data\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,10 +55,10 @@ public class CertificateTest { public void testMethods() throws Exception { Certificate certificate = objectMapper.readValue(JSON_FULL, Certificate.class); certificate.toString(); - + String privateKey = certificate.getPrivateKey(); Assert.assertNotNull(privateKey); - + String data = certificate.getData(); Assert.assertNotNull(data); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java index a52c99e..8e74e41 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ChangePassword; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class ChangePasswordTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"changePassword\" : {" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"changePassword\" : {" + EOL + + " \"adminPass\" : \"adminpass\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class ChangePasswordTest { public void testMethods() throws Exception { ChangePassword changepassword = objectMapper.readValue(JSON_FULL, ChangePassword.class); changepassword.toString(); - + String adminPass = changepassword.getAdminPass(); Assert.assertNotNull(adminPass); changepassword.setAdminPass(adminPass); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java index 7552f13..a96edbb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,16 @@ public class CloudpipeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cloudpipe\" : {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cloudpipe\" : {" + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"internalIp\" : \"internalip\"," + EOL + + " \"publicIp\" : \"publicip\"," + EOL + " \"publicPort\" : \"publicport\"," + EOL + + " \"state\" : \"state\"," + EOL + " \"instanceId\" : \"instanceid\"," + EOL + + " \"createdAt\" : 1486296000000" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,31 +59,31 @@ public class CloudpipeTest { public void testMethods() throws Exception { Cloudpipe cloudpipe = objectMapper.readValue(JSON_FULL, Cloudpipe.class); cloudpipe.toString(); - + Calendar createdAt = cloudpipe.getCreatedAt(); Assert.assertNotNull(createdAt); cloudpipe.setCreatedAt(createdAt); - + String instanceId = cloudpipe.getInstanceId(); Assert.assertNotNull(instanceId); cloudpipe.setInstanceId(instanceId); - + String publicIp = cloudpipe.getPublicIp(); Assert.assertNotNull(publicIp); cloudpipe.setPublicIp(publicIp); - + String publicPort = cloudpipe.getPublicPort(); Assert.assertNotNull(publicPort); cloudpipe.setPublicPort(publicPort); - + String state = cloudpipe.getState(); Assert.assertNotNull(state); cloudpipe.setState(state); - + String projectId = cloudpipe.getProjectId(); Assert.assertNotNull(projectId); cloudpipe.setProjectId(projectId); - + String internalIp = cloudpipe.getInternalIp(); Assert.assertNotNull(internalIp); cloudpipe.setInternalIp(internalIp); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java index 491b005..2fccdb3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,31 +34,19 @@ public class CloudpipesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cloudpipes\" : [ {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " }, {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cloudpipes\" : [ {" + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"internalIp\" : \"internalip\"," + EOL + + " \"publicIp\" : \"publicip\"," + EOL + " \"publicPort\" : \"publicport\"," + EOL + + " \"state\" : \"state\"," + EOL + " \"instanceId\" : \"instanceid\"," + EOL + + " \"createdAt\" : 1486296000000" + EOL + " }, {" + EOL + " \"projectId\" : \"projectid\"," + EOL + + " \"internalIp\" : \"internalip\"," + EOL + " \"publicIp\" : \"publicip\"," + EOL + + " \"publicPort\" : \"publicport\"," + EOL + " \"state\" : \"state\"," + EOL + + " \"instanceId\" : \"instanceid\"," + EOL + " \"createdAt\" : 1486296000000" + EOL + " } ]" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -76,7 +62,7 @@ public class CloudpipesTest { public void testMethods() throws Exception { Cloudpipes cloudpipes = objectMapper.readValue(JSON_FULL, Cloudpipes.class); cloudpipes.toString(); - + List list = cloudpipes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java index f311074..54d18b9 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ConfirmResize; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ConfirmResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"confirmResize\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"confirmResize\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java index 240e11e..b7b98f2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ConsoleOutput; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class ConsoleOutputTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"output\" : \"output\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"output\" : \"output\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class ConsoleOutputTest { public void testMethods() throws Exception { ConsoleOutput consoleoutput = objectMapper.readValue(JSON_FULL, ConsoleOutput.class); consoleoutput.toString(); - + String output = consoleoutput.getOutput(); Assert.assertNotNull(output); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java index 271cc69..fe39246 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.CreateBackup; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,25 +35,15 @@ public class CreateBackupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"createBackup\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"rotation\" : \"rotation\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"backup_type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"createBackup\" : {" + EOL + " \"name\" : \"name\"," + + EOL + " \"rotation\" : \"rotation\"," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"backup_type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -71,20 +59,20 @@ public class CreateBackupTest { public void testMethods() throws Exception { CreateBackup createbackup = objectMapper.readValue(JSON_FULL, CreateBackup.class); createbackup.toString(); - - Map metadata = createbackup.getMetadata(); + + Map metadata = createbackup.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); createbackup.setMetadata(metadata); - + String rotation = createbackup.getRotation(); Assert.assertNotNull(rotation); createbackup.setRotation(rotation); - + String name = createbackup.getName(); Assert.assertNotNull(name); createbackup.setName(name); - + String type = createbackup.getType(); Assert.assertNotNull(type); createbackup.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java index 2c33b27..903a29f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.CreateImage; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,23 +35,14 @@ public class CreateImageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"createImage\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"createImage\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -69,12 +58,12 @@ public class CreateImageTest { public void testMethods() throws Exception { CreateImage createimage = objectMapper.readValue(JSON_FULL, CreateImage.class); createimage.toString(); - - Map metadata = createimage.getMetadata(); + + Map metadata = createimage.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); createimage.setMetadata(metadata); - + String name = createimage.getName(); Assert.assertNotNull(name); createimage.setName(name); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java index 502e943..525b068 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class DisassociateFloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"removeFloatingIp\" : {" + EOL - + " \"address\" : \"address\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"removeFloatingIp\" : {" + EOL + " \"address\" : \"address\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class DisassociateFloatingIpTest { public void testMethods() throws Exception { DisassociateFloatingIp disassociatefloatingip = objectMapper.readValue(JSON_FULL, DisassociateFloatingIp.class); disassociatefloatingip.toString(); - + String address = disassociatefloatingip.getAddress(); Assert.assertNotNull(address); disassociatefloatingip.setAddress(address); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java index 514ea22..4cc2a44 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java @@ -24,10 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Calendar; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,32 +35,18 @@ public class ExtensionTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"extension\" : {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"extension\" : {" + EOL + " \"alias\" : \"alias\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,23 +62,23 @@ public class ExtensionTest { public void testMethods() throws Exception { Extension extension = objectMapper.readValue(JSON_FULL, Extension.class); extension.toString(); - + String name = extension.getName(); Assert.assertNotNull(name); - + String namespace = extension.getNamespace(); Assert.assertNotNull(namespace); - + String alias = extension.getAlias(); Assert.assertNotNull(alias); - + String description = extension.getDescription(); Assert.assertNotNull(description); - + List links = extension.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + Calendar updated = extension.getUpdated(); Assert.assertNotNull(updated); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java index 6fe182d..b3f32a3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,45 +34,22 @@ public class ExtensionsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"extensions\" : [ {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"extensions\" : [ {" + EOL + " \"alias\" : \"alias\"," + + EOL + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }, {" + EOL + + " \"alias\" : \"alias\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"namespace\" : \"namespace\"," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " } ]" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -90,13 +65,14 @@ public class ExtensionsTest { public void testMethods() throws Exception { Extensions extensions = objectMapper.readValue(JSON_FULL, Extensions.class); extensions.toString(); - + List list = extensions.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Extension x : extensions) { + for (@SuppressWarnings("unused") + Extension x : extensions) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java index a426d8a..a8efda6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Fault; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,18 +35,12 @@ public class FaultTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"code\" : 29," + EOL - + " \"message\" : \"message\"," + EOL - + " \"details\" : \"details\"," + EOL - + " \"created\" : 1485172800000" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"code\" : 29," + EOL + " \"message\" : \"message\"," + EOL + + " \"details\" : \"details\"," + EOL + " \"created\" : 1485172800000" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,16 +56,16 @@ public class FaultTest { public void testMethods() throws Exception { Fault fault = objectMapper.readValue(JSON_FULL, Fault.class); fault.toString(); - + Integer code = fault.getCode(); Assert.assertNotNull(code); - + Calendar created = fault.getCreated(); Assert.assertNotNull(created); - + String details = fault.getDetails(); Assert.assertNotNull(details); - + String message = fault.getMessage(); Assert.assertNotNull(message); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java index 2d6e1a7..195a7b2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,26 +33,15 @@ public class FlavorForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : \"vcpus\"," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : \"disk\"," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : \"vcpus\"," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : \"disk\"," + EOL + " \"swap\" : \"swap\"," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -69,35 +57,35 @@ public class FlavorForCreateTest { public void testMethods() throws Exception { FlavorForCreate flavorforcreate = objectMapper.readValue(JSON_FULL, FlavorForCreate.class); flavorforcreate.toString(); - + String disk = flavorforcreate.getDisk(); Assert.assertNotNull(disk); flavorforcreate.setDisk(disk); - + String swap = flavorforcreate.getSwap(); Assert.assertNotNull(swap); flavorforcreate.setSwap(swap); - + String name = flavorforcreate.getName(); Assert.assertNotNull(name); flavorforcreate.setName(name); - + Float rxtxFactor = flavorforcreate.getRxtxFactor(); Assert.assertNotNull(rxtxFactor); flavorforcreate.setRxtxFactor(rxtxFactor); - + Integer ephemeral = flavorforcreate.getEphemeral(); Assert.assertNotNull(ephemeral); flavorforcreate.setEphemeral(ephemeral); - + String id = flavorforcreate.getId(); Assert.assertNotNull(id); flavorforcreate.setId(id); - + String vcpus = flavorforcreate.getVcpus(); Assert.assertNotNull(vcpus); flavorforcreate.setVcpus(vcpus); - + Integer ram = flavorforcreate.getRam(); Assert.assertNotNull(ram); flavorforcreate.setRam(ram); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java index 63fa405..3a1bfca 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,40 +34,20 @@ public class FlavorTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " } ]," + EOL + " \"public\" : false," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0," + EOL + + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + " \"rxtx_quota\" : 42," + EOL + + " \"rxtx_cap\" : 96," + EOL + " \"os-flavor-access:is_public\" : false" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -85,52 +63,52 @@ public class FlavorTest { public void testMethods() throws Exception { Flavor flavor = objectMapper.readValue(JSON_FULL, Flavor.class); flavor.toString(); - + Integer rxtxQuota = flavor.getRxtxQuota(); Assert.assertNotNull(rxtxQuota); flavor.setRxtxQuota(rxtxQuota); - + String swap = flavor.getSwap(); Assert.assertNotNull(swap); flavor.setSwap(swap); - + Float rxtxFactor = flavor.getRxtxFactor(); Assert.assertNotNull(rxtxFactor); flavor.setRxtxFactor(rxtxFactor); - + Integer ephemeral = flavor.getEphemeral(); Assert.assertNotNull(ephemeral); flavor.setEphemeral(ephemeral); - + Integer vcpus = flavor.getVcpus(); Assert.assertNotNull(vcpus); flavor.setVcpus(vcpus); - + Integer rxtxCap = flavor.getRxtxCap(); Assert.assertNotNull(rxtxCap); flavor.setRxtxCap(rxtxCap); - + Integer disk = flavor.getDisk(); Assert.assertNotNull(disk); flavor.setDisk(disk); - + String name = flavor.getName(); Assert.assertNotNull(name); flavor.setName(name); - + List links = flavor.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); flavor.setLinks(links); - + Boolean disabled = flavor.getDisabled(); Assert.assertNotNull(disabled); flavor.setDisabled(disabled); - + String id = flavor.getId(); Assert.assertNotNull(id); flavor.setId(id); - + Integer ram = flavor.getRam(); Assert.assertNotNull(ram); flavor.setRam(ram); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java index 5316006..664df69 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,61 +34,28 @@ public class FlavorsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavors\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"flavors\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " } ]," + EOL + " \"public\" : false," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0," + EOL + + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + " \"rxtx_quota\" : 42," + EOL + + " \"rxtx_cap\" : 96," + EOL + " \"os-flavor-access:is_public\" : false" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + + " \"ram\" : 38," + EOL + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"public\" : false," + EOL + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + + " \"rxtx_factor\" : 11.0," + EOL + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + + " \"rxtx_quota\" : 42," + EOL + " \"rxtx_cap\" : 96," + EOL + + " \"os-flavor-access:is_public\" : false" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -106,13 +71,14 @@ public class FlavorsTest { public void testMethods() throws Exception { Flavors flavors = objectMapper.readValue(JSON_FULL, Flavors.class); flavors.toString(); - + List list = flavors.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Flavor x : flavors) { + for (@SuppressWarnings("unused") + Flavor x : flavors) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java index dac8a45..c3b5bad 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,15 @@ public class FloatingIpDomainTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating-ip-pool\" : {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"floating-ip-pool\" : {" + EOL + " \"domain\" : \"domain\"," + EOL + + " \"scope\" : \"scope\"," + EOL + " \"project\" : \"project\"," + EOL + + " \"availabilityZone\" : \"availabilityzone\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,16 +57,16 @@ public class FloatingIpDomainTest { public void testMethods() throws Exception { FloatingIpDomain floatingipdomain = objectMapper.readValue(JSON_FULL, FloatingIpDomain.class); floatingipdomain.toString(); - + String domain = floatingipdomain.getDomain(); Assert.assertNotNull(domain); - + String scope = floatingipdomain.getScope(); Assert.assertNotNull(scope); - + String project = floatingipdomain.getProject(); Assert.assertNotNull(project); - + String availabilityZone = floatingipdomain.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java index 6cfe54f..c03e741 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,16 @@ public class FloatingIpDomainsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"domain_entries\" : [ {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " }, {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"domain_entries\" : [ {" + EOL + + " \"domain\" : \"domain\"," + EOL + " \"scope\" : \"scope\"," + EOL + + " \"project\" : \"project\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"" + EOL + + " }, {" + EOL + " \"domain\" : \"domain\"," + EOL + " \"scope\" : \"scope\"," + EOL + + " \"project\" : \"project\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"" + EOL + " } ]" + + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +59,14 @@ public class FloatingIpDomainsTest { public void testMethods() throws Exception { FloatingIpDomains floatingipdomains = objectMapper.readValue(JSON_FULL, FloatingIpDomains.class); floatingipdomains.toString(); - + List list = floatingipdomains.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIpDomain x : floatingipdomains) { + for (@SuppressWarnings("unused") + FloatingIpDomain x : floatingipdomains) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java index 7048b63..8ab1ca2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class FloatingIpPoolTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class FloatingIpPoolTest { public void testMethods() throws Exception { FloatingIpPool floatingippool = objectMapper.readValue(JSON_FULL, FloatingIpPool.class); floatingippool.toString(); - + String name = floatingippool.getName(); Assert.assertNotNull(name); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java index 7f5c1c1..b5d50e6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,19 +35,12 @@ public class FloatingIpPoolsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ip_pools\" : [ {" + EOL - + " \"name\" : \"name\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ip_pools\" : [ {" + EOL + + " \"name\" : \"name\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,13 +56,14 @@ public class FloatingIpPoolsTest { public void testMethods() throws Exception { FloatingIpPools floatingippools = objectMapper.readValue(JSON_FULL, FloatingIpPools.class); floatingippools.toString(); - + List list = floatingippools.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIpPool x : floatingippools) { + for (@SuppressWarnings("unused") + FloatingIpPool x : floatingippools) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java index 00d382c..9e506cc 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,23 +33,14 @@ public class FloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ip\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ip\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,19 +56,19 @@ public class FloatingIpTest { public void testMethods() throws Exception { FloatingIp floatingip = objectMapper.readValue(JSON_FULL, FloatingIp.class); floatingip.toString(); - + String instanceId = floatingip.getInstanceId(); Assert.assertNotNull(instanceId); - + String ip = floatingip.getIp(); Assert.assertNotNull(ip); - + String pool = floatingip.getPool(); Assert.assertNotNull(pool); - + String fixedIp = floatingip.getFixedIp(); Assert.assertNotNull(fixedIp); - + String id = floatingip.getId(); Assert.assertNotNull(id); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java index 4b279df..53fbf44 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,27 +34,15 @@ public class FloatingIpsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ips\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ips\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -72,13 +58,14 @@ public class FloatingIpsTest { public void testMethods() throws Exception { FloatingIps floatingips = objectMapper.readValue(JSON_FULL, FloatingIps.class); floatingips.toString(); - + List list = floatingips.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIp x : floatingips) { + for (@SuppressWarnings("unused") + FloatingIp x : floatingips) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java index bf26778..4262f45 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ForceDelete; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ForceDeleteTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"forceDelete\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"forceDelete\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java index 8f2ea1e..6420ff5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.GetConsoleOutput; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class GetConsoleOutputTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-getConsoleOutput\" : {" + EOL - + " \"length\" : 60" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"os-getConsoleOutput\" : {" + EOL + " \"length\" : 60" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class GetConsoleOutputTest { public void testMethods() throws Exception { GetConsoleOutput getconsoleoutput = objectMapper.readValue(JSON_FULL, GetConsoleOutput.class); getconsoleoutput.toString(); - + Integer length = getconsoleoutput.getLength(); Assert.assertNotNull(length); getconsoleoutput.setLength(length); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java index d7ed6c9..924aabe 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.GetVncConsole; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class GetVncConsoleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-getVNCConsole\" : {" + EOL - + " \"type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"os-getVNCConsole\" : {" + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class GetVncConsoleTest { public void testMethods() throws Exception { GetVncConsole getvncconsole = objectMapper.readValue(JSON_FULL, GetVncConsole.class); getvncconsole.toString(); - + String type = getvncconsole.getType(); Assert.assertNotNull(type); getvncconsole.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java index 561ea9a..7ebcff5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule.Group; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class GroupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,10 +55,10 @@ public class GroupTest { public void testMethods() throws Exception { Group group = objectMapper.readValue(JSON_FULL, Group.class); group.toString(); - + String name = group.getName(); Assert.assertNotNull(name); - + String tenantId = group.getTenantId(); Assert.assertNotNull(tenantId); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java index 5631245..29ae8c6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java @@ -24,10 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,30 +35,18 @@ public class HostAggregateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"aggregate\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"aggregate\" : {" + EOL + " \"id\" : 1," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"2013-02-25T02:40:21Z\"," + EOL + " \"updated_at\" : \"2013-02-25T02:40:21Z\"," + + EOL + " \"deleted_at\" : \"2013-02-25T02:40:21Z\"" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -76,33 +62,33 @@ public class HostAggregateTest { public void testMethods() throws Exception { HostAggregate hostaggregate = objectMapper.readValue(JSON_FULL, HostAggregate.class); hostaggregate.toString(); - + String createdAt = hostaggregate.getCreatedAt(); Assert.assertNotNull(createdAt); - - Map metadata = hostaggregate.getMetadata(); + + Map metadata = hostaggregate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + String deletedAt = hostaggregate.getDeletedAt(); Assert.assertNotNull(deletedAt); - + Boolean deleted = hostaggregate.getDeleted(); Assert.assertNotNull(deleted); - + List hosts = hostaggregate.getHosts(); Assert.assertNotNull(hosts); Assert.assertEquals(2, hosts.size()); - + String name = hostaggregate.getName(); Assert.assertNotNull(name); - - String id = hostaggregate.getId(); + + Integer id = hostaggregate.getId(); Assert.assertNotNull(id); - + String availabilityZone = hostaggregate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String updatedAt = hostaggregate.getUpdatedAt(); Assert.assertNotNull(updatedAt); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java index 6fba9c2..1bbaa97 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,41 +34,23 @@ public class HostAggregatesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"aggregates\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"aggregates\" : [ {" + EOL + " \"id\" : 1," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"createdat\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"deleted_at\" : \"deletedat\"" + EOL + " }, {" + EOL + " \"id\" : 2," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"createdat\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"deleted_at\" : \"deletedat\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -86,13 +66,14 @@ public class HostAggregatesTest { public void testMethods() throws Exception { HostAggregates hostaggregates = objectMapper.readValue(JSON_FULL, HostAggregates.class); hostaggregates.toString(); - + List list = hostaggregates.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") HostAggregate x : hostaggregates) { + for (@SuppressWarnings("unused") + HostAggregate x : hostaggregates) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java index 99d747c..eac90bc 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Hosts.Host; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,17 +34,12 @@ public class HostTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"zone\" : \"zone\"," + EOL + " \"service\" : \"service\"," + + EOL + " \"host_name\" : \"hostname\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -61,14 +55,14 @@ public class HostTest { public void testMethods() throws Exception { Host host = objectMapper.readValue(JSON_FULL, Host.class); host.toString(); - + String hostName = host.getHostName(); Assert.assertNotNull(hostName); - + String zone = host.getZone(); Assert.assertNotNull(zone); host.setZone(zone); - + String service = host.getService(); Assert.assertNotNull(service); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java index ad60a69..0eaf6ac 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Hosts.Host; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,23 +35,14 @@ public class HostsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"hosts\" : [ {" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + " }, {" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"hosts\" : [ {" + EOL + " \"zone\" : \"zone\"," + EOL + + " \"service\" : \"service\"," + EOL + " \"host_name\" : \"hostname\"" + EOL + " }, {" + EOL + + " \"zone\" : \"zone\"," + EOL + " \"service\" : \"service\"," + EOL + + " \"host_name\" : \"hostname\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -69,13 +58,14 @@ public class HostsTest { public void testMethods() throws Exception { Hosts hosts = objectMapper.readValue(JSON_FULL, Hosts.class); hosts.toString(); - + List list = hosts.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Host x : hosts) { + for (@SuppressWarnings("unused") + Host x : hosts) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java index 4983a55..db8ad55 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,28 +33,18 @@ public class ImageFromVolumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-volume_upload_image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"updates_at\" : \"updates_at\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"display_description\" : \"display_description\"," + EOL - + " \"size\" : \"size\"," + EOL - + " \"volume_type\" : \"volume_type\"," + EOL - + " \"image_id\" : \"image_id\"," + EOL - + " \"container_format\" : \"container_format\"," + EOL - + " \"disk_format\" : \"disk_format\"," + EOL - + " \"image_name\" : \"image_name\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"os-volume_upload_image\" : {" + EOL + + " \"id\" : \"id\"," + EOL + " \"updates_at\" : \"updates_at\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"display_description\" : \"display_description\"," + EOL + + " \"size\" : \"size\"," + EOL + " \"volume_type\" : \"volume_type\"," + EOL + + " \"image_id\" : \"image_id\"," + EOL + " \"container_format\" : \"container_format\"," + EOL + + " \"disk_format\" : \"disk_format\"," + EOL + " \"image_name\" : \"image_name\"" + EOL + " }" + EOL + + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -71,43 +60,43 @@ public class ImageFromVolumeTest { public void testMethods() throws Exception { ImageFromVolume imagefromvolume = objectMapper.readValue(JSON_FULL, ImageFromVolume.class); imagefromvolume.toString(); - + String image_name = imagefromvolume.getImage_name(); Assert.assertNotNull(image_name); imagefromvolume.setImage_name(image_name); - + String display_description = imagefromvolume.getDisplay_description(); Assert.assertNotNull(display_description); imagefromvolume.setDisplay_description(display_description); - + String updates_at = imagefromvolume.getUpdates_at(); Assert.assertNotNull(updates_at); imagefromvolume.setUpdates_at(updates_at); - + String volume_type = imagefromvolume.getVolume_type(); Assert.assertNotNull(volume_type); imagefromvolume.setVolume_type(volume_type); - + String size = imagefromvolume.getSize(); Assert.assertNotNull(size); imagefromvolume.setSize(size); - + String disk_format = imagefromvolume.getDisk_format(); Assert.assertNotNull(disk_format); imagefromvolume.setDisk_format(disk_format); - + String id = imagefromvolume.getId(); Assert.assertNotNull(id); imagefromvolume.setId(id); - + String image_id = imagefromvolume.getImage_id(); Assert.assertNotNull(image_id); imagefromvolume.setImage_id(image_id); - + String container_format = imagefromvolume.getContainer_format(); Assert.assertNotNull(container_format); imagefromvolume.setContainer_format(container_format); - + String status = imagefromvolume.getStatus(); Assert.assertNotNull(status); imagefromvolume.setStatus(status); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java index 4fce1d4..ba3f2b8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java @@ -25,11 +25,9 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Image.Server; - import java.util.Calendar; import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,52 +37,24 @@ public class ImageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -100,51 +70,51 @@ public class ImageTest { public void testMethods() throws Exception { Image image = objectMapper.readValue(JSON_FULL, Image.class); image.toString(); - + Server server = image.getServer(); Assert.assertNotNull(server); - - Map metadata = image.getMetadata(); + + Map metadata = image.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); image.setMetadata(metadata); - + Long size = image.getSize(); Assert.assertNotNull(size); - + Calendar created = image.getCreated(); Assert.assertNotNull(created); image.setCreated(created); - + Integer minRam = image.getMinRam(); Assert.assertNotNull(minRam); image.setMinRam(minRam); - + String name = image.getName(); Assert.assertNotNull(name); image.setName(name); - + Integer progress = image.getProgress(); Assert.assertNotNull(progress); image.setProgress(progress); - + List links = image.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); image.setLinks(links); - + String id = image.getId(); Assert.assertNotNull(id); image.setId(id); - + Calendar updated = image.getUpdated(); Assert.assertNotNull(updated); image.setUpdated(updated); - + Integer minDisk = image.getMinDisk(); Assert.assertNotNull(minDisk); image.setMinDisk(minDisk); - + String status = image.getStatus(); Assert.assertNotNull(status); image.setStatus(status); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java index 2b52804..c54e22e 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,85 +34,35 @@ public class ImagesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"images\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"images\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -130,13 +78,14 @@ public class ImagesTest { public void testMethods() throws Exception { Images images = objectMapper.readValue(JSON_FULL, Images.class); images.toString(); - + List list = images.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Image x : images) { + for (@SuppressWarnings("unused") + Image x : images) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java index 0505671..f441499 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule.IpRange; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class IpRangeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cidr\" : \"cidr\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class IpRangeTest { public void testMethods() throws Exception { IpRange iprange = objectMapper.readValue(JSON_FULL, IpRange.class); iprange.toString(); - + String cidr = iprange.getCidr(); Assert.assertNotNull(cidr); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java index c7f564c..0ef3f5d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,23 +33,15 @@ public class KeyPairTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypair\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"fingerprint\" : \"fingerprint\"," + EOL + " \"user_id\" : \"userid\"," + EOL + + " \"public_key\" : \"publickey\"," + EOL + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,21 +57,21 @@ public class KeyPairTest { public void testMethods() throws Exception { KeyPair keypair = objectMapper.readValue(JSON_FULL, KeyPair.class); keypair.toString(); - + String privateKey = keypair.getPrivateKey(); Assert.assertNotNull(privateKey); - + String name = keypair.getName(); Assert.assertNotNull(name); keypair.setName(name); - + String fingerprint = keypair.getFingerprint(); Assert.assertNotNull(fingerprint); - + String publicKey = keypair.getPublicKey(); Assert.assertNotNull(publicKey); keypair.setPublicKey(publicKey); - + String userId = keypair.getUserId(); Assert.assertNotNull(userId); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java index 3ba27d0..302853c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.KeyPairs.KeyPairWrapper; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,21 +33,14 @@ public class KeyPairWrapperTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypair\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"fingerprint\" : \"fingerprint\"," + EOL + " \"user_id\" : \"userid\"," + EOL + + " \"public_key\" : \"publickey\"," + EOL + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java index fe6d090..ed1a258 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -37,34 +35,20 @@ public class KeyPairsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypairs\" : [ {" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"keypair\" : { " + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypairs\" : [ {" + EOL + " \"keypair\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"fingerprint\" : \"fingerprint\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"public_key\" : \"publickey\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + " }, {" + EOL + " \"keypair\" : { " + + EOL + " \"name\" : \"name\"," + EOL + " \"fingerprint\" : \"fingerprint\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"public_key\" : \"publickey\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); // This is test is ignored because The KeyPairs class does not - // serialize into JSON correctly. It is probably not an operational + // serialize into JSON correctly. It is probably not an operational // issue because KeyPairs is only used to represent the response to // the GET os-keypairs request. @Ignore @@ -87,7 +71,8 @@ public class KeyPairsTest { Assert.assertNotNull(list); int cnt = 0; - for (@SuppressWarnings("unused") KeyPair x : keypairs) { + for (@SuppressWarnings("unused") + KeyPair x : keypairs) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java index 25f6ab9..22fbc15 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.RateLimit.LimitEntry; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,20 +35,13 @@ public class LimitEntryTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + EOL + + " \"next-available\" : 1489320000000" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,22 +57,22 @@ public class LimitEntryTest { public void testMethods() throws Exception { LimitEntry limitentry = objectMapper.readValue(JSON_FULL, LimitEntry.class); limitentry.toString(); - + String unit = limitentry.getUnit(); Assert.assertNotNull(unit); - + String verb = limitentry.getVerb(); Assert.assertNotNull(verb); - + Integer available = limitentry.getAvailable(); Assert.assertNotNull(available); - + Calendar nextAvailable = limitentry.getNextAvailable(); Assert.assertNotNull(nextAvailable); - + Integer value = limitentry.getValue(); Assert.assertNotNull(value); - + Integer remaining = limitentry.getRemaining(); Assert.assertNotNull(remaining); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java index ec450d3..bd23ae9 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.AbsoluteLimit; import com.woorea.openstack.nova.model.Limits.RateLimit; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,83 +36,40 @@ public class LimitsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"limits\" : {" + EOL - + " \"rate\" : [ {" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + " } ]," + EOL - + " \"absolute\" : {" + EOL - + " \"maxServerMeta\" : 30," + EOL - + " \"serverMetaUsed\" : 37," + EOL - + " \"maxPersonality\" : 54," + EOL - + " \"personalityUsed\" : 61," + EOL - + " \"maxImageMeta\" : 82," + EOL - + " \"imageMetaUsed\" : 89," + EOL - + " \"maxPersonalitySize\" : 97," + EOL - + " \"personalitySizeUsed\" : 4," + EOL - + " \"maxTotalCores\" : 32," + EOL - + " \"totalCoresUsed\" : 39," + EOL - + " \"maxTotalInstances\" : 60," + EOL - + " \"totalInstancesUsed\" : 67," + EOL - + " \"maxTotalRAMSize\" : 55," + EOL - + " \"totalRAMUsed\" : 19," + EOL - + " \"maxSecurityGroupRules\" : 44," + EOL - + " \"securityGroupRulesUsed\" : 51," + EOL - + " \"maxTotalKeypairs\" : 64," + EOL - + " \"totalKeyPairsUsed\" : 71," + EOL - + " \"maxTotalVolumes\" : 71," + EOL - + " \"totalVolumesUsed\" : 78," + EOL - + " \"maxSecurityGroups\" : 4," + EOL - + " \"totalSecurityGroupsUsed\" : 59," + EOL - + " \"maxTotalFloatingIps\" : 76," + EOL - + " \"totalFloatingIpsUsed\" : 83," + EOL - + " \"maxTotalVolumeGigabytes\" : 15," + EOL - + " \"totalVolumeGigabytesUsed\" : 22" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"limits\" : {" + EOL + " \"rate\" : [ {" + EOL + + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + " \"limit\" : [ {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + " }, {" + EOL + + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + " \"limit\" : [ {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + " } ]," + EOL + + " \"absolute\" : {" + EOL + " \"maxServerMeta\" : 30," + EOL + " \"serverMetaUsed\" : 37," + + EOL + " \"maxPersonality\" : 54," + EOL + " \"personalityUsed\" : 61," + EOL + + " \"maxImageMeta\" : 82," + EOL + " \"imageMetaUsed\" : 89," + EOL + + " \"maxPersonalitySize\" : 97," + EOL + " \"personalitySizeUsed\" : 4," + EOL + + " \"maxTotalCores\" : 32," + EOL + " \"totalCoresUsed\" : 39," + EOL + + " \"maxTotalInstances\" : 60," + EOL + " \"totalInstancesUsed\" : 67," + EOL + + " \"maxTotalRAMSize\" : 55," + EOL + " \"totalRAMUsed\" : 19," + EOL + + " \"maxSecurityGroupRules\" : 44," + EOL + " \"securityGroupRulesUsed\" : 51," + EOL + + " \"maxTotalKeypairs\" : 64," + EOL + " \"totalKeyPairsUsed\" : 71," + EOL + + " \"maxTotalVolumes\" : 71," + EOL + " \"totalVolumesUsed\" : 78," + EOL + + " \"maxSecurityGroups\" : 4," + EOL + " \"totalSecurityGroupsUsed\" : 59," + EOL + + " \"maxTotalFloatingIps\" : 76," + EOL + " \"totalFloatingIpsUsed\" : 83," + EOL + + " \"maxTotalVolumeGigabytes\" : 15," + EOL + " \"totalVolumeGigabytesUsed\" : 22" + EOL + + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -130,11 +85,11 @@ public class LimitsTest { public void testMethods() throws Exception { Limits limits = objectMapper.readValue(JSON_FULL, Limits.class); limits.toString(); - + List rate = limits.getRate(); Assert.assertNotNull(rate); Assert.assertEquals(2, rate.size()); - + AbsoluteLimit absolute = limits.getAbsolute(); Assert.assertNotNull(absolute); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java index c2fae01..965220d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,17 +33,12 @@ public class LinkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,13 +54,13 @@ public class LinkTest { public void testMethods() throws Exception { Link link = objectMapper.readValue(JSON_FULL, Link.class); link.toString(); - + String rel = link.getRel(); Assert.assertNotNull(rel); - + String href = link.getHref(); Assert.assertNotNull(href); - + String type = link.getType(); Assert.assertNotNull(type); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java index 1c017de..37e9295 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Lock; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class LockTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"lock\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"lock\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java index b1c65f6..a0f8482 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java @@ -21,9 +21,7 @@ package com.woorea.openstack.nova.model; import org.junit.Test; - import java.util.Collections; - import static org.junit.Assert.*; public class MetadataTest { @@ -39,4 +37,4 @@ public class MetadataTest { public void setMetadata() { metadata.setMetadata(Collections.emptyMap()); } -} \ No newline at end of file +} diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java index aae0c7f..ed2fa55 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class NetworkForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,11 +54,11 @@ public class NetworkForCreateTest { public void testMethods() throws Exception { NetworkForCreate networkforcreate = objectMapper.readValue(JSON_FULL, NetworkForCreate.class); networkforcreate.toString(); - + String fixedIp = networkforcreate.getFixedIp(); Assert.assertNotNull(fixedIp); networkforcreate.setFixedIp(fixedIp); - + String id = networkforcreate.getId(); Assert.assertNotNull(id); networkforcreate.setId(id); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java index 73b871d..54e2f8b 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,46 +33,26 @@ public class NetworkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"network\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"network\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + " \"vlan\" : \"vlan\"," + EOL + + " \"broadcast\" : \"broadcast\"," + EOL + " \"netmask\" : \"netmask\"," + EOL + + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + EOL + " \"cidr\" : \"cidr\"," + EOL + + " \"gateway\" : \"gateway\"," + EOL + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + + EOL + " \"label\" : \"label\"," + EOL + " \"priority\" : \"priority\"," + EOL + + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " }" + EOL + + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -89,85 +68,85 @@ public class NetworkTest { public void testMethods() throws Exception { Network network = objectMapper.readValue(JSON_FULL, Network.class); network.toString(); - + String broadcast = network.getBroadcast(); Assert.assertNotNull(broadcast); - + String gatewayV6 = network.getGatewayV6(); Assert.assertNotNull(gatewayV6); - + String dns2 = network.getDns2(); Assert.assertNotNull(dns2); - + String bridgeInterface = network.getBridgeInterface(); Assert.assertNotNull(bridgeInterface); - + String dns1 = network.getDns1(); Assert.assertNotNull(dns1); - + String cidrV6 = network.getCidrV6(); Assert.assertNotNull(cidrV6); - + String deletedAt = network.getDeletedAt(); Assert.assertNotNull(deletedAt); - + String vlan = network.getVlan(); Assert.assertNotNull(vlan); - + String netmask = network.getNetmask(); Assert.assertNotNull(netmask); - + String netmaskV6 = network.getNetmaskV6(); Assert.assertNotNull(netmaskV6); - + Boolean injected = network.getInjected(); Assert.assertNotNull(injected); - + String host = network.getHost(); Assert.assertNotNull(host); - + String cidr = network.getCidr(); Assert.assertNotNull(cidr); - + String id = network.getId(); Assert.assertNotNull(id); - + String projectId = network.getProjectId(); Assert.assertNotNull(projectId); - + String vpnPublicAddress = network.getVpnPublicAddress(); Assert.assertNotNull(vpnPublicAddress); - + String label = network.getLabel(); Assert.assertNotNull(label); - + String priority = network.getPriority(); Assert.assertNotNull(priority); - + String vpnPublicPort = network.getVpnPublicPort(); Assert.assertNotNull(vpnPublicPort); - + String createdAt = network.getCreatedAt(); Assert.assertNotNull(createdAt); - + Boolean deleted = network.getDeleted(); Assert.assertNotNull(deleted); - + String rxtxBase = network.getRxtxBase(); Assert.assertNotNull(rxtxBase); - + String dhcpStart = network.getDhcpStart(); Assert.assertNotNull(dhcpStart); - + Boolean multiHost = network.getMultiHost(); Assert.assertNotNull(multiHost); - + String bridge = network.getBridge(); Assert.assertNotNull(bridge); - + String gateway = network.getGateway(); Assert.assertNotNull(gateway); - + String updatedAt = network.getUpdatedAt(); Assert.assertNotNull(updatedAt); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java index 3e4272c..bbebe26 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,73 +34,38 @@ public class NetworksTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"networks\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"networks\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + " \"vlan\" : \"vlan\"," + EOL + + " \"broadcast\" : \"broadcast\"," + EOL + " \"netmask\" : \"netmask\"," + EOL + + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + EOL + " \"cidr\" : \"cidr\"," + EOL + + " \"gateway\" : \"gateway\"," + EOL + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + + EOL + " \"label\" : \"label\"," + EOL + " \"priority\" : \"priority\"," + EOL + + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + + " \"vlan\" : \"vlan\"," + EOL + " \"broadcast\" : \"broadcast\"," + EOL + + " \"netmask\" : \"netmask\"," + EOL + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + + EOL + " \"cidr\" : \"cidr\"," + EOL + " \"gateway\" : \"gateway\"," + EOL + + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + EOL + " \"label\" : \"label\"," + EOL + + " \"priority\" : \"priority\"," + EOL + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " } ]" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -118,13 +81,14 @@ public class NetworksTest { public void testMethods() throws Exception { Networks networks = objectMapper.readValue(JSON_FULL, Networks.class); networks.toString(); - + List list = networks.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Network x : networks) { + for (@SuppressWarnings("unused") + Network x : networks) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java index c14cc40..5c54d38 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Pause; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class PauseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"pause\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"pause\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java index 6e113cb..142bfa8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class PersonalityFileTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,11 +54,11 @@ public class PersonalityFileTest { public void testMethods() throws Exception { PersonalityFile personalityfile = objectMapper.readValue(JSON_FULL, PersonalityFile.class); personalityfile.toString(); - + String path = personalityfile.getPath(); Assert.assertNotNull(path); personalityfile.setPath(path); - + String contents = personalityfile.getContents(); Assert.assertNotNull(contents); personalityfile.setContents(contents); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java index c26a3a1..200b1f5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,32 +33,18 @@ public class QuotaSetTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"quota_set\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"gigabytes\" : 77," + EOL - + " \"ram\" : 38," + EOL - + " \"instances\" : 86," + EOL - + " \"volumes\" : 97," + EOL - + " \"cores\" : 58," + EOL - + " \"metadata_items\" : 97," + EOL - + " \"injected_file_content_bytes\" : 86," + EOL - + " \"injected_files\" : 87," + EOL - + " \"floating_ips\" : 2," + EOL - + " \"security_groups\" : 78," + EOL - + " \"security_group_rules\" : 18," + EOL - + " \"injected_file_path_bytes\" : 52," + EOL - + " \"key_pairs\" : 90" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"quota_set\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"gigabytes\" : 77," + EOL + " \"ram\" : 38," + EOL + " \"instances\" : 86," + EOL + + " \"volumes\" : 97," + EOL + " \"cores\" : 58," + EOL + " \"metadata_items\" : 97," + EOL + + " \"injected_file_content_bytes\" : 86," + EOL + " \"injected_files\" : 87," + EOL + + " \"floating_ips\" : 2," + EOL + " \"security_groups\" : 78," + EOL + + " \"security_group_rules\" : 18," + EOL + " \"injected_file_path_bytes\" : 52," + EOL + + " \"key_pairs\" : 90" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -75,59 +60,59 @@ public class QuotaSetTest { public void testMethods() throws Exception { QuotaSet quotaset = objectMapper.readValue(JSON_FULL, QuotaSet.class); quotaset.toString(); - + Integer injectedFileContentBytes = quotaset.getInjectedFileContentBytes(); Assert.assertNotNull(injectedFileContentBytes); quotaset.setInjectedFileContentBytes(injectedFileContentBytes); - + Integer injectedFiles = quotaset.getInjectedFiles(); Assert.assertNotNull(injectedFiles); quotaset.setInjectedFiles(injectedFiles); - + Integer instances = quotaset.getInstances(); Assert.assertNotNull(instances); quotaset.setInstances(instances); - + Integer gigabytes = quotaset.getGigabytes(); Assert.assertNotNull(gigabytes); quotaset.setGigabytes(gigabytes); - + Integer metadataItems = quotaset.getMetadataItems(); Assert.assertNotNull(metadataItems); quotaset.setMetadataItems(metadataItems); - + Integer volumes = quotaset.getVolumes(); Assert.assertNotNull(volumes); quotaset.setVolumes(volumes); - + Integer injectedFilePathBytes = quotaset.getInjectedFilePathBytes(); Assert.assertNotNull(injectedFilePathBytes); quotaset.setInjectedFilePathBytes(injectedFilePathBytes); - + Integer securityGroupRules = quotaset.getSecurityGroupRules(); Assert.assertNotNull(securityGroupRules); quotaset.setSecurityGroupRules(securityGroupRules); - + Integer floatingIps = quotaset.getFloatingIps(); Assert.assertNotNull(floatingIps); quotaset.setFloatingIps(floatingIps); - + Integer cores = quotaset.getCores(); Assert.assertNotNull(cores); quotaset.setCores(cores); - + String id = quotaset.getId(); Assert.assertNotNull(id); quotaset.setId(id); - + Integer securityGroups = quotaset.getSecurityGroups(); Assert.assertNotNull(securityGroups); quotaset.setSecurityGroups(securityGroups); - + Integer ram = quotaset.getRam(); Assert.assertNotNull(ram); quotaset.setRam(ram); - + Integer keyPairs = quotaset.getKeyPairs(); Assert.assertNotNull(keyPairs); quotaset.setKeyPairs(keyPairs); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java index ef2e98a..b742174 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.RateLimit; import com.woorea.openstack.nova.model.Limits.RateLimit.LimitEntry; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,31 +36,16 @@ public class RateLimitTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + + " \"limit\" : [ {" + EOL + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + EOL + + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + " \"unit\" : \"unit\"," + EOL + + " \"verb\" : \"verb\"," + EOL + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + + " \"value\" : 59," + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,14 +61,14 @@ public class RateLimitTest { public void testMethods() throws Exception { RateLimit ratelimit = objectMapper.readValue(JSON_FULL, RateLimit.class); ratelimit.toString(); - + String regex = ratelimit.getRegex(); Assert.assertNotNull(regex); - + List limit = ratelimit.getLimit(); Assert.assertNotNull(limit); Assert.assertEquals(2, limit.size()); - + String uri = ratelimit.getUri(); Assert.assertNotNull(uri); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java index 494b088..b4e105b 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Reboot; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class RebootTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"reboot\" : {" + EOL - + " \"type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"reboot\" : {" + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class RebootTest { public void testMethods() throws Exception { Reboot reboot = objectMapper.readValue(JSON_FULL, Reboot.class); reboot.toString(); - + String type = reboot.getType(); Assert.assertNotNull(type); reboot.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java index b3fb845..501f68d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Rebuild; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,35 +36,19 @@ public class RebuildTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rebuild\" : {" + EOL - + " \"imageRef\" : \"imageref\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"personality\" : [ {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " }, {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " } ]," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"rebuild\" : {" + EOL + " \"imageRef\" : \"imageref\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"adminPass\" : \"adminpass\"," + EOL + + " \"accessIPv4\" : \"accessipv4\"," + EOL + " \"accessIPv6\" : \"accessipv6\"," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }," + EOL + " \"personality\" : [ {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " }, {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " } ]," + EOL + + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -82,37 +64,37 @@ public class RebuildTest { public void testMethods() throws Exception { Rebuild rebuild = objectMapper.readValue(JSON_FULL, Rebuild.class); rebuild.toString(); - - Map metadata = rebuild.getMetadata(); + + Map metadata = rebuild.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); rebuild.setMetadata(metadata); - + List personality = rebuild.getPersonality(); Assert.assertNotNull(personality); Assert.assertEquals(2, personality.size()); rebuild.setPersonality(personality); - + String name = rebuild.getName(); Assert.assertNotNull(name); rebuild.setName(name); - + String adminPass = rebuild.getAdminPass(); Assert.assertNotNull(adminPass); rebuild.setAdminPass(adminPass); - + String imageRef = rebuild.getImageRef(); Assert.assertNotNull(imageRef); rebuild.setImageRef(imageRef); - + String accessIPv6 = rebuild.getAccessIPv6(); Assert.assertNotNull(accessIPv6); rebuild.setAccessIPv6(accessIPv6); - + String diskConfig = rebuild.getDiskConfig(); Assert.assertNotNull(diskConfig); rebuild.setDiskConfig(diskConfig); - + String accessIPv4 = rebuild.getAccessIPv4(); Assert.assertNotNull(accessIPv4); rebuild.setAccessIPv4(accessIPv4); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java index 3cbee04..4486034 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.RescueResponse; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class RescueResponseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"adminPass\" : \"adminpass\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class RescueResponseTest { public void testMethods() throws Exception { RescueResponse rescueresponse = objectMapper.readValue(JSON_FULL, RescueResponse.class); rescueresponse.toString(); - + String adminPass = rescueresponse.getAdminPass(); Assert.assertNotNull(adminPass); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java index 6c68207..6a7afb6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Rescue; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class RescueTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rescue\" : {" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"rescue\" : {" + EOL + " \"adminPass\" : \"adminpass\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class RescueTest { public void testMethods() throws Exception { Rescue rescue = objectMapper.readValue(JSON_FULL, Rescue.class); rescue.toString(); - + String adminPass = rescue.getAdminPass(); Assert.assertNotNull(adminPass); rescue.setAdminPass(adminPass); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java index 520b9fb..7dfcc42 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Resize; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,20 +34,13 @@ public class ResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resize\" : {" + EOL - + " \"flavorRef\" : \"flavorref\"," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resize\" : {" + EOL + " \"flavorRef\" : \"flavorref\"," + + EOL + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,11 +56,11 @@ public class ResizeTest { public void testMethods() throws Exception { Resize resize = objectMapper.readValue(JSON_FULL, Resize.class); resize.toString(); - + String flavorRef = resize.getFlavorRef(); Assert.assertNotNull(flavorRef); resize.setFlavorRef(flavorRef); - + String diskConfig = resize.getDiskConfig(); Assert.assertNotNull(diskConfig); resize.setDiskConfig(diskConfig); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java index e48cb62..a4f75ec 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Host.ResourceWrapper.Resource; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,12 @@ public class ResourceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"project\" : \"project\"," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cpu\" : 46," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"disk_gb\" : 46" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"project\" : \"project\"," + EOL + " \"host\" : \"host\"," + + EOL + " \"cpu\" : 46," + EOL + " \"memory_mb\" : 90," + EOL + " \"disk_gb\" : 46" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,19 +55,19 @@ public class ResourceTest { public void testMethods() throws Exception { Resource resource = objectMapper.readValue(JSON_FULL, Resource.class); resource.toString(); - + Integer memoryMb = resource.getMemoryMb(); Assert.assertNotNull(memoryMb); - + String host = resource.getHost(); Assert.assertNotNull(host); - + String project = resource.getProject(); Assert.assertNotNull(project); - + Integer cpu = resource.getCpu(); Assert.assertNotNull(cpu); - + Integer diskGb = resource.getDiskGb(); Assert.assertNotNull(diskGb); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java index 3616551..c1be9db 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Host.ResourceWrapper; import com.woorea.openstack.nova.model.Host.ResourceWrapper.Resource; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,21 +35,13 @@ public class ResourceWrapperTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resource\" : {" + EOL - + " \"project\" : \"project\"," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cpu\" : 46," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"disk_gb\" : 46" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resource\" : {" + EOL + " \"project\" : \"project\"," + + EOL + " \"host\" : \"host\"," + EOL + " \"cpu\" : 46," + EOL + " \"memory_mb\" : 90," + EOL + + " \"disk_gb\" : 46" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,7 +57,7 @@ public class ResourceWrapperTest { public void testMethods() throws Exception { ResourceWrapper resourcewrapper = objectMapper.readValue(JSON_FULL, ResourceWrapper.class); resourcewrapper.toString(); - + Resource resource = resourcewrapper.getResource(); Assert.assertNotNull(resource); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java index c601a3f..fa059c3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Restore; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class RestoreTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"restore\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"restore\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java index db84968..33cc515 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Resume; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ResumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resume\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resume\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java index 9aca582..5b4dfb4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.RevertResize; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class RevertResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"revertResize\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"revertResize\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java index 65ecb6c..489662c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java @@ -27,7 +27,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule; import com.woorea.openstack.nova.model.SecurityGroup.Rule.Group; import com.woorea.openstack.nova.model.SecurityGroup.Rule.IpRange; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,31 +36,17 @@ public class RuleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group_rule\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"security_group_rule\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + " \"ip_range\" : {" + + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -77,28 +62,28 @@ public class RuleTest { public void testMethods() throws Exception { Rule rule = objectMapper.readValue(JSON_FULL, Rule.class); rule.toString(); - + String parentGroupId = rule.getParentGroupId(); Assert.assertNotNull(parentGroupId); - + String ipProtocol = rule.getIpProtocol(); Assert.assertNotNull(ipProtocol); - + IpRange ipRange = rule.getIpRange(); Assert.assertNotNull(ipRange); - + Integer fromPort = rule.getFromPort(); Assert.assertNotNull(fromPort); - + String name = rule.getName(); Assert.assertNotNull(name); - + String id = rule.getId(); Assert.assertNotNull(id); - + Integer toPort = rule.getToPort(); Assert.assertNotNull(toPort); - + Group group = rule.getGroup(); Assert.assertNotNull(group); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java index 0c995d1..7cd3048 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,20 +33,13 @@ public class SecurityGroupForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_group\" : {" + EOL + " \"name\" : \"name\"," + + EOL + " \"description\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,11 +55,11 @@ public class SecurityGroupForCreateTest { public void testMethods() throws Exception { SecurityGroupForCreate securitygroupforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupForCreate.class); securitygroupforcreate.toString(); - + String name = securitygroupforcreate.getName(); Assert.assertNotNull(name); securitygroupforcreate.setName(name); - + String description = securitygroupforcreate.getDescription(); Assert.assertNotNull(description); securitygroupforcreate.setDescription(description); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java index fc5cf69..c87e52f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,30 +33,22 @@ public class SecurityGroupRuleForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group_rule\" : {" + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"group_id\" : \"groupid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_group_rule\" : {" + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + + " \"ip_protocol\" : \"ipprotocol\"," + EOL + " \"from_port\" : 7," + EOL + " \"to_port\" : 98," + + EOL + " \"group_id\" : \"groupid\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { System.out.println("CLASS: " + SecurityGroupRuleForCreate.class.getName()); System.out.println("TEST JSON: " + JSON_FULL); - SecurityGroupRuleForCreate securitygroupruleforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); + SecurityGroupRuleForCreate securitygroupruleforcreate = + objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); String json = objectMapper.writeValueAsString(securitygroupruleforcreate); System.out.println("RE-SERIALIZED OBJECT: " + json); JSONAssert.assertEquals(JSON_FULL, json, JSONCompareMode.LENIENT); @@ -65,29 +56,30 @@ public class SecurityGroupRuleForCreateTest { @Test public void testMethods() throws Exception { - SecurityGroupRuleForCreate securitygroupruleforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); + SecurityGroupRuleForCreate securitygroupruleforcreate = + objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); securitygroupruleforcreate.toString(); - + String parentGroupId = securitygroupruleforcreate.getParentGroupId(); Assert.assertNotNull(parentGroupId); securitygroupruleforcreate.setParentGroupId(parentGroupId); - + String ipProtocol = securitygroupruleforcreate.getIpProtocol(); Assert.assertNotNull(ipProtocol); securitygroupruleforcreate.setIpProtocol(ipProtocol); - + String groupId = securitygroupruleforcreate.getGroupId(); Assert.assertNotNull(groupId); securitygroupruleforcreate.setGroupId(groupId); - + Integer fromPort = securitygroupruleforcreate.getFromPort(); Assert.assertNotNull(fromPort); securitygroupruleforcreate.setFromPort(fromPort); - + String cidr = securitygroupruleforcreate.getCidr(); Assert.assertNotNull(cidr); securitygroupruleforcreate.setCidr(cidr); - + Integer toPort = securitygroupruleforcreate.getToPort(); Assert.assertNotNull(toPort); securitygroupruleforcreate.setToPort(toPort); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java index b68e503..5abf0df 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerForCreate.SecurityGroup; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class SecurityGroupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class SecurityGroupTest { public void testMethods() throws Exception { SecurityGroup securitygroup = objectMapper.readValue(JSON_FULL, SecurityGroup.class); securitygroup.toString(); - + String name = securitygroup.getName(); Assert.assertNotNull(name); securitygroup.setName(name); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java index 2ee2faa..3ff73f4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,101 +34,42 @@ public class SecurityGroupsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_groups\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_groups\" : [ {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"rules\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " } ]," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " } ]," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -146,13 +85,14 @@ public class SecurityGroupsTest { public void testMethods() throws Exception { SecurityGroups securitygroups = objectMapper.readValue(JSON_FULL, SecurityGroups.class); securitygroups.toString(); - + List list = securitygroups.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") SecurityGroup x : securitygroups) { + for (@SuppressWarnings("unused") + SecurityGroup x : securitygroups) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java index 2f638ee..28a56cf 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java @@ -1,78 +1,76 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 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.model; - -import com.woorea.openstack.nova.model.ServerAction.ChangePassword; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - - -public class ServerActionTest { - private ChangePassword testObj = new ServerAction.ChangePassword(); - - @Test - public void testSetAdminPass(){ - - try { - - testObj.setAdminPass("sai"); - assertEquals( testObj.getAdminPass(), "sai"); - - } catch (Exception e) { - - fail("Exception in test obj"); - } - - } - - @Test - public void testChangePasswdConstructor(){ - - try { - ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai"); - assertEquals( test.getAdminPass(), "sai"); - - } catch (Exception e) { - - fail("Exception in test obj"); - } - - } - - private ServerAction.Reboot testObj1 = new ServerAction.Reboot(); - - @Test - public void testSetType(){ - testObj1.setType("sai"); - assertEquals("sai", testObj1.getType()); - } - - private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild(); - - @Test - public void testRebuild() - { - testRebuild.setAccessIPv4("1.1.1.1"); - assertEquals(testRebuild.getAccessIPv4(),"1.1.1.1"); - } -} +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 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.model; + +import com.woorea.openstack.nova.model.ServerAction.ChangePassword; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + + +public class ServerActionTest { + private ChangePassword testObj = new ServerAction.ChangePassword(); + + @Test + public void testSetAdminPass() { + + try { + + testObj.setAdminPass("sai"); + assertEquals(testObj.getAdminPass(), "sai"); + + } catch (Exception e) { + + fail("Exception in test obj"); + } + + } + + @Test + public void testChangePasswdConstructor() { + + try { + ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai"); + assertEquals(test.getAdminPass(), "sai"); + + } catch (Exception e) { + + fail("Exception in test obj"); + } + + } + + private ServerAction.Reboot testObj1 = new ServerAction.Reboot(); + + @Test + public void testSetType() { + testObj1.setType("sai"); + assertEquals("sai", testObj1.getType()); + } + + private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild(); + + @Test + public void testRebuild() { + testRebuild.setAccessIPv4("1.1.1.1"); + assertEquals(testRebuild.getAccessIPv4(), "1.1.1.1"); + } +} diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java index 7b5d165..8d865bb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerForCreate.SecurityGroup; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,54 +36,26 @@ public class ServerForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"server\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"imageRef\" : \"imageref\"," + EOL - + " \"flavorRef\" : \"flavorref\"," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"min\" : 42," + EOL - + " \"max\" : 44," + EOL - + " \"diskConfig\" : \"diskconfig\"," + EOL - + " \"personality\" : [ {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " }, {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"networks\" : [ {" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + " }, {" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + " } ]," + EOL - + " \"key_name\" : \"keyname\"," + EOL - + " \"security_groups\" : [ {" + EOL - + " \"name\" : \"name\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"" + EOL - + " } ]," + EOL - + " \"user_data\" : \"userdata\"," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"config_drive\" : true" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"server\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"adminPass\" : \"adminpass\"," + EOL + " \"imageRef\" : \"imageref\"," + EOL + + " \"flavorRef\" : \"flavorref\"," + EOL + " \"accessIPv4\" : \"accessipv4\"," + EOL + + " \"accessIPv6\" : \"accessipv6\"," + EOL + " \"min\" : 42," + EOL + " \"max\" : 44," + EOL + + " \"diskConfig\" : \"diskconfig\"," + EOL + " \"personality\" : [ {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " }, {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " } ]," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }," + EOL + " \"networks\" : [ {" + EOL + + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + " }, {" + EOL + + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + " } ]," + EOL + + " \"key_name\" : \"keyname\"," + EOL + " \"security_groups\" : [ {" + EOL + + " \"name\" : \"name\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"" + EOL + " } ]," + + EOL + " \"user_data\" : \"userdata\"," + EOL + " \"availability_zone\" : \"availabilityzone\"," + + EOL + " \"config_drive\" : true" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -101,70 +71,70 @@ public class ServerForCreateTest { public void testMethods() throws Exception { ServerForCreate serverforcreate = objectMapper.readValue(JSON_FULL, ServerForCreate.class); serverforcreate.toString(); - - Map metadata = serverforcreate.getMetadata(); + + Map metadata = serverforcreate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); serverforcreate.setMetadata(metadata); - + Integer max = serverforcreate.getMax(); Assert.assertNotNull(max); serverforcreate.setMax(max); - + List networks = serverforcreate.getNetworks(); Assert.assertNotNull(networks); Assert.assertEquals(2, networks.size()); serverforcreate.setNetworks(networks); - + String userData = serverforcreate.getUserData(); Assert.assertNotNull(userData); serverforcreate.setUserData(userData); - + Integer min = serverforcreate.getMin(); Assert.assertNotNull(min); serverforcreate.setMin(min); - + List personality = serverforcreate.getPersonality(); Assert.assertNotNull(personality); Assert.assertEquals(2, personality.size()); serverforcreate.setPersonality(personality); - + String name = serverforcreate.getName(); Assert.assertNotNull(name); serverforcreate.setName(name); - + String flavorRef = serverforcreate.getFlavorRef(); Assert.assertNotNull(flavorRef); serverforcreate.setFlavorRef(flavorRef); - + String keyName = serverforcreate.getKeyName(); Assert.assertNotNull(keyName); serverforcreate.setKeyName(keyName); - + String adminPass = serverforcreate.getAdminPass(); Assert.assertNotNull(adminPass); serverforcreate.setAdminPass(adminPass); - + String imageRef = serverforcreate.getImageRef(); Assert.assertNotNull(imageRef); serverforcreate.setImageRef(imageRef); - + String accessIPv6 = serverforcreate.getAccessIPv6(); Assert.assertNotNull(accessIPv6); serverforcreate.setAccessIPv6(accessIPv6); - + String diskConfig = serverforcreate.getDiskConfig(); Assert.assertNotNull(diskConfig); serverforcreate.setDiskConfig(diskConfig); - + List securityGroups = serverforcreate.getSecurityGroups(); Assert.assertNotNull(securityGroups); Assert.assertEquals(2, securityGroups.size()); - + String availabilityZone = serverforcreate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); serverforcreate.setAvailabilityZone(availabilityZone); - + String accessIPv4 = serverforcreate.getAccessIPv4(); Assert.assertNotNull(accessIPv4); serverforcreate.setAccessIPv4(accessIPv4); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java index 27ba42d..290f4a5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java @@ -26,10 +26,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses; import com.woorea.openstack.nova.model.Server.Fault; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,236 +37,104 @@ public class ServerTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"addresses\" : {" + EOL - + " \"addresses\" : {" + EOL - + " \"addresses-k1\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"addresses-k2\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }," + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"progress\" : 3," + EOL - + " \"fault\" : {" + EOL - + " \"code\" : 29," + EOL - + " \"message\" : \"message\"," + EOL - + " \"details\" : \"details\"," + EOL - + " \"created\" : 1485172800000" + EOL - + " }," + EOL - + " \"hostId\" : \"hostid\"," + EOL - + " \"updated\" : \"updated\"," + EOL - + " \"created\" : \"created\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"uuid\" : \"uuid\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"config_drive\" : \"configdrive\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"key_name\" : \"keyname\"," + EOL - + " \"security_groups\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-STS:task_state\" : \"taskstate\"," + EOL - + " \"OS-EXT-STS:power_state\" : \"powerstate\"," + EOL - + " \"OS-EXT-STS:vm_state\" : \"vmstate\"," + EOL - + " \"OS-EXT-SRV-ATTR:host\" : \"host\"," + EOL - + " \"OS-EXT-SRV-ATTR:instance_name\" : \"instancename\"," + EOL - + " \"OS-EXT-SRV-ATTR:hypervisor_hostname\" : \"hypervisorhostname\"," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"," + EOL - + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL - + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL - + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL - + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"addresses\" : {" + EOL + " \"addresses\" : {" + EOL + + " \"addresses-k1\" : [ {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " }, {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + + EOL + " } ]," + EOL + " \"addresses-k2\" : [ {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + + EOL + " }, {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + " }," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + " \"minRam\" : 62," + EOL + + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + + " }," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }," + EOL + + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + " \"disk\" : 45," + EOL + + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"public\" : false," + EOL + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + + EOL + " \"rxtx_factor\" : 11.0," + EOL + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + + " \"rxtx_quota\" : 42," + EOL + " \"rxtx_cap\" : 96," + EOL + + " \"os-flavor-access:is_public\" : false" + EOL + " }," + EOL + + " \"accessIPv4\" : \"accessipv4\"," + EOL + " \"accessIPv6\" : \"accessipv6\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"progress\" : 3," + EOL + " \"fault\" : {" + EOL + + " \"code\" : 29," + EOL + " \"message\" : \"message\"," + EOL + + " \"details\" : \"details\"," + EOL + " \"created\" : 1485172800000" + EOL + " }," + EOL + + " \"hostId\" : \"hostid\"," + EOL + " \"updated\" : \"updated\"," + EOL + + " \"created\" : \"created\"," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"uuid\" : \"uuid\"," + EOL + " \"adminPass\" : \"adminpass\"," + EOL + + " \"config_drive\" : \"configdrive\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"key_name\" : \"keyname\"," + EOL + + " \"security_groups\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " } ]," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " } ]," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]," + EOL + + " \"OS-EXT-STS:task_state\" : \"taskstate\"," + EOL + + " \"OS-EXT-STS:power_state\" : \"powerstate\"," + EOL + " \"OS-EXT-STS:vm_state\" : \"vmstate\"," + + EOL + " \"OS-EXT-SRV-ATTR:host\" : \"host\"," + EOL + + " \"OS-EXT-SRV-ATTR:instance_name\" : \"instancename\"," + EOL + + " \"OS-EXT-SRV-ATTR:hypervisor_hostname\" : \"hypervisorhostname\"," + EOL + + " \"OS-DCF:diskConfig\" : \"diskconfig\"," + EOL + + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL + + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL + + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL + + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -284,109 +150,109 @@ public class ServerTest { public void testMethods() throws Exception { Server server = objectMapper.readValue(JSON_FULL, Server.class); server.toString(); - + Addresses addresses = server.getAddresses(); Assert.assertNotNull(addresses); - - Map metadata = server.getMetadata(); + + Map metadata = server.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + String hostId = server.getHostId(); Assert.assertNotNull(hostId); - + String uuid = server.getUuid(); Assert.assertNotNull(uuid); - + String userId = server.getUserId(); Assert.assertNotNull(userId); - + String taskState = server.getTaskState(); Assert.assertNotNull(taskState); - + String powerState = server.getPowerState(); Assert.assertNotNull(powerState); - + String vmState = server.getVmState(); Assert.assertNotNull(vmState); - + String tenantId = server.getTenantId(); Assert.assertNotNull(tenantId); - + String configDrive = server.getConfigDrive(); Assert.assertNotNull(configDrive); - + String host = server.getHost(); Assert.assertNotNull(host); - + String keyName = server.getKeyName(); Assert.assertNotNull(keyName); - + List links = server.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + String id = server.getId(); Assert.assertNotNull(id); - + String launchedAt = server.getLaunchedAt(); Assert.assertNotNull(launchedAt); - + Image image = server.getImage(); Assert.assertNotNull(image); server.setImage(image); - + String terminatedAt = server.getTerminatedAt(); Assert.assertNotNull(terminatedAt); - + String created = server.getCreated(); Assert.assertNotNull(created); - + Fault fault = server.getFault(); Assert.assertNotNull(fault); - + String hypervisorHostname = server.getHypervisorHostname(); Assert.assertNotNull(hypervisorHostname); - + Flavor flavor = server.getFlavor(); Assert.assertNotNull(flavor); server.setFlavor(flavor); - + String instanceName = server.getInstanceName(); Assert.assertNotNull(instanceName); - + List osExtendedVolumesAttached = server.getOsExtendedVolumesAttached(); Assert.assertNotNull(osExtendedVolumesAttached); Assert.assertEquals(2, osExtendedVolumesAttached.size()); - + String name = server.getName(); Assert.assertNotNull(name); - + Integer progress = server.getProgress(); Assert.assertNotNull(progress); - + String adminPass = server.getAdminPass(); Assert.assertNotNull(adminPass); - + String accessIPv6 = server.getAccessIPv6(); Assert.assertNotNull(accessIPv6); - + String diskConfig = server.getDiskConfig(); Assert.assertNotNull(diskConfig); - + List securityGroups = server.getSecurityGroups(); Assert.assertNotNull(securityGroups); Assert.assertEquals(2, securityGroups.size()); - + String updated = server.getUpdated(); Assert.assertNotNull(updated); - + String availabilityZone = server.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String accessIPv4 = server.getAccessIPv4(); Assert.assertNotNull(accessIPv4); - + String status = server.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java index cfec1f7..6cd37cd 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SimpleTenantUsage.ServerUsage; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,26 +34,16 @@ public class ServerUsageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = + "{" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,40 +59,40 @@ public class ServerUsageTest { public void testMethods() throws Exception { ServerUsage serverusage = objectMapper.readValue(JSON_FULL, ServerUsage.class); serverusage.toString(); - + String flavor = serverusage.getFlavor(); Assert.assertNotNull(flavor); - + Integer memoryMb = serverusage.getMemoryMb(); Assert.assertNotNull(memoryMb); - + Double hours = serverusage.getHours(); Assert.assertNotNull(hours); - + String instanceId = serverusage.getInstanceId(); Assert.assertNotNull(instanceId); - + Integer localDiskSize = serverusage.getLocalDiskSize(); Assert.assertNotNull(localDiskSize); - + String endedAt = serverusage.getEndedAt(); Assert.assertNotNull(endedAt); - + String name = serverusage.getName(); Assert.assertNotNull(name); - + String tenantId = serverusage.getTenantId(); Assert.assertNotNull(tenantId); - + String startedAt = serverusage.getStartedAt(); Assert.assertNotNull(startedAt); - + String state = serverusage.getState(); Assert.assertNotNull(state); - + Integer vcpus = serverusage.getVcpus(); Assert.assertNotNull(vcpus); - + Integer uptime = serverusage.getUptime(); Assert.assertNotNull(uptime); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java index ecd5394..bbf80ff 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -261,7 +259,9 @@ public class ServersTest { sb.append(" \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL); sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL); sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL); - sb.append(" \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL); + sb.append( + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL); sb.append(" }, {" + EOL); sb.append(" \"id\" : \"id\"," + EOL); sb.append(" \"name\" : \"name\"," + EOL); @@ -480,17 +480,17 @@ public class ServersTest { sb.append(" \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL); sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL); sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL); - sb.append(" \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL); + sb.append( + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL); sb.append(" } ]" + EOL); sb.append("}"); JSON_FULL = sb.toString(); } - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -506,13 +506,14 @@ public class ServersTest { public void testMethods() throws Exception { Servers servers = objectMapper.readValue(JSON_FULL, Servers.class); servers.toString(); - + List list = servers.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Server x : servers) { + for (@SuppressWarnings("unused") + Server x : servers) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java index da2208f..ce8d0cb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SimpleTenantUsage.ServerUsage; - import java.math.BigDecimal; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,52 +36,27 @@ public class SimpleTenantUsageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenant_usage\" : {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"tenant_usage\" : {" + EOL + " \"start\" : \"start\"," + + EOL + " \"stop\" : \"stop\"," + EOL + " \"total_memory_mb_usage\" : 14," + EOL + + " \"total_vcpus_usage\" : 3," + EOL + " \"total_local_gb_usage\" : 66," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"total_hours\" : \"totalhours\"," + EOL + + " \"server_usages\" : [ {" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"instance_id\" : \"instanceid\"," + EOL + + " \"started_at\" : \"startedat\"," + EOL + " \"ended_at\" : \"endedat\"," + EOL + + " \"memory_mb\" : 90," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"local_gb\" : 11" + EOL + " }, {" + EOL + " \"uptime\" : 78," + EOL + + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " }" + + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -99,36 +72,36 @@ public class SimpleTenantUsageTest { public void testMethods() throws Exception { SimpleTenantUsage simpletenantusage = objectMapper.readValue(JSON_FULL, SimpleTenantUsage.class); simpletenantusage.toString(); - + BigDecimal totalMemoryMbUsage = simpletenantusage.getTotalMemoryMbUsage(); Assert.assertNotNull(totalMemoryMbUsage); simpletenantusage.setTotalMemoryMbUsage(totalMemoryMbUsage); - + String stop = simpletenantusage.getStop(); Assert.assertNotNull(stop); simpletenantusage.setStop(stop); - + BigDecimal totalVcpusUsage = simpletenantusage.getTotalVcpusUsage(); Assert.assertNotNull(totalVcpusUsage); simpletenantusage.setTotalVcpusUsage(totalVcpusUsage); - + String tenantId = simpletenantusage.getTenantId(); Assert.assertNotNull(tenantId); simpletenantusage.setTenantId(tenantId); - + String start = simpletenantusage.getStart(); Assert.assertNotNull(start); simpletenantusage.setStart(start); - + List serverUsages = simpletenantusage.getServerUsages(); Assert.assertNotNull(serverUsages); Assert.assertEquals(2, serverUsages.size()); simpletenantusage.setServerUsages(serverUsages); - + BigDecimal totalLocalGbUsage = simpletenantusage.getTotalLocalGbUsage(); Assert.assertNotNull(totalLocalGbUsage); simpletenantusage.setTotalLocalGbUsage(totalLocalGbUsage); - + String totalHours = simpletenantusage.getTotalHours(); Assert.assertNotNull(totalHours); simpletenantusage.setTotalHours(totalHours); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java index ee4598c..49bb979 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,85 +34,40 @@ public class SimpleTenantUsagesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenant_usages\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"tenant_usages\" : [ {" + EOL + " \"start\" : \"start\"," + + EOL + " \"stop\" : \"stop\"," + EOL + " \"total_memory_mb_usage\" : 14," + EOL + + " \"total_vcpus_usage\" : 3," + EOL + " \"total_local_gb_usage\" : 66," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"total_hours\" : \"totalhours\"," + EOL + + " \"server_usages\" : [ {" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"instance_id\" : \"instanceid\"," + EOL + + " \"started_at\" : \"startedat\"," + EOL + " \"ended_at\" : \"endedat\"," + EOL + + " \"memory_mb\" : 90," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"local_gb\" : 11" + EOL + " }, {" + EOL + " \"uptime\" : 78," + EOL + + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " }, {" + + EOL + " \"start\" : \"start\"," + EOL + " \"stop\" : \"stop\"," + EOL + + " \"total_memory_mb_usage\" : 14," + EOL + " \"total_vcpus_usage\" : 3," + EOL + + " \"total_local_gb_usage\" : 66," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"total_hours\" : \"totalhours\"," + EOL + " \"server_usages\" : [ {" + EOL + + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " }, {" + EOL + + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " } ]" + + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -130,13 +83,14 @@ public class SimpleTenantUsagesTest { public void testMethods() throws Exception { SimpleTenantUsages simpletenantusages = objectMapper.readValue(JSON_FULL, SimpleTenantUsages.class); simpletenantusages.toString(); - + List list = simpletenantusages.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") SimpleTenantUsage x : simpletenantusages) { + for (@SuppressWarnings("unused") + SimpleTenantUsage x : simpletenantusages) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java index e894375..635eabd 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,14 @@ public class SnapshotForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshot\" : {" + EOL - + " \"force\" : false," + EOL - + " \"volume_id\" : \"volumeid\"," + EOL - + " \"display_name\" : \"name\"," + EOL - + " \"display_description\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshot\" : {" + EOL + " \"force\" : false," + EOL + + " \"volume_id\" : \"volumeid\"," + EOL + " \"display_name\" : \"name\"," + EOL + + " \"display_description\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,19 +56,19 @@ public class SnapshotForCreateTest { public void testMethods() throws Exception { SnapshotForCreate snapshotforcreate = objectMapper.readValue(JSON_FULL, SnapshotForCreate.class); snapshotforcreate.toString(); - + String name = snapshotforcreate.getName(); Assert.assertNotNull(name); snapshotforcreate.setName(name); - + String volumeId = snapshotforcreate.getVolumeId(); Assert.assertNotNull(volumeId); snapshotforcreate.setVolumeId(volumeId); - + String description = snapshotforcreate.getDescription(); Assert.assertNotNull(description); snapshotforcreate.setDescription(description); - + Boolean force = snapshotforcreate.getForce(); Assert.assertNotNull(force); snapshotforcreate.setForce(force); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java index 23e152c..d177c2e 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,25 +33,15 @@ public class SnapshotTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshot\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshot\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL + + " \"displayDescription\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -68,25 +57,25 @@ public class SnapshotTest { public void testMethods() throws Exception { Snapshot snapshot = objectMapper.readValue(JSON_FULL, Snapshot.class); snapshot.toString(); - + String createdAt = snapshot.getCreatedAt(); Assert.assertNotNull(createdAt); - + Integer size = snapshot.getSize(); Assert.assertNotNull(size); - + String name = snapshot.getName(); Assert.assertNotNull(name); - + String volumeId = snapshot.getVolumeId(); Assert.assertNotNull(volumeId); - + String description = snapshot.getDescription(); Assert.assertNotNull(description); - + String id = snapshot.getId(); Assert.assertNotNull(id); - + String status = snapshot.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java index c4e56b5..1b248b2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,31 +34,17 @@ public class SnapshotsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshots\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshots\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL + + " \"displayDescription\" : \"description\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL + + " \"displayDescription\" : \"description\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -76,13 +60,14 @@ public class SnapshotsTest { public void testMethods() throws Exception { Snapshots snapshots = objectMapper.readValue(JSON_FULL, Snapshots.class); snapshots.toString(); - + List list = snapshots.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Snapshot x : snapshots) { + for (@SuppressWarnings("unused") + Snapshot x : snapshots) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java index 3b433a4..e7f2199 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Start; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class StartTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-start\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-start\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java index b9989b8..6af28ea 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Stop; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class StopTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-stop\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-stop\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java index b885ffe..57f43f8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Suspend; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class SuspendTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"suspend\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"suspend\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java index e6f8a05..9f050a0 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unlock; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnlockTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unlock\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unlock\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java index 924eb2a..d348db8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unpause; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnpauseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unpause\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unpause\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java index 2945ee5..d634ce3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unrescue; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnrescueTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unrescue\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unrescue\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java index 36cf35a..6835fa7 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.VncConsole; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,20 +34,13 @@ public class VncConsoleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"console\" : {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"url\" : \"url\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"console\" : {" + EOL + " \"type\" : \"type\"," + EOL + + " \"url\" : \"url\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,10 +56,10 @@ public class VncConsoleTest { public void testMethods() throws Exception { VncConsole vncconsole = objectMapper.readValue(JSON_FULL, VncConsole.class); vncconsole.toString(); - + String type = vncconsole.getType(); Assert.assertNotNull(type); - + String url = vncconsole.getUrl(); Assert.assertNotNull(url); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java index b051d52..37dfd64 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,14 @@ public class VolumeAttachmentTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumeAttachment\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumeAttachment\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,19 +56,19 @@ public class VolumeAttachmentTest { public void testMethods() throws Exception { VolumeAttachment volumeattachment = objectMapper.readValue(JSON_FULL, VolumeAttachment.class); volumeattachment.toString(); - + String volumeId = volumeattachment.getVolumeId(); Assert.assertNotNull(volumeId); volumeattachment.setVolumeId(volumeId); - + String id = volumeattachment.getId(); Assert.assertNotNull(id); volumeattachment.setId(id); - + String device = volumeattachment.getDevice(); Assert.assertNotNull(device); volumeattachment.setDevice(device); - + String serverId = volumeattachment.getServerId(); Assert.assertNotNull(serverId); volumeattachment.setServerId(serverId); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java index f409aa2..441d498 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class VolumeAttachmentsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumeAttachments\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumeAttachments\" : [ {" + EOL + " \"id\" : \"id\"," + + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +58,14 @@ public class VolumeAttachmentsTest { public void testMethods() throws Exception { VolumeAttachments volumeattachments = objectMapper.readValue(JSON_FULL, VolumeAttachments.class); volumeattachments.toString(); - + List list = volumeattachments.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") VolumeAttachment x : volumeattachments) { + for (@SuppressWarnings("unused") + VolumeAttachment x : volumeattachments) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java index 7654cef..0c7dab7 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,27 +34,17 @@ public class VolumeForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume\" : {" + EOL - + " \"size\" : 61," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"display_name\" : \"name\"," + EOL - + " \"display_description\" : \"description\"," + EOL - + " \"snapshot_id\" : 3" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"volume\" : {" + EOL + " \"size\" : 61," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"display_name\" : \"name\"," + EOL + " \"display_description\" : \"description\"," + EOL + + " \"snapshot_id\" : 3" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -72,28 +60,28 @@ public class VolumeForCreateTest { public void testMethods() throws Exception { VolumeForCreate volumeforcreate = objectMapper.readValue(JSON_FULL, VolumeForCreate.class); volumeforcreate.toString(); - - Map metadata = volumeforcreate.getMetadata(); + + Map metadata = volumeforcreate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); volumeforcreate.setMetadata(metadata); - + Integer snapshotId = volumeforcreate.getSnapshotId(); Assert.assertNotNull(snapshotId); volumeforcreate.setSnapshotId(snapshotId); - + Integer size = volumeforcreate.getSize(); Assert.assertNotNull(size); volumeforcreate.setSize(size); - + String name = volumeforcreate.getName(); Assert.assertNotNull(name); volumeforcreate.setName(name); - + String description = volumeforcreate.getDescription(); Assert.assertNotNull(description); volumeforcreate.setDescription(description); - + String availabilityZone = volumeforcreate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); volumeforcreate.setAvailabilityZone(availabilityZone); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java index 98a3e1a..b9be30d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,24 +33,16 @@ public class VolumeForImageCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-volume_upload_image\" : {" + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"force\" : false," + EOL - + " \"container_format\" : \"container_format\"," + EOL - + " \"disk_format\" : \"disk_format\"," + EOL - + " \"image_name\" : \"image_name\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-volume_upload_image\" : {" + EOL + + " \"volumeId\" : \"volumeid\"," + EOL + " \"tenantId\" : \"tenantid\"," + EOL + + " \"force\" : false," + EOL + " \"container_format\" : \"container_format\"," + EOL + + " \"disk_format\" : \"disk_format\"," + EOL + " \"image_name\" : \"image_name\"" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -67,27 +58,27 @@ public class VolumeForImageCreateTest { public void testMethods() throws Exception { VolumeForImageCreate volumeforimagecreate = objectMapper.readValue(JSON_FULL, VolumeForImageCreate.class); volumeforimagecreate.toString(); - + String image_name = volumeforimagecreate.getImage_name(); Assert.assertNotNull(image_name); volumeforimagecreate.setImage_name(image_name); - + String tenantId = volumeforimagecreate.getTenantId(); Assert.assertNotNull(tenantId); volumeforimagecreate.setTenantId(tenantId); - + String volumeId = volumeforimagecreate.getVolumeId(); Assert.assertNotNull(volumeId); volumeforimagecreate.setVolumeId(volumeId); - + String disk_format = volumeforimagecreate.getDisk_format(); Assert.assertNotNull(disk_format); volumeforimagecreate.setDisk_format(disk_format); - + Boolean force = volumeforimagecreate.getForce(); Assert.assertNotNull(force); volumeforimagecreate.setForce(force); - + String container_format = volumeforimagecreate.getContainer_format(); Assert.assertNotNull(container_format); volumeforimagecreate.setContainer_format(container_format); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java index bf1a7e1..053821c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java @@ -24,10 +24,9 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - +import java.util.Date; import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,38 +36,22 @@ public class VolumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"," + EOL - + " \"volumeType\" : \"volumetype\"," + EOL - + " \"snapshotId\" : \"snapshotid\"," + EOL - + " \"attachments\" : [ {" + EOL - + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL - + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL - + " }, {" + EOL - + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL - + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"size\" : 61," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"volume\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"," + EOL + + " \"volumeType\" : \"volumetype\"," + EOL + " \"snapshotId\" : \"snapshotid\"," + EOL + + " \"attachments\" : [ {" + EOL + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL + + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL + + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL + + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL + + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " }" + + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -84,39 +67,39 @@ public class VolumeTest { public void testMethods() throws Exception { Volume volume = objectMapper.readValue(JSON_FULL, Volume.class); volume.toString(); - + String volumeType = volume.getVolumeType(); Assert.assertNotNull(volumeType); - + String createdAt = volume.getCreatedAt(); Assert.assertNotNull(createdAt); - - Map metadata = volume.getMetadata(); + + Map metadata = volume.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - - List> attachments = volume.getAttachments(); + + List> attachments = volume.getAttachments(); Assert.assertNotNull(attachments); Assert.assertEquals(2, attachments.size()); - + String snapshotId = volume.getSnapshotId(); Assert.assertNotNull(snapshotId); - + Integer size = volume.getSize(); Assert.assertNotNull(size); - + String name = volume.getName(); Assert.assertNotNull(name); - + String description = volume.getDescription(); Assert.assertNotNull(description); - + String id = volume.getId(); Assert.assertNotNull(id); - + String availabilityZone = volume.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String status = volume.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java index 9033b9e..a2f78f1 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -33,17 +32,12 @@ public class VolumeTypeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume-type\" : { }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"volume-type\" : { }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java index 73f84b2..0e07453 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,15 +34,11 @@ public class VolumeTypesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume-types\" : [ { }, { } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volume-types\" : [ { }, { } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,13 +54,14 @@ public class VolumeTypesTest { public void testMethods() throws Exception { VolumeTypes volumetypes = objectMapper.readValue(JSON_FULL, VolumeTypes.class); volumetypes.toString(); - + List list = volumetypes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") VolumeType x : volumetypes) { + for (@SuppressWarnings("unused") + VolumeType x : volumetypes) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java index 6729cc4..ccc28b5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,57 +34,31 @@ public class VolumesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumes\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"," + EOL - + " \"volumeType\" : \"volumetype\"," + EOL - + " \"snapshotId\" : \"snapshotid\"," + EOL - + " \"attachments\" : [ {" + EOL - + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL - + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL - + " }, {" + EOL - + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL - + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"size\" : 61," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"," + EOL - + " \"volumeType\" : \"volumetype\"," + EOL - + " \"snapshotId\" : \"snapshotid\"," + EOL - + " \"attachments\" : [ {" + EOL - + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL - + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL - + " }, {" + EOL - + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL - + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"size\" : 61," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumes\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"," + EOL + + " \"volumeType\" : \"volumetype\"," + EOL + " \"snapshotId\" : \"snapshotid\"," + EOL + + " \"attachments\" : [ {" + EOL + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL + + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL + + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL + + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL + + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " }, {" + + EOL + " \"id\" : \"id\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"availabilityZone\" : \"availabilityzone\"," + EOL + " \"volumeType\" : \"volumetype\"," + EOL + + " \"snapshotId\" : \"snapshotid\"," + EOL + " \"attachments\" : [ {" + EOL + + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL + + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL + + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL + + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL + + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " } ]" + + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -102,13 +74,14 @@ public class VolumesTest { public void testMethods() throws Exception { Volumes volumes = objectMapper.readValue(JSON_FULL, Volumes.class); volumes.toString(); - + List list = volumes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Volume x : volumes) { + for (@SuppressWarnings("unused") + Volume x : volumes) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/openstack-client-connectors/http-connector/pom.xml b/openstack-client-connectors/http-connector/pom.xml index c62be3a..5e1dcd8 100644 --- a/openstack-client-connectors/http-connector/pom.xml +++ b/openstack-client-connectors/http-connector/pom.xml @@ -1,34 +1,34 @@ - 4.0.0 - - org.onap.so.libs.openstack-java-sdk - client-connectors - 1.4.0-SNAPSHOT - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.onap.so.libs.openstack-java-sdk + client-connectors + 1.4.0-SNAPSHOT + - org.onap.so.libs.openstack-java-sdk.client-connectors - http-connector - OpenStack HTTP-Client Connector - OpenStack HTTP-Client Connector - - - org.apache.httpcomponents - httpclient - - - org.apache.httpcomponents - httpcore - - - org.slf4j - slf4j-api - 1.7.25 - - - ch.qos.logback - logback-classic - 1.2.3 - - + org.onap.so.libs.openstack-java-sdk.client-connectors + http-connector + OpenStack HTTP-Client Connector + OpenStack HTTP-Client Connector + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + org.slf4j + slf4j-api + 1.7.25 + + + ch.qos.logback + logback-classic + 1.2.3 + + diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java index 27bbe87..418268b 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java @@ -1,27 +1,20 @@ -/* - * ONAP-SO - * ============LICENSE_START========================================== - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== +/*- + * ============LICENSE_START======================================================= * 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 + * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * + * ============LICENSE_END========================================================= */ + package com.woorea.openstack.connector; import java.io.IOException; @@ -30,7 +23,6 @@ import java.net.URISyntaxException; import java.net.UnknownHostException; import java.util.List; import java.util.Map.Entry; - import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; import org.apache.http.client.HttpResponseException; @@ -47,7 +39,6 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.core.JsonProcessingException; @@ -85,7 +76,7 @@ public class HttpClientConnector implements OpenStackClientConnector { WRAPPED_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); } - protected static ObjectMapper getObjectMapper (Class type) { + protected static ObjectMapper getObjectMapper(Class type) { return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; } @@ -105,7 +96,7 @@ public class HttpClientConnector implements OpenStackClientConnector { uri = uriBuilder.build(); } catch (URISyntaxException e) { - throw new HttpClientException (e); + throw new HttpClientException(e); } HttpEntity entity = null; @@ -114,17 +105,18 @@ public class HttpClientConnector implements OpenStackClientConnector { try { // Get appropriate mapper, based on existence of a root element in Entity class - ObjectMapper mapper = getObjectMapper (request.entity().getEntity().getClass()); + ObjectMapper mapper = getObjectMapper(request.entity().getEntity().getClass()); - String entityJson = mapper.writeValueAsString (request.entity().getEntity()); + String entityJson = mapper.writeValueAsString(request.entity().getEntity()); entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType())); - logger.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\"")); + logger.debug("Request JSON Body: " + + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\"")); } catch (JsonProcessingException e) { - throw new HttpClientException ("Json processing error on request entity", e); + throw new HttpClientException("Json processing error on request entity", e); } catch (IOException e) { - throw new HttpClientException ("Json IO error on request entity", e); + throw new HttpClientException("Json IO error on request entity", e); } } @@ -141,52 +133,46 @@ public class HttpClientConnector implements OpenStackClientConnector { httpRequest.addHeader(h.getKey(), sb.toString()); } - logger.debug ("Sending HTTP request: " + httpRequest.toString()); + logger.debug("Sending HTTP request: " + httpRequest.toString()); - // Get the Response. But don't get the body entity yet, as this response - // will be wrapped in an HttpClientResponse. The HttpClientResponse + // Get the Response. But don't get the body entity yet, as this response + // will be wrapped in an HttpClientResponse. The HttpClientResponse // buffers the body in constructor, so can close the response here. HttpClientResponse httpClientResponse = null; CloseableHttpResponse httpResponse = null; // Catch known HttpClient exceptions, and wrap them in OpenStack Client Exceptions - // so calling functions can distinguish. Only RuntimeExceptions are allowed. + // so calling functions can distinguish. Only RuntimeExceptions are allowed. try { httpResponse = httpClient.execute(httpRequest); - logger.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode()); + logger.debug("Response status: " + httpResponse.getStatusLine().getStatusCode()); - httpClientResponse = new HttpClientResponse (httpResponse); + httpClientResponse = new HttpClientResponse(httpResponse); int status = httpResponse.getStatusLine().getStatusCode(); - if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED || - status == HttpStatus.SC_NO_CONTENT || status == HttpStatus.SC_ACCEPTED) - { + if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED || status == HttpStatus.SC_NO_CONTENT + || status == HttpStatus.SC_ACCEPTED) { return httpClientResponse; } - } - catch (HttpResponseException e) { - // What exactly does this mean? It does not appear to get thrown for + } catch (HttpResponseException e) { + // What exactly does this mean? It does not appear to get thrown for // non-2XX responses as documented. - logger.error ("HttpResponseException: " +e.getMessage()); + logger.error("HttpResponseException: " + e.getMessage()); throw new OpenStackResponseException(e.getMessage(), e.getStatusCode()); - } - catch (UnknownHostException e) { - logger.error ("Unknown Host: " +e.getMessage()); + } catch (UnknownHostException e) { + logger.error("Unknown Host: " + e.getMessage()); throw new OpenStackConnectException("Unknown Host: " + e.getMessage()); - } - catch (IOException e) { - logger.error ("IOException: " +e.getMessage()); + } catch (IOException e) { + logger.error("IOException: " + e.getMessage()); // Catch all other IOExceptions and throw as OpenStackConnectException throw new OpenStackConnectException(e.getMessage()); - } - catch (Exception e) { + } catch (Exception e) { // Catchall for anything else, must throw as a RuntimeException - logger.error ("Unexpected client exception: " +e.getMessage()); + logger.error("Unexpected client exception: " + e.getMessage()); throw new RuntimeException("Unexpected client exception", e); - } - finally { - // Have the body. Close the stream + } finally { + // Have the body. Close the stream if (httpResponse != null) try { httpResponse.close(); @@ -197,8 +183,7 @@ public class HttpClientConnector implements OpenStackClientConnector { // Get here on an error response (4XX-5XX) throw new OpenStackResponseException(httpResponse.getStatusLine().getReasonPhrase(), - httpResponse.getStatusLine().getStatusCode(), - httpClientResponse); + httpResponse.getStatusLine().getStatusCode(), httpClientResponse); } private HttpUriRequest getHttpUriRequest(OpenStackRequest request, URI uri, HttpEntity entity) { @@ -206,7 +191,7 @@ public class HttpClientConnector implements OpenStackClientConnector { switch (request.method()) { case POST: HttpPost post = new HttpPost(uri); - post.setEntity (entity); + post.setEntity(entity); httpRequest = post; break; @@ -216,7 +201,7 @@ public class HttpClientConnector implements OpenStackClientConnector { case PUT: HttpPut put = new HttpPut(uri); - put.setEntity (entity); + put.setEntity(entity); httpRequest = put; break; @@ -231,11 +216,11 @@ public class HttpClientConnector implements OpenStackClientConnector { } private void setUriBuilderParams(OpenStackRequest request, URIBuilder uriBuilder) { - for(Entry> entry : request.queryParams().entrySet()) { + for (Entry> entry : request.queryParams().entrySet()) { for (Object o : entry.getValue()) { uriBuilder.setParameter(entry.getKey(), String.valueOf(o)); } } } -} \ No newline at end of file +} diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientException.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientException.java index ecdc1d7..b2e08b4 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientException.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientException.java @@ -1,39 +1,39 @@ -/*- - * ============LICENSE_START======================================================= - * 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.connector; - -/* - * Declare a RuntimeException since the Interface does not declare any - * throwables. Any caught exception will be wrapped in HttpClientException - */ -public class HttpClientException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - public HttpClientException (String s) { - super (s); - } - - public HttpClientException (Exception e) { - super ("Caught nested exception in HttpClient", e); - } - - public HttpClientException (String s, Exception e) { - super (s, e); - } -} \ No newline at end of file +/*- + * ============LICENSE_START======================================================= + * 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.connector; + +/* + * Declare a RuntimeException since the Interface does not declare any throwables. Any caught exception will be wrapped + * in HttpClientException + */ +public class HttpClientException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public HttpClientException(String s) { + super(s); + } + + public HttpClientException(Exception e) { + super("Caught nested exception in HttpClient", e); + } + + public HttpClientException(String s, Exception e) { + super(s, e); + } +} diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java index c611e13..4c5946d 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java @@ -1,103 +1,92 @@ -/*- - * ============LICENSE_START======================================================= - * 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.connector; - -import java.net.URI; - -import org.apache.http.HttpRequest; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.ProtocolException; -import org.apache.http.annotation.Immutable; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.client.methods.RequestBuilder; -import org.apache.http.impl.client.DefaultRedirectStrategy; -import org.apache.http.protocol.HttpContext; - -/** - * Custom {@link org.apache.http.client.RedirectStrategy} implementation - * that automatically redirects all HEAD, GET and DELETE requests. - * The {@link org.apache.http.client.DefaultRedirectStrategy} only - * redirects GET and HEAD automatically, per the HTTP specification - * (POST and PUT typically have bodies and thus cannot be redirected). - * - * A custom strategy is needed for the Openstack API, which can also send - * 302 on a DELETE (by name) request, expecting the client to follow the - * redirect to perform the actual deletion. - */ -@Immutable -public class HttpClientRedirectStrategy extends DefaultRedirectStrategy { - - /** - * Redirectable methods. - */ - private static final String[] REDIRECT_METHODS = new String[] { - HttpGet.METHOD_NAME, - HttpDelete.METHOD_NAME, - HttpHead.METHOD_NAME - }; - - /** - * Determine if the request should be redirected. - * This may not actually be needed, since the REDIRECT_METHODS - * array has been updated with the DELETE. - */ - @Override - protected boolean isRedirectable(final String method) { - for (final String m: REDIRECT_METHODS) { - if (m.equalsIgnoreCase(method)) { - return true; - } - } - return false; - } - - /** - * Override the default redirect handling method. As implemented - * in HttpClient, it does not preserve the method on 301 or 302 - * responses, always redirecting to a GET. - */ - @Override - public HttpUriRequest getRedirect( - final HttpRequest request, - final HttpResponse response, - final HttpContext context) throws ProtocolException { - - final URI uri = getLocationURI(request, response, context); - final String method = request.getRequestLine().getMethod(); - if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) { - return new HttpHead(uri); - } else if (method.equalsIgnoreCase(HttpGet.METHOD_NAME)) { - return new HttpGet(uri); - } else { - - final int status = response.getStatusLine().getStatusCode(); - - HttpUriRequest newRequest; - if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) { - newRequest = RequestBuilder.copy(request).setUri(uri).build(); - } else { - newRequest = new HttpGet(uri); - } - return newRequest; - } - } -} \ No newline at end of file +/*- + * ============LICENSE_START======================================================= + * 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.connector; + +import java.net.URI; +import org.apache.http.HttpRequest; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.ProtocolException; +import org.apache.http.annotation.Immutable; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpHead; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.client.methods.RequestBuilder; +import org.apache.http.impl.client.DefaultRedirectStrategy; +import org.apache.http.protocol.HttpContext; + +/** + * Custom {@link org.apache.http.client.RedirectStrategy} implementation that automatically redirects all HEAD, GET and + * DELETE requests. The {@link org.apache.http.client.DefaultRedirectStrategy} only redirects GET and HEAD + * automatically, per the HTTP specification (POST and PUT typically have bodies and thus cannot be redirected). + * + * A custom strategy is needed for the Openstack API, which can also send 302 on a DELETE (by name) request, expecting + * the client to follow the redirect to perform the actual deletion. + */ +@Immutable +public class HttpClientRedirectStrategy extends DefaultRedirectStrategy { + + /** + * Redirectable methods. + */ + private static final String[] REDIRECT_METHODS = + new String[] {HttpGet.METHOD_NAME, HttpDelete.METHOD_NAME, HttpHead.METHOD_NAME}; + + /** + * Determine if the request should be redirected. This may not actually be needed, since the REDIRECT_METHODS array + * has been updated with the DELETE. + */ + @Override + protected boolean isRedirectable(final String method) { + for (final String m : REDIRECT_METHODS) { + if (m.equalsIgnoreCase(method)) { + return true; + } + } + return false; + } + + /** + * Override the default redirect handling method. As implemented in HttpClient, it does not preserve the method on + * 301 or 302 responses, always redirecting to a GET. + */ + @Override + public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context) + throws ProtocolException { + + final URI uri = getLocationURI(request, response, context); + final String method = request.getRequestLine().getMethod(); + if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) { + return new HttpHead(uri); + } else if (method.equalsIgnoreCase(HttpGet.METHOD_NAME)) { + return new HttpGet(uri); + } else { + + final int status = response.getStatusLine().getStatusCode(); + + HttpUriRequest newRequest; + if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) { + newRequest = RequestBuilder.copy(request).setUri(uri).build(); + } else { + newRequest = new HttpGet(uri); + } + return newRequest; + } + } +} diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientResponse.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientResponse.java index f1c8c78..24541cd 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientResponse.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientResponse.java @@ -21,10 +21,8 @@ import org.apache.http.Header; import org.apache.http.HttpResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.base.client.OpenStackResponse; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -39,14 +37,13 @@ public class HttpClientResponse implements OpenStackResponse { private HttpResponse response = null; private String entityBody = null; - public HttpClientResponse(HttpResponse response) - { + public HttpClientResponse(HttpResponse response) { this.response = response; // Read the body so InputStream can be closed if (response.getEntity() == null) { // No body - logger.debug ("No Response Body"); + logger.debug("No Response Body"); return; } @@ -54,23 +51,23 @@ public class HttpClientResponse implements OpenStackResponse { try { response.getEntity().writeTo(responseBody); } catch (IOException e) { - throw new HttpClientException ("Error Reading Response Body", e); + throw new HttpClientException("Error Reading Response Body", e); } entityBody = responseBody.toString(); - logger.debug (entityBody); + logger.debug(entityBody); } @Override - public T getEntity (Class returnType) { + public T getEntity(Class returnType) { // Get appropriate mapper, based on existence of a root element - ObjectMapper mapper = HttpClientConnector.getObjectMapper (returnType); + ObjectMapper mapper = HttpClientConnector.getObjectMapper(returnType); T resp = null; try { resp = mapper.readValue(entityBody, returnType); } catch (Exception e) { - throw new HttpClientException ("Caught exception in getEntity", e); + throw new HttpClientException("Caught exception in getEntity", e); } return resp; } @@ -82,7 +79,7 @@ public class HttpClientResponse implements OpenStackResponse { @Override public InputStream getInputStream() { - return new ByteArrayInputStream (entityBody.getBytes()); + return new ByteArrayInputStream(entityBody.getBytes()); } @Override @@ -102,4 +99,4 @@ public class HttpClientResponse implements OpenStackResponse { return headers; } -} \ No newline at end of file +} diff --git a/openstack-client-connectors/pom.xml b/openstack-client-connectors/pom.xml index 133e7f1..7017c1d 100644 --- a/openstack-client-connectors/pom.xml +++ b/openstack-client-connectors/pom.xml @@ -1,31 +1,32 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - client-connectors - OpenStack Client Connectors - OpenStack Client Connectors - pom - - - http - - true - - - http-connector - - - - - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - - + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + client-connectors + OpenStack Client Connectors + OpenStack Client Connectors + pom + + + http + + true + + + http-connector + + + + + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + + diff --git a/openstack-client/pom.xml b/openstack-client/pom.xml index 8e4b6b0..302f176 100644 --- a/openstack-client/pom.xml +++ b/openstack-client/pom.xml @@ -1,53 +1,53 @@ - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - openstack-client - OpenStack Client - OpenStack Client + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + openstack-client + OpenStack Client + OpenStack Client - - - junit - junit - test - - - org.mockito - mockito-all - test - - - org.powermock - powermock-api-mockito - test - - + + + junit + junit + test + + + org.mockito + mockito-all + test + + + org.powermock + powermock-api-mockito + test + + - - - - org.apache.maven.plugins - maven-jar-plugin - 3.0.2 - - - test-jar - - test-jar - - - false - - - - - - + + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + test-jar + + test-jar + + + false + + + + + + diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java index 53d2595..bcb7d51 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java @@ -1,40 +1,39 @@ -/*- - * ============LICENSE_START======================================================= - * 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.base.client; - -/** - * A common abstract parent of all Openstack Exception types, allowing - * calling classes the choice to catch all error exceptions together. - */ -public abstract class OpenStackBaseException extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - /* - * Implement only the basic constructors - */ - public OpenStackBaseException () {} - - public OpenStackBaseException(String message) { - super(message); - } - - public OpenStackBaseException(String message, Throwable cause) { - super(message, cause); - } -} \ No newline at end of file +/*- + * ============LICENSE_START======================================================= + * 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.base.client; + +/** + * A common abstract parent of all Openstack Exception types, allowing calling classes the choice to catch all error + * exceptions together. + */ +public abstract class OpenStackBaseException extends RuntimeException { + private static final long serialVersionUID = 1L; + + /* + * Implement only the basic constructors + */ + public OpenStackBaseException() {} + + public OpenStackBaseException(String message) { + super(message); + } + + public OpenStackBaseException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java index a111975..8c61b30 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java @@ -70,23 +70,24 @@ public class OpenStackClient { try { return connector.request(request); } catch (OpenStackResponseException e) { - if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED - || tokenProvider == null) { + if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED || tokenProvider == null) { throw e; } authException = e; tokenProvider.expireToken(); } } - if(null == authException){ - authException = new OpenStackResponseException("Unknown issue",500); + if (null == authException) { + authException = new OpenStackResponseException("Unknown issue", 500); } throw authException; } public T execute(OpenStackRequest request) { - OpenStackResponse response = request(request); - return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null; + OpenStackResponse response = request(request); + return (request.returnType() != null && request.returnType() != Void.class) + ? response.getEntity(request.returnType()) + : null; } public void property(String property, String value) { @@ -105,4 +106,4 @@ public class OpenStackClient { return new OpenStackRequest<>(this, HttpMethod.GET, path, null, returnType); } -} \ No newline at end of file +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackConnectException.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackConnectException.java index 0e29335..30d6722 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackConnectException.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackConnectException.java @@ -18,9 +18,8 @@ package com.woorea.openstack.base.client; /** - * Custom RuntimeException to report connection errors to Openstack endpoints. - * Must be a RuntimeException to conform with OpenstackClient interface, which - * does not declare specific Exceptions. + * Custom RuntimeException to report connection errors to Openstack endpoints. Must be a RuntimeException to conform + * with OpenstackClient interface, which does not declare specific Exceptions. */ public class OpenStackConnectException extends OpenStackBaseException { @@ -33,4 +32,4 @@ public class OpenStackConnectException extends OpenStackBaseException { public OpenStackConnectException(String message, Throwable cause) { super(message, cause); } -} \ No newline at end of file +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java index 07b6f70..d896837 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java @@ -25,137 +25,137 @@ import java.util.Map; public class OpenStackRequest { - private OpenStackClient client; + private OpenStackClient client; - private String endpoint; - - private HttpMethod method; + private String endpoint; + + private HttpMethod method; - private StringBuilder path = new StringBuilder(); + private StringBuilder path = new StringBuilder(); - private Map> headers = new HashMap<>(); + private Map> headers = new HashMap<>(); - private Entity entity; + private Entity entity; - private Class returnType; + private Class returnType; - public OpenStackRequest() { - - } - - public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity entity, - Class returnType) { - this.client = client; - this.method = method; - this.path = new StringBuilder(path); - this.entity = entity; - this.returnType = returnType; - header("Accept", "application/json"); - } - - public OpenStackRequest endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - public String endpoint() { - return endpoint; - } - - public OpenStackRequest method(HttpMethod method) { - this.method = method; - return this; - } - - public HttpMethod method() { - return method; - } - - public OpenStackRequest path(String path) { - this.path.append(path); - return this; - } - - public String path() { - return path.toString(); - } - - public OpenStackRequest header(String name, Object value) { - if (value != null) { - headers.put(name, Arrays.asList(value)); - } - return this; - } - - public Map> headers() { - return headers; - } - - public Entity entity(T entity, String contentType) { - return new Entity<>(entity, contentType); - } - - public Entity entity() { - return entity; - } - - public Entity json(T entity) { - return entity(entity, "application/json"); - } - - public void returnType(Class returnType) { - this.returnType = returnType; - } - - public Class returnType() { - return returnType; - } - - public R execute() { - return client.execute(this); - } - - public OpenStackResponse request() { - return client.request(this); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method + ", path=" + path + ", headers=" - + headers + ", entity=" + entity + ", returnType=" + returnType + "]"; - } - - private Map> queryParams = new LinkedHashMap<>(); - - public Map> queryParams() { - return queryParams; - } - - public OpenStackRequest queryParam(String key, Object value) { - if (value != null) { - if (queryParams.containsKey(key)) { - List values = queryParams.get(key); - values.add(value); - } else { - List values = new ArrayList<>(); - values.add(value); - queryParams.put(key, values); - } - } - return this; - } - - protected static String buildPath(String... elements) { - StringBuilder stringBuilder = new StringBuilder(); - for (String element : elements) { - stringBuilder.append(element); - } - - return stringBuilder.toString(); - } + public OpenStackRequest() { + + } + + public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity entity, + Class returnType) { + this.client = client; + this.method = method; + this.path = new StringBuilder(path); + this.entity = entity; + this.returnType = returnType; + header("Accept", "application/json"); + } + + public OpenStackRequest endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + public String endpoint() { + return endpoint; + } + + public OpenStackRequest method(HttpMethod method) { + this.method = method; + return this; + } + + public HttpMethod method() { + return method; + } + + public OpenStackRequest path(String path) { + this.path.append(path); + return this; + } + + public String path() { + return path.toString(); + } + + public OpenStackRequest header(String name, Object value) { + if (value != null) { + headers.put(name, Arrays.asList(value)); + } + return this; + } + + public Map> headers() { + return headers; + } + + public Entity entity(T entity, String contentType) { + return new Entity<>(entity, contentType); + } + + public Entity entity() { + return entity; + } + + public Entity json(T entity) { + return entity(entity, "application/json"); + } + + public void returnType(Class returnType) { + this.returnType = returnType; + } + + public Class returnType() { + return returnType; + } + + public R execute() { + return client.execute(this); + } + + public OpenStackResponse request() { + return client.request(this); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method + ", path=" + path + ", headers=" + + headers + ", entity=" + entity + ", returnType=" + returnType + "]"; + } + + private Map> queryParams = new LinkedHashMap<>(); + + public Map> queryParams() { + return queryParams; + } + + public OpenStackRequest queryParam(String key, Object value) { + if (value != null) { + if (queryParams.containsKey(key)) { + List values = queryParams.get(key); + values.add(value); + } else { + List values = new ArrayList<>(); + values.add(value); + queryParams.put(key, values); + } + } + return this; + } + + protected static String buildPath(String... elements) { + StringBuilder stringBuilder = new StringBuilder(); + for (String element : elements) { + stringBuilder.append(element); + } + + return stringBuilder.toString(); + } } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java index 0add524..dfc1d13 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java @@ -32,7 +32,7 @@ public interface OpenStackResponse { public InputStream getInputStream(); public String header(String name); - + public Map headers(); - + } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java index e8b1e87..1d7f29b 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java @@ -56,4 +56,4 @@ public class OpenStackResponseException extends OpenStackBaseException { return response; } -} \ No newline at end of file +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java index 73204e9..aa552ad 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java @@ -18,7 +18,7 @@ package com.woorea.openstack.base.client; public class OpenStackResponseStatus { - private OpenStackResponseStatus(){ + private OpenStackResponseStatus() { } @@ -28,4 +28,4 @@ public class OpenStackResponseStatus { public static final int CONFLICT = 409; -} \ No newline at end of file +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java index a7dd2e5..74b92a1 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java @@ -30,7 +30,6 @@ public class OpenStackSimpleTokenProvider implements OpenStackTokenProvider { } @Override - public void expireToken() { - } + public void expireToken() {} } diff --git a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java index 618adb5..edef0a9 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java +++ b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java @@ -14,4 +14,4 @@ * ============LICENSE_END========================================================= */ -package com.woorea.openstack.common.session; \ No newline at end of file +package com.woorea.openstack.common.session; diff --git a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java index 618adb5..edef0a9 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java +++ b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java @@ -14,4 +14,4 @@ * ============LICENSE_END========================================================= */ -package com.woorea.openstack.common.session; \ No newline at end of file +package com.woorea.openstack.common.session; diff --git a/openstack-client/src/test/java/com/woorea/openstack/base/client/OpenStackClientMockUtils.java b/openstack-client/src/test/java/com/woorea/openstack/base/client/OpenStackClientMockUtils.java index 8ff2634..29580ba 100644 --- a/openstack-client/src/test/java/com/woorea/openstack/base/client/OpenStackClientMockUtils.java +++ b/openstack-client/src/test/java/com/woorea/openstack/base/client/OpenStackClientMockUtils.java @@ -63,9 +63,9 @@ public class OpenStackClientMockUtils { return this; } - public OpenStackClientMockUtils mockRequestThrow(T request, String message, int status) { - Mockito.when(connector.request(Mockito.eq(request))) - .thenThrow(new OpenStackResponseException(message, status)); + public OpenStackClientMockUtils mockRequestThrow(T request, String message, + int status) { + Mockito.when(connector.request(Mockito.eq(request))).thenThrow(new OpenStackResponseException(message, status)); return this; } diff --git a/openstack-client/src/test/java/com/woorea/openstack/base/client/OpenStackClientTest.java b/openstack-client/src/test/java/com/woorea/openstack/base/client/OpenStackClientTest.java index 9a83903..e4a4098 100644 --- a/openstack-client/src/test/java/com/woorea/openstack/base/client/OpenStackClientTest.java +++ b/openstack-client/src/test/java/com/woorea/openstack/base/client/OpenStackClientTest.java @@ -43,11 +43,9 @@ public class OpenStackClientTest { } private OpenStackClientConnector mockClientConnector() { - return OpenStackClientMockUtils.getInstance() - .mockRequestResponse(Entity.class, Entity.json(SUCCESS)) + return OpenStackClientMockUtils.getInstance().mockRequestResponse(Entity.class, Entity.json(SUCCESS)) .mockRequestThrow(notAuthorizedRequest, "Not Authorized", OpenStackResponseStatus.NOT_AUTHORIZED) - .mockRequestThrow(conflictRequest, "Conflict", OpenStackResponseStatus.CONFLICT) - .getConnector(); + .mockRequestThrow(conflictRequest, "Conflict", OpenStackResponseStatus.CONFLICT).getConnector(); } @@ -69,4 +67,4 @@ public class OpenStackClientTest { public void executeConflict() { client.execute(conflictRequest); } -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index b52d50f..15c10d1 100644 --- a/pom.xml +++ b/pom.xml @@ -1,268 +1,385 @@ - - 4.0.0 + + 4.0.0 - - org.onap.oparent - oparent - 1.2.1 - - + + org.onap.oparent + oparent + 1.2.1 + + - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - pom - so-libs - OpenStack Java SDK - - false - https://nexus.onap.org - /content/repositories/snapshots/ - /content/repositories/releases/ - /content/sites/site/org/onap/so/libs/${project.version} - - - - ecomp-releases - OpenECOMP - Release Repository - ${nexusproxy}/${releaseNexusPath} - - - ecomp-snapshots - OpenECOMP - Snapshot Repository - ${nexusproxy}/${snapshotNexusPath} - - - ecomp-site - dav:${nexusproxy}${siteNexusPath} - - - - openstack-client - nova-model - nova-client - keystone-client - swift-client - quantum-client - heat-client - glance-model - glance-client - keystone-model - swift-model - quantum-model - ceilometer-model - ceilometer-client - openstack-client-connectors - heat-model - cinder-model - cinder-client - - - - Apache2 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - 2012 - - - ecomp-staging - https://nexus.onap.org/content/repositories/staging/ - - false - - - - ecomp-public - https://nexus.onap.org/content/repositories/public/ - - false - - - - ecomp-releases - https://nexus.onap.org/content/repositories/releases/ - - false - - - - ecomp-snapshots - https://nexus.onap.org/content/repositories/snapshots/ - - false - - - - central - Maven 2 repository - http://repo2.maven.org/maven2/ - - - - - central - Maven 2 plugin repository - http://repo2.maven.org/maven2/ - - - - - - org.apache.httpcomponents - httpcore - 4.4.4 - compile - - - junit - junit - 4.12 - test - - - org.mockito - mockito-all - 1.10.19 - test - - - org.powermock - powermock-api-mockito - 1.6.2 - test - - - org.powermock - powermock-module-junit4 - 1.6.2 - test - - - org.skyscreamer - jsonassert - 1.4.0 - test - - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - test-jar - test - - - - - - com.fasterxml.jackson.core - jackson-databind - 2.9.6 - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 - - false - org.umlgraph.doclet.UmlGraphDoc - - org.umlgraph - umlgraph - 5.6 - - -views - true - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - - - - - org.apache.maven.plugins - maven-site-plugin - 3.6 - - - org.apache.maven.wagon - wagon-webdav-jackrabbit - 2.10 - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ${nexusproxy} - 176c31dfe190a - ecomp-staging - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - UTF-8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.9 - - - org.apache.maven.plugins - maven-resources-plugin - 2.6 - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - verify - - jar-no-fork - - - - - - + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + pom + so-libs + OpenStack Java SDK + + false + https://nexus.onap.org + /content/repositories/snapshots/ + /content/repositories/releases/ + /content/sites/site/org/onap/so/libs/${project.version} + false + true + + + + ecomp-releases + OpenECOMP - Release Repository + ${nexusproxy}/${releaseNexusPath} + + + ecomp-snapshots + OpenECOMP - Snapshot Repository + ${nexusproxy}/${snapshotNexusPath} + + + ecomp-site + dav:${nexusproxy}${siteNexusPath} + + + + openstack-client + nova-model + nova-client + keystone-client + swift-client + quantum-client + heat-client + glance-model + glance-client + keystone-model + swift-model + quantum-model + ceilometer-model + ceilometer-client + openstack-client-connectors + heat-model + cinder-model + cinder-client + + + + Apache2 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + 2012 + + + ecomp-staging + https://nexus.onap.org/content/repositories/staging/ + + false + + + + ecomp-public + https://nexus.onap.org/content/repositories/public/ + + false + + + + ecomp-releases + https://nexus.onap.org/content/repositories/releases/ + + false + + + + ecomp-snapshots + https://nexus.onap.org/content/repositories/snapshots/ + + false + + + + central + Maven 2 repository + http://repo2.maven.org/maven2/ + + + + + central + Maven 2 plugin repository + http://repo2.maven.org/maven2/ + + + + + + org.apache.httpcomponents + httpcore + 4.4.4 + compile + + + junit + junit + 4.12 + test + + + org.mockito + mockito-all + 1.10.19 + test + + + org.powermock + powermock-api-mockito + 1.6.2 + test + + + org.powermock + powermock-module-junit4 + 1.6.2 + test + + + org.skyscreamer + jsonassert + 1.4.0 + test + + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + test-jar + test + + + + + + format + + true + false + + + + + + com.fasterxml.jackson.core + jackson-databind + 2.9.6 + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + false + org.umlgraph.doclet.UmlGraphDoc + + org.umlgraph + umlgraph + 5.6 + + -views + true + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.6 + + + org.apache.maven.wagon + wagon-webdav-jackrabbit + 2.10 + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ${nexusproxy} + 176c31dfe190a + ecomp-staging + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + UTF-8 + + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.9 + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + verify + + jar-no-fork + + + + + + org.codehaus.gmaven + groovy-maven-plugin + 2.0 + + + + find-basepath + validate + + execute + + + + + + + + + + + net.revelc.code.formatter + formatter-maven-plugin + 2.9.0 + + + format-java + + format + + + ${format.skipExecute} + ${base-path}/project-configs/code-tools/onap-eclipse-format.xml + + + + format-xml + + format + + + ${format.skipExecute} + ${project.basedir} + ${base-path}/project-configs/code-tools/pom-format.properties + + pom.xml + + + + + validate-java + + validate + + + ${format.skipValidate} + ${base-path}/project-configs/code-tools/onap-eclipse-format.xml + + + + validate-poms + + validate + + + ${format.skipValidate} + ${base-path}/project-configs/code-tools/pom-format.properties + + pom.xml + + + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.9.8 + + + + + diff --git a/project-configs/code-tools/findbugs_include_filter.xml b/project-configs/code-tools/findbugs_include_filter.xml new file mode 100644 index 0000000..b1b2fe2 --- /dev/null +++ b/project-configs/code-tools/findbugs_include_filter.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/project-configs/code-tools/oap_checkstyle_1.0.xml b/project-configs/code-tools/oap_checkstyle_1.0.xml new file mode 100644 index 0000000..a3da8e8 --- /dev/null +++ b/project-configs/code-tools/oap_checkstyle_1.0.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project-configs/code-tools/oap_codetemplates_1.0.xml b/project-configs/code-tools/oap_codetemplates_1.0.xml new file mode 100644 index 0000000..1cc1e6e --- /dev/null +++ b/project-configs/code-tools/oap_codetemplates_1.0.xml @@ -0,0 +1,53 @@ + \ No newline at end of file diff --git a/project-configs/code-tools/onap-eclipse-format.xml b/project-configs/code-tools/onap-eclipse-format.xml new file mode 100644 index 0000000..cd13617 --- /dev/null +++ b/project-configs/code-tools/onap-eclipse-format.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project-configs/code-tools/pom-format.properties b/project-configs/code-tools/pom-format.properties new file mode 100644 index 0000000..4452c2a --- /dev/null +++ b/project-configs/code-tools/pom-format.properties @@ -0,0 +1,5 @@ +maxLineLength=120 +wrapLongLines=true +tabInsteadOfSpaces=false +tabWidth=2 +splitMultiAttrs=false \ No newline at end of file diff --git a/quantum-client/pom.xml b/quantum-client/pom.xml index add8703..013b8a3 100644 --- a/quantum-client/pom.xml +++ b/quantum-client/pom.xml @@ -1,31 +1,32 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - quantum-client - OpenStack Quantum Client - OpenStack Quantum Client - - - junit - junit - 4.11 - test - - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - - - org.onap.so.libs.openstack-java-sdk - quantum-model - ${project.version} - - + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + quantum-client + OpenStack Quantum Client + OpenStack Quantum Client + + + junit + junit + 4.11 + test + + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + + + org.onap.so.libs.openstack-java-sdk + quantum-model + ${project.version} + + diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java index ab64531..c4f5e9f 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java @@ -26,42 +26,42 @@ import com.woorea.openstack.quantum.api.SubnetsResource; public class Quantum extends OpenStackClient { - + private final NetworksResource NETWORKS; - + private final PortsResource PORTS; - + private final SubnetsResource SUBNETS; private final RoutersResource ROUTERS; - + public Quantum(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); NETWORKS = new NetworksResource(this); PORTS = new PortsResource(this); SUBNETS = new SubnetsResource(this); - ROUTERS=new RoutersResource(this); - + ROUTERS = new RoutersResource(this); + } - + public Quantum(String endpoint) { this(endpoint, null); } - + public NetworksResource networks() { return NETWORKS; } - + public PortsResource ports() { return PORTS; } - + public SubnetsResource subnets() { return SUBNETS; } - public RoutersResource routers() - { + + public RoutersResource routers() { return ROUTERS; } - + } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java index 8b5ee25..6530237 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java @@ -44,11 +44,11 @@ public class NetworksResource { return new Update(net); } - public Delete delete(String netId){ + public Delete delete(String netId) { return new Delete(netId); } - public Show show(String netId){ + public Show show(String netId) { return new Show(netId); } @@ -62,7 +62,7 @@ public class NetworksResource { public class Query extends OpenStackRequest { public Query(Network network) { - + } } @@ -90,7 +90,7 @@ public class NetworksResource { public class Delete extends OpenStackRequest { - public Delete(String id){ + public Delete(String id) { super(CLIENT, HttpMethod.DELETE, buildPath("networks/", id), null, Void.class); } } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java index a82c111..7ac0c8c 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java @@ -36,19 +36,19 @@ public class PortsResource { return new List(); } - public Create create(Port port){ + public Create create(Port port) { return new Create(port); } - public Update update(Port port){ + public Update update(Port port) { return new Update(port); } - public Delete delete(String portId){ + public Delete delete(String portId) { return new Delete(portId); } - public Show show(String portId){ + public Show show(String portId) { return new Show(portId); } @@ -61,22 +61,21 @@ public class PortsResource { public class Query extends OpenStackRequest { - public Query(Port port) { - } + public Query(Port port) {} } public class Create extends OpenStackRequest { - public Create(Port port){ + public Create(Port port) { super(CLIENT, HttpMethod.POST, "ports", Entity.json(port), Port.class); } } public class Update extends OpenStackRequest { - public Update(Port port){ + public Update(Port port) { super(CLIENT, HttpMethod.PUT, buildPath("ports/", port.getId()), Entity.json(port), Port.class); } } @@ -90,7 +89,7 @@ public class PortsResource { public class Delete extends OpenStackRequest { - public Delete(String id){ + public Delete(String id) { super(CLIENT, HttpMethod.DELETE, buildPath("ports/", id), null, Void.class); } } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java index 774e44a..ed2f22d 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java @@ -28,87 +28,89 @@ import com.woorea.openstack.quantum.model.Routers; public class RoutersResource { - private final OpenStackClient CLIENT; + private final OpenStackClient CLIENT; - public RoutersResource(OpenStackClient client) { - CLIENT = client; - } + public RoutersResource(OpenStackClient client) { + CLIENT = client; + } - public List list() { - return new List(); - } + public List list() { + return new List(); + } - public Create create(RouterForCreate router){ - return new Create(router); - } + public Create create(RouterForCreate router) { + return new Create(router); + } - public Delete delete(String netId){ - return new Delete(netId); - } + public Delete delete(String netId) { + return new Delete(netId); + } - public Show show(String netId){ - return new Show(netId); - } + public Show show(String netId) { + return new Show(netId); + } - public class List extends OpenStackRequest { + public class List extends OpenStackRequest { - public List() { - super(CLIENT, HttpMethod.GET, "routers", null, Routers.class); - } + public List() { + super(CLIENT, HttpMethod.GET, "routers", null, Routers.class); } + } - public class Query extends OpenStackRequest { + public class Query extends OpenStackRequest { - public Query(Router router) { - } - } - public class Create extends OpenStackRequest { + public Query(Router router) {} + } + public class Create extends OpenStackRequest { - public Create(RouterForCreate router){ - super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class); - } + public Create(RouterForCreate router) { + super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class); } + } - - public class Show extends OpenStackRequest { - public Show(String id) { - super(CLIENT, HttpMethod.GET, buildPath("routers/", id), null, Router.class); - } + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("routers/", id), null, Router.class); } + } - public class Delete extends OpenStackRequest { + public class Delete extends OpenStackRequest { - public Delete(String id){ - super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class); - } + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class); } - public Attach addInterface(RouterForAddInterface interfaceToAdd){ - return new Attach(interfaceToAdd); - } - public class Attach extends OpenStackRequest { + } - public Attach(RouterForAddInterface interfaceToAdd){ - super(CLIENT, HttpMethod.PUT, buildPath("routers/",interfaceToAdd.getRouterId(),"/add_router_interface"), Entity.json(interfaceToAdd),RouterInterface.class); - } - - } - public Detach deleteInterface(RouterForAddInterface interfaceRouter) { - return new Detach(interfaceRouter); + public Attach addInterface(RouterForAddInterface interfaceToAdd) { + return new Attach(interfaceToAdd); + } + + public class Attach extends OpenStackRequest { + + public Attach(RouterForAddInterface interfaceToAdd) { + super(CLIENT, HttpMethod.PUT, buildPath("routers/", interfaceToAdd.getRouterId(), "/add_router_interface"), + Entity.json(interfaceToAdd), RouterInterface.class); } - public class Detach extends OpenStackRequest { + } + + public Detach deleteInterface(RouterForAddInterface interfaceRouter) { + return new Detach(interfaceRouter); + } + + public class Detach extends OpenStackRequest { public Detach(RouterForAddInterface interfaceToAdd) { - super(CLIENT, HttpMethod.PUT, buildPath("routers/", - interfaceToAdd.getRouterId(), "/remove_router_interface"), + super(CLIENT, HttpMethod.PUT, + buildPath("routers/", interfaceToAdd.getRouterId(), "/remove_router_interface"), Entity.json(interfaceToAdd), RouterInterface.class); } } - - + } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java index bee3743..91553b3 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java @@ -44,11 +44,11 @@ public class SubnetsResource { return new Update(net); } - public Delete delete(String netId){ + public Delete delete(String netId) { return new Delete(netId); } - public Show show(String netId){ + public Show show(String netId) { return new Show(netId); } @@ -61,8 +61,7 @@ public class SubnetsResource { public class Query extends OpenStackRequest { - public Query(Subnet subnet) { - } + public Query(Subnet subnet) {} } @@ -89,7 +88,7 @@ public class SubnetsResource { public class Delete extends OpenStackRequest { - public Delete(String id){ + public Delete(String id) { super(CLIENT, HttpMethod.DELETE, buildPath("subnets/", id), null, Void.class); } } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java index 8914ab0..2b5c977 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java @@ -19,7 +19,6 @@ package com.woorea.openstack.quantum.api.query; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.woorea.openstack.base.client.OpenStackRequest; @@ -27,8 +26,7 @@ public class AbsOpenStackCmd extends OpenStackRequest { private T query; - protected AbsOpenStackCmd(T query) - { + protected AbsOpenStackCmd(T query) { this.setQuery(query); } @@ -46,8 +44,7 @@ public class AbsOpenStackCmd extends OpenStackRequest { return query; } - private String getFieldValue(Field field, T target) - { + private String getFieldValue(Field field, T target) { try { field.setAccessible(true); Object obj = field.get(target); @@ -59,8 +56,7 @@ public class AbsOpenStackCmd extends OpenStackRequest { } } - private Map getObjectParamMap(T target) - { + private Map getObjectParamMap(T target) { Map resultMap = new HashMap<>(); if (target == null) return resultMap; diff --git a/quantum-model/pom.xml b/quantum-model/pom.xml index 532af1b..9231534 100644 --- a/quantum-model/pom.xml +++ b/quantum-model/pom.xml @@ -1,24 +1,25 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - quantum-model - OpenStack Quantum Model - OpenStack Quantum Model - - - junit - junit - test - - - org.skyscreamer - jsonassert - test - - + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + quantum-model + OpenStack Quantum Model + OpenStack Quantum Model + + + junit + junit + test + + + org.skyscreamer + jsonassert + test + + diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java index 88fb6a4..84e1a0c 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java @@ -17,7 +17,6 @@ package com.woorea.openstack.quantum.model; import com.fasterxml.jackson.annotation.JsonProperty; - import java.io.Serializable; public class GatewayInfo implements Serializable { @@ -33,7 +32,8 @@ public class GatewayInfo implements Serializable { this.networkId = id; } - @Override public String toString() { + @Override + public String toString() { return "[networkId=" + networkId + "]"; } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java index 958a21d..ace3849 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java @@ -26,6 +26,7 @@ public class HostRoute implements Serializable { public String getDestination() { return destination; } + public void setDestination(String destination) { this.destination = destination; } @@ -33,11 +34,13 @@ public class HostRoute implements Serializable { public String getNexthop() { return nexthop; } + public void setNexthop(String nexthop) { this.nexthop = nexthop; } - @Override public String toString() { + @Override + public String toString() { return "[destination=" + destination + ", nexthop=" + nexthop + "]"; } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Link.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Link.java new file mode 100644 index 0000000..05fa9e9 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Link.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * 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.quantum.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Link { + @JsonProperty("href") + private String href; + + @JsonProperty("rel") + private String rel; + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getRel() { + return rel; + } + + public void setRel(String rel) { + this.rel = rel; + } + + @Override + public String toString() { + return "Link{" + "href='" + href + '\'' + ", rel='" + rel + '\'' + '}'; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java index bec7dbf..fbc00fb 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java @@ -21,19 +21,18 @@ package com.woorea.openstack.quantum.model; */ import java.io.Serializable; +import java.util.Date; import java.util.List; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; /** - * Network Extension supporting both Provider networks and Multi-Provider networks. - * The attributes for both of these network extensions are included. - * It is the responsibility of users to populate only one or the other. It is - * also critical that the Mapper is set for serialization inclusion.NON_NULL, or - * both would be sent to Openstack which would cause an error. + * Network Extension supporting both Provider networks and Multi-Provider networks. The attributes for both of these + * network extensions are included. It is the responsibility of users to populate only one or the other. It is also + * critical that the Mapper is set for serialization inclusion.NON_NULL, or both would be sent to Openstack which would + * cause an error. * */ @SuppressWarnings("serial") @@ -41,15 +40,27 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonIgnoreProperties(ignoreUnknown = true) public class Network implements Serializable { + @JsonProperty("status") private String status; + @JsonProperty("subnets") private List subnets; + @JsonProperty("availability_zones") + private List availabilityZones; + + @JsonProperty("availability_zone_hints") + private List availabilityZoneHints; + + @JsonProperty("name") private String name; @JsonProperty("admin_state_up") private Boolean adminStateUp; + @JsonProperty("project_id") + private String projectId; + @JsonProperty("tenant_id") private String tenantId; @@ -63,25 +74,57 @@ public class Network implements Serializable { private Integer providerSegmentationId; @JsonProperty("router:external") - private String routerExternal; + private Boolean routerExternal; + + @JsonProperty("ipv6_address_scope") + private String ipv6AddressScope; + + @JsonProperty("ipv4_address_scope") + private String ipv4AddressScope; + + @JsonProperty("revision_number") + private Integer revisionNumber; + + @JsonProperty("port_security_enabled") + private Boolean portSecurityEnabled; + + @JsonProperty("mtu") + private Integer mtu; private String id; - private String shared; - + @JsonProperty("shared") + private Boolean shared; + + @JsonProperty("updated_at") + private Date updatedAt; + + @JsonProperty("created_at") + private Date createdAt; + + @JsonProperty("description") + private String description; + + + + @JsonProperty("is_default") + private Boolean isDefault; + private List segments; + @JsonProperty("tags") + private List tags; + /** * @return the status */ - + public String getStatus() { return status; } /** - * @param status - * the status to set + * @param status the status to set */ @JsonProperty public void setStatus(String status) { @@ -91,14 +134,13 @@ public class Network implements Serializable { /** * @return the subnets */ - + public List getSubnets() { return subnets; } /** - * @param subnets - * the subnets to set + * @param subnets the subnets to set */ @JsonProperty public void setSubnets(List subnets) { @@ -113,8 +155,7 @@ public class Network implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -125,18 +166,17 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - + public String getProviderPhyNet() { return getProviderPhysicalNetwork(); } /** - * @param providerPhyNet - * the providerPhyNet to set + * @param providerPhyNet the providerPhyNet to set * @deprecated */ @Deprecated - + public void setProviderPhyNet(String providerPhyNet) { setProviderPhysicalNetwork(providerPhyNet); } @@ -144,7 +184,7 @@ public class Network implements Serializable { /** * @return the adminStateUp */ - + public boolean isAdminStateUp() { return adminStateUp; } @@ -154,8 +194,7 @@ public class Network implements Serializable { } /** - * @param adminStateUp - * the adminStateUp to set + * @param adminStateUp the adminStateUp to set */ public void setAdminStateUp(Boolean adminStateUp) { this.adminStateUp = adminStateUp; @@ -169,8 +208,7 @@ public class Network implements Serializable { } /** - * @param tenantId - * the tenantId to set + * @param tenantId the tenantId to set */ public void setTenantId(String tenantId) { this.tenantId = tenantId; @@ -181,18 +219,17 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - + public String getNetType() { return getProviderNetworkType(); } /** - * @param netType - * the netType to set + * @param netType the netType to set * @deprecated */ @Deprecated - + public void setNetType(String netType) { setProviderNetworkType(netType); } @@ -200,29 +237,27 @@ public class Network implements Serializable { /** * @return the routerExternal */ - public String getRouterExternal() { + public Boolean getRouterExternal() { return routerExternal; } /** - * @param routerExternal - * the routerExternal to set + * @param routerExternal the routerExternal to set */ - public void setRouterExternal(String routerExternal) { + public void setRouterExternal(Boolean routerExternal) { this.routerExternal = routerExternal; } /** * @return the id */ - + public String getId() { return id; } /** - * @param id - * the id to set + * @param id the id to set */ @JsonProperty public void setId(String id) { @@ -232,15 +267,14 @@ public class Network implements Serializable { /** * @return the shared */ - public String getShared() { + public Boolean getShared() { return shared; } /** - * @param shared - * the shared to set + * @param shared the shared to set */ - public void setShared(String shared) { + public void setShared(Boolean shared) { this.shared = shared; } @@ -249,18 +283,17 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - + public String getProviderSegID() { return getProviderSegmentationId() == null ? null : Integer.toString(getProviderSegmentationId()); } /** - * @param providerSegID - * the providerSegID to set + * @param providerSegID the providerSegID to set * @deprecated */ @Deprecated - + public void setProviderSegID(String providerSegID) { setProviderSegmentationId(providerSegID == null ? null : Integer.parseInt(providerSegID)); } @@ -300,10 +333,12 @@ public class Network implements Serializable { /** * Function to detect and return the network type */ - public enum NetworkType { BASIC, PROVIDER, MULTI_PROVIDER }; - - - public NetworkType getNetworkType () { + public enum NetworkType { + BASIC, PROVIDER, MULTI_PROVIDER + }; + + + public NetworkType getNetworkType() { if (segments != null) return NetworkType.MULTI_PROVIDER; else if (providerNetworkType != null) @@ -319,19 +354,18 @@ public class Network implements Serializable { */ @Override public String toString() { - StringBuilder buf = new StringBuilder("Network [id=" + id + ", name=" + name + ", subnets=" - + subnets + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + - tenantId + ", shared=" + shared + ", router:external=" + routerExternal); + StringBuilder buf = new StringBuilder("Network [id=" + id + ", name=" + name + ", subnets=" + subnets + + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + tenantId + ", shared=" + + shared + ", router:external=" + routerExternal); if (getNetworkType() == NetworkType.PROVIDER) - buf.append (", provider:physical_network=" + providerPhysicalNetwork + - ", provider:network_type=" + providerNetworkType + - ", provider:segmentation_id=" + providerSegmentationId); + buf.append(", provider:physical_network=" + providerPhysicalNetwork + ", provider:network_type=" + + providerNetworkType + ", provider:segmentation_id=" + providerSegmentationId); if (getNetworkType() == NetworkType.MULTI_PROVIDER) { - buf.append (", segments: "); + buf.append(", segments: "); for (Segment s : segments) - buf.append (s.toString()).append(" "); + buf.append(s.toString()).append(" "); } - buf.append ("]"); + buf.append("]"); return buf.toString(); } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java index 3bf24c3..f0473a7 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java @@ -19,14 +19,24 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Networks implements Iterable, Serializable{ - +public class Networks implements Iterable, Serializable { + @JsonProperty("networks") private List list; + @JsonProperty("networks_links") + private List links; + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + /** * @return the list */ @@ -51,5 +61,5 @@ public class Networks implements Iterable, Serializable{ public Iterator iterator() { return list.iterator(); } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java index fda8da1..ad5f109 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java @@ -17,18 +17,17 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("NeutronError") public class NeutronError implements Serializable { private String type; - + private String message; private String detail; - + /** * @return the code */ @@ -50,13 +49,14 @@ public class NeutronError implements Serializable { return detail; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "NeutronError [type=" + type + ", title=" + detail + ", message=" - + message + "]"; + return "NeutronError [type=" + type + ", title=" + detail + ", message=" + message + "]"; } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java index a7ce888..2d1b019 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java @@ -18,39 +18,42 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; -public class Pool implements Serializable{ - +public class Pool implements Serializable { + private String start; private String end; - + /** * @return the start */ public String getStart() { return start; } + /** * @param start the start to set */ public void setStart(String start) { this.start = start; } + /** * @return the end */ public String getEnd() { return end; } + /** * @param end the end to set */ public void setEnd(String end) { this.end = end; } - + @Override public String toString() { return "Allocation_pool [start=" + start + ", end=" + end + "]"; } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java index 1951a60..2fc6b21 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java @@ -19,7 +19,6 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -47,8 +46,7 @@ public class Port implements Serializable { } /** - * @param address - * the address to set + * @param address the address to set */ public void setAddress(String address) { this.address = address; @@ -62,8 +60,7 @@ public class Port implements Serializable { } /** - * @param subnetId - * the subnetId to set + * @param subnetId the subnetId to set */ public void setSubnetId(String subnetId) { this.subnetId = subnetId; @@ -151,11 +148,8 @@ public class Port implements Serializable { @Override public String toString() { - return "Binding [hostId=" + hostId - + ", vifType=" + vifType + - ", vnicType=" + vnicType + - ", vifDetails=" + vifDetails + - ", profile=" + profile + "]"; + return "Binding [hostId=" + hostId + ", vifType=" + vifType + ", vnicType=" + vnicType + ", vifDetails=" + + vifDetails + ", profile=" + profile + "]"; } } @@ -190,7 +184,7 @@ public class Port implements Serializable { private List securityGroups; @JsonUnwrapped - private Binding binding; + private Binding binding; /** * @return the adminStateUp @@ -200,8 +194,7 @@ public class Port implements Serializable { } /** - * @param adminStateUp - * the adminStateUp to set + * @param adminStateUp the adminStateUp to set */ public void setAdminStateUp(Boolean adminStateUp) { this.adminStateUp = adminStateUp; @@ -215,8 +208,7 @@ public class Port implements Serializable { } /** - * @param deviceId - * the deviceId to set + * @param deviceId the deviceId to set */ public void setDeviceId(String deviceId) { this.deviceId = deviceId; @@ -230,8 +222,7 @@ public class Port implements Serializable { } /** - * @param deviceOwner - * the deviceOwner to set + * @param deviceOwner the deviceOwner to set */ public void setDeviceOwner(String deviceOwner) { this.deviceOwner = deviceOwner; @@ -245,8 +236,7 @@ public class Port implements Serializable { } /** - * @param list - * the list to set + * @param list the list to set */ public void setList(List list) { this.list = list; @@ -261,8 +251,7 @@ public class Port implements Serializable { } /** - * @param id - * the id to set + * @param id the id to set */ @JsonProperty public void setId(String id) { @@ -277,8 +266,7 @@ public class Port implements Serializable { } /** - * @param macAddress - * the macAddress to set + * @param macAddress the macAddress to set */ public void setMacAddress(String macAddress) { this.macAddress = macAddress; @@ -292,8 +280,7 @@ public class Port implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -307,8 +294,7 @@ public class Port implements Serializable { } /** - * @param networkId - * the networkId to set + * @param networkId the networkId to set */ public void setNetworkId(String networkId) { this.networkId = networkId; @@ -323,8 +309,7 @@ public class Port implements Serializable { } /** - * @param status - * the status to set + * @param status the status to set */ @JsonProperty public void setStatus(String status) { @@ -339,8 +324,7 @@ public class Port implements Serializable { } /** - * @param tenantId - * the tenantId to set + * @param tenantId the tenantId to set */ public void setTenantId(String tenantId) { this.tenantId = tenantId; @@ -354,8 +338,7 @@ public class Port implements Serializable { } /** - * @param securityGroups - * IDs of security groups to associate to the port + * @param securityGroups IDs of security groups to associate to the port */ public void setSecurityGroups(List securityGroups) { this.securityGroups = securityGroups; @@ -369,8 +352,7 @@ public class Port implements Serializable { } /** - * @param binding - * The port bindings by which the port is bind to network on host + * @param binding The port bindings by which the port is bind to network on host */ public void setBinding(Binding binding) { this.binding = binding; @@ -378,12 +360,9 @@ public class Port implements Serializable { @Override public String toString() { - return "Port [id=" + id + ", name=" + name + ", mac_address=" - + macAddress + ", admin_state_up=" + adminStateUp + ", device_id=" + deviceId - + ", device_owner=" + deviceOwner + ", fixed_ips=" + list - + ", network_id=" + networkId + ", status=" + status - + ", tenant_id=" + tenantId - + ", securityGroups=" + securityGroups + return "Port [id=" + id + ", name=" + name + ", mac_address=" + macAddress + ", admin_state_up=" + adminStateUp + + ", device_id=" + deviceId + ", device_owner=" + deviceOwner + ", fixed_ips=" + list + ", network_id=" + + networkId + ", status=" + status + ", tenant_id=" + tenantId + ", securityGroups=" + securityGroups + ", binding=" + binding + "]"; } -} \ No newline at end of file +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java index eeb4c64..a32e993 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java @@ -19,7 +19,6 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; @SuppressWarnings("serial") @@ -36,8 +35,7 @@ public class Ports implements Iterable, Serializable { } /** - * @param list - * the list to set + * @param list the list to set */ public void setList(List list) { this.list = list; diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java index d180a12..05c622a 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java @@ -17,10 +17,8 @@ package com.woorea.openstack.quantum.model; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - import java.io.Serializable; @JsonRootName("router") @@ -50,45 +48,58 @@ public class Router implements Serializable { public String getName() { return name; } + public void setName(String name) { this.name = name; } + public List getRoutes() { return routes; } + public void setRoutes(List routes) { this.routes = routes; } + public String getAdminStateUp() { return adminStateUp; } + public void setAdminStateUp(String adminStateUp) { this.adminStateUp = adminStateUp; } + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public GatewayInfo getExternalGatewayInfo() { return externalGatewayInfo; } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { this.externalGatewayInfo = externalGatewayInfo; } + public String getTenantId() { return tenantId; } + public void setTenantId(String tenantId) { this.tenantId = tenantId; } + public String getId() { return id; } + public void setId(String id) { this.id = id; } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java index 04d99cb..9b6f918 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java @@ -17,28 +17,27 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class RouterForAddInterface implements Serializable { - @JsonProperty("subnet_id") - String subnetId; - String routerId; + @JsonProperty("subnet_id") + String subnetId; + String routerId; - public String getSubnetId() { - return subnetId; - } + public String getSubnetId() { + return subnetId; + } - public void setSubnetId(String subnetId) { - this.subnetId = subnetId; - } + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } - public String getRouterId() { - return routerId; - } + public String getRouterId() { + return routerId; + } - public void setRouterId(String routerId) { - this.routerId = routerId; - } + public void setRouterId(String routerId) { + this.routerId = routerId; } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java index 6f5ddae..ec3bdd4 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java @@ -17,10 +17,8 @@ package com.woorea.openstack.quantum.model; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - import java.io.Serializable; @JsonRootName("router") @@ -49,15 +47,19 @@ public class RouterForCreate implements Serializable { public String getName() { return name; } + public void setName(String name) { this.name = name; } + public List getRoutes() { return routes; } + public void setRoutes(List routes) { this.routes = routes; } + public String getAdminStateUp() { return adminStateUp; } @@ -65,29 +67,37 @@ public class RouterForCreate implements Serializable { public void setAdminStateUp(String adminStateUp) { this.adminStateUp = adminStateUp; } + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public GatewayInfo getExternalGatewayInfo() { return externalGatewayInfo; } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { this.externalGatewayInfo = externalGatewayInfo; } + public String getTenantId() { return tenantId; } + public void setTenantId(String tenantId) { this.tenantId = tenantId; } + public String getId() { return id; } + public void setId(String id) { this.id = id; } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java index 42cca03..bfa9902 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java @@ -17,7 +17,6 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class RouterInterface implements Serializable { diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java index 370b77d..13ca024 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java @@ -19,11 +19,10 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Routers implements Iterable, Serializable{ - +public class Routers implements Iterable, Serializable { + @JsonProperty("routers") private List list; @@ -51,5 +50,5 @@ public class Routers implements Iterable, Serializable{ public Iterator iterator() { return list.iterator(); } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java index 25e27c3..a15a651 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java @@ -17,7 +17,6 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -65,8 +64,7 @@ public class Segment implements Serializable { */ @Override public String toString() { - return "Segment [ provider:physical_network=" + providerPhysicalNetwork + - ", provider:network_type=" + providerNetworkType + - ", provider:segmentation_id=" + providerSegmentationId + "]"; + return "Segment [ provider:physical_network=" + providerPhysicalNetwork + ", provider:network_type=" + + providerNetworkType + ", provider:segmentation_id=" + providerSegmentationId + "]"; } -} \ No newline at end of file +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java index a2319d4..f47f25d 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java @@ -17,8 +17,8 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; +import java.util.Date; import java.util.List; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @JsonIgnoreProperties(ignoreUnknown = true) public class Subnet implements Serializable { + @JsonProperty("name") private String name; @JsonProperty("enable_dhcp") @@ -42,6 +43,9 @@ public class Subnet implements Serializable { @JsonProperty("tenant_id") private String tenantId; + @JsonProperty("project_id") + private String projectId; + @JsonProperty("dns_nameservers") private List dnsNames; @@ -51,19 +55,35 @@ public class Subnet implements Serializable { @JsonProperty("host_routes") private List hostRoutes; + @JsonProperty("service_types") + private List serviceTypes; + @JsonProperty("ip_version") private IpVersion ipversion; + @JsonProperty("ipv6_address_mode") + private String ipv6AddressMode; + + @JsonProperty("ipv6_ra_mode") + private String ipv6RAMode; + @JsonProperty("gateway_ip") private String gw; + @JsonProperty("cidr") private String cidr; + @JsonProperty("created_at") + private Date createdAt; + + @JsonProperty("updated_at") + private Date updatedAt; + + @JsonProperty("id") private String id; public enum IpVersion implements Serializable { - IPV4(4), - IPV6(6); + IPV4(4), IPV6(6); private int code; IpVersion(int code) { @@ -99,8 +119,7 @@ public class Subnet implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -109,7 +128,6 @@ public class Subnet implements Serializable { /** * @return the enableDHCP */ - @JsonIgnore public boolean isEnableDHCP() { return enableDHCP; } @@ -119,8 +137,7 @@ public class Subnet implements Serializable { } /** - * @param enableDHCP - * the enableDHCP to set + * @param enableDHCP the enableDHCP to set */ public void setEnableDHCP(Boolean enableDHCP) { this.enableDHCP = enableDHCP; @@ -134,8 +151,7 @@ public class Subnet implements Serializable { } /** - * @param networkId - * the networkId to set + * @param networkId the networkId to set */ public void setNetworkId(String networkId) { this.networkId = networkId; @@ -149,8 +165,7 @@ public class Subnet implements Serializable { } /** - * @param tenantId - * the tenantId to set + * @param tenantId the tenantId to set */ public void setTenantId(String tenantId) { this.tenantId = tenantId; @@ -164,8 +179,7 @@ public class Subnet implements Serializable { } /** - * @param dnsNames - * the dnsNames to set + * @param dnsNames the dnsNames to set */ public void setDnsNames(List dnsNames) { this.dnsNames = dnsNames; @@ -179,8 +193,7 @@ public class Subnet implements Serializable { } /** - * @param list - * the list to set + * @param list the list to set */ public void setList(List list) { this.list = list; @@ -194,8 +207,7 @@ public class Subnet implements Serializable { } /** - * @param hostRoutes - * the hostRoutes to set + * @param hostRoutes the hostRoutes to set */ public void setHostRoutes(List hostRoutes) { this.hostRoutes = hostRoutes; @@ -209,8 +221,7 @@ public class Subnet implements Serializable { } /** - * @param ipversion - * the ipversion to set + * @param ipversion the ipversion to set */ public void setIpversion(IpVersion ipversion) { this.ipversion = ipversion; @@ -224,8 +235,7 @@ public class Subnet implements Serializable { } /** - * @param gw - * the gw to set + * @param gw the gw to set */ public void setGw(String gw) { this.gw = gw; @@ -239,8 +249,7 @@ public class Subnet implements Serializable { } /** - * @param cidr - * the cidr to set + * @param cidr the cidr to set */ public void setCidr(String cidr) { this.cidr = cidr; @@ -249,14 +258,12 @@ public class Subnet implements Serializable { /** * @return the id */ - @JsonIgnore public String getId() { return id; } /** - * @param id - * the id to set + * @param id the id to set */ @JsonProperty public void setId(String id) { @@ -270,11 +277,9 @@ public class Subnet implements Serializable { */ @Override public String toString() { - return "Subnet [id=" + id + ", name=" + name + ", network_id=" - + networkId + ", tenant_id=" + tenantId + ", allocation_pools=" + list - + ", gateway_ip=" + gw + ", ip_version=" + ipversion - + ", cidr=" + cidr + ", enable_dhcp=" + enableDHCP + ", dns_nameservers=" - + dnsNames + ", host_routes=" + hostRoutes + "]"; + return "Subnet [id=" + id + ", name=" + name + ", network_id=" + networkId + ", tenant_id=" + tenantId + + ", allocation_pools=" + list + ", gateway_ip=" + gw + ", ip_version=" + ipversion + ", cidr=" + cidr + + ", enable_dhcp=" + enableDHCP + ", dns_nameservers=" + dnsNames + ", host_routes=" + hostRoutes + "]"; } -} \ No newline at end of file +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java index 34820aa..f5987a6 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; /** * Please use {@link Subnet} directly. + * * @Deprecated */ @SuppressWarnings("serial") @@ -39,8 +40,7 @@ public class SubnetForCreate extends Subnet { } /** - * @param ipVersion - * the ipVersion to set + * @param ipVersion the ipVersion to set * @deprecated */ @Deprecated diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java index 0faef86..e02c224 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java @@ -19,14 +19,13 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Subnets implements Serializable, Iterable { - + @JsonProperty("subnets") private List list; - + /** * @return the list */ @@ -45,7 +44,7 @@ public class Subnets implements Serializable, Iterable { public String toString() { return "Subnets [list=" + list + "]"; } - + @Override public Iterator iterator() { return list.iterator(); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/BindingTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/BindingTest.java index 22d9735..ed7f85c 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/BindingTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/BindingTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.quantum.model.Port.Binding; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,25 +35,16 @@ public class BindingTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"binding:host_id\" : \"hostid\"," + EOL - + " \"binding:vif_type\" : \"viftype\"," + EOL - + " \"binding:vnic_type\" : \"vnictype\"," + EOL - + " \"binding:vif_details\" : {" + EOL - + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL - + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL - + " }," + EOL - + " \"binding:profile\" : {" + EOL - + " \"profile-k1\" : \"profile-v1\"," + EOL - + " \"profile-k2\" : \"profile-v2\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL + + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL + + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\"" + + EOL + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\"," + + EOL + " \"profile-k2\" : \"profile-v2\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -71,25 +60,25 @@ public class BindingTest { public void testMethods() throws Exception { Binding binding = objectMapper.readValue(JSON_FULL, Binding.class); binding.toString(); - + String vnicType = binding.getVnicType(); Assert.assertNotNull(vnicType); binding.setVnicType(vnicType); - - Map vifDetails = binding.getVifDetails(); + + Map vifDetails = binding.getVifDetails(); Assert.assertNotNull(vifDetails); Assert.assertEquals(2, vifDetails.size()); binding.setVifDetails(vifDetails); - - Map profile = binding.getProfile(); + + Map profile = binding.getProfile(); Assert.assertNotNull(profile); Assert.assertEquals(2, profile.size()); binding.setProfile(profile); - + String hostId = binding.getHostId(); Assert.assertNotNull(hostId); binding.setHostId(hostId); - + String vifType = binding.getVifType(); Assert.assertNotNull(vifType); binding.setVifType(vifType); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/GatewayInfoTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/GatewayInfoTest.java index 92e8692..92c9217 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/GatewayInfoTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/GatewayInfoTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,15 +33,11 @@ public class GatewayInfoTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"network_id\" : \"networkid\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -58,7 +53,7 @@ public class GatewayInfoTest { public void testMethods() throws Exception { GatewayInfo gatewayinfo = objectMapper.readValue(JSON_FULL, GatewayInfo.class); gatewayinfo.toString(); - + String networkId = gatewayinfo.getNetworkId(); Assert.assertNotNull(networkId); gatewayinfo.setNetworkId(networkId); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/HostRouteTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/HostRouteTest.java index 063014e..519c281 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/HostRouteTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/HostRouteTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class HostRouteTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,11 +54,11 @@ public class HostRouteTest { public void testMethods() throws Exception { HostRoute hostroute = objectMapper.readValue(JSON_FULL, HostRoute.class); hostroute.toString(); - + String destination = hostroute.getDestination(); Assert.assertNotNull(destination); hostroute.setDestination(destination); - + String nexthop = hostroute.getNexthop(); Assert.assertNotNull(nexthop); hostroute.setNexthop(nexthop); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpTest.java index 799a0f5..6be8138 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.quantum.model.Port.Ip; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class IpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,11 +55,11 @@ public class IpTest { public void testMethods() throws Exception { Ip ip = objectMapper.readValue(JSON_FULL, Ip.class); ip.toString(); - + String subnetId = ip.getSubnetId(); Assert.assertNotNull(subnetId); ip.setSubnetId(subnetId); - + String address = ip.getAddress(); Assert.assertNotNull(address); ip.setAddress(address); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpVersionTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpVersionTest.java index b58aed5..3ea4ddd 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpVersionTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpVersionTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.quantum.model.Subnet.IpVersion; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -36,11 +35,9 @@ public class IpVersionTest { private static final String JSON_FULL = "4"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java index 7a2b2c1..e4f33e6 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,35 +34,24 @@ public class NetworkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"network\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"shared\" : \"shared\"," + EOL - + " \"segments\" : [ {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " }, {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " } ]," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92," + EOL - + " \"router:external\" : \"routerexternal\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"network\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false," + + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : true" + EOL + " }" + EOL + + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -80,40 +67,40 @@ public class NetworkTest { public void testMethods() throws Exception { Network network = objectMapper.readValue(JSON_FULL, Network.class); network.toString(); - - String shared = network.getShared(); + + Boolean shared = network.getShared(); Assert.assertNotNull(shared); network.setShared(shared); - + String providerNetworkType = network.getProviderNetworkType(); Assert.assertNotNull(providerNetworkType); network.setProviderNetworkType(providerNetworkType); - - String routerExternal = network.getRouterExternal(); + + Boolean routerExternal = network.getRouterExternal(); Assert.assertNotNull(routerExternal); network.setRouterExternal(routerExternal); - + Integer providerSegmentationId = network.getProviderSegmentationId(); Assert.assertNotNull(providerSegmentationId); network.setProviderSegmentationId(providerSegmentationId); - + List segments = network.getSegments(); Assert.assertNotNull(segments); Assert.assertEquals(2, segments.size()); network.setSegments(segments); - + Boolean adminStateUp = network.getAdminStateUp(); Assert.assertNotNull(adminStateUp); network.setAdminStateUp(adminStateUp); - + String tenantId = network.getTenantId(); Assert.assertNotNull(tenantId); network.setTenantId(tenantId); - + String name = network.getName(); Assert.assertNotNull(name); network.setName(name); - + String providerPhysicalNetwork = network.getProviderPhysicalNetwork(); Assert.assertNotNull(providerPhysicalNetwork); network.setProviderPhysicalNetwork(providerPhysicalNetwork); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworksTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworksTest.java index 9b4dc3b..caa9135 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworksTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworksTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,51 +34,34 @@ public class NetworksTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"networks\" : [ {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"shared\" : \"shared\"," + EOL - + " \"segments\" : [ {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " }, {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " } ]," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92," + EOL - + " \"router:external\" : \"routerexternal\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"shared\" : \"shared\"," + EOL - + " \"segments\" : [ {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " }, {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " } ]," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92," + EOL - + " \"router:external\" : \"routerexternal\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"networks\" : [ {" + EOL + " \"name\" : \"name\"," + EOL + + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false," + + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : true " + EOL + " }, {" + EOL + + " \"name\" : \"name\"," + EOL + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false," + + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : true" + EOL + " } ]" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -96,14 +77,15 @@ public class NetworksTest { public void testMethods() throws Exception { Networks networks = objectMapper.readValue(JSON_FULL, Networks.class); networks.toString(); - + List list = networks.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); networks.setList(list); - + int cnt = 0; - for (@SuppressWarnings("unused") Network x : networks) { + for (@SuppressWarnings("unused") + Network x : networks) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NeutronErrorTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NeutronErrorTest.java index e2dc7f5..58a8a04 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NeutronErrorTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NeutronErrorTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,21 +33,13 @@ public class NeutronErrorTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"NeutronError\" : {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"message\" : \"message\"," + EOL - + " \"detail\" : \"detail\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"NeutronError\" : {" + EOL + " \"type\" : \"type\"," + + EOL + " \"message\" : \"message\"," + EOL + " \"detail\" : \"detail\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,13 +55,13 @@ public class NeutronErrorTest { public void testMethods() throws Exception { NeutronError neutronerror = objectMapper.readValue(JSON_FULL, NeutronError.class); neutronerror.toString(); - + String detail = neutronerror.getDetail(); Assert.assertNotNull(detail); - + String type = neutronerror.getType(); Assert.assertNotNull(type); - + String message = neutronerror.getMessage(); Assert.assertNotNull(message); } diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PoolTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PoolTest.java index ce7574b..8adbffb 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PoolTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PoolTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class PoolTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,11 +54,11 @@ public class PoolTest { public void testMethods() throws Exception { Pool pool = objectMapper.readValue(JSON_FULL, Pool.class); pool.toString(); - + String start = pool.getStart(); Assert.assertNotNull(start); pool.setStart(start); - + String end = pool.getEnd(); Assert.assertNotNull(end); pool.setEnd(end); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java index b8a7a34..7509578 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.quantum.model.Port.Binding; import com.woorea.openstack.quantum.model.Port.Ip; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,44 +36,24 @@ public class PortTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"port\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"binding:host_id\" : \"hostid\"," + EOL - + " \"binding:vif_type\" : \"viftype\"," + EOL - + " \"binding:vnic_type\" : \"vnictype\"," + EOL - + " \"binding:vif_details\" : {" + EOL - + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL - + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL - + " }," + EOL - + " \"binding:profile\" : {" + EOL - + " \"profile-k1\" : \"profile-v1\"," + EOL - + " \"profile-k2\" : \"profile-v2\"" + EOL - + " }," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"device_id\" : \"deviceid\"," + EOL - + " \"device_owner\" : \"deviceowner\"," + EOL - + " \"fixed_ips\" : [ {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " }, {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " } ]," + EOL - + " \"mac_address\" : \"macaddress\"," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"port\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL + + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL + + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL + + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\"," + EOL + + " \"profile-k2\" : \"profile-v2\"" + EOL + " }," + EOL + " \"admin_state_up\" : false," + EOL + + " \"device_id\" : \"deviceid\"," + EOL + " \"device_owner\" : \"deviceowner\"," + EOL + + " \"fixed_ips\" : [ {" + EOL + " \"ip_address\" : \"address\"," + EOL + + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {" + EOL + " \"ip_address\" : \"address\"," + + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " } ]," + EOL + + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\"," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -91,45 +69,45 @@ public class PortTest { public void testMethods() throws Exception { Port port = objectMapper.readValue(JSON_FULL, Port.class); port.toString(); - + String deviceOwner = port.getDeviceOwner(); Assert.assertNotNull(deviceOwner); port.setDeviceOwner(deviceOwner); - + Boolean adminStateUp = port.getAdminStateUp(); Assert.assertNotNull(adminStateUp); port.setAdminStateUp(adminStateUp); - + String name = port.getName(); Assert.assertNotNull(name); port.setName(name); - + String tenantId = port.getTenantId(); Assert.assertNotNull(tenantId); port.setTenantId(tenantId); - + Binding binding = port.getBinding(); Assert.assertNotNull(binding); port.setBinding(binding); - + String macAddress = port.getMacAddress(); Assert.assertNotNull(macAddress); port.setMacAddress(macAddress); - + String networkId = port.getNetworkId(); Assert.assertNotNull(networkId); port.setNetworkId(networkId); - + List list = port.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); port.setList(list); - + List securityGroups = port.getSecurityGroups(); Assert.assertNotNull(securityGroups); Assert.assertEquals(2, securityGroups.size()); port.setSecurityGroups(securityGroups); - + String deviceId = port.getDeviceId(); Assert.assertNotNull(deviceId); port.setDeviceId(deviceId); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortsTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortsTest.java index 62e5c3b..b24b6b8 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortsTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,69 +34,35 @@ public class PortsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"ports\" : [ {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"binding:host_id\" : \"hostid\"," + EOL - + " \"binding:vif_type\" : \"viftype\"," + EOL - + " \"binding:vnic_type\" : \"vnictype\"," + EOL - + " \"binding:vif_details\" : {" + EOL - + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL - + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL - + " }," + EOL - + " \"binding:profile\" : {" + EOL - + " \"profile-k1\" : \"profile-v1\"," + EOL - + " \"profile-k2\" : \"profile-v2\"" + EOL - + " }," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"device_id\" : \"deviceid\"," + EOL - + " \"device_owner\" : \"deviceowner\"," + EOL - + " \"fixed_ips\" : [ {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " }, {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " } ]," + EOL - + " \"mac_address\" : \"macaddress\"," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"binding:host_id\" : \"hostid\"," + EOL - + " \"binding:vif_type\" : \"viftype\"," + EOL - + " \"binding:vnic_type\" : \"vnictype\"," + EOL - + " \"binding:vif_details\" : {" + EOL - + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL - + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL - + " }," + EOL - + " \"binding:profile\" : {" + EOL - + " \"profile-k1\" : \"profile-v1\"," + EOL - + " \"profile-k2\" : \"profile-v2\"" + EOL - + " }," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"device_id\" : \"deviceid\"," + EOL - + " \"device_owner\" : \"deviceowner\"," + EOL - + " \"fixed_ips\" : [ {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " }, {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " } ]," + EOL - + " \"mac_address\" : \"macaddress\"," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"ports\" : [ {" + EOL + " \"name\" : \"name\"," + EOL + + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL + + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL + + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL + + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\"," + EOL + + " \"profile-k2\" : \"profile-v2\"" + EOL + " }," + EOL + " \"admin_state_up\" : false," + EOL + + " \"device_id\" : \"deviceid\"," + EOL + " \"device_owner\" : \"deviceowner\"," + EOL + + " \"fixed_ips\" : [ {" + EOL + " \"ip_address\" : \"address\"," + EOL + + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {" + EOL + " \"ip_address\" : \"address\"," + + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " } ]," + EOL + + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\"," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL + " }, {" + EOL + + " \"name\" : \"name\"," + EOL + " \"binding:host_id\" : \"hostid\"," + EOL + + " \"binding:vif_type\" : \"viftype\"," + EOL + " \"binding:vnic_type\" : \"vnictype\"," + EOL + + " \"binding:vif_details\" : {" + EOL + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL + " }," + EOL + " \"binding:profile\" : {" + EOL + + " \"profile-k1\" : \"profile-v1\"," + EOL + " \"profile-k2\" : \"profile-v2\"" + EOL + " }," + + EOL + " \"admin_state_up\" : false," + EOL + " \"device_id\" : \"deviceid\"," + EOL + + " \"device_owner\" : \"deviceowner\"," + EOL + " \"fixed_ips\" : [ {" + EOL + + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {" + + EOL + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + + " } ]," + EOL + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\"," + + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -114,14 +78,15 @@ public class PortsTest { public void testMethods() throws Exception { Ports ports = objectMapper.readValue(JSON_FULL, Ports.class); ports.toString(); - + List list = ports.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); ports.setList(list); - + int cnt = 0; - for (@SuppressWarnings("unused") Port x : ports) { + for (@SuppressWarnings("unused") + Port x : ports) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForAddInterfaceTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForAddInterfaceTest.java index 270b7a2..65fa321 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForAddInterfaceTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForAddInterfaceTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class RouterForAddInterfaceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"routerId\" : \"routerid\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"routerId\" : \"routerid\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,11 +54,11 @@ public class RouterForAddInterfaceTest { public void testMethods() throws Exception { RouterForAddInterface routerforaddinterface = objectMapper.readValue(JSON_FULL, RouterForAddInterface.class); routerforaddinterface.toString(); - + String subnetId = routerforaddinterface.getSubnetId(); Assert.assertNotNull(subnetId); routerforaddinterface.setSubnetId(subnetId); - + String routerId = routerforaddinterface.getRouterId(); Assert.assertNotNull(routerId); routerforaddinterface.setRouterId(routerId); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForCreateTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForCreateTest.java index 31a0373..80dd10b 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForCreateTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForCreateTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,33 +34,19 @@ public class RouterForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"router\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"routes\" : [ {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " }, {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " } ]," + EOL - + " \"admin_state_up\" : \"admin_state_up\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"id\" : \"id\"," + EOL - + " \"external_gateway_info\" : {" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + " }," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"router\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + EOL + + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + " \"destination\" : \"destination\"," + + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + EOL + + " \"admin_state_up\" : \"admin_state_up\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"id\" : \"id\"," + EOL + " \"external_gateway_info\" : {" + EOL + + " \"network_id\" : \"networkid\"" + EOL + " }," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,32 +62,32 @@ public class RouterForCreateTest { public void testMethods() throws Exception { RouterForCreate routerforcreate = objectMapper.readValue(JSON_FULL, RouterForCreate.class); routerforcreate.toString(); - + List routes = routerforcreate.getRoutes(); Assert.assertNotNull(routes); Assert.assertEquals(2, routes.size()); routerforcreate.setRoutes(routes); - + String admin_state_up = routerforcreate.getAdminStateUp(); Assert.assertNotNull(admin_state_up); routerforcreate.setAdminStateUp(admin_state_up); - + String name = routerforcreate.getName(); Assert.assertNotNull(name); routerforcreate.setName(name); - + String tenantId = routerforcreate.getTenantId(); Assert.assertNotNull(tenantId); routerforcreate.setTenantId(tenantId); - + GatewayInfo externalGatewayInfo = routerforcreate.getExternalGatewayInfo(); Assert.assertNotNull(externalGatewayInfo); routerforcreate.setExternalGatewayInfo(externalGatewayInfo); - + String id = routerforcreate.getId(); Assert.assertNotNull(id); routerforcreate.setId(id); - + String status = routerforcreate.getStatus(); Assert.assertNotNull(status); routerforcreate.setStatus(status); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterInterfaceTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterInterfaceTest.java index ee4e08b..b51c562 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterInterfaceTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterInterfaceTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -33,18 +32,12 @@ public class RouterInterfaceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"subnet_id\" : \"subnetid\"," + EOL - + " \"port_id\" : \"portid\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"subnet_id\" : \"subnetid\"," + + EOL + " \"port_id\" : \"portid\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterTest.java index 81573df..e5d2caa 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,33 +34,18 @@ public class RouterTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"router\" : {" + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"admin_state_up\" : \"admin_state_up\"," + EOL - + " \"id\" : \"id\"," + EOL - + " \"routes\" : [ {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " }, {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " } ]," + EOL - + " \"external_gateway_info\" : {" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + " }," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"router\" : {" + EOL + " \"status\" : \"status\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL + + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + EOL + " }," + + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,32 +61,32 @@ public class RouterTest { public void testMethods() throws Exception { Router router = objectMapper.readValue(JSON_FULL, Router.class); router.toString(); - + List routes = router.getRoutes(); Assert.assertNotNull(routes); Assert.assertEquals(2, routes.size()); router.setRoutes(routes); - + String admin_state_up = router.getAdminStateUp(); Assert.assertNotNull(admin_state_up); router.setAdminStateUp(admin_state_up); - + String name = router.getName(); Assert.assertNotNull(name); router.setName(name); - + String tenantId = router.getTenantId(); Assert.assertNotNull(tenantId); router.setTenantId(tenantId); - + GatewayInfo externalGatewayInfo = router.getExternalGatewayInfo(); Assert.assertNotNull(externalGatewayInfo); router.setExternalGatewayInfo(externalGatewayInfo); - + String id = router.getId(); Assert.assertNotNull(id); router.setId(id); - + String status = router.getStatus(); Assert.assertNotNull(status); router.setStatus(status); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RoutersTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RoutersTest.java index 168dffc..917838a 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RoutersTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RoutersTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,47 +34,23 @@ public class RoutersTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"routers\" : [ {" + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"admin_state_up\" : \"admin_state_up\"," + EOL - + " \"id\" : \"id\"," + EOL - + " \"routes\" : [ {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " }, {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " } ]," + EOL - + " \"external_gateway_info\" : {" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + " }," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }, {" + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"admin_state_up\" : \"admin_state_up\"," + EOL - + " \"id\" : \"id\"," + EOL - + " \"routes\" : [ {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " }, {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " } ]," + EOL - + " \"external_gateway_info\" : {" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + " }," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"routers\" : [ {" + EOL + " \"status\" : \"status\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL + + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + EOL + " }," + + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + " \"status\" : \"status\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL + + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + EOL + " }," + + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -92,14 +66,15 @@ public class RoutersTest { public void testMethods() throws Exception { Routers routers = objectMapper.readValue(JSON_FULL, Routers.class); routers.toString(); - + List list = routers.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); routers.setList(list); - + int cnt = 0; - for (@SuppressWarnings("unused") Router x : routers) { + for (@SuppressWarnings("unused") + Router x : routers) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SegmentTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SegmentTest.java index 992d5ab..7d41335 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SegmentTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SegmentTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,17 +33,13 @@ public class SegmentTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + + EOL + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,15 +55,15 @@ public class SegmentTest { public void testMethods() throws Exception { Segment segment = objectMapper.readValue(JSON_FULL, Segment.class); segment.toString(); - + String providerNetworkType = segment.getProviderNetworkType(); Assert.assertNotNull(providerNetworkType); segment.setProviderNetworkType(providerNetworkType); - + Integer providerSegmentationId = segment.getProviderSegmentationId(); Assert.assertNotNull(providerSegmentationId); segment.setProviderSegmentationId(providerSegmentationId); - + String providerPhysicalNetwork = segment.getProviderPhysicalNetwork(); Assert.assertNotNull(providerPhysicalNetwork); segment.setProviderPhysicalNetwork(providerPhysicalNetwork); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java index 9bdd37c..11c178b 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.quantum.model.Subnet.IpVersion; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,34 +35,19 @@ public class SubnetTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"subnet\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"enable_dhcp\" : true," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL - + " \"allocation_pools\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " } ]," + EOL - + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL - + " \"ip_version\" : 4," + EOL - + " \"gateway_ip\" : \"gw\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"subnet\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL + + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {" + + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL + + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL + + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL + + " \"gateway_ip\" : \"gw\"" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -80,45 +63,45 @@ public class SubnetTest { public void testMethods() throws Exception { Subnet subnet = objectMapper.readValue(JSON_FULL, Subnet.class); subnet.toString(); - + String gw = subnet.getGw(); Assert.assertNotNull(gw); subnet.setGw(gw); - + List dnsNames = subnet.getDnsNames(); Assert.assertNotNull(dnsNames); Assert.assertEquals(2, dnsNames.size()); subnet.setDnsNames(dnsNames); - + List hostRoutes = subnet.getHostRoutes(); Assert.assertNotNull(hostRoutes); Assert.assertEquals(2, hostRoutes.size()); subnet.setHostRoutes(hostRoutes); - + String name = subnet.getName(); Assert.assertNotNull(name); subnet.setName(name); - + String tenantId = subnet.getTenantId(); Assert.assertNotNull(tenantId); subnet.setTenantId(tenantId); - + String cidr = subnet.getCidr(); Assert.assertNotNull(cidr); subnet.setCidr(cidr); - + String networkId = subnet.getNetworkId(); Assert.assertNotNull(networkId); subnet.setNetworkId(networkId); - + Boolean enableDHCP = subnet.getEnableDHCP(); Assert.assertNotNull(enableDHCP); subnet.setEnableDHCP(enableDHCP); - + IpVersion ipversion = subnet.getIpversion(); Assert.assertNotNull(ipversion); subnet.setIpversion(ipversion); - + List list = subnet.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.java index 710f694..02f4c75 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,49 +34,25 @@ public class SubnetsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"subnets\" : [ {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"enable_dhcp\" : true," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL - + " \"allocation_pools\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " } ]," + EOL - + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL - + " \"ip_version\" : 4," + EOL - + " \"gateway_ip\" : \"gw\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"enable_dhcp\" : true," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL - + " \"allocation_pools\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " } ]," + EOL - + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL - + " \"ip_version\" : 4," + EOL - + " \"gateway_ip\" : \"gw\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"subnets\" : [ {" + EOL + " \"name\" : \"name\"," + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL + + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {" + + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL + + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL + + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL + + " \"gateway_ip\" : \"gw\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"," + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL + + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {" + + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL + + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL + + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL + + " \"gateway_ip\" : \"gw\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -94,14 +68,15 @@ public class SubnetsTest { public void testMethods() throws Exception { Subnets subnets = objectMapper.readValue(JSON_FULL, Subnets.class); subnets.toString(); - + List list = subnets.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); subnets.setList(list); - + int cnt = 0; - for (@SuppressWarnings("unused") Subnet x : subnets) { + for (@SuppressWarnings("unused") + Subnet x : subnets) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/swift-client/pom.xml b/swift-client/pom.xml index de1f1b1..b7b0852 100644 --- a/swift-client/pom.xml +++ b/swift-client/pom.xml @@ -1,24 +1,25 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - swift-client - OpenStack Swift Client - OpenStack Swift Client - - - org.onap.so.libs.openstack-java-sdk - openstack-client - ${project.version} - - - org.onap.so.libs.openstack-java-sdk - swift-model - ${project.version} - - + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + swift-client + OpenStack Swift Client + OpenStack Swift Client + + + org.onap.so.libs.openstack-java-sdk + openstack-client + ${project.version} + + + org.onap.so.libs.openstack-java-sdk + swift-model + ${project.version} + + diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java b/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java index 8ae3200..1e3d498 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java @@ -23,25 +23,25 @@ import com.woorea.openstack.swift.api.AccountResource; import com.woorea.openstack.swift.api.ContainersResource; public class Swift extends OpenStackClient { - + private final AccountResource ACCOUNT; - + private final ContainersResource CONTAINERS; - + public Swift(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); CONTAINERS = new ContainersResource(this); ACCOUNT = new AccountResource(this); } - + public Swift(String endpoint) { this(endpoint, null); } - + public ContainersResource containers() { return CONTAINERS; } - + public AccountResource account() { return ACCOUNT; } diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java index a860c71..7ed0ca2 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java @@ -20,9 +20,9 @@ import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackRequest; public class AccountResource { - + private final OpenStackClient CLIENT; - + public AccountResource(OpenStackClient client) { CLIENT = client; } diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java index 5b5cc02..b0ef16b 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java @@ -17,8 +17,6 @@ package com.woorea.openstack.swift.api; import java.util.Map; - - import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.base.client.OpenStackResponse; @@ -26,72 +24,72 @@ import com.woorea.openstack.swift.model.ObjectDownload; import com.woorea.openstack.swift.model.ObjectForUpload; public class ContainerResource { - + private final OpenStackClient CLIENT; - + private String container; - + public ContainerResource(OpenStackClient client, String container) { CLIENT = client; this.container = container; } - + public List list() { return new List(container, null); } - + public CreateDirectory createDirectory(String path) { return new CreateDirectory(container, path); } - + public Show show(String path) { return new Show(container, path); } - + public Upload upload(ObjectForUpload objectForUpload) { return new Upload(objectForUpload); } - + public Download download(String path) { return new Download(container, path); } - + public Delete delete(String path) { return new Delete(container, path); } - + public class List extends OpenStackRequest> { private String containerName; - + private Map filters; - + public List(String containerName, Map filters) { this.containerName = containerName; this.filters = filters; } - + } public class CreateDirectory extends OpenStackRequest { private String container; - + private String path; - + public CreateDirectory(String container, String path) { this.container = container; this.path = path; } - + } - + public class Show extends OpenStackRequest { private String containerName; - + private String objectName; - + public Show(String containerName, String objectName) { this.containerName = containerName; this.objectName = objectName; @@ -99,24 +97,24 @@ public class ContainerResource { } } - + public class Upload extends OpenStackRequest { private ObjectForUpload objectForUpload; - + public Upload(ObjectForUpload objectForUpload) { this.objectForUpload = objectForUpload; } } - + public class Download extends OpenStackRequest { private String containerName; - + private String objectName; - + public Download(String containerName, String objectName) { this.containerName = containerName; this.objectName = objectName; @@ -124,13 +122,13 @@ public class ContainerResource { } - + public class Delete extends OpenStackRequest { private String containerName; - + private String objectName; - + public Delete(String containerName, String objectName) { this.containerName = containerName; this.objectName = objectName; diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java index 05147bc..04d8ba4 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java @@ -22,68 +22,67 @@ import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.swift.model.Container; public class ContainersResource { - + private final OpenStackClient CLIENT; - + public ContainersResource(OpenStackClient client) { CLIENT = client; } - + public List list() { return new List(); } - + public Create create(String name) { return new Create(name); } - + public Show show(String name) { return new Show(name); } - + public Delete delete(String name) { return new Delete(name); } - + public ContainerResource container(String name) { return new ContainerResource(CLIENT, name); } - + public class List extends OpenStackRequest> { - public List() { - } + public List() {} } public class Create extends OpenStackRequest { - + public Create(String containerName) { } } - + public class Show extends OpenStackRequest { private String containerName; - + public Show(String containerName) { } } - + public class Delete extends OpenStackRequest { private String containerName; - + public Delete(String containerName) { this.containerName = containerName; } } - + } diff --git a/swift-model/pom.xml b/swift-model/pom.xml index 0229890..38708cf 100644 --- a/swift-model/pom.xml +++ b/swift-model/pom.xml @@ -1,24 +1,25 @@ - - 4.0.0 - - org.onap.so.libs - openstack-java-sdk - 1.4.0-SNAPSHOT - - org.onap.so.libs.openstack-java-sdk - swift-model - OpenStack Swift Model - OpenStack Swift Model - - - junit - junit - test - - - org.skyscreamer - jsonassert - test - - + + 4.0.0 + + org.onap.so.libs + openstack-java-sdk + 1.4.0-SNAPSHOT + + org.onap.so.libs.openstack-java-sdk + swift-model + OpenStack Swift Model + OpenStack Swift Model + + + junit + junit + test + + + org.skyscreamer + jsonassert + test + + diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java index 008574e..64bc2bf 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java @@ -21,9 +21,9 @@ import java.io.Serializable; public class Account implements Serializable { private Integer containerCount; - + private Integer objectCount; - + private Integer bytesUsed; /** @@ -68,13 +68,15 @@ public class Account implements Serializable { this.bytesUsed = bytesUsed; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Account [containerCount=" + containerCount + ", objectCount=" - + objectCount + ", bytesUsed=" + bytesUsed + "]"; + return "Account [containerCount=" + containerCount + ", objectCount=" + objectCount + ", bytesUsed=" + bytesUsed + + "]"; } - + } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java index 5efe9a7..5299a5f 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java @@ -17,16 +17,15 @@ package com.woorea.openstack.swift.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class Container implements Serializable { - + private String name; - + @JsonProperty("count") private Integer objectCount; - + @JsonProperty("bytes") private Long bytesUsed; @@ -72,15 +71,16 @@ public class Container implements Serializable { this.bytesUsed = bytesUsed; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Container [name=" + name + ", objectCount=" + objectCount - + ", bytesUsed=" + bytesUsed + "]"; + return "Container [name=" + name + ", objectCount=" + objectCount + ", bytesUsed=" + bytesUsed + "]"; } - - + + } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java index cfc3eba..36d56fe 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java @@ -18,22 +18,21 @@ package com.woorea.openstack.swift.model; import java.io.Serializable; import java.util.Calendar; - import com.fasterxml.jackson.annotation.JsonProperty; public class Object implements Serializable { - + private String subdir; - + private String name; - + private String hash; - + private int bytes; - + @JsonProperty("content_type") private String contentType; - + @JsonProperty("last_modified") private Calendar lastModified; @@ -120,5 +119,5 @@ public class Object implements Serializable { public void setLastModified(Calendar lastModified) { this.lastModified = lastModified; } - + } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java index 269532e..f75f27e 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java @@ -23,7 +23,7 @@ import java.io.InputStream; public class ObjectDownload { private Object object; - + private InputStream inputStream; /** diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java index 93c8c72..b35d14f 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java @@ -22,11 +22,11 @@ import java.util.Map; public class ObjectForUpload { - + private String container; - + private String name; - + private Map properties; private InputStream inputStream; @@ -63,7 +63,7 @@ public class ObjectForUpload { * @return the properties */ public Map getProperties() { - if(properties == null) { + if (properties == null) { properties = new HashMap<>(); } return properties; @@ -83,6 +83,6 @@ public class ObjectForUpload { this.inputStream = inputStream; } - + } diff --git a/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java b/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java index 41d7f6e..d75d4ea 100644 --- a/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java +++ b/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,17 +33,12 @@ public class ContainerTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"," + EOL - + " \"count\" : 2," + EOL - + " \"bytes\" : 84" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"name\" : \"name\"," + EOL + " \"count\" : 2," + EOL + " \"bytes\" : 84" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,15 +54,15 @@ public class ContainerTest { public void testMethods() throws Exception { Container container = objectMapper.readValue(JSON_FULL, Container.class); container.toString(); - + Long bytesUsed = container.getBytesUsed(); Assert.assertNotNull(bytesUsed); container.setBytesUsed(bytesUsed); - + Integer objectCount = container.getObjectCount(); Assert.assertNotNull(objectCount); container.setObjectCount(objectCount); - + String name = container.getName(); Assert.assertNotNull(name); container.setName(name); diff --git a/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java b/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java index 28d909a..b3a72ca 100644 --- a/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java +++ b/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,20 +34,13 @@ public class ObjectTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"subdir\" : \"subdir\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"hash\" : \"hash\"," + EOL - + " \"bytes\" : 82," + EOL - + " \"content_type\" : \"contenttype\"," + EOL - + " \"last_modified\" : 1488715200000" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"subdir\" : \"subdir\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"hash\" : \"hash\"," + EOL + " \"bytes\" : 82," + EOL + " \"content_type\" : \"contenttype\"," + + EOL + " \"last_modified\" : 1488715200000" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,29 +54,30 @@ public class ObjectTest { @Test public void testMethods() throws Exception { - com.woorea.openstack.swift.model.Object object = objectMapper.readValue(JSON_FULL, com.woorea.openstack.swift.model.Object.class); + com.woorea.openstack.swift.model.Object object = + objectMapper.readValue(JSON_FULL, com.woorea.openstack.swift.model.Object.class); object.toString(); - + String subdir = object.getSubdir(); Assert.assertNotNull(subdir); object.setSubdir(subdir); - + Calendar lastModified = object.getLastModified(); Assert.assertNotNull(lastModified); object.setLastModified(lastModified); - + int bytes = object.getBytes(); Assert.assertNotNull(bytes); object.setBytes(bytes); - + String name = object.getName(); Assert.assertNotNull(name); object.setName(name); - + String hash = object.getHash(); Assert.assertNotNull(hash); object.setHash(hash); - + String contentType = object.getContentType(); Assert.assertNotNull(contentType); object.setContentType(contentType); -- cgit 1.2.3-korg