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