From 8d26999bc2bd54a910e7728b45cf8c8ecde74df5 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sat, 9 Apr 2011 01:09:35 -0700 Subject: [PATCH] updated to surefire 2.8, and revised test annotations to be compatible with testng 5.14.10 --- ...irectoryListFromContentAndHeadersTest.java | 12 ++-- blobstore/pom.xml | 2 +- ...CommandExecutorServiceIntegrationTest.java | 27 ++++----- ...CommandExecutorServiceIntegrationTest.java | 5 +- ...pacheHCHttpCommandExecutorServiceTest.java | 22 +++++++- .../EnterpriseConfigurationModuleTest.java | 20 ++++++- ...CommandExecutorServiceIntegrationTest.java | 5 +- project/pom.xml | 4 +- ...inerNameEnumerationResultsHandlerTest.java | 56 +++++++++---------- 9 files changed, 89 insertions(+), 64 deletions(-) diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/functions/ParseDirectoryListFromContentAndHeadersTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/functions/ParseDirectoryListFromContentAndHeadersTest.java index e08bb87ff6..fdef404393 100644 --- a/apis/atmos/src/test/java/org/jclouds/atmos/functions/ParseDirectoryListFromContentAndHeadersTest.java +++ b/apis/atmos/src/test/java/org/jclouds/atmos/functions/ParseDirectoryListFromContentAndHeadersTest.java @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2010 Cloud Conscious, LLC. + * Copyright (C) 2011 Cloud Conscious, LLC. * * ==================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,6 @@ * limitations under the License. * ==================================================================== */ - package org.jclouds.atmos.functions; import static org.testng.Assert.assertEquals; @@ -35,7 +34,8 @@ import org.testng.annotations.Test; import com.google.common.base.Function; import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Sets; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSet.Builder; /** * Tests behavior of {@code ParseDirectoryListFromContentAndHeaders} @@ -64,16 +64,16 @@ public class ParseDirectoryListFromContentAndHeadersTest extends BaseHandlerTest "/list_basic.xml"))); BoundedSet result = createFn().apply(response); - assertEquals(result, values()); + assertEquals(ImmutableSet.copyOf(result), values()); assertEquals(result.getToken(), null); } protected Set values() { - Set expected = Sets.newLinkedHashSet(); + Builder expected = ImmutableSet.builder(); expected.add(new DirectoryEntry("4980cdb2a411106a04a4538c92a1b204ad92077de6e3", FileType.DIRECTORY, "adriancole-blobstore-2096685753")); expected.add(new DirectoryEntry("4980cdb2a410105404980d99e53a0504ad93939e7dc3", FileType.DIRECTORY, "adriancole-blobstore247496608")); - return expected; + return expected.build(); } } diff --git a/blobstore/pom.xml b/blobstore/pom.xml index d582b77282..b4c0301569 100644 --- a/blobstore/pom.xml +++ b/blobstore/pom.xml @@ -63,7 +63,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.4.3 + 2.8 integration diff --git a/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java b/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java index 7ae2c63cf0..3c3fc9f30e 100644 --- a/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java +++ b/core/src/test/java/org/jclouds/http/BaseHttpCommandExecutorServiceIntegrationTest.java @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2010 Cloud Conscious, LLC. + * Copyright (C) 2011 Cloud Conscious, LLC. * * ==================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,6 @@ * limitations under the License. * ==================================================================== */ - package org.jclouds.http; import static org.testng.Assert.assertEquals; @@ -57,7 +56,6 @@ import com.google.common.io.Closeables; * * @author Adrian Cole */ -@Test(threadPoolSize = 10, groups = "integration", sequential = true) public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends BaseJettyTest { @Test(invocationCount = 25, timeOut = 5000) @@ -86,8 +84,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base } @Test(invocationCount = 5, timeOut = 5000) - public void testGetStringViaRequest() throws ExecutionException, InterruptedException, - TimeoutException, IOException { + public void testGetStringViaRequest() throws ExecutionException, InterruptedException, TimeoutException, IOException { assertEquals( Strings2.toStringAndClose( client.invoke( @@ -167,16 +164,6 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base assertEquals(client.post("", "foo").trim(), "fooPOST"); } - @Test(invocationCount = 5, timeOut = 10000) - public void testPostAsInputStream() throws MalformedURLException, ExecutionException, InterruptedException, - TimeoutException { - try { - assertEquals(client.postAsInputStream("", "foo").trim(), "fooPOST"); - } catch (Exception e) { - postFailures.incrementAndGet(); - } - } - /** * Tests sending a big file to the server. Note: this is a heavy test, takes several minutes to * finish. @@ -231,6 +218,16 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends Base postFailures.set(0); } + @Test(invocationCount = 5, timeOut = 10000) + public void testPostAsInputStream() throws MalformedURLException, ExecutionException, InterruptedException, + TimeoutException { + try { + assertEquals(client.postAsInputStream("", "foo").trim(), "fooPOST"); + } catch (Exception e) { + postFailures.incrementAndGet(); + } + } + @Test(dependsOnMethods = "testPostAsInputStream") public void testPostResults() { // failures happen when trying to replay inputstreams diff --git a/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java b/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java index ce92433388..66334e23e3 100644 --- a/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java +++ b/core/src/test/java/org/jclouds/http/JavaUrlHttpCommandExecutorServiceIntegrationTest.java @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2010 Cloud Conscious, LLC. + * Copyright (C) 2011 Cloud Conscious, LLC. * * ==================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,6 @@ * limitations under the License. * ==================================================================== */ - package org.jclouds.http; import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS; @@ -37,7 +36,7 @@ import com.google.inject.Module; * * @author Adrian Cole */ -@Test +@Test(threadPoolSize = 10, groups = "integration", testName = "JavaUrlHttpCommandExecutorServiceIntegrationTest") public class JavaUrlHttpCommandExecutorServiceIntegrationTest extends BaseHttpCommandExecutorServiceIntegrationTest { diff --git a/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTest.java b/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTest.java index 099cc3dae8..18142299d3 100644 --- a/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTest.java +++ b/drivers/apachehc/src/test/java/org/jclouds/http/apachehc/ApacheHCHttpCommandExecutorServiceTest.java @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2010 Cloud Conscious, LLC. + * Copyright (C) 2011 Cloud Conscious, LLC. * * ==================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,6 @@ * limitations under the License. * ==================================================================== */ - package org.jclouds.http.apachehc; import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS; @@ -25,6 +24,7 @@ import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST; import static org.jclouds.Constants.PROPERTY_USER_THREADS; import java.io.IOException; +import java.net.MalformedURLException; import java.util.Properties; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; @@ -40,7 +40,7 @@ import com.google.inject.Module; * * @author Adrian Cole */ -@Test +@Test(threadPoolSize = 10, singleThreaded = true, groups = "integration", testName = "ApacheHCHttpCommandExecutorServiceTest") public class ApacheHCHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorServiceIntegrationTest { static { System.setProperty("http.conn-manager.timeout", 1000 + ""); @@ -60,6 +60,20 @@ public class ApacheHCHttpCommandExecutorServiceTest extends BaseHttpCommandExecu } @Override + @Test(invocationCount = 5, timeOut = 10000) + public void testPostAsInputStream() throws MalformedURLException, ExecutionException, InterruptedException, + TimeoutException { + super.testPostAsInputStream(); + } + + @Override + @Test(dependsOnMethods = "testPostAsInputStream") + public void testPostResults() { + super.testPostResults(); + } + + @Override + @Test(enabled = false) public void testPostContentDisposition() throws ExecutionException, InterruptedException, TimeoutException, IOException { // TODO: currently times out, see issue @@ -67,12 +81,14 @@ public class ApacheHCHttpCommandExecutorServiceTest extends BaseHttpCommandExecu } @Override + @Test(enabled = false) public void testPostContentEncoding() throws ExecutionException, InterruptedException, TimeoutException, IOException { // TODO: currently times out, see issue // http://code.google.com/p/jclouds/issues/detail?id=353 } @Override + @Test(enabled = false) public void testPostContentLanguage() throws ExecutionException, InterruptedException, TimeoutException, IOException { // TODO: currently times out, see issue // http://code.google.com/p/jclouds/issues/detail?id=353 diff --git a/drivers/enterprise/src/test/java/org/jclouds/enterprise/config/EnterpriseConfigurationModuleTest.java b/drivers/enterprise/src/test/java/org/jclouds/enterprise/config/EnterpriseConfigurationModuleTest.java index 4de9c4a298..7c2e8a3680 100644 --- a/drivers/enterprise/src/test/java/org/jclouds/enterprise/config/EnterpriseConfigurationModuleTest.java +++ b/drivers/enterprise/src/test/java/org/jclouds/enterprise/config/EnterpriseConfigurationModuleTest.java @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2010 Cloud Conscious, LLC. + * Copyright (C) 2011 Cloud Conscious, LLC. * * ==================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,6 @@ * limitations under the License. * ==================================================================== */ - package org.jclouds.enterprise.config; import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS; @@ -24,7 +23,10 @@ import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT; import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST; import static org.jclouds.Constants.PROPERTY_USER_THREADS; +import java.net.MalformedURLException; import java.util.Properties; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; import org.jclouds.http.BaseHttpCommandExecutorServiceIntegrationTest; import org.testng.annotations.Test; @@ -36,7 +38,7 @@ import com.google.inject.Module; * * @author Adrian Cole */ -@Test +@Test(threadPoolSize = 10, groups = "integration", singleThreaded = true, testName = "EnterpriseConfigurationModuleTest") public class EnterpriseConfigurationModuleTest extends BaseHttpCommandExecutorServiceIntegrationTest { protected Module createConnectionModule() { @@ -51,4 +53,16 @@ public class EnterpriseConfigurationModuleTest extends BaseHttpCommandExecutorSe props.setProperty(PROPERTY_USER_THREADS, 5 + ""); } + @Override + @Test(invocationCount = 5, timeOut = 10000) + public void testPostAsInputStream() throws MalformedURLException, ExecutionException, InterruptedException, + TimeoutException { + super.testPostAsInputStream(); + } + + @Override + @Test(dependsOnMethods = "testPostAsInputStream") + public void testPostResults() { + super.testPostResults(); + } } \ No newline at end of file diff --git a/drivers/gae/src/test/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorServiceIntegrationTest.java b/drivers/gae/src/test/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorServiceIntegrationTest.java index be5189551c..4336dbf1b4 100644 --- a/drivers/gae/src/test/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorServiceIntegrationTest.java +++ b/drivers/gae/src/test/java/org/jclouds/gae/AsyncGaeHttpCommandExecutorServiceIntegrationTest.java @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2010 Cloud Conscious, LLC. + * Copyright (C) 2011 Cloud Conscious, LLC. * * ==================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,6 @@ * limitations under the License. * ==================================================================== */ - package org.jclouds.gae; import static org.jclouds.concurrent.FutureIterables.awaitCompletion; @@ -65,7 +64,7 @@ import com.google.inject.Module; * * @author Adrian Cole */ -@Test(threadPoolSize = 10, groups = "integration", sequential = true) +@Test(threadPoolSize = 10, groups = "integration", singleThreaded = true, testName = "AsyncGaeHttpCommandExecutorServiceIntegrationTest") public class AsyncGaeHttpCommandExecutorServiceIntegrationTest extends BaseHttpCommandExecutorServiceIntegrationTest { Logger logger = Logger.CONSOLE; diff --git a/project/pom.xml b/project/pom.xml index a3ba590d14..65bc26a5db 100644 --- a/project/pom.xml +++ b/project/pom.xml @@ -283,7 +283,7 @@ maven-surefire-plugin - 2.5 + 2.8 integration @@ -292,7 +292,7 @@ test - -Xmx512m -Xms256m -Djava.awt.headless=true -XX:MaxPermSize=256m -Xss256k + -Xss64kb -Xmx512m -Xms256m -Djava.awt.headless=true -XX:MaxPermSize=256m -Xss256k tests 5