updated to surefire 2.8, and revised test annotations to be compatible with testng 5.14.10

This commit is contained in:
Adrian Cole 2011-04-09 01:09:35 -07:00
parent 41b5e3130f
commit 8d26999bc2
9 changed files with 89 additions and 64 deletions

View File

@ -1,6 +1,6 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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<DirectoryEntry> result = createFn().apply(response);
assertEquals(result, values());
assertEquals(ImmutableSet.copyOf(result), values());
assertEquals(result.getToken(), null);
}
protected Set<DirectoryEntry> values() {
Set<DirectoryEntry> expected = Sets.newLinkedHashSet();
Builder<DirectoryEntry> expected = ImmutableSet.<DirectoryEntry>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();
}
}

View File

@ -63,7 +63,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<version>2.8</version>
<executions>
<execution>
<id>integration</id>

View File

@ -1,6 +1,6 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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

View File

@ -1,6 +1,6 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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 {

View File

@ -1,6 +1,6 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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

View File

@ -1,6 +1,6 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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();
}
}

View File

@ -1,6 +1,6 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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;

View File

@ -283,7 +283,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<version>2.8</version>
<executions>
<execution>
<id>integration</id>
@ -292,7 +292,7 @@
<goal>test</goal>
</goals>
<configuration>
<argLine>-Xmx512m -Xms256m -Djava.awt.headless=true -XX:MaxPermSize=256m -Xss256k</argLine>
<argLine>-Xss64kb -Xmx512m -Xms256m -Djava.awt.headless=true -XX:MaxPermSize=256m -Xss256k</argLine>
<parallel>tests</parallel>
<threadCount>5</threadCount>
<!-- note that the groups/excluded groups don't work due to some problem

View File

@ -1,6 +1,6 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* limitations under the License.
* ====================================================================
*/
package org.jclouds.azureblob.xml;
import static org.testng.Assert.assertEquals;
@ -65,20 +64,21 @@ public class ContainerNameEnumerationResultsHandlerTest extends BaseHandlerTest
.create("http://myaccount.blob.core.windows.net/mycontainer/blob1.txt"), dateService
.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), "0x8CAE7D55D050B8B", 8,
"text/plain; charset=UTF-8", null, null, null, LeaseStatus.UNLOCKED, ImmutableMap
.<String, String> of()), new BlobPropertiesImpl(BlobType.BLOCK_BLOB, "blob2.txt",
"mycontainer", URI.create("http://myaccount.blob.core.windows.net/mycontainer/blob2.txt"),
dateService.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), "0x8CAE7D55CF6C339", 14,
.<String, String> of()),
new BlobPropertiesImpl(BlobType.BLOCK_BLOB, "blob2.txt", "mycontainer", URI
.create("http://myaccount.blob.core.windows.net/mycontainer/blob2.txt"), dateService
.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), "0x8CAE7D55CF6C339", 14,
"text/plain; charset=UTF-8", null, null, null, LeaseStatus.UNLOCKED, ImmutableMap
.<String, String> of()), new BlobPropertiesImpl(BlobType.PAGE_BLOB, "newblob1.txt",
"mycontainer", URI.create("http://myaccount.blob.core.windows.net/mycontainer/newblob1.txt"),
dateService.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), "0x8CAE7D55CF6C339", 25,
.<String, String> of()),
new BlobPropertiesImpl(BlobType.PAGE_BLOB, "newblob1.txt", "mycontainer", URI
.create("http://myaccount.blob.core.windows.net/mycontainer/newblob1.txt"), dateService
.rfc822DateParse("Thu, 18 Sep 2008 18:41:57 GMT"), "0x8CAE7D55CF6C339", 25,
"text/plain; charset=UTF-8", null, null, null, LeaseStatus.UNLOCKED, ImmutableMap
.<String, String> of()));
ListBlobsResponse list = new HashSetListBlobsResponse(contents, URI
.create("http://myaccount.blob.core.windows.net/mycontainer"),
"myfolder/", null, 4, "newblob2.txt", "/", Sets.<String> newTreeSet());
ListBlobsResponse list = new HashSetListBlobsResponse(contents,
URI.create("http://myaccount.blob.core.windows.net/mycontainer"), "myfolder/", null, 4, "newblob2.txt",
null, ImmutableSet.<String> of("myfolder/"));
ListBlobsResponse result = (ListBlobsResponse) factory.create(
injector.getInstance(ContainerNameEnumerationResultsHandler.class)).parse(is);
@ -93,11 +93,11 @@ public class ContainerNameEnumerationResultsHandlerTest extends BaseHandlerTest
dateService.rfc822DateParse("Sat, 30 Jan 2010 17:46:15 GMT"), "0x8CC6FEB41736428", 8,
"application/octet-stream", null, null, null, LeaseStatus.UNLOCKED, ImmutableMap.<String, String> of()));
ListBlobsResponse list = new HashSetListBlobsResponse(contents, URI
.create("https://jclouds.blob.core.windows.net/adriancole-blobstore3"),
ListBlobsResponse list = new HashSetListBlobsResponse(contents,
URI.create("https://jclouds.blob.core.windows.net/adriancole-blobstore3"),
null, null, 1, "2!68!MDAwMDA2IWFwcGxlcyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", "/", Sets
.<String> newTreeSet());
null, null, 1, "2!68!MDAwMDA2IWFwcGxlcyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", "/",
Sets.<String> newTreeSet());
ListBlobsResponse result = (ListBlobsResponse) factory.create(
injector.getInstance(ContainerNameEnumerationResultsHandler.class)).parse(is);