From 75939353800ad8e1f18646428ab40be32a9f4f16 Mon Sep 17 00:00:00 2001 From: Zack Shoylev Date: Fri, 4 Oct 2013 14:34:34 -0500 Subject: [PATCH] JCLOUDS-332 Skips tests broken on windows --- .../FilesystemContainerIntegrationTest.java | 73 ++++++++++++++++++- .../jclouds/filesystem/utils/TestUtils.java | 7 ++ .../internal/BaseBlobIntegrationTest.java | 6 +- 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemContainerIntegrationTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemContainerIntegrationTest.java index 0798d5926c..eb124ccabe 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemContainerIntegrationTest.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemContainerIntegrationTest.java @@ -21,6 +21,8 @@ import static org.testng.Assert.assertEquals; import java.io.IOException; import java.util.Properties; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; import javax.ws.rs.core.MediaType; @@ -32,6 +34,7 @@ import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest; import org.jclouds.blobstore.integration.internal.BaseContainerIntegrationTest; import org.jclouds.filesystem.reference.FilesystemConstants; import org.jclouds.filesystem.utils.TestUtils; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import org.testng.SkipException; @@ -55,12 +58,13 @@ public class FilesystemContainerIntegrationTest extends BaseContainerIntegration props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR); return props; } - @Test(groups = { "integration", "live" }) - public void testNotWithDetails() throws InterruptedException { + @Test(dataProvider = "ignoreOnWindows", groups = { "integration", "live" }) + public void testNotWithDetails() throws InterruptedException { String key = "hello"; - // NOTE all metadata in jclouds comes out as lowercase, in an effort to normalize the + // NOTE all metadata in jclouds comes out as lowercase, in an effort to + // normalize the // providers. Blob object = view.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("Adrian", "powderpuff")) .payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).build(); @@ -72,7 +76,8 @@ public class FilesystemContainerIntegrationTest extends BaseContainerIntegration PageSet container = view.getBlobStore().list(containerName, maxResults(1)); BlobMetadata metadata = (BlobMetadata) Iterables.getOnlyElement(container); - // transient container should be lenient and not return metadata on undetailed listing. + // transient container should be lenient and not return metadata on + // undetailed listing. assertEquals(metadata.getUserMetadata().size(), 0); @@ -95,4 +100,64 @@ public class FilesystemContainerIntegrationTest extends BaseContainerIntegration public void testWithDetails() throws InterruptedException, IOException { throw new SkipException("not yet implemented"); } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void containerExists() throws InterruptedException { + super.containerExists(); + } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void deleteContainerWithContents() throws InterruptedException { + super.deleteContainerWithContents(); + } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void testListContainer() throws InterruptedException, ExecutionException, TimeoutException { + super.testListContainer(); + } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void testListContainerMarker() throws InterruptedException { + super.testListContainerMarker(); + } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void testListContainerPrefix() throws InterruptedException { + super.testListContainerPrefix(); + } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void testListRootUsesDelimiter() throws InterruptedException { + super.testListRootUsesDelimiter(); + } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void testPutTwiceIsOkAndDoesntOverwrite() throws InterruptedException { + super.testPutTwiceIsOkAndDoesntOverwrite(); + } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void deleteContainerIfEmpty() throws InterruptedException { + super.deleteContainerIfEmpty(); + } + + @Override + @Test(dataProvider = "ignoreOnWindows") + public void testListContainerMaxResults() throws InterruptedException { + super.testListContainerMaxResults(); + } + + @DataProvider + public Object[][] ignoreOnWindows() { + return (TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS + : TestUtils.SINGLE_NO_ARG_INVOCATION); + } } diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java index 62609f5001..d0c30623e7 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/utils/TestUtils.java @@ -55,6 +55,9 @@ public class TestUtils { private static final Iterator IMAGE_RESOURCES_ITERATOR = Iterators.cycle(IMAGE_RESOURCES); + public static final Object[][] NO_INVOCATIONS = new Object[0][0]; + public static final Object[][] SINGLE_NO_ARG_INVOCATION = { new Object[0] }; + /** * Generate a random blob key simple name (with no path in the key) * @return @@ -218,4 +221,8 @@ public class TestUtils { Files.copy(ByteStreams.newInputStreamSupplier(buffer), file); } } + + public static boolean isWindowsOs() { + return System.getProperty("os.name", "").toLowerCase().contains("windows"); + } } diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java index 5e5d3c9ec9..c55c49f256 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java @@ -454,8 +454,12 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest { @DataProvider(name = "delete") public Object[][] createData() { - return new Object[][] { { "normal" }, { "sp ace" }, { "qu?stion" }, { "unic₪de" }, { "path/foo" }, { "colon:" }, + if (System.getProperty("os.name").toLowerCase().contains("windows")) { + return new Object[][] { { "normal" }, { "sp ace" } }; + } else { + return new Object[][] { { "normal" }, { "sp ace" }, { "qu?stion" }, { "unic₪de" }, { "path/foo" }, { "colon:" }, { "asteri*k" }, { "quote\"" }, { "{greaten" }, { "p|pe" } }; + } } @Test(groups = { "integration", "live" }, dataProvider = "delete")