mirror of https://github.com/apache/jclouds.git
Address error-prone errors
Mostly of the form, Collection.size() >= 0.
This commit is contained in:
parent
ba55ab4b12
commit
98b3105669
|
@ -71,7 +71,7 @@ public class AddressApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
return;
|
return;
|
||||||
Set<PublicIPAddress> response = client.getAddressApi().listPublicIPAddresses();
|
Set<PublicIPAddress> response = client.getAddressApi().listPublicIPAddresses();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (PublicIPAddress ip : response) {
|
for (PublicIPAddress ip : response) {
|
||||||
PublicIPAddress newDetails = getOnlyElement(client.getAddressApi().listPublicIPAddresses(
|
PublicIPAddress newDetails = getOnlyElement(client.getAddressApi().listPublicIPAddresses(
|
||||||
ListPublicIPAddressesOptions.Builder.id(ip.getId())));
|
ListPublicIPAddressesOptions.Builder.id(ip.getId())));
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class EventApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testlistEventTypes() throws Exception {
|
public void testlistEventTypes() throws Exception {
|
||||||
final Set<String> response = client.getEventApi().listEventTypes();
|
final Set<String> response = client.getEventApi().listEventTypes();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (String type : response) {
|
for (String type : response) {
|
||||||
checkEventType(type);
|
checkEventType(type);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class EventApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testlistEvents() throws Exception {
|
public void testlistEvents() throws Exception {
|
||||||
final Set<Event> response = client.getEventApi().listEvents();
|
final Set<Event> response = client.getEventApi().listEvents();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (Event event : response) {
|
for (Event event : response) {
|
||||||
checkEvent(event);
|
checkEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class FirewallApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testListPortForwardingRules() throws Exception {
|
public void testListPortForwardingRules() throws Exception {
|
||||||
Set<PortForwardingRule> response = client.getFirewallApi().listPortForwardingRules();
|
Set<PortForwardingRule> response = client.getFirewallApi().listPortForwardingRules();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (final PortForwardingRule rule : response) {
|
for (final PortForwardingRule rule : response) {
|
||||||
checkPortForwardingRule(rule);
|
checkPortForwardingRule(rule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class GlobalAlertApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
|
|
||||||
final Set<Alert> response = globalAdminClient.getAlertClient().listAlerts();
|
final Set<Alert> response = globalAdminClient.getAlertClient().listAlerts();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Alert alert : response) {
|
for (Alert alert : response) {
|
||||||
assertNotNull(alert.getDescription());
|
assertNotNull(alert.getDescription());
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class GlobalUsageApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
|
|
||||||
Set<UsageRecord> records = globalAdminClient.getUsageClient().listUsageRecords(start, end, ListUsageRecordsOptions.NONE);
|
Set<UsageRecord> records = globalAdminClient.getUsageClient().listUsageRecords(start, end, ListUsageRecordsOptions.NONE);
|
||||||
assertNotNull(records);
|
assertNotNull(records);
|
||||||
assertTrue(records.size() >= 0);
|
assertTrue(records.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class GuestOSApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testListOSTypes() throws Exception {
|
public void testListOSTypes() throws Exception {
|
||||||
Set<OSType> response = client.getGuestOSApi().listOSTypes();
|
Set<OSType> response = client.getGuestOSApi().listOSTypes();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (OSType type : response) {
|
for (OSType type : response) {
|
||||||
OSType newDetails = getOnlyElement(client.getGuestOSApi().listOSTypes(
|
OSType newDetails = getOnlyElement(client.getGuestOSApi().listOSTypes(
|
||||||
ListOSTypesOptions.Builder.id(type.getId())));
|
ListOSTypesOptions.Builder.id(type.getId())));
|
||||||
|
@ -50,7 +50,7 @@ public class GuestOSApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testListOSCategories() throws Exception {
|
public void testListOSCategories() throws Exception {
|
||||||
Map<String, String> response = client.getGuestOSApi().listOSCategories();
|
Map<String, String> response = client.getGuestOSApi().listOSCategories();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (Entry<String, String> category : response.entrySet()) {
|
for (Entry<String, String> category : response.entrySet()) {
|
||||||
checkOSCategory(category);
|
checkOSCategory(category);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class HypervisorApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testListHypervisors() throws Exception {
|
public void testListHypervisors() throws Exception {
|
||||||
Set<String> response = client.getHypervisorApi().listHypervisors();
|
Set<String> response = client.getHypervisorApi().listHypervisors();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (Zone zone : client.getZoneApi().listZones()) {
|
for (Zone zone : client.getZoneApi().listZones()) {
|
||||||
Set<String> zoneHype = client.getHypervisorApi().listHypervisorsInZone(zone.getId());
|
Set<String> zoneHype = client.getHypervisorApi().listHypervisorsInZone(zone.getId());
|
||||||
assert response.containsAll(zoneHype);
|
assert response.containsAll(zoneHype);
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testListLoadBalancerRules() throws Exception {
|
public void testListLoadBalancerRules() throws Exception {
|
||||||
Set<LoadBalancerRule> response = client.getLoadBalancerApi().listLoadBalancerRules();
|
Set<LoadBalancerRule> response = client.getLoadBalancerApi().listLoadBalancerRules();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (LoadBalancerRule rule : response) {
|
for (LoadBalancerRule rule : response) {
|
||||||
LoadBalancerRule newDetails = findRuleWithId(rule.getId());
|
LoadBalancerRule newDetails = findRuleWithId(rule.getId());
|
||||||
assertEquals(rule.getId(), newDetails.getId());
|
assertEquals(rule.getId(), newDetails.getId());
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class NATApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testListIPForwardingRules() throws Exception {
|
public void testListIPForwardingRules() throws Exception {
|
||||||
Set<IPForwardingRule> response = client.getNATApi().listIPForwardingRules();
|
Set<IPForwardingRule> response = client.getNATApi().listIPForwardingRules();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (IPForwardingRule rule : response) {
|
for (IPForwardingRule rule : response) {
|
||||||
IPForwardingRule newDetails = getOnlyElement(client.getNATApi().listIPForwardingRules(
|
IPForwardingRule newDetails = getOnlyElement(client.getNATApi().listIPForwardingRules(
|
||||||
ListIPForwardingRulesOptions.Builder.id(rule.getId())));
|
ListIPForwardingRulesOptions.Builder.id(rule.getId())));
|
||||||
|
|
|
@ -335,7 +335,7 @@ public class VirtualMachineApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
public void testListVirtualMachines() throws Exception {
|
public void testListVirtualMachines() throws Exception {
|
||||||
Set<VirtualMachine> response = client.getVirtualMachineApi().listVirtualMachines();
|
Set<VirtualMachine> response = client.getVirtualMachineApi().listVirtualMachines();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (VirtualMachine vm : response) {
|
for (VirtualMachine vm : response) {
|
||||||
VirtualMachine newDetails = getOnlyElement(client.getVirtualMachineApi().listVirtualMachines(
|
VirtualMachine newDetails = getOnlyElement(client.getVirtualMachineApi().listVirtualMachines(
|
||||||
ListVirtualMachinesOptions.Builder.id(vm.getId())));
|
ListVirtualMachinesOptions.Builder.id(vm.getId())));
|
||||||
|
@ -392,7 +392,7 @@ public class VirtualMachineApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
assert vm.getSecurityGroups() != null && vm.getSecurityGroups().size() >= 0 : vm;
|
assert vm.getSecurityGroups() != null && vm.getSecurityGroups().size() > 0 : vm;
|
||||||
assert vm.getHypervisor() != null : vm;
|
assert vm.getHypervisor() != null : vm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,8 @@ public class ZoneApiLiveTest extends BaseCloudStackApiLiveTest {
|
||||||
break;
|
break;
|
||||||
case BASIC:
|
case BASIC:
|
||||||
assert zone.getVLAN() == null : zone;
|
assert zone.getVLAN() == null : zone;
|
||||||
assert zone.getDNS().size() >= 0 : zone;
|
assert zone.getDNS().size() > 0 : zone;
|
||||||
assert zone.getInternalDNS().size() >= 0 : zone;
|
assert zone.getInternalDNS().size() > 0 : zone;
|
||||||
assert zone.getDomain() == null : zone;
|
assert zone.getDomain() == null : zone;
|
||||||
assert zone.getDomainId() == null : zone;
|
assert zone.getDomainId() == null : zone;
|
||||||
assert zone.getGuestCIDRAddress() == null : zone;
|
assert zone.getGuestCIDRAddress() == null : zone;
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(super.hashCode(), autoAssignFloatingIp, floatingIpPoolNames, generateKeyPair, keyPairName,
|
return Objects.hashCode(super.hashCode(), autoAssignFloatingIp, floatingIpPoolNames, generateKeyPair, keyPairName,
|
||||||
userData, diskConfig, configDrive, novaNetworks, availabilityZone);
|
Arrays.hashCode(userData), diskConfig, configDrive, novaNetworks, availabilityZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
FloatingIPApi api = apiOption.get();
|
FloatingIPApi api = apiOption.get();
|
||||||
Set<? extends FloatingIP> response = api.list().toSet();
|
Set<? extends FloatingIP> response = api.list().toSet();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (FloatingIP ip : response) {
|
for (FloatingIP ip : response) {
|
||||||
FloatingIP newDetails = api.get(ip.getId());
|
FloatingIP newDetails = api.get(ip.getId());
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
Set<LoadBalancer> response = api.getLoadBalancerApi(region).list().concat().toSet();
|
Set<LoadBalancer> response = api.getLoadBalancerApi(region).list().concat().toSet();
|
||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
|
|
||||||
for (LoadBalancer lb : response) {
|
for (LoadBalancer lb : response) {
|
||||||
if (!lbs.contains(lb))
|
if (!lbs.contains(lb))
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
for (LoadBalancer lb : nodes.keySet()) {
|
for (LoadBalancer lb : nodes.keySet()) {
|
||||||
Set<Node> response = api.getNodeApi(lb.getRegion(), lb.getId()).list().concat().toSet();
|
Set<Node> response = api.getNodeApi(lb.getRegion(), lb.getId()).list().concat().toSet();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (Node n : response) {
|
for (Node n : response) {
|
||||||
assert n.getId() != -1 : n;
|
assert n.getId() != -1 : n;
|
||||||
assert n.getCondition() != null : n;
|
assert n.getCondition() != null : n;
|
||||||
|
|
|
@ -844,7 +844,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
||||||
for (Hardware hardware : client.listHardwareProfiles()) {
|
for (Hardware hardware : client.listHardwareProfiles()) {
|
||||||
assert hardware.getProviderId() != null : hardware;
|
assert hardware.getProviderId() != null : hardware;
|
||||||
assert getCores(hardware) > 0 : hardware;
|
assert getCores(hardware) > 0 : hardware;
|
||||||
assert hardware.getVolumes().size() >= 0 : hardware;
|
assert hardware.getVolumes().size() > 0 : hardware;
|
||||||
assert hardware.getRam() > 0 : hardware;
|
assert hardware.getRam() > 0 : hardware;
|
||||||
assertEquals(hardware.getType(), ComputeType.HARDWARE);
|
assertEquals(hardware.getType(), ComputeType.HARDWARE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class AWSInstanceApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
for (String region : view.unwrapApi(AWSEC2Api.class).getAvailabilityZoneAndRegionApi().get().describeRegions().keySet()) {
|
for (String region : view.unwrapApi(AWSEC2Api.class).getAvailabilityZoneAndRegionApi().get().describeRegions().keySet()) {
|
||||||
Set<? extends Reservation<? extends RunningInstance>> allResults = client.describeInstancesInRegion(region);
|
Set<? extends Reservation<? extends RunningInstance>> allResults = client.describeInstancesInRegion(region);
|
||||||
assertNotNull(allResults);
|
assertNotNull(allResults);
|
||||||
assert allResults.size() >= 0 : allResults.size();
|
assert allResults.size() > 0 : allResults.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class AccountApiLiveTest extends BaseSoftLayerApiLiveTest {
|
||||||
@Test
|
@Test
|
||||||
public void testListVirtualGuests() throws Exception {
|
public void testListVirtualGuests() throws Exception {
|
||||||
Set<VirtualGuest> response = api().listVirtualGuests();
|
Set<VirtualGuest> response = api().listVirtualGuests();
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (VirtualGuest vg : response) {
|
for (VirtualGuest vg : response) {
|
||||||
checkVirtualGuest(vg);
|
checkVirtualGuest(vg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DatacenterApiLiveTest extends BaseSoftLayerApiLiveTest {
|
||||||
public void testListDatacenters() {
|
public void testListDatacenters() {
|
||||||
Set<Datacenter> response = api().listDatacenters();
|
Set<Datacenter> response = api().listDatacenters();
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
for (Datacenter vg : response) {
|
for (Datacenter vg : response) {
|
||||||
Datacenter newDetails = api().getDatacenter(vg.getId());
|
Datacenter newDetails = api().getDatacenter(vg.getId());
|
||||||
assertEquals(vg.getId(), newDetails.getId());
|
assertEquals(vg.getId(), newDetails.getId());
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class SoftwareDescriptionApiLiveTest extends BaseSoftLayerApiLiveTest {
|
||||||
public void testGetAllObjects() {
|
public void testGetAllObjects() {
|
||||||
Set<SoftwareDescription> response = api().getAllObjects();
|
Set<SoftwareDescription> response = api().getAllObjects();
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SoftwareDescriptionApi api() {
|
private SoftwareDescriptionApi api() {
|
||||||
|
|
Loading…
Reference in New Issue