JCLOUDS-1263: Add live integration test for manipulating objects through the Swift ObjectApi with unicode characters in their path

This commit is contained in:
Mat Mannion 2017-04-04 13:52:26 +01:00 committed by Andrew Gaul
parent 14621c08d7
commit 29655f3149
1 changed files with 27 additions and 8 deletions

View File

@ -61,11 +61,7 @@ public class ObjectApiLiveTest extends BaseSwiftApiLiveTest {
private String containerName = getClass().getSimpleName() + "Container";
static final Payload PAYLOAD = newByteSourcePayload(ByteSource.wrap("swifty".getBytes()));
public void testCreateWithSpacesAndSpecialCharacters() throws Exception {
final String containerName = "container # ! special";
final String objectName = "object # ! special";
for (String regionId : regions) {
protected void assertCanCreateReadUpdateDeleteList(String regionId, String containerName, String objectName) throws Exception {
assertNotNull(getApi().getContainerApi(regionId).create(containerName));
assertNotNull(getApi().getObjectApi(regionId, containerName).put(objectName, PAYLOAD));
@ -74,9 +70,32 @@ public class ObjectApiLiveTest extends BaseSwiftApiLiveTest {
checkObject(object);
assertEquals(toStringAndClose(object.getPayload().openStream()), "swifty");
String lexicographicallyBeforeName = objectName.substring(0, objectName.length() - 1);
object = getApi().getObjectApi(regionId, containerName)
.list(marker(lexicographicallyBeforeName)).get(0);
assertEquals(object.getName(), objectName);
checkObject(object);
getApi().getObjectApi(regionId, containerName).delete(objectName);
getApi().getContainerApi(regionId).deleteIfEmpty(containerName);
}
public void testCreateWithSpacesAndSpecialCharacters() throws Exception {
final String containerName = "container # ! special";
final String objectName = "object # ! special";
for (String regionId : regions) {
assertCanCreateReadUpdateDeleteList(regionId, containerName, objectName);
}
}
public void testCreateAndListWithUnicodeCharacters() throws Exception {
final String containerName = "container-unic₪de";
final String objectName = "object-unic₪de";
for (String regionId : regions) {
assertCanCreateReadUpdateDeleteList(regionId, containerName, objectName);
}
}
public void testPutWithExpiration() throws Exception {