Skip to content

Commit ab78887

Browse files
author
hansdude
committed
Merge pull request #61 from SpectraLogic/1.1-dev
1.1 dev branch merge
2 parents 84a1d5f + 5b4904d commit ab78887

File tree

3 files changed

+57
-6
lines changed

3 files changed

+57
-6
lines changed

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

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99

1010
import java.io.IOException;
1111
import java.net.URISyntaxException;
12+
import java.nio.channels.SeekableByteChannel;
13+
import java.nio.file.Files;
14+
import java.nio.file.Path;
15+
import java.nio.file.StandardOpenOption;
1216
import java.security.SignatureException;
17+
import java.util.UUID;
1318

19+
import com.spectralogic.ds3client.commands.*;
20+
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers;
21+
import com.spectralogic.ds3client.models.bulk.JobStatus;
1422
import org.junit.BeforeClass;
1523
import org.junit.Test;
1624

1725
import com.spectralogic.ds3client.Ds3Client;
18-
import com.spectralogic.ds3client.commands.DeleteBucketRequest;
19-
import com.spectralogic.ds3client.commands.GetBucketRequest;
20-
import com.spectralogic.ds3client.commands.GetBucketResponse;
21-
import com.spectralogic.ds3client.commands.HeadBucketRequest;
22-
import com.spectralogic.ds3client.commands.HeadBucketResponse;
23-
import com.spectralogic.ds3client.commands.PutBucketRequest;
2426
import com.spectralogic.ds3client.models.ListBucketResult;
2527
import com.spectralogic.ds3client.networking.FailedRequestException;
2628
import com.spectralogic.ds3client.serializer.XmlProcessingException;
@@ -105,6 +107,38 @@ public void listContents() throws IOException, SignatureException,
105107
}
106108
}
107109

110+
@Test
111+
public void getContents() throws IOException, SignatureException, URISyntaxException, XmlProcessingException {
112+
final String bucketName = "test_get_contents";
113+
114+
try {
115+
client.putBucket(new PutBucketRequest(bucketName));
116+
Util.loadBookTestData(client, bucketName);
117+
118+
final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client);
119+
120+
final Ds3ClientHelpers.Job job = helpers.startReadAllJob(bucketName);
121+
122+
final UUID jobId = job.getJobId();
123+
124+
job.transfer(new Ds3ClientHelpers.ObjectChannelBuilder() {
125+
@Override
126+
public SeekableByteChannel buildChannel(final String key) throws IOException {
127+
128+
final Path filePath = Files.createTempFile("ds3", key);
129+
130+
return Files.newByteChannel(filePath, StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.WRITE);
131+
}
132+
});
133+
134+
final GetJobResponse jobResponse = client.getJob(new GetJobRequest(jobId));
135+
assertThat(jobResponse.getMasterObjectList().getStatus(), is(JobStatus.COMPLETED));
136+
137+
} finally {
138+
Util.deleteAllContents(client, bucketName);
139+
}
140+
}
141+
108142
@Test
109143
public void negativeDeleteNonEmptyBucket() throws IOException,
110144
SignatureException, XmlProcessingException, URISyntaxException {

ds3-sdk/src/main/java/com/spectralogic/ds3client/models/bulk/JobInfo.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,13 @@ public class JobInfo {
6262
@JsonProperty("ChunkClientProcessingOrderGuarantee")
6363
private ChunkClientProcessingOrderGuarantee chunkClientProcessingOrderGuarantee;
6464

65+
@JsonProperty("Status")
66+
private JobStatus status;
67+
6568
public UUID getJobId() {
6669
return this.jobId;
6770
}
71+
6872
public void setJobId(final UUID jobId) {
6973
this.jobId = jobId;
7074
}
@@ -164,4 +168,12 @@ public UUID getUserId() {
164168
public void setUserId(final UUID userId) {
165169
this.userId = userId;
166170
}
171+
172+
public JobStatus getStatus() {
173+
return status;
174+
}
175+
176+
public void setStatus(JobStatus status) {
177+
this.status = status;
178+
}
167179
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.spectralogic.ds3client.models.bulk;
2+
3+
public enum JobStatus {
4+
IN_PROGRESS, COMPLETED, CANCELED
5+
}

0 commit comments

Comments
 (0)