Address Checkstyle violations in tests

This commit is contained in:
Andrew Gaul 2013-12-08 22:27:18 -08:00
parent fc07a31412
commit 4cef85d1cd
52 changed files with 142 additions and 134 deletions

View File

@ -64,7 +64,7 @@ public class ParseImageFromJsonResponseTest {
assertEquals(response.getProgress(), Integer.valueOf(80)); assertEquals(response.getProgress(), Integer.valueOf(80));
assertEquals(response.getServerId(), Integer.valueOf(12)); assertEquals(response.getServerId(), Integer.valueOf(12));
assertEquals(response.getStatus(), ImageStatus.SAVING); assertEquals(response.getStatus(), ImageStatus.SAVING);
assertEquals(response.getUpdated(), dateService.iso8601SecondsDateParse(("2010-10-10T12:00:00Z"))); assertEquals(response.getUpdated(), dateService.iso8601SecondsDateParse("2010-10-10T12:00:00Z"));
} }

View File

@ -343,8 +343,8 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
// behavior on shutdown depends on how your server OS is set up to respond // behavior on shutdown depends on how your server OS is set up to respond
// to an ACPI power // to an ACPI power
// button signal // button signal
assert (client.getServerInfo(server.getUuid()).getStatus() == ServerStatus.ACTIVE || client.getServerInfo( assert client.getServerInfo(server.getUuid()).getStatus() == ServerStatus.ACTIVE || client.getServerInfo(
server.getUuid()).getStatus() == ServerStatus.STOPPED); server.getUuid()).getStatus() == ServerStatus.STOPPED;
} }
@Test(dependsOnMethods = "testLifeCycle") @Test(dependsOnMethods = "testLifeCycle")

View File

@ -115,7 +115,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudStackApiLiveTest {
} }
} }
assertNotNull(rule, "Failed to get a load balancer rule after " + attempts + " attempts"); assertNotNull(rule, "Failed to get a load balancer rule after " + attempts + " attempts");
assert (rule.getPublicIPId() == ip.getId()) : rule; assert rule.getPublicIPId() == ip.getId() : rule;
assertEquals(rule.getPublicPort(), 22); assertEquals(rule.getPublicPort(), 22);
assertEquals(rule.getPrivatePort(), 22); assertEquals(rule.getPrivatePort(), 22);
assertEquals(rule.getAlgorithm(), Algorithm.LEASTCONN); assertEquals(rule.getAlgorithm(), Algorithm.LEASTCONN);

View File

@ -86,8 +86,8 @@ public class TemplateApiLiveTest extends BaseCloudStackApiLiveTest {
assert template.getAccount() != null : template; assert template.getAccount() != null : template;
assert template.getZone() != null : template; assert template.getZone() != null : template;
assert template.getZoneId() != null : template; assert template.getZoneId() != null : template;
assert (template.getStatus() == null || assert template.getStatus() == null ||
template.getStatus() == Template.Status.DOWNLOADED) : template; template.getStatus() == Template.Status.DOWNLOADED : template;
assert template.getType() != null && template.getType() != Template.Type.UNRECOGNIZED : template; assert template.getType() != null && template.getType() != Template.Type.UNRECOGNIZED : template;
assert template.getHypervisor() != null : template; assert template.getHypervisor() != null : template;
assert template.getDomain() != null : template; assert template.getDomain() != null : template;

View File

@ -146,4 +146,4 @@ public class SaveAlarmOptionsTest {
assertEquals(formParameters.get("Unit"), ImmutableSet.of(unit.toString())); assertEquals(formParameters.get("Unit"), ImmutableSet.of(unit.toString()));
} }
} }

View File

@ -66,7 +66,7 @@ public class EC2TemplateBuilderImplTest extends TemplateBuilderImplTest {
@Override @Override
protected EC2TemplateBuilderImpl createTemplateBuilder(final Image knownImage, protected EC2TemplateBuilderImpl createTemplateBuilder(final Image knownImage,
@Memoized Supplier<Set<? extends Location>> locations, final @Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Location>> locations, @Memoized final Supplier<Set<? extends Image>> images,
@Memoized Supplier<Set<? extends Hardware>> sizes, Location defaultLocation, @Memoized Supplier<Set<? extends Hardware>> sizes, Location defaultLocation,
Provider<TemplateOptions> optionsProvider, Provider<TemplateBuilder> templateBuilderProvider) { Provider<TemplateOptions> optionsProvider, Provider<TemplateBuilder> templateBuilderProvider) {

View File

@ -73,4 +73,4 @@ public class AMIApiExpectTest extends BaseEC2ApiExpectTest<EC2Api> {
.build()), .build()),
ImmutableSet.of()); ImmutableSet.of());
} }
} }

View File

@ -73,4 +73,4 @@ public class KeyPairApiExpectTest extends BaseEC2ApiExpectTest<EC2Api> {
.build()), .build()),
ImmutableSet.of()); ImmutableSet.of());
} }
} }

View File

@ -73,4 +73,4 @@ public class SecurityGroupApiExpectTest extends BaseEC2ApiExpectTest<EC2Api> {
.build()), .build()),
ImmutableSet.of()); ImmutableSet.of());
} }
} }

View File

@ -240,8 +240,8 @@ public class ElasticStackApiLiveTest extends BaseComputeServiceContextLiveTest {
client.shutdownServer(server.getUuid()); client.shutdownServer(server.getUuid());
// behavior on shutdown depends on how your server OS is set up to respond to an ACPI power // behavior on shutdown depends on how your server OS is set up to respond to an ACPI power
// button signal // button signal
assert (client.getServerInfo(server.getUuid()).getStatus() == ServerStatus.ACTIVE || client.getServerInfo( assert client.getServerInfo(server.getUuid()).getStatus() == ServerStatus.ACTIVE || client.getServerInfo(
server.getUuid()).getStatus() == ServerStatus.STOPPED); server.getUuid()).getStatus() == ServerStatus.STOPPED;
} }
@Test(dependsOnMethods = "testLifeCycle") @Test(dependsOnMethods = "testLifeCycle")

View File

@ -157,7 +157,7 @@ public class FilesystemContainerIntegrationTest extends BaseContainerIntegration
@DataProvider @DataProvider
public Object[][] ignoreOnWindows() { public Object[][] ignoreOnWindows() {
return (TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS return TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS
: TestUtils.SINGLE_NO_ARG_INVOCATION); : TestUtils.SINGLE_NO_ARG_INVOCATION;
} }
} }

View File

@ -55,4 +55,4 @@ public class QuotasApiLiveTest extends BaseCinderApiLiveTest {
assertTrue(volumeQuota.getVolumes() >= 0); assertTrue(volumeQuota.getVolumes() >= 0);
assertTrue(volumeQuota.getSnapshots() >= 0); assertTrue(volumeQuota.getSnapshots() >= 0);
} }
} }

View File

@ -42,4 +42,4 @@ public class AvailabilityZonesApiLiveTest extends BaseNovaApiLiveTest {
assertTrue(zone.getState().available(), "zone: " + zone.getName() + " is not available."); assertTrue(zone.getState().available(), "zone: " + zone.getName() + " is not available.");
} }
} }
} }

View File

@ -36,7 +36,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import org.jclouds.openstack.nova.v2_0.parse.*; import org.jclouds.openstack.nova.v2_0.parse.ParseServerDiagnostics;
/** /**
* Tests annotation parsing of {@code ServerAsyncApi} * Tests annotation parsing of {@code ServerAsyncApi}

View File

@ -21,7 +21,6 @@ import static org.jclouds.rackspace.cloudloadbalancers.v1.predicates.LoadBalance
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -38,6 +37,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
/** /**
* @author Everett Toews * @author Everett Toews
@ -62,7 +62,7 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
accessRule3 = AccessRule.deny("206.160.163.22"); accessRule3 = AccessRule.deny("206.160.163.22");
accessRule4 = AccessRule.deny("206.160.168.22"); accessRule4 = AccessRule.deny("206.160.168.22");
accessRules = new HashMap<String, AccessRule>(); accessRules = Maps.newHashMap();
accessRules.put(accessRule1.getAddress(), accessRule1); accessRules.put(accessRule1.getAddress(), accessRule1);
accessRules.put(accessRule2.getAddress(), accessRule2); accessRules.put(accessRule2.getAddress(), accessRule2);
accessRules.put(accessRule3.getAddress(), accessRule3); accessRules.put(accessRule3.getAddress(), accessRule3);
@ -120,7 +120,7 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
assertTrue(api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).deleteAll()); assertTrue(api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).deleteAll());
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb)); assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
assertExpectedAccessRules(new HashMap<String, AccessRule>()); assertExpectedAccessRules(Maps.<String, AccessRule>newHashMap());
} }
private void assertExpectedAccessRules(Map<String, AccessRule> expectedAccessList) { private void assertExpectedAccessRules(Map<String, AccessRule> expectedAccessList) {

View File

@ -309,14 +309,14 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest {
} }
protected void assertCacheControl(S3Object newObject, String string) { protected void assertCacheControl(S3Object newObject, String string) {
assert (newObject.getMetadata().getCacheControl().indexOf(string) != -1) : newObject.getMetadata() assert newObject.getMetadata().getCacheControl().indexOf(string) != -1 : newObject.getMetadata()
.getCacheControl(); .getCacheControl();
} }
protected void assertContentEncoding(S3Object newObject, String string) { protected void assertContentEncoding(S3Object newObject, String string) {
assert (newObject.getPayload().getContentMetadata().getContentEncoding().indexOf(string) != -1) : newObject assert newObject.getPayload().getContentMetadata().getContentEncoding().indexOf(string) != -1 : newObject
.getPayload().getContentMetadata().getContentEncoding(); .getPayload().getContentMetadata().getContentEncoding();
assert (newObject.getMetadata().getContentMetadata().getContentEncoding().indexOf(string) != -1) : newObject assert newObject.getMetadata().getContentMetadata().getContentEncoding().indexOf(string) != -1 : newObject
.getMetadata().getContentMetadata().getContentEncoding(); .getMetadata().getContentMetadata().getContentEncoding();
} }

View File

@ -37,6 +37,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.Atomics;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.mockwebserver.MockResponse; import com.google.mockwebserver.MockResponse;
import com.google.mockwebserver.MockWebServer; import com.google.mockwebserver.MockWebServer;
@ -121,7 +122,7 @@ public class SequentialMultipartUploadStrategyMockTest {
* this method, which allows us to send back links to the mock server. * this method, which allows us to send back links to the mock server.
*/ */
private AtomicReference<URL> setURLReplacingDispatcher(MockWebServer server) { private AtomicReference<URL> setURLReplacingDispatcher(MockWebServer server) {
final AtomicReference<URL> url = new AtomicReference<URL>(); final AtomicReference<URL> url = Atomics.newReference();
final QueueDispatcher dispatcher = new QueueDispatcher() { final QueueDispatcher dispatcher = new QueueDispatcher() {
protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<MockResponse>(); protected final BlockingQueue<MockResponse> responseQueue = new LinkedBlockingQueue<MockResponse>();

View File

@ -39,6 +39,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import com.google.common.collect.Maps;
@Test(groups = "unit") @Test(groups = "unit")
public class KeystoneStorageEndpointModuleTest { public class KeystoneStorageEndpointModuleTest {
@ -53,7 +54,7 @@ public class KeystoneStorageEndpointModuleTest {
*/ */
@BeforeTest @BeforeTest
public void setup() { public void setup() {
Map<String, Supplier<URI>> endpoints = new HashMap<String, Supplier<URI>>(); Map<String, Supplier<URI>> endpoints = Maps.newHashMap();
try { try {
endpoints.put("region1", Suppliers.ofInstance(new URI("http://region1.example.org/"))); endpoints.put("region1", Suppliers.ofInstance(new URI("http://region1.example.org/")));

View File

@ -57,8 +57,8 @@ public class VCloudApiTest extends BaseVCloudApiTest<VCloudApi> {
@DataProvider @DataProvider
public Object[][] ignoreOnWindows() { public Object[][] ignoreOnWindows() {
return (TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS return TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS
: TestUtils.SINGLE_NO_ARG_INVOCATION); : TestUtils.SINGLE_NO_ARG_INVOCATION;
} }
} }

View File

@ -313,8 +313,8 @@ public class VmApiTest extends BaseVCloudApiTest<VmApi> {
@DataProvider @DataProvider
public Object[][] ignoreOnWindows() { public Object[][] ignoreOnWindows() {
return (TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS return TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS
: TestUtils.SINGLE_NO_ARG_INVOCATION); : TestUtils.SINGLE_NO_ARG_INVOCATION;
} }
} }

View File

@ -599,9 +599,9 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
} }
protected void checkContentEncoding(Blob blob, String contentEncoding) { protected void checkContentEncoding(Blob blob, String contentEncoding) {
assert (blob.getPayload().getContentMetadata().getContentEncoding().indexOf(contentEncoding) != -1) : blob assert blob.getPayload().getContentMetadata().getContentEncoding().indexOf(contentEncoding) != -1 : blob
.getPayload().getContentMetadata().getContentEncoding(); .getPayload().getContentMetadata().getContentEncoding();
assert (blob.getMetadata().getContentMetadata().getContentEncoding().indexOf(contentEncoding) != -1) : blob assert blob.getMetadata().getContentMetadata().getContentEncoding().indexOf(contentEncoding) != -1 : blob
.getMetadata().getContentMetadata().getContentEncoding(); .getMetadata().getContentMetadata().getContentEncoding();
} }
@ -612,7 +612,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
.getMetadata().getContentMetadata().getContentLanguage(); .getMetadata().getContentMetadata().getContentLanguage();
} }
protected volatile static Crypto crypto; protected static volatile Crypto crypto;
static { static {
try { try {
crypto = new JCECrypto(); crypto = new JCECrypto();

View File

@ -90,7 +90,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
/** /**
* two test groups integration and live. * two test groups integration and live.
*/ */
private volatile static BlockingQueue<String> containerNames = new ArrayBlockingQueue<String>(containerCount); private static volatile BlockingQueue<String> containerNames = new ArrayBlockingQueue<String>(containerCount);
/** /**
* There are a lot of retries here mainly from experience running inside amazon EC2. * There are a lot of retries here mainly from experience running inside amazon EC2.

View File

@ -396,7 +396,7 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
return actual == null; return actual == null;
} }
try { try {
String real = Strings2.toString(((Payload) actual)); String real = Strings2.toString((Payload) actual);
assertEquals(real, expected); assertEquals(real, expected);
return true; return true;
} catch (IOException e) { } catch (IOException e) {

View File

@ -486,7 +486,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
public void testCredentialsCache() throws Exception { public void testCredentialsCache() throws Exception {
initializeContext(); initializeContext();
for (NodeMetadata node : nodes) for (NodeMetadata node : nodes)
assert (view.utils().credentialStore().get("node#" + node.getId()) != null) : "credentials for " + node.getId(); assert view.utils().credentialStore().get("node#" + node.getId()) != null : "credentials for " + node.getId();
} }
protected Map<? extends NodeMetadata, ExecResponse> runScriptWithCreds(final String group, OperatingSystem os, protected Map<? extends NodeMetadata, ExecResponse> runScriptWithCreds(final String group, OperatingSystem os,
@ -537,7 +537,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
assertLocationSameOrChild(checkNotNull(metadata.getLocation(), "location of %s", metadata), template.getLocation()); assertLocationSameOrChild(checkNotNull(metadata.getLocation(), "location of %s", metadata), template.getLocation());
checkImageIdMatchesTemplate(metadata); checkImageIdMatchesTemplate(metadata);
checkOsMatchesTemplate(metadata); checkOsMatchesTemplate(metadata);
assert (metadata.getStatus() == Status.RUNNING) : metadata; assert metadata.getStatus() == Status.RUNNING : metadata;
// due to DHCP the addresses can actually change in-between runs. // due to DHCP the addresses can actually change in-between runs.
assertEquals(metadata.getPrivateAddresses().size(), node.getPrivateAddresses().size(), format( assertEquals(metadata.getPrivateAddresses().size(), node.getPrivateAddresses().size(), format(
"[%s] didn't match: [%s]", metadata.getPrivateAddresses(), node.getPrivateAddresses().size())); "[%s] didn't match: [%s]", metadata.getPrivateAddresses(), node.getPrivateAddresses().size()));

View File

@ -168,9 +168,9 @@ public class JcloudsVersionTest {
@Override @Override
public InputStream getResourceAsStream(String name) { public InputStream getResourceAsStream(String name) {
return (Iterables.contains(resourcesToHide, name) return Iterables.contains(resourcesToHide, name)
? null ? null
: delegate.getResourceAsStream(name)); : delegate.getResourceAsStream(name);
} }
} }
} }

View File

@ -112,7 +112,7 @@ public abstract class PerformanceTest {
} }
if (performanceTestName != null) { if (performanceTestName != null) {
System.out.printf("TIMING: Multi-threaded %s took %.3fms for %d threads\n", System.out.printf("TIMING: Multi-threaded %s took %.3fms for %d threads\n",
performanceTestName, ((double) endTime / 1000000), THREAD_COUNT); performanceTestName, (double) endTime / 1000000, THREAD_COUNT);
} }
} }

View File

@ -43,47 +43,47 @@ public class JsonBallTest {
public void testJSON_STRING_PATTERN1() { public void testJSON_STRING_PATTERN1() {
Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("hello"); Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("hello");
assert (matcher.find()); assert matcher.find();
} }
public void testJSON_STRING_PATTERN2() { public void testJSON_STRING_PATTERN2() {
Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("hello world!"); Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("hello world!");
assert (matcher.find()); assert matcher.find();
} }
public void testJSON_STRING_PATTERN3() { public void testJSON_STRING_PATTERN3() {
Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("\"hello world!\""); Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("\"hello world!\"");
assert (!matcher.find()); assert !matcher.find();
} }
public void testJSON_STRING_PATTERN4() { public void testJSON_STRING_PATTERN4() {
Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("[hello world!]"); Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("[hello world!]");
assert (!matcher.find()); assert !matcher.find();
} }
public void testJSON_STRING_PATTERN5() { public void testJSON_STRING_PATTERN5() {
Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("{hello world!}"); Matcher matcher = JsonBall.JSON_STRING_PATTERN.matcher("{hello world!}");
assert (!matcher.find()); assert !matcher.find();
} }
public void testJSON_NUMBER_PATTERN1() { public void testJSON_NUMBER_PATTERN1() {
Matcher matcher = JsonBall.JSON_NUMBER_PATTERN.matcher("1"); Matcher matcher = JsonBall.JSON_NUMBER_PATTERN.matcher("1");
assert (matcher.find()); assert matcher.find();
} }
public void testJSON_NUMBER_PATTERN2() { public void testJSON_NUMBER_PATTERN2() {
Matcher matcher = JsonBall.JSON_NUMBER_PATTERN.matcher("1.1"); Matcher matcher = JsonBall.JSON_NUMBER_PATTERN.matcher("1.1");
assert (matcher.find()); assert matcher.find();
} }
public void testJSON_NUMBER_PATTERN3() { public void testJSON_NUMBER_PATTERN3() {
Matcher matcher = JsonBall.JSON_NUMBER_PATTERN.matcher("\"1.1\""); Matcher matcher = JsonBall.JSON_NUMBER_PATTERN.matcher("\"1.1\"");
assert (!matcher.find()); assert !matcher.find();
} }
public void testJSON_NUMBER_PATTERN4() { public void testJSON_NUMBER_PATTERN4() {
Matcher matcher = JsonBall.JSON_NUMBER_PATTERN.matcher("\"1\""); Matcher matcher = JsonBall.JSON_NUMBER_PATTERN.matcher("\"1\"");
assert (!matcher.find()); assert !matcher.find();
} }
private ParseJson<Map<String, JsonBall>> handler; private ParseJson<Map<String, JsonBall>> handler;

View File

@ -57,12 +57,12 @@ public class ParseSaxTest extends BaseHandlerTest {
@DataProvider @DataProvider
public Object[][] runUnderJava7() { public Object[][] runUnderJava7() {
return (TestUtils.isJava7() ? SINGLE_NO_ARG_INVOCATION : NO_INVOCATIONS); return TestUtils.isJava7() ? SINGLE_NO_ARG_INVOCATION : NO_INVOCATIONS;
} }
@DataProvider @DataProvider
public Object[][] ignoreUnderJava7() { public Object[][] ignoreUnderJava7() {
return (TestUtils.isJava7() ? NO_INVOCATIONS : SINGLE_NO_ARG_INVOCATION); return TestUtils.isJava7() ? NO_INVOCATIONS : SINGLE_NO_ARG_INVOCATION;
} }
@Test @Test

View File

@ -50,31 +50,31 @@ public class BackoffLimitedRetryHandlerTest {
long startTime = System.nanoTime(); long startTime = System.nanoTime();
handler.imposeBackoffExponentialDelay(period, 2, 1, 5, "TEST FAILURE: 1"); handler.imposeBackoffExponentialDelay(period, 2, 1, 5, "TEST FAILURE: 1");
long elapsedTime = (System.nanoTime() - startTime) / 1000000; long elapsedTime = (System.nanoTime() - startTime) / 1000000;
assert (elapsedTime >= period - 1) : elapsedTime; assert elapsedTime >= period - 1 : elapsedTime;
assertTrue(elapsedTime < period + acceptableDelay); assertTrue(elapsedTime < period + acceptableDelay);
startTime = System.nanoTime(); startTime = System.nanoTime();
handler.imposeBackoffExponentialDelay(period, 2, 2, 5, "TEST FAILURE: 2"); handler.imposeBackoffExponentialDelay(period, 2, 2, 5, "TEST FAILURE: 2");
elapsedTime = (System.nanoTime() - startTime) / 1000000; elapsedTime = (System.nanoTime() - startTime) / 1000000;
assert (elapsedTime >= period * 4 - 1) : elapsedTime; assert elapsedTime >= period * 4 - 1 : elapsedTime;
assertTrue(elapsedTime < period * 9); assertTrue(elapsedTime < period * 9);
startTime = System.nanoTime(); startTime = System.nanoTime();
handler.imposeBackoffExponentialDelay(period, 2, 3, 5, "TEST FAILURE: 3"); handler.imposeBackoffExponentialDelay(period, 2, 3, 5, "TEST FAILURE: 3");
elapsedTime = (System.nanoTime() - startTime) / 1000000; elapsedTime = (System.nanoTime() - startTime) / 1000000;
assert (elapsedTime >= period * 9 - 1) : elapsedTime; assert elapsedTime >= period * 9 - 1 : elapsedTime;
assertTrue(elapsedTime < period * 10); assertTrue(elapsedTime < period * 10);
startTime = System.nanoTime(); startTime = System.nanoTime();
handler.imposeBackoffExponentialDelay(period, 2, 4, 5, "TEST FAILURE: 4"); handler.imposeBackoffExponentialDelay(period, 2, 4, 5, "TEST FAILURE: 4");
elapsedTime = (System.nanoTime() - startTime) / 1000000; elapsedTime = (System.nanoTime() - startTime) / 1000000;
assert (elapsedTime >= period * 10 - 1) : elapsedTime; assert elapsedTime >= period * 10 - 1 : elapsedTime;
assertTrue(elapsedTime < period * 11); assertTrue(elapsedTime < period * 11);
startTime = System.nanoTime(); startTime = System.nanoTime();
handler.imposeBackoffExponentialDelay(period, 2, 5, 5, "TEST FAILURE: 5"); handler.imposeBackoffExponentialDelay(period, 2, 5, 5, "TEST FAILURE: 5");
elapsedTime = (System.nanoTime() - startTime) / 1000000; elapsedTime = (System.nanoTime() - startTime) / 1000000;
assert (elapsedTime >= period * 10 - 1) : elapsedTime; assert elapsedTime >= period * 10 - 1 : elapsedTime;
assertTrue(elapsedTime < period * 11); assertTrue(elapsedTime < period * 11);
} }

View File

@ -39,7 +39,7 @@ import com.google.inject.Guice;
*/ */
@Test(groups = { "unit" }) @Test(groups = { "unit" })
public abstract class BaseHttpErrorHandlerTest<T extends HttpErrorHandler> { public abstract class BaseHttpErrorHandlerTest<T extends HttpErrorHandler> {
abstract protected Class<T> getClassToTest(); protected abstract Class<T> getClassToTest();
protected void assertCodeMakes(String method, URI uri, int statusCode, String message, String content, protected void assertCodeMakes(String method, URI uri, int statusCode, String message, String content,
Class<? extends Exception> expected, String exceptionMessage) { Class<? extends Exception> expected, String exceptionMessage) {

View File

@ -120,14 +120,14 @@ public class WireLiveTest {
public static HttpWire setUp() throws Exception { public static HttpWire setUp() throws Exception {
BufferLogger bufferLogger = new BufferLogger(); BufferLogger bufferLogger = new BufferLogger();
HttpWire wire = new HttpWire(); HttpWire wire = new HttpWire();
wire.wireLog = (bufferLogger); wire.wireLog = bufferLogger;
return wire; return wire;
} }
public HttpWire setUpSynch() throws Exception { public HttpWire setUpSynch() throws Exception {
BufferLogger bufferLogger = new BufferLogger(); BufferLogger bufferLogger = new BufferLogger();
HttpWire wire = new HttpWire(); HttpWire wire = new HttpWire();
wire.wireLog = (bufferLogger); wire.wireLog = bufferLogger;
return wire; return wire;
} }

View File

@ -86,14 +86,14 @@ public class WireTest {
public HttpWire setUp() throws Exception { public HttpWire setUp() throws Exception {
BufferLogger bufferLogger = new BufferLogger(); BufferLogger bufferLogger = new BufferLogger();
HttpWire wire = new HttpWire(); HttpWire wire = new HttpWire();
wire.wireLog = (bufferLogger); wire.wireLog = bufferLogger;
return wire; return wire;
} }
public HttpWire setUpSynch() throws Exception { public HttpWire setUpSynch() throws Exception {
BufferLogger bufferLogger = new BufferLogger(); BufferLogger bufferLogger = new BufferLogger();
HttpWire wire = new HttpWire(); HttpWire wire = new HttpWire();
wire.wireLog = (bufferLogger); wire.wireLog = bufferLogger;
return wire; return wire;
} }

View File

@ -26,7 +26,10 @@ import java.util.concurrent.CountDownLatch;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import static org.easymock.EasyMock.*; import static org.easymock.EasyMock.createStrictMock;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import org.jclouds.concurrent.config.ExecutorServiceModule; import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.lifecycle.Closer; import org.jclouds.lifecycle.Closer;
import org.testng.annotations.Test; import org.testng.annotations.Test;

View File

@ -99,7 +99,7 @@ public class Reflection2OverriddenMethodTest {
return new SimpleForwardingLoadingCache<TypeToken<?>, Set<Invokable<?, ?>>>(originalMethodsForTypeToken) { return new SimpleForwardingLoadingCache<TypeToken<?>, Set<Invokable<?, ?>>>(originalMethodsForTypeToken) {
@Override @Override
public Set<Invokable<?, ?>> get(TypeToken<?> key) throws ExecutionException { public Set<Invokable<?, ?>> get(TypeToken<?> key) throws ExecutionException {
return (key.equals(overriddenKey) ? value : super.get(key)); return key.equals(overriddenKey) ? value : super.get(key);
} }
}; };
} }

View File

@ -87,7 +87,7 @@ public class DelegateAnnotationExpectTest extends BaseRestClientExpectTest<Deleg
@HEAD @HEAD
@Path("/disks/{disk}") @Path("/disks/{disk}")
@Fallback(FalseOnNotFoundOr404.class) @Fallback(FalseOnNotFoundOr404.class)
public ListenableFuture<Boolean> exists(@PathParam("disk") String diskName); ListenableFuture<Boolean> exists(@PathParam("disk") String diskName);
} }
public void testDelegatingCallTakesIntoConsiderationAndCalleeFormParam() { public void testDelegatingCallTakesIntoConsiderationAndCalleeFormParam() {

View File

@ -69,36 +69,36 @@ public class JAXBResponseParserAnnotationExpectTest extends
} }
public interface TestJAXBApi extends Closeable { public interface TestJAXBApi extends Closeable {
public TestJAXBDomain jaxbGetWithAnnotation(); TestJAXBDomain jaxbGetWithAnnotation();
public Object jaxbGetWithAnnotationAndCustomClass(); Object jaxbGetWithAnnotationAndCustomClass();
public TestJAXBDomain jaxbGetWithAcceptHeader(); TestJAXBDomain jaxbGetWithAcceptHeader();
public String jaxbGetWithTransformer(); String jaxbGetWithTransformer();
} }
public interface TestJAXBAsyncApi extends Closeable { public interface TestJAXBAsyncApi extends Closeable {
@GET @GET
@Path("/jaxb/annotation") @Path("/jaxb/annotation")
@JAXBResponseParser @JAXBResponseParser
public ListenableFuture<TestJAXBDomain> jaxbGetWithAnnotation(); ListenableFuture<TestJAXBDomain> jaxbGetWithAnnotation();
@GET @GET
@Path("/jaxb/custom") @Path("/jaxb/custom")
@JAXBResponseParser(TestJAXBDomain.class) @JAXBResponseParser(TestJAXBDomain.class)
public ListenableFuture<Object> jaxbGetWithAnnotationAndCustomClass(); ListenableFuture<Object> jaxbGetWithAnnotationAndCustomClass();
@GET @GET
@Path("/jaxb/header") @Path("/jaxb/header")
@Consumes(MediaType.APPLICATION_XML) @Consumes(MediaType.APPLICATION_XML)
public ListenableFuture<TestJAXBDomain> jaxbGetWithAcceptHeader(); ListenableFuture<TestJAXBDomain> jaxbGetWithAcceptHeader();
@GET @GET
@Path("/jaxb/transformer") @Path("/jaxb/transformer")
@JAXBResponseParser(TestJAXBDomain.class) @JAXBResponseParser(TestJAXBDomain.class)
@Transform(ToString.class) @Transform(ToString.class)
public ListenableFuture<String> jaxbGetWithTransformer(); ListenableFuture<String> jaxbGetWithTransformer();
} }
private static class ToString implements Function<Object, String> { private static class ToString implements Function<Object, String> {

View File

@ -199,20 +199,20 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
URI getURI(); URI getURI();
@Delegate @Delegate
public Callee getCallee(); Callee getCallee();
@Delegate @Delegate
public Callee2 getCallee2(); Callee2 getCallee2();
@Delegate @Delegate
public Callee getCallee(@EndpointParam URI endpoint); Callee getCallee(@EndpointParam URI endpoint);
@Delegate @Delegate
public Optional<Callee> getOptionalCallee(@EndpointParam URI endpoint); Optional<Callee> getOptionalCallee(@EndpointParam URI endpoint);
@Delegate @Delegate
@Path("/testing/testing/{wibble}") @Path("/testing/testing/{wibble}")
public Callee getCalleeWithPath(@EndpointParam URI endpoint, @PathParam("wibble") String wibble); Callee getCalleeWithPath(@EndpointParam URI endpoint, @PathParam("wibble") String wibble);
} }
public interface Callee extends Closeable { public interface Callee extends Closeable {
@ -229,20 +229,20 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
URI getURI(); URI getURI();
@Delegate @Delegate
public AsyncCallee getCallee(); AsyncCallee getCallee();
@Delegate @Delegate
public AsyncCallee2 getCallee2(); AsyncCallee2 getCallee2();
@Delegate @Delegate
public AsyncCallee getCallee(@EndpointParam URI endpoint); AsyncCallee getCallee(@EndpointParam URI endpoint);
@Delegate @Delegate
public Optional<AsyncCallee> getOptionalCallee(@EndpointParam URI endpoint); Optional<AsyncCallee> getOptionalCallee(@EndpointParam URI endpoint);
@Delegate @Delegate
@Path("/testing/testing/{wibble}") @Path("/testing/testing/{wibble}")
public AsyncCallee getCalleeWithPath(@EndpointParam URI endpoint, @PathParam("wibble") String wibble); AsyncCallee getCalleeWithPath(@EndpointParam URI endpoint, @PathParam("wibble") String wibble);
} }
public void testAsyncDelegateIsLazyLoadedAndRequestIncludesVersionAndPath() throws InterruptedException, public void testAsyncDelegateIsLazyLoadedAndRequestIncludesVersionAndPath() throws InterruptedException,
@ -620,21 +620,21 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public interface TestPayloadParamVarargs { public interface TestPayloadParamVarargs {
@POST @POST
public void varargs(HttpRequestOptions... options); void varargs(HttpRequestOptions... options);
@POST @POST
public void varargsWithReq(String required, HttpRequestOptions... options); void varargsWithReq(String required, HttpRequestOptions... options);
@POST @POST
public void post(HttpRequestOptions options); void post(HttpRequestOptions options);
@POST @POST
@Produces(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_OCTET_STREAM)
public void post(); void post();
@POST @POST
@Produces(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_OCTET_STREAM)
public void post(Payload payload); void post(Payload payload);
} }
public void testHttpRequestOptionsNoPayloadParam() throws SecurityException, NoSuchMethodException, IOException { public void testHttpRequestOptionsNoPayloadParam() throws SecurityException, NoSuchMethodException, IOException {
@ -737,7 +737,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
} }
public interface Parent { public interface Parent {
public void foo(); void foo();
} }
public class TestOverridden implements Parent { public class TestOverridden implements Parent {
@ -793,29 +793,29 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
void postNonnull(@BinderParam(BindToStringPayload.class) String content); void postNonnull(@BinderParam(BindToStringPayload.class) String content);
@POST @POST
public void postAsJson(@BinderParam(BindToJsonPayload.class) String content); void postAsJson(@BinderParam(BindToJsonPayload.class) String content);
@POST @POST
@Path("/{foo}") @Path("/{foo}")
public void postWithPath(@PathParam("foo") @PayloadParam("fooble") String path, MapBinder content); void postWithPath(@PathParam("foo") @PayloadParam("fooble") String path, MapBinder content);
@POST @POST
@Path("/{foo}") @Path("/{foo}")
@MapBinder(BindToJsonPayload.class) @MapBinder(BindToJsonPayload.class)
public void postWithMethodBinder(@PathParam("foo") @PayloadParam("fooble") String path); void postWithMethodBinder(@PathParam("foo") @PayloadParam("fooble") String path);
@POST @POST
@Path("/{foo}") @Path("/{foo}")
@PayloadParams(keys = "rat", values = "atat") @PayloadParams(keys = "rat", values = "atat")
@MapBinder(BindToJsonPayload.class) @MapBinder(BindToJsonPayload.class)
public void postWithMethodBinderAndDefaults(@PathParam("foo") @PayloadParam("fooble") String path); void postWithMethodBinderAndDefaults(@PathParam("foo") @PayloadParam("fooble") String path);
@POST @POST
@Path("/{foo}") @Path("/{foo}")
@PayloadParams(keys = "rat", values = "atat") @PayloadParams(keys = "rat", values = "atat")
@org.jclouds.rest.annotations.Payload("name {fooble}") @org.jclouds.rest.annotations.Payload("name {fooble}")
@Produces(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN)
public void testPayload(@PathParam("foo") @PayloadParam("fooble") String path); void testPayload(@PathParam("foo") @PayloadParam("fooble") String path);
} }
public void testCreatePostRequest() throws SecurityException, NoSuchMethodException, IOException { public void testCreatePostRequest() throws SecurityException, NoSuchMethodException, IOException {
@ -1148,7 +1148,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@Target({ ElementType.METHOD }) @Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@HttpMethod("ROWDY") @HttpMethod("ROWDY")
public @interface ROWDY { @interface ROWDY {
} }
@ROWDY @ROWDY
@ -1360,19 +1360,19 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
interface TestRequestFilter { interface TestRequestFilter {
@GET @GET
@RequestFilters(TestRequestFilter2.class) @RequestFilters(TestRequestFilter2.class)
public void get(); void get();
@GET @GET
@OverrideRequestFilters @OverrideRequestFilters
@RequestFilters(TestRequestFilter2.class) @RequestFilters(TestRequestFilter2.class)
public void getOverride(); void getOverride();
@OverrideRequestFilters @OverrideRequestFilters
@RequestFilters(TestRequestFilter2.class) @RequestFilters(TestRequestFilter2.class)
public void getOverride(HttpRequest request); void getOverride(HttpRequest request);
@POST @POST
public void post(); void post();
} }
@Test @Test
@ -1468,7 +1468,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
@GET @GET
@Path("/{path1}/{path2}") @Path("/{path1}/{path2}")
public void twoPaths(@PathParam("path1") String path, @PathParam("path2") String path2); void twoPaths(@PathParam("path1") String path, @PathParam("path2") String path2);
} }
@Test(enabled = false) @Test(enabled = false)
@ -2308,15 +2308,15 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public interface TestPayload { public interface TestPayload {
@PUT @PUT
public void put(@BinderParam(BindToStringPayload.class) String content); void put(@BinderParam(BindToStringPayload.class) String content);
@PUT @PUT
@Path("/{foo}") @Path("/{foo}")
public ListenableFuture<Void> putWithPath(@PathParam("foo") String path, ListenableFuture<Void> putWithPath(@PathParam("foo") String path,
@BinderParam(BindToStringPayload.class) String content); @BinderParam(BindToStringPayload.class) String content);
@PUT @PUT
public void twoEntities(@BinderParam(BindToStringPayload.class) String payload1, void twoEntities(@BinderParam(BindToStringPayload.class) String payload1,
@BinderParam(BindToStringPayload.class) String payload2); @BinderParam(BindToStringPayload.class) String payload2);
} }

View File

@ -49,20 +49,20 @@ public class UnitTestStatusListener implements ITestListener {
threadTestStart.set(System.currentTimeMillis()); threadTestStart.set(System.currentTimeMillis());
} }
synchronized public void onTestSuccess(ITestResult arg0) { public synchronized void onTestSuccess(ITestResult arg0) {
System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + " succeeded: " System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + " succeeded: "
+ (System.currentTimeMillis() - threadTestStart.get()) + "ms"); + (System.currentTimeMillis() - threadTestStart.get()) + "ms");
succeded.incrementAndGet(); succeded.incrementAndGet();
printStatus(); printStatus();
} }
synchronized public void onTestFailure(ITestResult arg0) { public synchronized void onTestFailure(ITestResult arg0) {
System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + " failed."); System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + " failed.");
failed.incrementAndGet(); failed.incrementAndGet();
printStatus(); printStatus();
} }
synchronized public void onTestSkipped(ITestResult arg0) { public synchronized void onTestSkipped(ITestResult arg0) {
System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + " skipped."); System.out.println(getThreadId() + " Test " + getTestDesc(arg0) + " skipped.");
skipped.incrementAndGet(); skipped.incrementAndGet();
printStatus(); printStatus();

View File

@ -56,7 +56,7 @@ public class ConvertToGaeRequestTest {
ConvertToGaeRequest req; ConvertToGaeRequest req;
URI endPoint; URI endPoint;
protected volatile static Crypto crypto; protected static volatile Crypto crypto;
static { static {
try { try {
crypto = new JCECrypto(); crypto = new JCECrypto();

View File

@ -53,7 +53,7 @@ public class ConvertToJcloudsResponseTest {
ConvertToJcloudsResponse req; ConvertToJcloudsResponse req;
URI endPoint; URI endPoint;
protected volatile static Crypto crypto; protected static volatile Crypto crypto;
static { static {
try { try {
crypto = new JCECrypto(); crypto = new JCECrypto();

View File

@ -134,7 +134,7 @@ public abstract class BaseLoadBalancerServiceLiveTest extends BaseViewLiveTest<L
socketTester = retry(socketOpen, 60, 1, SECONDS); socketTester = retry(socketOpen, 60, 1, SECONDS);
} }
abstract protected Module getSshModule(); protected abstract Module getSshModule();
@BeforeClass(groups = { "integration", "live" }, dependsOnMethods = "setupContext") @BeforeClass(groups = { "integration", "live" }, dependsOnMethods = "setupContext")
public void createNodes() throws RunNodesException { public void createNodes() throws RunNodesException {

View File

@ -673,6 +673,7 @@
<!-- jclouds-resources has the checkstyle config in the classpath --> <!-- jclouds-resources has the checkstyle config in the classpath -->
<configLocation>resources/checkstyle.xml</configLocation> <configLocation>resources/checkstyle.xml</configLocation>
<violationSeverity>warning</violationSeverity> <violationSeverity>warning</violationSeverity>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -165,7 +165,7 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
.period(60) .period(60)
.statistic(Statistics.AVERAGE) .statistic(Statistics.AVERAGE)
.build()); .build());
assert (datapoints.size() > 0) : instance; assert datapoints.size() > 0 : instance;
} finally { } finally {
monitoringApi.close(); monitoringApi.close();
} }

View File

@ -104,7 +104,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
// http://www.regular-expressions.info/lookaround.html // http://www.regular-expressions.info/lookaround.html
.imageDescriptionMatches("^(?!.*(daily|testing)).*ubuntu-images.*$").osFamily(OsFamily.UBUNTU).build(); .imageDescriptionMatches("^(?!.*(daily|testing)).*ubuntu-images.*$").osFamily(OsFamily.UBUNTU).build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert template.getImage().getProviderId().startsWith("ami-") : template;
assert template.getImage().getDescription().indexOf("test") == -1 : template; assert template.getImage().getDescription().indexOf("test") == -1 : template;
assert template.getImage().getDescription().indexOf("daily") == -1 : template; assert template.getImage().getDescription().indexOf("daily") == -1 : template;
assertEquals(template.getImage().getVersion(), "20100224"); assertEquals(template.getImage().getVersion(), "20100224");
@ -131,7 +131,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
// http://www.regular-expressions.info/lookaround.html // http://www.regular-expressions.info/lookaround.html
.imageDescriptionMatches("^(?!.*(daily|testing)).*ubuntu-images.*$").osFamily(OsFamily.UBUNTU).build(); .imageDescriptionMatches("^(?!.*(daily|testing)).*ubuntu-images.*$").osFamily(OsFamily.UBUNTU).build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert template.getImage().getProviderId().startsWith("ami-") : template;
assert template.getImage().getDescription().indexOf("test") == -1 : template; assert template.getImage().getDescription().indexOf("test") == -1 : template;
assert template.getImage().getDescription().indexOf("daily") == -1 : template; assert template.getImage().getDescription().indexOf("daily") == -1 : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.04"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.04");
@ -150,7 +150,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
Template template = view.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5") Template template = view.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5")
.hardwareId(InstanceType.M2_2XLARGE).locationId("us-east-1a").build(); .hardwareId(InstanceType.M2_2XLARGE).locationId("us-east-1a").build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert template.getImage().getProviderId().startsWith("ami-") : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
@ -166,7 +166,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
@Test @Test
public void testDefaultTemplateBuilder() throws IOException { public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build(); Template defaultTemplate = view.getComputeService().templateBuilder().build();
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate; assert defaultTemplate.getImage().getProviderId().startsWith("ami-") : defaultTemplate;
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().contains("pv-201"), assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().contains("pv-201"),
"Default template version should include 'pv-201' but is " "Default template version should include 'pv-201' but is "
+ defaultTemplate.getImage().getOperatingSystem().getVersion()); + defaultTemplate.getImage().getOperatingSystem().getVersion());
@ -183,7 +183,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
Template defaultTemplate = view.getComputeService().templateBuilder().osFamily(OsFamily.AMZN_LINUX) Template defaultTemplate = view.getComputeService().templateBuilder().osFamily(OsFamily.AMZN_LINUX)
.imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).build(); .imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).build();
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate; assert defaultTemplate.getImage().getProviderId().startsWith("ami-") : defaultTemplate;
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "pv-2013.09.rc-1"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "pv-2013.09.rc-1");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
@ -197,7 +197,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
public void testFastestTemplateBuilder() throws IOException { public void testFastestTemplateBuilder() throws IOException {
Template fastestTemplate = view.getComputeService().templateBuilder().fastest().osFamily(OsFamily.AMZN_LINUX) Template fastestTemplate = view.getComputeService().templateBuilder().fastest().osFamily(OsFamily.AMZN_LINUX)
.build(); .build();
assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate; assert fastestTemplate.getImage().getProviderId().startsWith("ami-") : fastestTemplate;
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC2_8XLARGE); assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "2011.09.2"); assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "2011.09.2");
assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
@ -214,7 +214,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
Template microTemplate = view.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO) Template microTemplate = view.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO)
.osFamily(OsFamily.UBUNTU).osVersionMatches("10.10").os64Bit(true).build(); .osFamily(OsFamily.UBUNTU).osVersionMatches("10.10").os64Bit(true).build();
assert (microTemplate.getImage().getProviderId().startsWith("ami-")) : microTemplate; assert microTemplate.getImage().getProviderId().startsWith("ami-") : microTemplate;
assertEquals(microTemplate.getImage().getOperatingSystem().getVersion(), "10.10"); assertEquals(microTemplate.getImage().getOperatingSystem().getVersion(), "10.10");
assertEquals(microTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(microTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(microTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(microTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
@ -238,7 +238,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
assertEquals(context.getComputeService().listImages().size(), 0); assertEquals(context.getComputeService().listImages().size(), 0);
Template template = context.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build(); Template template = context.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert template.getImage().getProviderId().startsWith("ami-") : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
@ -271,7 +271,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
assertEquals(context.getComputeService().listImages().size(), 0); assertEquals(context.getComputeService().listImages().size(), 0);
Template template = context.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build(); Template template = context.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert template.getImage().getProviderId().startsWith("ami-") : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
@ -316,7 +316,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
assert context.getComputeService().listImages().size() < this.view.getComputeService().listImages().size(); assert context.getComputeService().listImages().size() < this.view.getComputeService().listImages().size();
Template template = context.getComputeService().templateBuilder().imageId("eu-west-1/ami-a33b06d7").build(); Template template = context.getComputeService().templateBuilder().imageId("eu-west-1/ami-a33b06d7").build();
assert (template.getImage().getProviderId().startsWith("ami-")) : template; assert template.getImage().getProviderId().startsWith("ami-") : template;
assertEquals(template.getImage().getOperatingSystem().getVersion(), "2011.09.2"); assertEquals(template.getImage().getOperatingSystem().getVersion(), "2011.09.2");
assertEquals(template.getImage().getOperatingSystem().is64Bit(), true); assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX); assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
@ -349,7 +349,7 @@ public class AWSEC2TemplateBuilderLiveTest extends EC2TemplateBuilderLiveTest {
String imageId = "us-east-1/ami-44d02f2d"; String imageId = "us-east-1/ami-44d02f2d";
Template defaultTemplate = view.getComputeService().templateBuilder().imageId(imageId) Template defaultTemplate = view.getComputeService().templateBuilder().imageId(imageId)
.imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).build(); .imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).build();
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate; assert defaultTemplate.getImage().getProviderId().startsWith("ami-") : defaultTemplate;
assertEquals(defaultTemplate.getImage().getId(), imageId); assertEquals(defaultTemplate.getImage().getId(), imageId);
} }

View File

@ -53,6 +53,6 @@ public class AWSAMIApiLiveTest extends AMIApiLiveTest {
.put("root-device-type", "ebs")// .put("root-device-type", "ebs")//
.build()).ownedBy("137112412989", "099720109477")); .build()).ownedBy("137112412989", "099720109477"));
assertNotNull(ccResults); assertNotNull(ccResults);
assert (ccResults.size() >= 34) : ccResults; assert ccResults.size() >= 34 : ccResults;
} }
} }

View File

@ -75,4 +75,4 @@ public class PlacementGroupApiExpectTest extends BaseAWSEC2ComputeServiceExpectT
.build()), .build()),
ImmutableSet.of()); ImmutableSet.of());
} }
} }

View File

@ -75,4 +75,4 @@ public class SpotInstanceApiExpectTest extends BaseAWSEC2ComputeServiceExpectTes
.build()), .build()),
ImmutableSet.of()); ImmutableSet.of());
} }
} }

View File

@ -31,7 +31,8 @@ public class MpuGraphData {
} }
private static void foreach(long from, long to1, long to2, long to3, MultipartUploadSlicingAlgorithm algorithm) { private static void foreach(long from, long to1, long to2, long to3, MultipartUploadSlicingAlgorithm algorithm) {
long i = 0L, step = 1L; long i = 0L;
long step = 1L;
System.out.println("=== {" + from + "," + to1 + "} ==="); System.out.println("=== {" + from + "," + to1 + "} ===");
for (; i < to1 - from; step += i, i += step) { for (; i < to1 - from; step += i, i += step) {
calculate(i + from, algorithm); calculate(i + from, algorithm);

View File

@ -324,7 +324,7 @@ public class AzureBlobClientLiveTest extends BaseBlobStoreIntegrationTest {
GetOptions.Builder.ifETagDoesntMatch(newEtag)); GetOptions.Builder.ifETagDoesntMatch(newEtag));
} catch (Exception e) { } catch (Exception e) {
HttpResponseException httpEx = Throwables2.getFirstThrowableOfType(e, HttpResponseException.class); HttpResponseException httpEx = Throwables2.getFirstThrowableOfType(e, HttpResponseException.class);
assert (httpEx != null) : "expected http exception, not " + e; assert httpEx != null : "expected http exception, not " + e;
assertEquals(httpEx.getResponse().getStatusCode(), 304); assertEquals(httpEx.getResponse().getStatusCode(), 304);
} }

View File

@ -26,9 +26,10 @@ import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.InputStream; import java.io.InputStream;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import com.google.common.collect.Lists;
/** /**
* Test XML Parsing of the Blob Block List * Test XML Parsing of the Blob Block List
*/ */
@ -44,7 +45,7 @@ public class BlobBlocksResultsHandlerTest extends BaseHandlerTest {
public void testGetResult() throws Exception { public void testGetResult() throws Exception {
InputStream is = getClass().getResourceAsStream("/test_list_blob_blocks.xml"); InputStream is = getClass().getResourceAsStream("/test_list_blob_blocks.xml");
List<BlobBlockProperties> blocks = new LinkedList<BlobBlockProperties>(); List<BlobBlockProperties> blocks = Lists.newLinkedList();
blocks.add(new BlobBlockPropertiesImpl("blockIdA", 1234, true)); blocks.add(new BlobBlockPropertiesImpl("blockIdA", 1234, true));
blocks.add(new BlobBlockPropertiesImpl("blockIdB", 4321, true)); blocks.add(new BlobBlockPropertiesImpl("blockIdB", 4321, true));
blocks.add(new BlobBlockPropertiesImpl("blockIdC", 5678, false)); blocks.add(new BlobBlockPropertiesImpl("blockIdC", 5678, false));

View File

@ -145,13 +145,13 @@ public class GoGridLiveTestDisabled extends BaseApiLiveTest<GoGridApi> {
// get server by name // get server by name
Set<Server> response = api.getServerServices().getServersByName(nameOfServer); Set<Server> response = api.getServerServices().getServersByName(nameOfServer);
assert (response.size() == 1); assert response.size() == 1;
// restart the server // restart the server
api.getServerServices().power(nameOfServer, PowerCommand.RESTART); api.getServerServices().power(nameOfServer, PowerCommand.RESTART);
Set<Job> jobs = api.getJobServices().getJobsForObjectName(nameOfServer); Set<Job> jobs = api.getJobServices().getJobsForObjectName(nameOfServer);
assert ("RestartVirtualServer".equals(Iterables.getLast(jobs).getCommand().getName())); assert "RestartVirtualServer".equals(Iterables.getLast(jobs).getCommand().getName());
assert serverLatestJobCompleted.apply(createdServer); assert serverLatestJobCompleted.apply(createdServer);
@ -162,7 +162,7 @@ public class GoGridLiveTestDisabled extends BaseApiLiveTest<GoGridApi> {
api.getServerServices().deleteByName(nameOfServer); api.getServerServices().deleteByName(nameOfServer);
jobs = api.getJobServices().getJobsForObjectName(nameOfServer); jobs = api.getJobServices().getJobsForObjectName(nameOfServer);
assert ("DeleteVirtualServer".equals(Iterables.getLast(jobs).getCommand().getName())); assert "DeleteVirtualServer".equals(Iterables.getLast(jobs).getCommand().getName());
assert serverLatestJobCompleted.apply(createdServer); assert serverLatestJobCompleted.apply(createdServer);
@ -249,7 +249,7 @@ public class GoGridLiveTestDisabled extends BaseApiLiveTest<GoGridApi> {
// get load balancer by name // get load balancer by name
Set<LoadBalancer> response = api.getLoadBalancerServices().getLoadBalancersByName(nameOfLoadBalancer); Set<LoadBalancer> response = api.getLoadBalancerServices().getLoadBalancersByName(nameOfLoadBalancer);
assert (response.size() == 1); assert response.size() == 1;
createdLoadBalancer = Iterables.getOnlyElement(response); createdLoadBalancer = Iterables.getOnlyElement(response);
assertNotNull(createdLoadBalancer.getRealIpList()); assertNotNull(createdLoadBalancer.getRealIpList());
assertEquals(createdLoadBalancer.getRealIpList().size(), 2); assertEquals(createdLoadBalancer.getRealIpList().size(), 2);
@ -270,7 +270,7 @@ public class GoGridLiveTestDisabled extends BaseApiLiveTest<GoGridApi> {
api.getLoadBalancerServices().deleteByName(nameOfLoadBalancer); api.getLoadBalancerServices().deleteByName(nameOfLoadBalancer);
Set<Job> jobs = api.getJobServices().getJobsForObjectName(nameOfLoadBalancer); Set<Job> jobs = api.getJobServices().getJobsForObjectName(nameOfLoadBalancer);
assert ("DeleteLoadBalancer".equals(Iterables.getLast(jobs).getCommand().getName())); assert "DeleteLoadBalancer".equals(Iterables.getLast(jobs).getCommand().getName());
assert loadBalancerLatestJobCompleted.apply(createdLoadBalancer); assert loadBalancerLatestJobCompleted.apply(createdLoadBalancer);
@ -325,7 +325,7 @@ public class GoGridLiveTestDisabled extends BaseApiLiveTest<GoGridApi> {
// get server by name // get server by name
Set<Server> response = api.getServerServices().getServersByName(nameOfServer); Set<Server> response = api.getServerServices().getServersByName(nameOfServer);
assert (response.size() == 1); assert response.size() == 1;
createdServer = Iterables.getOnlyElement(response); createdServer = Iterables.getOnlyElement(response);
Map<String, Credentials> credsMap = api.getServerServices().getServerCredentialsList(); Map<String, Credentials> credsMap = api.getServerServices().getServerCredentialsList();

View File

@ -16,7 +16,7 @@
*/ */
package org.jclouds.scriptbuilder.statements.login; package org.jclouds.scriptbuilder.statements.login;
import static org.testng.Assert.*; import static org.testng.Assert.assertEquals;
import org.jclouds.scriptbuilder.domain.OsFamily; import org.jclouds.scriptbuilder.domain.OsFamily;
import org.testng.annotations.Test; import org.testng.annotations.Test;