Skip to content

Commit 6e3a0b7

Browse files
author
shabtaisharon
committed
Merge pull request #160 from rpmoore/space_test
Adding an integration test to verify that spaces in object names do n…
2 parents 37c2497 + cb9530a commit 6e3a0b7

File tree

1 file changed

+37
-0
lines changed
  • ds3-sdk-integration/src/test/java/com/spectralogic/ds3client/integration

1 file changed

+37
-0
lines changed

ds3-sdk-integration/src/test/java/com/spectralogic/ds3client/integration/Smoke_Test.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,4 +1056,41 @@ public Map<String, String> getMetadataValue(final String filename) {
10561056
deleteAllContents(client, bucketName);
10571057
}
10581058
}
1059+
1060+
@Test
1061+
public void nameWithSpace() throws IOException, SignatureException, XmlProcessingException {
1062+
final String bucketName = "test_space_bucket";
1063+
1064+
try {
1065+
final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client);
1066+
1067+
helpers.ensureBucketExists(bucketName);
1068+
1069+
final List<Ds3Object> objs = Lists.newArrayList(new Ds3Object("space object.txt", 10));
1070+
1071+
final Ds3ClientHelpers.Job job = helpers.startWriteJob(bucketName, objs);
1072+
1073+
job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() {
1074+
@Override
1075+
public SeekableByteChannel buildChannel(final String key) throws IOException {
1076+
1077+
final byte[] randomData = IOUtils.toByteArray(new RandomDataInputStream(124345, 10));
1078+
final ByteBuffer randomBuffer = ByteBuffer.wrap(randomData);
1079+
1080+
final ByteArraySeekableByteChannel channel = new ByteArraySeekableByteChannel(10);
1081+
channel.write(randomBuffer);
1082+
1083+
return channel;
1084+
}
1085+
});
1086+
1087+
final Iterable<Contents> contents = helpers.listObjects(bucketName);
1088+
1089+
assertThat(Iterables.size(contents), is(1));
1090+
assertThat(Iterables.get(contents, 0).getKey(), is("space object.txt"));
1091+
1092+
} finally {
1093+
deleteAllContents(client, bucketName);
1094+
}
1095+
}
10591096
}

0 commit comments

Comments
 (0)