JCLOUDS-332 Skips tests broken on windows

This commit is contained in:
Zack Shoylev 2013-10-04 14:34:34 -05:00
parent 7d20658b02
commit 7593935380
3 changed files with 81 additions and 5 deletions

View File

@ -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<? extends StorageMetadata> 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);
}
}

View File

@ -55,6 +55,9 @@ public class TestUtils {
private static final Iterator<File> 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");
}
}

View File

@ -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\"" }, { "{great<r}" }, { "lesst>en" }, { "p|pe" } };
}
}
@Test(groups = { "integration", "live" }, dataProvider = "delete")