mirror of https://github.com/apache/jclouds.git
Merge pull request #954 from andrewgaul/specific-asserts
Prefer specific asserts where possible
This commit is contained in:
commit
55025c0764
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.cloudfiles;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
|
@ -75,7 +76,7 @@ public class CloudFilesClientLiveTest extends CommonSwiftClientLiveTest<CloudFil
|
|||
|
||||
// Enable CDN with PUT for one container
|
||||
final URI cdnUri = getApi().enableCDN(containerNameWithCDN);
|
||||
assertTrue(cdnUri != null);
|
||||
assertNotNull(cdnUri);
|
||||
|
||||
// Confirm CDN is enabled via HEAD request and has default TTL
|
||||
cdnMetadata = getApi().getCDNMetadata(containerNameWithCDN);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class OptionsConverterTest {
|
|||
DeployVirtualMachineOptions optionsOut = new DeployVirtualMachineOptions();
|
||||
|
||||
DeployVirtualMachineOptions optionsOut2 = converter.apply(optionsIn, EMPTY_NETWORKS_MAP, ZONE_ID, optionsOut);
|
||||
assertTrue(optionsOut == optionsOut2);
|
||||
assertEquals(optionsOut, optionsOut2);
|
||||
|
||||
DeployVirtualMachineOptions optionsExpected = DeployVirtualMachineOptions.Builder.securityGroupId("42").networkId("46");
|
||||
assertEquals(optionsOut, optionsExpected);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
|
@ -40,14 +41,14 @@ public class GlobalCapacityClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
skipIfNotGlobalAdmin();
|
||||
|
||||
final Set<Capacity> response = globalAdminClient.getCapacityClient().listCapacity();
|
||||
assert null != response;
|
||||
assertTrue(response.size() >= 0);
|
||||
assertNotNull(response);
|
||||
assertNotEquals(0, response.size());
|
||||
int count = 0;
|
||||
for (Capacity capacity : response) {
|
||||
assertTrue(capacity.getCapacityTotal() > 0);
|
||||
assertTrue(capacity.getCapacityUsed() > 0);
|
||||
assertTrue(capacity.getPercentUsed() >= 0);
|
||||
assertTrue(capacity.getType() != Capacity.Type.UNRECOGNIZED);
|
||||
assertNotEquals(Capacity.Type.UNRECOGNIZED, capacity.getType());
|
||||
assertNotNull(capacity.getZoneName());
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -80,15 +82,15 @@ public class GlobalHostClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
}
|
||||
|
||||
private void checkCluster(Cluster cluster) {
|
||||
assertTrue(cluster.getId() != null);
|
||||
assertNotNull(cluster.getId());
|
||||
assertFalse(Strings.isNullOrEmpty(cluster.getName()));
|
||||
assertTrue(cluster.getAllocationState() != AllocationState.UNKNOWN);
|
||||
assertTrue(cluster.getClusterType() != Host.ClusterType.UNKNOWN);
|
||||
assertNotEquals(AllocationState.UNKNOWN, cluster.getAllocationState());
|
||||
assertNotEquals(Host.ClusterType.UNKNOWN, cluster.getClusterType());
|
||||
assertFalse(Strings.isNullOrEmpty(cluster.getHypervisor()));
|
||||
assertTrue(cluster.getManagedState() != Cluster.ManagedState.UNRECOGNIZED);
|
||||
assertTrue(cluster.getPodId() != null);
|
||||
assertNotEquals(Cluster.ManagedState.UNRECOGNIZED, cluster.getManagedState());
|
||||
assertNotNull(cluster.getPodId());
|
||||
assertFalse(Strings.isNullOrEmpty(cluster.getPodName()));
|
||||
assertTrue(cluster.getZoneId() != null);
|
||||
assertNotNull(cluster.getZoneId());
|
||||
assertFalse(Strings.isNullOrEmpty(cluster.getZoneName()));
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public class GlobalOfferingClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
}
|
||||
|
||||
private void checkServiceOffering(ServiceOffering offering) {
|
||||
assertTrue(offering.getId() != null);
|
||||
assertNotNull(offering.getId());
|
||||
assertEquals(offering.getCpuNumber(), 2);
|
||||
assertEquals(offering.getCpuSpeed(), 1024);
|
||||
assertEquals(offering.getMemory(), 2048);
|
||||
|
|
|
@ -64,9 +64,9 @@ public class GlobalPodClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
ListPodsOptions.Builder.id(pod.getId())));
|
||||
assertEquals(pod, newDetails);
|
||||
assertEquals(pod, globalAdminClient.getPodClient().getPod(pod.getId()));
|
||||
assertFalse(pod.getId() == null);
|
||||
assertNotNull(pod.getId());
|
||||
assertFalse(Strings.isNullOrEmpty(pod.getName()));
|
||||
assertFalse(pod.getZoneId() == null);
|
||||
assertNotNull(pod.getZoneId());
|
||||
assertFalse(Strings.isNullOrEmpty(pod.getZoneName()));
|
||||
assertFalse(Strings.isNullOrEmpty(pod.getGateway()));
|
||||
assertFalse(Strings.isNullOrEmpty(pod.getNetmask()));
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
|
@ -46,17 +47,17 @@ public class GlobalStoragePoolClientLiveTest extends BaseCloudStackClientLiveTes
|
|||
assertNotNull(result);
|
||||
assertTrue(result.size() > 0);
|
||||
for(StoragePool pool : result) {
|
||||
assertTrue(pool.getId() != null);
|
||||
assertNotNull(pool.getId());
|
||||
assertFalse(Strings.isNullOrEmpty(pool.getName()));
|
||||
assertFalse(Strings.isNullOrEmpty(pool.getPath()));
|
||||
assertNotNull(pool.getTags());
|
||||
assertTrue(pool.getState() != StoragePool.State.UNRECOGNIZED);
|
||||
assertTrue(pool.getType() != StoragePool.Type.UNRECOGNIZED);
|
||||
assertTrue(pool.getZoneId() != null);
|
||||
assertNotEquals(StoragePool.State.UNRECOGNIZED, pool.getState());
|
||||
assertNotEquals(StoragePool.Type.UNRECOGNIZED, pool.getType());
|
||||
assertNotNull(pool.getZoneId());
|
||||
assertFalse(Strings.isNullOrEmpty(pool.getZoneName()));
|
||||
assertTrue(pool.getPodId() != null);
|
||||
assertNotNull(pool.getPodId());
|
||||
assertFalse(Strings.isNullOrEmpty(pool.getPodName()));
|
||||
assertTrue(pool.getClusterId() != null);
|
||||
assertNotNull(pool.getClusterId());
|
||||
assertFalse(Strings.isNullOrEmpty(pool.getClusterName()));
|
||||
assertNotNull(pool.getCreated());
|
||||
assertTrue(pool.getDiskSizeTotal() > 0);
|
||||
|
|
|
@ -22,6 +22,7 @@ import static com.google.common.collect.Iterables.find;
|
|||
import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.zoneId;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -71,17 +72,17 @@ public class GlobalVlanClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
ListVlanIPRangesOptions.Builder.id(range.getId())));
|
||||
assertEquals(range, newDetails);
|
||||
assertEquals(range, globalAdminClient.getVlanClient().getVlanIPRange(range.getId()));
|
||||
assertFalse(range.getId() != null);
|
||||
assertFalse(range.getZoneId() != null);
|
||||
assertNull(range.getId());
|
||||
assertNull(range.getZoneId());
|
||||
assertFalse(Strings.isNullOrEmpty(range.getVlan()));
|
||||
assertFalse(Strings.isNullOrEmpty(range.getAccount()));
|
||||
assertFalse(range.getDomainId() != null);
|
||||
assertNull(range.getDomainId());
|
||||
assertFalse(Strings.isNullOrEmpty(range.getDomain()));
|
||||
assertFalse(Strings.isNullOrEmpty(range.getGateway()));
|
||||
assertFalse(Strings.isNullOrEmpty(range.getNetmask()));
|
||||
assertFalse(Strings.isNullOrEmpty(range.getStartIP()));
|
||||
assertFalse(Strings.isNullOrEmpty(range.getEndIP()));
|
||||
assertFalse(range.getNetworkId() != null);
|
||||
assertNull(range.getNetworkId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ public class SecurityGroupClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
jobComplete, virtualMachineRunning);
|
||||
try {
|
||||
VirtualMachine runningVm = client.getVirtualMachineClient().getVirtualMachine(newVm.getId());
|
||||
assertTrue(runningVm.getSecurityGroups().size() == 1);
|
||||
assertEquals(1, runningVm.getSecurityGroups().size());
|
||||
assertEquals(Iterables.getOnlyElement(runningVm.getSecurityGroups()).getName(), "default");
|
||||
} finally {
|
||||
assertTrue(jobComplete.apply(client.getVirtualMachineClient().destroyVirtualMachine(newVm.getId())));
|
||||
|
|
|
@ -22,6 +22,7 @@ import static org.jclouds.ec2.options.RunInstancesOptions.Builder.asType;
|
|||
import static org.jclouds.scriptbuilder.domain.Statements.exec;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
|
@ -331,7 +332,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
|||
.describeInstancesInRegion(null, instanceId));
|
||||
|
||||
assertNotNull(Iterables.getOnlyElement(reservation).getIpAddress());
|
||||
assertFalse(Iterables.getOnlyElement(reservation).getIpAddress().equals(address));
|
||||
assertNotEquals(address, Iterables.getOnlyElement(reservation).getIpAddress());
|
||||
|
||||
doCheckKey(address);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.openstack.nova.domain;
|
|||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -47,7 +48,7 @@ public class ServerStatusTest {
|
|||
"PASSWORD", "RESCUE", "REBOOT",
|
||||
"HARD_REBOOT", "DELETE_IP", "UNKNOWN", "DELETED");
|
||||
for (String status : knownStatuses) {
|
||||
assertFalse(ServerStatus.fromValue(status).equals(ServerStatus.UNRECOGNIZED));
|
||||
assertNotEquals(ServerStatus.UNRECOGNIZED, ServerStatus.fromValue(status));
|
||||
}
|
||||
|
||||
List<String> allStatuses = Lists.newArrayList(knownStatuses);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.openstack.nova.functions;
|
||||
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.UnknownHostException;
|
||||
|
@ -63,7 +63,7 @@ public class ParseAddressesFromJsonResponseTest {
|
|||
List<Address> privateAddresses = ImmutableList.copyOf(Iterables.transform(
|
||||
ImmutableList.of("10.176.42.16", "::babe:10.176.42.16"), Address.newString2AddressFunction()));
|
||||
|
||||
assertTrue(response.getPublicAddresses().equals(Sets.newHashSet(publicAddresses)));
|
||||
assertTrue(response.getPrivateAddresses().equals(Sets.newHashSet(privateAddresses)));
|
||||
assertEquals(Sets.newHashSet(publicAddresses), response.getPublicAddresses());
|
||||
assertEquals(Sets.newHashSet(privateAddresses), response.getPrivateAddresses());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.jclouds.openstack.nova.v2_0.compute.predicates;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -60,8 +61,8 @@ public class GetImageWhenImageInZoneHasActiveStatusPredicateWithResultExpectTest
|
|||
ZoneAndId zoneAdnId1 = ZoneAndId.fromZoneAndId("az-1.region-a.geo-1", "12");
|
||||
ZoneAndId zoneAdnId2 = ZoneAndId.fromZoneAndId("az-1.region-a.geo-1", "15");
|
||||
assertTrue(predicate.apply(zoneAdnId0)); // ACTIVE
|
||||
assertTrue(!predicate.apply(zoneAdnId1)); // SAVING
|
||||
assertTrue(!predicate.apply(zoneAdnId2)); // UNRECOGNIZED
|
||||
assertFalse(predicate.apply(zoneAdnId1)); // SAVING
|
||||
assertFalse(predicate.apply(zoneAdnId2)); // UNRECOGNIZED
|
||||
assertEquals("oneiric-server-cloudimg-amd64", predicate.getResult().getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import static org.jclouds.s3.options.CopyObjectOptions.Builder.overrideMetadataW
|
|||
import static org.jclouds.s3.options.PutObjectOptions.Builder.withAcl;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -156,7 +157,7 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest {
|
|||
AccessControlList acl = getApi().getObjectACL(containerName, publicReadWriteObjectKey);
|
||||
assertEquals(acl.getGrants().size(), 3);
|
||||
assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 2);
|
||||
assertTrue(acl.getOwner() != null);
|
||||
assertNotNull(acl.getOwner());
|
||||
String ownerId = acl.getOwner().getId();
|
||||
assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
|
||||
assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ));
|
||||
|
@ -230,7 +231,7 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest {
|
|||
AccessControlList acl = getApi().getObjectACL(containerName, privateObjectKey);
|
||||
|
||||
assertEquals(acl.getGrants().size(), 1);
|
||||
assertTrue(acl.getOwner() != null);
|
||||
assertNotNull(acl.getOwner());
|
||||
String ownerId = acl.getOwner().getId();
|
||||
assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
|
||||
} finally {
|
||||
|
@ -255,7 +256,7 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest {
|
|||
|
||||
assertEquals(acl.getGrants().size(), 2);
|
||||
assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 1);
|
||||
assertTrue(acl.getOwner() != null);
|
||||
assertNotNull(acl.getOwner());
|
||||
String ownerId = acl.getOwner().getId();
|
||||
assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
|
||||
assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ));
|
||||
|
|
|
@ -24,6 +24,7 @@ import static org.jclouds.s3.options.ListBucketOptions.Builder.maxResults;
|
|||
import static org.jclouds.s3.options.ListBucketOptions.Builder.withPrefix;
|
||||
import static org.jclouds.s3.options.PutBucketOptions.Builder.withBucketAcl;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
|
@ -98,7 +99,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
|
|||
try {
|
||||
AccessControlList acl = getApi().getBucketACL(bucketName);
|
||||
assertEquals(acl.getGrants().size(), 1);
|
||||
assertTrue(acl.getOwner() != null);
|
||||
assertNotNull(acl.getOwner());
|
||||
String ownerId = acl.getOwner().getId();
|
||||
assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
|
||||
} finally {
|
||||
|
|
|
@ -295,7 +295,7 @@ public abstract class CommonSwiftClientLiveTest<C extends CommonSwiftClient> ext
|
|||
// test that not giving a destination name *doesn't* copy source name to the destination container with
|
||||
// the source name but copy still returns success :(
|
||||
assertTrue(getApi().copyObject(sourceContainer, sourceObject, destinationContainer, ""));
|
||||
assertTrue(!getApi().objectExists(destinationContainer, sourceObject));
|
||||
assertFalse(getApi().objectExists(destinationContainer, sourceObject));
|
||||
|
||||
// test copy works
|
||||
assertTrue(getApi().copyObject(sourceContainer, sourceObject, destinationContainer, destinationObject));
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.trmk.vcloud_0_8.binders;
|
|||
|
||||
import static org.jclouds.trmk.vcloud_0_8.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NS;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -96,7 +97,7 @@ public class BindAddInternetServiceToXmlPayloadTest {
|
|||
|
||||
binder.bindToRequest(request, map);
|
||||
String rawContent = (String) request.getPayload().getRawContent();
|
||||
assertTrue(rawContent.indexOf("<MonitorType>Disabled</MonitorType>") == -1);
|
||||
assertEquals(-1, rawContent.indexOf("<MonitorType>Disabled</MonitorType>"));
|
||||
}
|
||||
|
||||
public void testDisableMonitoringDisabled() throws IOException {
|
||||
|
@ -114,6 +115,6 @@ public class BindAddInternetServiceToXmlPayloadTest {
|
|||
|
||||
binder.bindToRequest(request, map);
|
||||
String rawContent = (String) request.getPayload().getRawContent();
|
||||
assertTrue(rawContent.indexOf("<MonitorType>Disabled</MonitorType>") != -1);
|
||||
assertNotEquals(-1, rawContent.indexOf("<MonitorType>Disabled</MonitorType>"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ListAttachedNicsLiveApiTest extends BaseAbiquoStrategyLiveApiTest {
|
|||
public void testExecute() {
|
||||
Iterable<Ip<?, ?>> vapps = strategy.execute(env.virtualMachine);
|
||||
assertNotNull(vapps);
|
||||
assertTrue(size(vapps) == 4);
|
||||
assertEquals(4, size(vapps));
|
||||
}
|
||||
|
||||
public void testExecutePredicateWithoutResults() {
|
||||
|
|
|
@ -75,7 +75,7 @@ public class OSImageApiLiveTest extends BaseAzureManagementApiLiveTest {
|
|||
checkNotNull(image.getCategory(), "While Category can be null for OSImage, its Optional wrapper cannot: %s",
|
||||
image);
|
||||
if (image.getCategory().isPresent())
|
||||
assertFalse(image.getCategory().get().trim().equals(""), "Invalid Category: " + image.toString());
|
||||
assertNotEquals("", image.getCategory().get().trim(), "Invalid Category: " + image.toString());
|
||||
|
||||
checkNotNull(image.getLogicalSizeInGB(),
|
||||
"While LogicalSizeInGB can be null for OSImage, its Optional wrapper cannot: %s", image);
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jclouds.fujitsu.fgcp.compute.functions;
|
|||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
@ -56,7 +57,7 @@ public class DiskImageToOperatingSystemTest {
|
|||
|
||||
assertNotNull(os, description);
|
||||
assertNotNull(os.getFamily(), description);
|
||||
assertFalse(os.getFamily().equals(OsFamily.UNRECOGNIZED),
|
||||
assertNotEquals(OsFamily.UNRECOGNIZED, os.getFamily(),
|
||||
"OsFamily not recognised: " + description);
|
||||
assertNotNull(os.getVersion(), "Version not recognised: "
|
||||
+ description);
|
||||
|
|
|
@ -128,7 +128,7 @@ public class VirtualDCApiExpectTest extends BaseFGCPRestApiExpectTest {
|
|||
Set<DiskImage> images = api.listDiskImages(null, "IMG_A1B2C3_1234567890ABCD");
|
||||
|
||||
assertNotNull(images, "images");
|
||||
assertTrue(images.size() == 1, "Unexpected number of images: " + images.size());
|
||||
assertEquals(1, images.size(), "Unexpected number of images: " + images.size());
|
||||
}
|
||||
|
||||
public void testGetAddressRange() {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.fujitsu.fgcp.services;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
|
@ -59,7 +60,7 @@ public class VirtualDCApiLiveTest extends BaseFGCPApiLiveTest {
|
|||
String vsysId = api.createVirtualSystem("abc", "def");
|
||||
|
||||
assertNotNull(vsysId, "vsysId");
|
||||
assertFalse(vsysId.equals(""), "vsysId is empty (\"\")");
|
||||
assertNotEquals("", vsysId, "vsysId is empty (\"\")");
|
||||
System.out.println("vsysId: " + vsysId);
|
||||
}*/
|
||||
|
||||
|
@ -67,7 +68,7 @@ public class VirtualDCApiLiveTest extends BaseFGCPApiLiveTest {
|
|||
Set<ServerType> serverTypes = api.listServerTypes();
|
||||
|
||||
assertNotNull(serverTypes, "serverTypes");
|
||||
assertTrue(serverTypes.size() == 4, "serverTypes.size should return 4, not " + serverTypes.size());
|
||||
assertEquals(4, serverTypes.size(), "serverTypes.size should return 4, not " + serverTypes.size());
|
||||
|
||||
// System.out.println("listServerTypes: " + serverTypes);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public class VirtualSystemApiExpectTest extends BaseFGCPRestApiExpectTest {
|
|||
|
||||
Set<PublicIP> ips = api.listPublicIPs("ABCDEFGH-A123B456CE");
|
||||
assertNotNull(ips, "ips");
|
||||
assertTrue(ips.size() == 2, "Unexpected number of ips: " + ips.size());
|
||||
assertEquals(2, ips.size(), "Unexpected number of ips: " + ips.size());
|
||||
assertEquals(ips.iterator().next().getVersion(), PublicIP.Version.IPv4);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ public class KeyPairsApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
keyPairsContainerName);
|
||||
assertNotNull(keyPairsContainer.getFiles(),
|
||||
String.format(OBJ_FIELD_REQ, MEDIA, "files"));
|
||||
assertTrue(keyPairsContainer.getFiles().size() == 1, String.format(
|
||||
assertEquals(1, keyPairsContainer.getFiles().size(), String.format(
|
||||
OBJ_FIELD_LIST_SIZE_EQ, MEDIA, "files", 1, keyPairsContainer
|
||||
.getFiles().size()));
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
Checks.checkMediaFor(MEDIA, media);
|
||||
|
||||
assertNotNull(media.getFiles(), String.format(OBJ_FIELD_REQ, MEDIA, "files"));
|
||||
assertTrue(media.getFiles().size() == 1,
|
||||
assertEquals(1, media.getFiles().size(),
|
||||
String.format(OBJ_FIELD_LIST_SIZE_EQ, MEDIA, "files", 1, media.getFiles().size()));
|
||||
File uploadFile = getFirst(media.getFiles(), null);
|
||||
assertNotNull(uploadFile, String.format(OBJ_FIELD_REQ, MEDIA, "files.first"));
|
||||
|
|
|
@ -27,6 +27,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.U
|
|||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResource;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
|
@ -88,7 +89,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
String.format(REQUIRED_VALUE_OBJECT_FMT, ".class", NETWORK, abstractNetwork.getClass(), "OrgNetwork"));
|
||||
OrgNetwork network = Network.toSubType(abstractNetwork);
|
||||
assertNotNull(network, String.format(OBJ_REQ_LIVE, NETWORK));
|
||||
assertTrue(!network.getDescription().equals("DO NOT USE"), "Network isn't to be used for testing");
|
||||
assertNotEquals("DO NOT USE", network.getDescription(), "Network isn't to be used for testing");
|
||||
|
||||
Checks.checkOrgNetwork(network);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.O
|
|||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.URN_REQ_LIVE;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
@ -134,7 +135,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
public void testGetVdc() {
|
||||
Vdc vdc = lazyGetVdc();
|
||||
assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC));
|
||||
assertFalse("DO NOT USE".equals(vdc.getDescription()), "vDC isn't to be used for testing");
|
||||
assertNotEquals("DO NOT USE", vdc.getDescription(), "vDC isn't to be used for testing");
|
||||
Checks.checkVdc(vdc);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ import static org.testng.Assert.assertEquals;
|
|||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertSame;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
@ -451,9 +452,9 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest {
|
|||
for (NetworkConnection connection : modified.getNetworkConnections()) {
|
||||
if (connection.getNetwork().equals(
|
||||
newNetworkConnection.getNetwork())) {
|
||||
assertTrue(connection.getIpAddressAllocationMode().equals(
|
||||
newNetworkConnection.getIpAddressAllocationMode()));
|
||||
assertTrue(connection.getNetworkConnectionIndex() == newNetworkConnection
|
||||
assertEquals(connection.getIpAddressAllocationMode(),
|
||||
newNetworkConnection.getIpAddressAllocationMode());
|
||||
assertSame(connection.getNetworkConnectionIndex(), newNetworkConnection
|
||||
.getNetworkConnectionIndex());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.O
|
|||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkControlAccessParams;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
@ -176,7 +177,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest {
|
|||
@Test(description = "POST /admin/catalog/{id}/action/publish", dependsOnMethods = { "testEditCatalog" })
|
||||
public void testPublishCatalog() {
|
||||
assertNotNull(catalog, String.format(NOT_NULL_OBJ_FMT, "Catalog"));
|
||||
assertTrue(!catalog.isPublished(),
|
||||
assertFalse(catalog.isPublished(),
|
||||
String.format(OBJ_FIELD_EQ, CATALOG, "isPublished", false, catalog.isPublished()));
|
||||
|
||||
PublishCatalogParams params = PublishCatalogParams.builder().isPublished(true).build();
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.virtualbox.compute;
|
|||
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -78,13 +79,13 @@ public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClien
|
|||
@Test
|
||||
public void testListHardwareProfiles() {
|
||||
Iterable<Hardware> profiles = adapter.listHardwareProfiles();
|
||||
assertTrue(!Iterables.isEmpty(profiles));
|
||||
assertFalse(Iterables.isEmpty(profiles));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListImages() {
|
||||
Iterable<Image> iMageIterable = adapter.listImages();
|
||||
assertTrue(!Iterables.isEmpty(iMageIterable));
|
||||
assertFalse(Iterables.isEmpty(iMageIterable));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
|
|
@ -75,7 +75,7 @@ public class VirtualBoxExperimentLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
TemplateOptions.Builder.overrideLoginUser("toor").runScript(AdminAccess.standard()));
|
||||
assertEquals(numNodes, nodes.size(), "wrong number of nodes");
|
||||
for (NodeMetadata node : nodes) {
|
||||
assertTrue(node.getGroup().equals("test-launch-cluster"));
|
||||
assertEquals("test-launch-cluster", node.getGroup());
|
||||
logger.debug("Created Node: %s", node);
|
||||
SshClient client = context.utils().sshForNode().apply(node);
|
||||
client.connect();
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.virtualbox.domain;
|
|||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.virtualbox_4_1.CleanupMode;
|
||||
|
@ -39,28 +40,28 @@ public class VmSpecTest {
|
|||
public void testEqualsWrongId() throws Exception {
|
||||
VmSpec vmSpec = defaultVm().build();
|
||||
VmSpec other = defaultVm().id("OtherVMId").build();
|
||||
assertFalse(vmSpec.equals(other));
|
||||
assertNotEquals(vmSpec, other);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsWrongName() throws Exception {
|
||||
VmSpec vmSpec = defaultVm().build();
|
||||
VmSpec other = defaultVm().name("OtherName").build();
|
||||
assertFalse(vmSpec.equals(other));
|
||||
assertNotEquals(vmSpec, other);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsWrongOsType() throws Exception {
|
||||
VmSpec vmSpec = defaultVm().build();
|
||||
VmSpec other = defaultVm().osTypeId("OtherOS").build();
|
||||
assertFalse(vmSpec.equals(other));
|
||||
assertNotEquals(vmSpec, other);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsWrongForceOverwriteRule() throws Exception {
|
||||
VmSpec vmSpec = defaultVm().build();
|
||||
VmSpec other = defaultVm().forceOverwrite(false).build();
|
||||
assertFalse(vmSpec.equals(other));
|
||||
assertNotEquals(vmSpec, other);
|
||||
}
|
||||
|
||||
private VmSpec.Builder defaultVm() {
|
||||
|
|
|
@ -22,7 +22,8 @@ package org.jclouds.virtualbox.functions;
|
|||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
@ -136,7 +137,8 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
|
||||
String version = machine.getGuestPropertyValue("/VirtualBox/GuestAdd/Version");
|
||||
|
||||
assertTrue(version != null && !version.isEmpty());
|
||||
assertNotNull(version);
|
||||
assertFalse(version.isEmpty());
|
||||
} finally {
|
||||
for (VmSpec spec : ImmutableSet.of(machineSpec.getVmSpec())) {
|
||||
machineController.ensureMachineIsShutdown(spec.getVmName());
|
||||
|
|
|
@ -21,6 +21,8 @@ package org.jclouds.virtualbox.util;
|
|||
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE;
|
||||
import static org.testng.AssertJUnit.assertEquals;
|
||||
import static org.testng.AssertJUnit.assertSame;
|
||||
import static org.testng.AssertJUnit.assertTrue;
|
||||
|
||||
import org.jclouds.config.ValueOfConfigurationKeyOrNull;
|
||||
|
@ -102,16 +104,16 @@ public class MachineControllerLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
public void testEnsureMachineisLaunchedAndSessionIsUnlocked() {
|
||||
cloneFromMaster();
|
||||
ISession cloneMachineSession = machineController.ensureMachineIsLaunched(instanceName);
|
||||
assertTrue(cloneMachineSession.getState() == SessionState.Unlocked);
|
||||
assertSame(cloneMachineSession.getState(), SessionState.Unlocked);
|
||||
cloneMachineSession = machineController.ensureMachineHasPowerDown(instanceName);
|
||||
assertTrue(cloneMachineSession.getState() == SessionState.Unlocked);
|
||||
assertSame(cloneMachineSession.getState(), SessionState.Unlocked);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods="testEnsureMachineisLaunchedAndSessionIsUnlocked")
|
||||
public void testEnsureMachineCanBePoweredOffMoreThanOneTimeAndSessionIsUnlocked() {
|
||||
ISession cloneMachineSession = machineController.ensureMachineHasPowerDown(instanceName);
|
||||
SessionState state = cloneMachineSession.getState();
|
||||
assertTrue(state.equals(SessionState.Unlocked));
|
||||
assertEquals(SessionState.Unlocked, state);
|
||||
}
|
||||
|
||||
private IMachine cloneFromMaster() {
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.jclouds.virtualbox.util;
|
|||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE;
|
||||
import static org.testng.AssertJUnit.assertEquals;
|
||||
import static org.testng.AssertJUnit.assertTrue;
|
||||
|
||||
import org.jclouds.config.ValueOfConfigurationKeyOrNull;
|
||||
|
@ -100,7 +101,7 @@ public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
new Function<ISession, ISession>() {
|
||||
@Override
|
||||
public ISession apply(ISession session) {
|
||||
assertTrue(session.getMachine().getName().equals(clone.getName()));
|
||||
assertEquals(session.getMachine().getName(), clone.getName());
|
||||
return session;
|
||||
}
|
||||
});
|
||||
|
@ -115,7 +116,7 @@ public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
new Function<ISession, ISession>() {
|
||||
@Override
|
||||
public ISession apply(ISession session) {
|
||||
assertTrue(session.getMachine().getName().equals(clone.getName()));
|
||||
assertEquals(session.getMachine().getName(), clone.getName());
|
||||
return session;
|
||||
}
|
||||
});
|
||||
|
@ -148,7 +149,7 @@ public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
@Override
|
||||
public ISession apply(ISession sharedSession) {
|
||||
checkState(sharedSession.getState().equals(SessionState.Locked));
|
||||
assertTrue(sharedSession.getMachine().getName().equals(clone.getName()));
|
||||
assertEquals(sharedSession.getMachine().getName(), clone.getName());
|
||||
return sharedSession;
|
||||
}
|
||||
});
|
||||
|
@ -173,7 +174,7 @@ public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
@Override
|
||||
public ISession apply(ISession writeSession) {
|
||||
checkState(writeSession.getState().equals(SessionState.Locked));
|
||||
assertTrue(writeSession.getMachine().getName().equals(clone.getName()));
|
||||
assertEquals(writeSession.getMachine().getName(), clone.getName());
|
||||
return writeSession;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -112,18 +112,18 @@ public class EmailAccountApiLiveTest extends BaseGleSYSApiLiveTest {
|
|||
assertEquals(aliasFromList, alias);
|
||||
|
||||
EmailOverview overview = api.getOverview();
|
||||
assertTrue(overview.getSummary().getAliases() == 1);
|
||||
assertEquals(1, overview.getSummary().getAliases());
|
||||
|
||||
alias = api.updateAlias("test2@" + testDomain, "test1@" + testDomain);
|
||||
overview = api.getOverview();
|
||||
assertTrue(overview.getSummary().getAliases() == 1);
|
||||
assertEquals(1, overview.getSummary().getAliases());
|
||||
|
||||
aliasFromList = Iterables.getOnlyElement(api.listAliasesInDomain(testDomain));
|
||||
assertEquals(aliasFromList, alias);
|
||||
|
||||
api.delete("test2@" + testDomain);
|
||||
overview = api.getOverview();
|
||||
assertTrue(overview.getSummary().getAliases() == 0);
|
||||
assertEquals(0, overview.getSummary().getAliases());
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreateEmail")
|
||||
|
|
|
@ -201,7 +201,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest {
|
|||
assertNotNull(entry.getValue());
|
||||
ServerLimit limit = entry.getValue();
|
||||
assertTrue(limit.getBarrier() >= 0);
|
||||
assertTrue(limit.getFailCount() == 0);
|
||||
assertEquals(0, limit.getFailCount());
|
||||
assertTrue(limit.getHeld() >= 0);
|
||||
assertTrue(limit.getLimit() > 0);
|
||||
assertTrue(limit.getMaxHeld() >= 0);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.hpcloud.objectstorage;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
|
@ -71,7 +72,7 @@ public class HPCloudObjectStorageClientLiveTest extends CommonSwiftClientLiveTes
|
|||
|
||||
// Enable CDN with PUT for one container
|
||||
final URI cdnUri = getApi().getCDNExtension().get().enable(containerNameWithCDN);
|
||||
assertTrue(cdnUri != null);
|
||||
assertNotNull(cdnUri);
|
||||
|
||||
// Confirm CDN is enabled via HEAD request and has default TTL
|
||||
cdnMetadata = getApi().getCDNExtension().get().get(containerNameWithCDN);
|
||||
|
|
|
@ -152,7 +152,7 @@ public class ScriptBuilderTest {
|
|||
Utils.writeFunctionFromResource("abort", OsFamily.UNIX));
|
||||
|
||||
for (String fn : defaultFunctions.values()) {
|
||||
assertTrue(fn.indexOf("\r\n") == -1, "windows linefeeds!");
|
||||
assertEquals(-1, fn.indexOf("\r\n"), "windows linefeeds!");
|
||||
}
|
||||
|
||||
Map<String, String> resolvedFunctions = ScriptBuilder.resolveFunctionDependenciesForStatements(defaultFunctions,
|
||||
|
|
Loading…
Reference in New Issue