Skip to content

Commit f530c85

Browse files
author
Sharon Shabtai
committed
add new test for attachDataLister to a job
1 parent 9f46fdb commit f530c85

File tree

3 files changed

+145
-81
lines changed

3 files changed

+145
-81
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.spectralogic.ds3client.integration;
2+
3+
import com.spectralogic.ds3client.helpers.DataTransferredListener;
4+
import com.spectralogic.ds3client.helpers.ObjectCompletedListener;
5+
6+
class TransferredListener implements DataTransferredListener, ObjectCompletedListener {
7+
8+
private long totalBytes = 0;
9+
private int numberOfFiles = 0;
10+
public TransferredListener() {
11+
//pass
12+
}
13+
14+
@Override
15+
public synchronized void dataTransferred(final long size) {
16+
this.totalBytes += size;
17+
}
18+
19+
public long getTotalBytes() {
20+
return this.totalBytes;
21+
}
22+
23+
24+
@Override
25+
public synchronized void objectCompleted(final String s) {
26+
this.numberOfFiles += 1;
27+
}
28+
29+
public int getNumberOfFiles() {
30+
return this.numberOfFiles;
31+
}
32+
}

ds3-sdk-integration/src/main/java/com/spectralogic/ds3client/integration/Util.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
public class Util {
4343
public static final String RESOURCE_BASE_NAME = "books/";
44+
public static final String[] BOOKS = {"beowulf.txt", "sherlock_holmes.txt", "tale_of_two_cities.txt", "ulysses.txt"};
4445

4546
private Util() {}
4647

@@ -62,7 +63,6 @@ public static void assumeVersion1_2(final Ds3Client client) throws IOException,
6263
assumeThat(majorVersion, is(1));
6364
}
6465

65-
private static final String[] BOOKS = {"beowulf.txt", "sherlock_holmes.txt", "tale_of_two_cities.txt", "ulysses.txt"};
6666
public static void loadBookTestData(final Ds3Client client, final String bucketName) throws IOException, SignatureException, XmlProcessingException, URISyntaxException {
6767

6868
getLoadJob(client, bucketName, RESOURCE_BASE_NAME)
@@ -100,7 +100,6 @@ public static void loadBookTestDataWithPrefix(final Ds3Client client, final Stri
100100
helpers.startWriteJob(bucketName, objects).transfer(new PrefixAdderObjectChannelBuilder(new ResourceObjectPutter(RESOURCE_BASE_NAME), prefix));
101101
}
102102

103-
104103
public static void deleteAllContents(final Ds3Client client, final String bucketName) throws IOException, SignatureException {
105104
final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client);
106105

0 commit comments

Comments
 (0)