diff --git a/build.gradle b/build.gradle
index 2358c96..d554b2e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -52,7 +52,7 @@ subprojects {
compile 'ch.qos.logback:logback-core:1.2.3'
compile 'ch.qos.logback:logback-classic:1.2.3'
compile 'com.google.guava:guava:23.0-jre'
- compile 'com.spectralogic.ds3:ds3-sdk:3.5.4'
+ compile 'com.spectralogic.ds3:ds3-sdk:5.0.2'
compile 'com.google.inject:guice:4.2.0'
testCompile ('org.mockito:mockito-core:1.10.19') {
diff --git a/ds3-cli-certification/src/test/java/com/spectralogic/ds3cli/certification/Certification_Test.java b/ds3-cli-certification/src/test/java/com/spectralogic/ds3cli/certification/Certification_Test.java
index ec5214e..5bcd046 100644
--- a/ds3-cli-certification/src/test/java/com/spectralogic/ds3cli/certification/Certification_Test.java
+++ b/ds3-cli-certification/src/test/java/com/spectralogic/ds3cli/certification/Certification_Test.java
@@ -20,6 +20,8 @@
import com.google.common.collect.Iterables;
import com.spectralogic.ds3cli.CommandResponse;
import com.spectralogic.ds3cli.exceptions.*;
+import com.spectralogic.ds3cli.helpers.TempStorageIds;
+import com.spectralogic.ds3cli.helpers.TempStorageUtil;
import com.spectralogic.ds3cli.helpers.Util;
import com.spectralogic.ds3client.Ds3Client;
import com.spectralogic.ds3client.Ds3ClientBuilder;
@@ -30,10 +32,7 @@
import com.spectralogic.ds3client.models.common.Credentials;
import com.spectralogic.ds3client.networking.FailedRequestException;
import org.apache.commons.io.FileUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
+import org.junit.*;
import org.junit.runners.MethodSorters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,6 +44,7 @@
import java.util.*;
import static com.spectralogic.ds3cli.certification.CertificationUtil.*;
+import static com.spectralogic.ds3cli.helpers.TempStorageUtil.setupDataPolicy;
import static com.spectralogic.ds3cli.helpers.TempStorageUtil.verifyAvailableTapePartition;
import static junit.framework.TestCase.assertFalse;
import static org.hamcrest.CoreMatchers.is;
@@ -56,10 +56,10 @@
/**
* Implement tests to automate the BlackPearl Certification process for the JavaCLI.
- *
+ *
* For details, refer to
- * https://developer.spectralogic.com/certification/
- * https://developer.spectralogic.com/test-plan/
+ * https://developer.spectralogic.com/certification/
+ * https://developer.spectralogic.com/test-plan/
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING) // Order only matters for manually verifying the results
@@ -74,6 +74,7 @@ public class Certification_Test {
private static UUID envDataPolicyId;
private final static Ds3ExceptionHandlerMapper EXCEPTION_MAPPER = Ds3ExceptionHandlerMapper.getInstance();
+
static {
EXCEPTION_MAPPER.addHandler(FailedRequestException.class, new FailedRequestExceptionHandler());
EXCEPTION_MAPPER.addHandler(RuntimeException.class, new RuntimeExceptionHandler());
@@ -133,7 +134,7 @@ public void test_7_2_1_invalid_credentials() throws Exception {
try {
Util.command(invalid_client, "--http -c get_service");
- } catch(final FailedRequestException e) {
+ } catch (final FailedRequestException e) {
final String formattedException = FailedRequestExceptionHandler.format(e);
OUT.insertPreformat(formattedException);
final String expectedError = "permissions / authorization error";
@@ -155,7 +156,7 @@ public void test_7_2_2_invalid_endpoint() throws Exception {
boolean success = false;
try {
Util.command(invalid_client, "--http -c get_service");
- } catch(final UnknownHostException uhe) {
+ } catch (final UnknownHostException uhe) {
final String formattedException = ExceptionFormatter.format(uhe);
final String expectedError = "UnknownHost";
assertThat(formattedException, containsString(expectedError));
@@ -177,7 +178,7 @@ public void test_7_3_1_list_nonexistent_bucket() throws Exception {
try {
Util.command(client, "--http -c get_bucket -b " + bucketName);
- } catch(final CommandException ce) {
+ } catch (final CommandException ce) {
final String formattedException = ExceptionFormatter.format(ce);
assertThat(formattedException, containsString("Error: Unknown bucket."));
OUT.insertLog("CommandResponse for 7.3.1 failed attempt to list nonexistent bucket:");
@@ -212,7 +213,7 @@ public void test_7_3_2_access_bucket_wrong_user() throws Exception {
// Attempt to access the bucket with the new user, which should fail
final String listBucketCmd = "--http -c get_bucket -b " + bucketName;
Util.command(invalid_client, listBucketCmd);
- } catch(final FailedRequestException e) {
+ } catch (final FailedRequestException e) {
final String formattedException = FailedRequestExceptionHandler.format(e);
final String expectedError = "permissions / authorization error";
assertThat(formattedException, containsString(expectedError));
@@ -250,7 +251,7 @@ public void test_7_4_get_nonexistent_object() throws Exception {
final CommandResponse getNonExtandObjectResponse = Util.command(client, getNonExtantObject);
OUT.insertCommand(getNonExtantObject, getNonExtandObjectResponse.getMessage());
- } catch(final FailedRequestException fre) {
+ } catch (final FailedRequestException fre) {
final String formattedException = FailedRequestExceptionHandler.format(fre);
final String expectedError = "not found";
assertThat(formattedException, containsString(expectedError));
@@ -266,6 +267,7 @@ public void test_7_4_get_nonexistent_object() throws Exception {
/**
* 7.5-7: Archive and Restore 3 objects larger than the chunk size to BP simultaneously.
+ *
* @throws Exception
*/
@Test
@@ -282,6 +284,7 @@ public void test_7_5_and_6_bulk_performance_3x110GB() throws Exception {
/**
* 7.7-8: Archive 250 objects of approximately 1GB size to BP.
+ *
* @throws Exception
*/
@Test
@@ -323,7 +326,7 @@ private static boolean testBulkPutAndBulkGetPerformance(
OUT.insertLog("Bulk PUT from bucket " + bucketName);
final long startPutTime = getCurrentTime();
- final String putBulkCmd = "--http -c put_bulk -b " + bucketName + " -d " + bulkPutLocalTempDir.toString();
+ final String putBulkCmd = "--http -c put_bulk -b " + bucketName + " -d " + bulkPutLocalTempDir.toString();
final CommandResponse putBulkResponse = Util.command(client, putBulkCmd);
OUT.insertCommand(putBulkCmd, putBulkResponse.getMessage());
final long endPutTime = getCurrentTime();
@@ -368,14 +371,20 @@ public void test_8_1_versioning() throws Exception {
final Long fileSize = 1024L;
final String bucketName = CertificationUtil.getBucketName(testDescription);
boolean success = false;
+ final UUID dataPolicy = setupDataPolicy(testDescription, false, ChecksumType.Type.MD5, client);
+ final TempStorageIds tempStorageIds = TempStorageUtil.setup(testDescription, dataPolicy, client);
+
OUT.startNewTest(testDescription);
try {
+
OUT.insertLog("Set data policy to use versioning");
- final String enableDataPolicyVersioningCmd = "--http -c modify_data_policy --modify-params versioning:KEEP_LATEST -i " + envDataPolicyId;
+ final String enableDataPolicyVersioningCmd = "--http -c modify_data_policy --modify-params versioning:KEEP_LATEST -i " + dataPolicy;
final CommandResponse modifyDataPolicyResponse = Util.command(client, enableDataPolicyVersioningCmd);
OUT.insertCommand(enableDataPolicyVersioningCmd, modifyDataPolicyResponse.getMessage());
assertThat(modifyDataPolicyResponse.getReturnCode(), is(0));
+ client.modifyUserSpectraS3(new ModifyUserSpectraS3Request("Administrator")
+ .withDefaultDataPolicyId(dataPolicy));
// create and store one file
Path bulkPutLocalTempDir = CertificationUtil.createTempFiles(bucketName, numFiles, fileSize);
@@ -407,11 +416,9 @@ public void test_8_1_versioning() throws Exception {
} catch (final Exception e) {
LOG.error("Exception: {}", e.getMessage(), e);
} finally {
- Util.deleteBucket(client, bucketName);
-
- // undo versioning
- Util.command(client, "--http -c modify_data_policy --modify-params versioning:NONE -i " + envDataPolicyId);
-
+ client.modifyUserSpectraS3(new ModifyUserSpectraS3Request("Administrator")
+ .withDefaultDataPolicyId(envDataPolicyId));
+ TempStorageUtil.teardown(testDescription, tempStorageIds, client);
OUT.finishTest(testDescription, success);
assertTrue(testDescription + " did not complete", success);
}
@@ -432,7 +439,7 @@ public void test_8_2_partial_restore() throws Exception {
try {
final Path bulkPutLocalTempDir = CertificationUtil.createTempFiles(bucketName, numFiles, fileSize);
- final String putBulkCmd = "--http -c put_bulk -b " + bucketName + " -d " + bulkPutLocalTempDir.toString();
+ final String putBulkCmd = "--http -c put_bulk -b " + bucketName + " -d " + bulkPutLocalTempDir.toString();
final CommandResponse putBulkResponse = Util.command(client, putBulkCmd);
OUT.insertCommand(putBulkCmd, putBulkResponse.getMessage());
assertThat(putBulkResponse.getReturnCode(), is(0));
@@ -445,7 +452,7 @@ public void test_8_2_partial_restore() throws Exception {
OUT.insertPreformat(objectName);
// restore first 100 bytes
- final String getPartialObjectCmd = "--http -c get_object --range-offset 0 --range-length 100 -b " + bucketName + " -o " + objectName + " -d " + bulkPutLocalTempDir.toString();
+ final String getPartialObjectCmd = "--http -c get_object --range-offset 0 --range-length 100 -b " + bucketName + " -o " + objectName + " -d " + bulkPutLocalTempDir.toString();
final CommandResponse getPartialResponse = Util.command(client, getPartialObjectCmd);
OUT.insertCommand(getPartialObjectCmd, getPartialResponse.getMessage());
assertThat(getPartialResponse.getReturnCode(), is(0));
@@ -455,11 +462,11 @@ public void test_8_2_partial_restore() throws Exception {
final com.spectralogic.ds3cli.util.FileUtils.ObjectsToPut objectsToPut = com.spectralogic.ds3cli.util.FileUtils.getObjectsToPut(filesToPut, bulkPutLocalTempDir, "", true);
final Ds3Object obj = objectsToPut.getDs3Objects().get(0);
assertTrue(obj.getSize() < 150);
- OUT.insertLog(obj.getName() + " size: " + Long.toString(obj.getSize()));
+ OUT.insertLog(obj.getName() + " size: " + Long.toString(obj.getSize()));
success = true;
} catch (final Exception e) {
- LOG.error("Exception in " + testDescription, e );
+ LOG.error("Exception in " + testDescription, e);
} finally {
OUT.finishTest(testDescription, success);
Util.deleteBucket(client, bucketName);
@@ -501,7 +508,7 @@ public void test_8_4_change_priorities() throws Exception {
success = true;
} catch (final Exception e) {
- LOG.error("Exception in " + testDescription, e );
+ LOG.error("Exception in " + testDescription, e);
} finally {
OUT.finishTest(testDescription, success);
CertificationUtil.deleteJob(client, jobId);
@@ -551,7 +558,7 @@ public boolean apply(@Nullable final Tape tape) {
assertTrue(postEjectResponse.getMessage().contains(ejectLocation));
success = true;
} catch (final Exception e) {
- LOG.error("Exception in " + testDescription, e );
+ LOG.error("Exception in " + testDescription, e);
} finally {
CertificationUtil.cancelTapeEject(client, barcode);
OUT.finishTest(testDescription, success);
@@ -587,7 +594,7 @@ public void test_8_6_fully_persisted() throws Exception {
// Create temp files for BULK_PUT
final Path bulkPutLocalTempDir = CertificationUtil.createTempFiles(bucketName, numFiles, fileSize);
- final String putBulkCmd = "--http -c put_bulk -b " + bucketName + " -d " + bulkPutLocalTempDir.toString();
+ final String putBulkCmd = "--http -c put_bulk -b " + bucketName + " -d " + bulkPutLocalTempDir.toString();
final CommandResponse putBulkResponse = Util.command(client, putBulkCmd);
assertThat(putBulkResponse.getReturnCode(), is(0));
@@ -620,7 +627,7 @@ public void test_8_6_fully_persisted() throws Exception {
final CommandResponse getPhysicalPlacementAfterResponse = Util.command(client, getPhysicalPlacementCmd);
OUT.insertCommand(getPhysicalPlacementCmd, getPhysicalPlacementAfterResponse.getMessage());
} catch (final Exception e) {
- LOG.error("Exception in " + testDescription, e );
+ LOG.error("Exception in " + testDescription, e);
} finally {
OUT.finishTest(testDescription, success);
Util.deleteBucket(client, bucketName);
@@ -642,16 +649,16 @@ public void test_8_7_large_list() throws Exception {
boolean success = false;
try {
// Put 500 files into bucket
- final CommandResponse performanceResponse = Util.putPerformanceFiles(client, bucketName, numFiles, fileSize);
+ final CommandResponse performanceResponse = Util.putPerformanceFiles(client, bucketName, numFiles, fileSize);
assertThat(performanceResponse.getReturnCode(), is(0));
final String listBucketArgs = "--http -c get_bucket -b " + bucketName;
- final CommandResponse getBucketResponseAfterBulkPut = Util.command(client, listBucketArgs);
+ final CommandResponse getBucketResponseAfterBulkPut = Util.command(client, listBucketArgs);
OUT.insertCommand(listBucketArgs, getBucketResponseAfterBulkPut.getMessage());
assertThat(getBucketResponseAfterBulkPut.getReturnCode(), is(0));
success = true;
} catch (final Exception e) {
- LOG.error("Exception in " + testDescription, e );
+ LOG.error("Exception in " + testDescription, e);
} finally {
OUT.finishTest(testDescription, success);
Util.deleteBucket(client, bucketName);
diff --git a/ds3-cli-integration/src/test/java/com/spectralogic/ds3cli/integration/FeatureIntegration_Test.java b/ds3-cli-integration/src/test/java/com/spectralogic/ds3cli/integration/FeatureIntegration_Test.java
index a324646..9575936 100644
--- a/ds3-cli-integration/src/test/java/com/spectralogic/ds3cli/integration/FeatureIntegration_Test.java
+++ b/ds3-cli-integration/src/test/java/com/spectralogic/ds3cli/integration/FeatureIntegration_Test.java
@@ -43,6 +43,7 @@
import com.spectralogic.ds3client.commands.GetBucketResponse;
import com.spectralogic.ds3client.commands.GetObjectRequest;
import com.spectralogic.ds3client.commands.GetObjectResponse;
+import com.spectralogic.ds3client.commands.spectrads3.CancelJobSpectraS3Request;
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers;
import com.spectralogic.ds3client.helpers.FileObjectPutter;
import com.spectralogic.ds3client.helpers.FolderNameFilter;
@@ -833,9 +834,9 @@ public void getPhysicalPlacement() throws Exception {
final Arguments args = new Arguments(new String[]{"--http", "-c", "get_physical_placement", "-b", bucketName, "-o", "beowulf.txt" });
final CommandResponse response = Util.command(client, args);
- assertTrue(response.getMessage().contains("| Object Name | ID | In Cache | Length | Offset | Latest | Version |"));
+ assertTrue(response.getMessage().contains("| Object Name | ID | In Cache | Length | Offset | Latest | Version |"));
assertTrue(response.getMessage().contains("| beowulf.txt |"));
- assertTrue(response.getMessage().contains("| true | 294059 | 0 | true | 1 |"));
+ assertTrue(response.getMessage().contains("| true | 294059 | 0 | true |"));
} finally {
Util.deleteBucket(client, bucketName);
@@ -1254,6 +1255,7 @@ public void testResettingDeadJobTimerWithModifyJob() throws Exception {
assertNotNull(response);
assertNotNull(response.getMessage());
assertFalse(response.getMessage().isEmpty());
+ client.cancelJobSpectraS3(new CancelJobSpectraS3Request(job.getJobId()));
} finally {
Util.deleteBucket(client, bucketName);
}
diff --git a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/EjectStorageDomain.java b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/EjectStorageDomain.java
index c914a0b..1df8bf8 100644
--- a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/EjectStorageDomain.java
+++ b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/EjectStorageDomain.java
@@ -54,7 +54,7 @@ public CliCommand init(final Arguments args) throws Exception {
public DefaultResult call() throws Exception {
final EjectStorageDomainSpectraS3Request request
- = new EjectStorageDomainSpectraS3Request(id)
+ = new EjectStorageDomainSpectraS3Request(id.toString())
.withBucketId(bucket).withEjectLabel(ejectLabel).withEjectLocation(ejectLocation);
this.getClient().ejectStorageDomainSpectraS3(request);
diff --git a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/GetDetailedObjects.java b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/GetDetailedObjects.java
index b64d24a..fefe2de 100644
--- a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/GetDetailedObjects.java
+++ b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/GetDetailedObjects.java
@@ -90,7 +90,7 @@ private void checkFilterParams() throws BadArgumentException {
public GetDetailedObjectsResult call() throws Exception {
final FluentIterable detailedObjects = FluentIterable.from(new LazyIterable<>(
- new GetObjectsFullDetailsLoaderFactory(getClient(), this.bucketName, this.prefix, 100, 5, true)))
+ new GetObjectsFullDetailsLoaderFactory(getClient(), this.bucketName, 100, 5, true)))
.filter(Predicates.and(getDatePredicate(), getSizePredicate(), getNamePredicate(), getOwnerPredicate()));
return new GetDetailedObjectsResult(detailedObjects);
diff --git a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/GetObjectsOnTape.java b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/GetObjectsOnTape.java
index 03101cc..5d87649 100644
--- a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/GetObjectsOnTape.java
+++ b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/command/GetObjectsOnTape.java
@@ -56,7 +56,7 @@ public GetObjectsOnTapeResult call() throws CommandException, IOException {
try {
final GetBlobsOnTapeSpectraS3Response response
- = getClient().getBlobsOnTapeSpectraS3(new GetBlobsOnTapeSpectraS3Request(null, this.tapeId));
+ = getClient().getBlobsOnTapeSpectraS3(new GetBlobsOnTapeSpectraS3Request(this.tapeId));
return new GetObjectsOnTapeResult(this.tapeId, response.getBulkObjectListResult().getObjects());
} catch (final FailedRequestException e) {
diff --git a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetDataPathBackendView.java b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetDataPathBackendView.java
index b6dd84d..6ca0257 100644
--- a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetDataPathBackendView.java
+++ b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetDataPathBackendView.java
@@ -39,7 +39,7 @@ public String render(final GetDataPathBackendResult obj) {
return "No valid Data Path Backend on remote appliance";
}
- initTable(ImmutableList.of("Activated", "Auto Timeout", "Auto Inspect", "Conflict Resolution", "ID",
+ initTable(ImmutableList.of("Activated", "Auto Timeout", "Auto Inspect", "ID",
"Last Heartbeat", "Unavailable Media Policy", "Unavailable Pool Retry Mins", "Unavailable Partition Retry Mins"));
return ASCIITable.getInstance().getTable(getHeaders(), formatTableContents());
@@ -51,12 +51,11 @@ protected String[][] formatTableContents() {
attributesArray[0] = nullGuardToString(dataPathBackend.getActivated());
attributesArray[1] = nullGuardToString(dataPathBackend.getAutoActivateTimeoutInMins());
attributesArray[2] = nullGuardToString(dataPathBackend.getAutoInspect());
- attributesArray[3] = nullGuardToString(dataPathBackend.getDefaultImportConflictResolutionMode());
- attributesArray[4] = nullGuardToString(dataPathBackend.getId());
- attributesArray[5] = nullGuardFromDate(dataPathBackend.getLastHeartbeat(), DATE_FORMAT);
- attributesArray[6] = nullGuardToString(dataPathBackend.getUnavailableMediaPolicy());
- attributesArray[7] = nullGuardToString(dataPathBackend.getUnavailablePoolMaxJobRetryInMins());
- attributesArray[8] = nullGuardToString(dataPathBackend.getUnavailableTapePartitionMaxJobRetryInMins());
+ attributesArray[3] = nullGuardToString(dataPathBackend.getId());
+ attributesArray[4] = nullGuardFromDate(dataPathBackend.getLastHeartbeat(), DATE_FORMAT);
+ attributesArray[5] = nullGuardToString(dataPathBackend.getUnavailableMediaPolicy());
+ attributesArray[6] = nullGuardToString(dataPathBackend.getUnavailablePoolMaxJobRetryInMins());
+ attributesArray[7] = nullGuardToString(dataPathBackend.getUnavailableTapePartitionMaxJobRetryInMins());
contents.add(attributesArray);
return contents.toArray(new String[contents.size()][]);
}
diff --git a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetDataPoliciesView.java b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetDataPoliciesView.java
index 3018f5c..0fec369 100644
--- a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetDataPoliciesView.java
+++ b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetDataPoliciesView.java
@@ -41,7 +41,7 @@ public String render(final GetDataPoliciesResult br) {
initTable(ImmutableList.of("Name", "Created", "Versioning", "Checksum Type", "End-to-End CRC Required",
"Blobbing Enabled", "Default Blob Size", "Default Get Job Priority","Default Put Job Priority",
- "Default Verify Job Priority", "Id", "LTFS Object Naming"));
+ "Default Verify Job Priority", "Id"));
setTableDataAlignment(ImmutableList.of(ASCIITable.ALIGN_LEFT, ASCIITable.ALIGN_LEFT, ASCIITable.ALIGN_RIGHT , ASCIITable.ALIGN_RIGHT, ASCIITable.ALIGN_RIGHT,
ASCIITable.ALIGN_RIGHT, ASCIITable.ALIGN_RIGHT, ASCIITable.ALIGN_RIGHT, ASCIITable.ALIGN_RIGHT, ASCIITable.ALIGN_RIGHT, ASCIITable.ALIGN_RIGHT, ASCIITable.ALIGN_RIGHT, ASCIITable.ALIGN_RIGHT));
return ASCIITable.getInstance().getTable(getHeaders(), formatTableContents());
@@ -64,7 +64,6 @@ protected String[][] formatTableContents() {
arrayEntry[8] = nullGuardToString(dataPolicy.getDefaultPutJobPriority());
arrayEntry[9] = nullGuardToString(dataPolicy.getDefaultVerifyJobPriority());
arrayEntry[10] = nullGuardToString(dataPolicy.getId());
- arrayEntry[11] = nullGuardToString(dataPolicy.getLtfsObjectNamingAllowed());
builder.add(arrayEntry);
}
diff --git a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetPhysicalPlacementWithFullDetailsView.java b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetPhysicalPlacementWithFullDetailsView.java
index a673df6..216597a 100644
--- a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetPhysicalPlacementWithFullDetailsView.java
+++ b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetPhysicalPlacementWithFullDetailsView.java
@@ -85,7 +85,7 @@ private String[][] formatBulkObjectList(final BulkObject obj) {
bulkObjectArray[3] = nullGuardToString(obj.getLength());
bulkObjectArray[4] = nullGuardToString(obj.getOffset());
bulkObjectArray[5] = nullGuardToString(obj.getLatest());
- bulkObjectArray[6] = nullGuardToString(obj.getVersion());
+ bulkObjectArray[6] = nullGuardToString(obj.getVersionId());
formatArray[0] = bulkObjectArray;
return formatArray;
diff --git a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetTapesView.java b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetTapesView.java
index 153a390..aaeaa22 100644
--- a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetTapesView.java
+++ b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/GetTapesView.java
@@ -79,7 +79,7 @@ protected String[][] formatTableContents() {
private String storageDomainName(final Tape tape) {
try {
- return getTapesResult.getResult().getStorageDomainIdNameMap().get(tape.getStorageDomainId());
+ return getTapesResult.getResult().getStorageDomainIdNameMap().get(tape.getStorageDomainMemberId());
} catch (final Throwable t) {
LOG.debug("Error getting storage domain name for tape.", t);
}
diff --git a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/VerifyBulkJobView.java b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/VerifyBulkJobView.java
index 3d7958d..1ad4292 100644
--- a/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/VerifyBulkJobView.java
+++ b/ds3_java_cli/src/main/java/com/spectralogic/ds3cli/views/cli/VerifyBulkJobView.java
@@ -59,7 +59,7 @@ protected String[][] formatTableContents() {
arrayEntry[0] = nullGuardToString(chunk);
arrayEntry[1] = nullGuard(bulkObject.getName());
arrayEntry[2] = nullGuardToString(bulkObject.getLength());
- arrayEntry[3] = nullGuardToString(bulkObject.getVersion());
+ arrayEntry[3] = nullGuardToString(bulkObject.getVersionId());
contents.add(arrayEntry);
}
}
diff --git a/ds3_java_cli/src/test/java/com/spectralogic/ds3cli/Ds3Cli_Test.java b/ds3_java_cli/src/test/java/com/spectralogic/ds3cli/Ds3Cli_Test.java
index 48a4e3b..22b65d4 100644
--- a/ds3_java_cli/src/test/java/com/spectralogic/ds3cli/Ds3Cli_Test.java
+++ b/ds3_java_cli/src/test/java/com/spectralogic/ds3cli/Ds3Cli_Test.java
@@ -38,6 +38,7 @@
import org.apache.commons.cli.MissingOptionException;
import org.apache.commons.cli.UnrecognizedOptionException;
import org.apache.commons.io.IOUtils;
+import org.hamcrest.CoreMatchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
@@ -57,6 +58,8 @@
import static com.spectralogic.ds3cli.util.Constants.DATE_FORMAT;
import static com.spectralogic.ds3client.utils.ResponseUtils.toImmutableIntList;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;
@@ -394,88 +397,99 @@ public void getBucketJson() throws Exception {
assertTrue(command instanceof GetBucket);
final View view = command.getView();
- final String expected =
- " \"Data\" : {\n" +
- " \"bucket\" : {\n" +
- " \"CreationDate\" : \"2016-11-18T15:48:08.000Z\",\n" +
- " \"DataPolicyId\" : \"8a5d5e56-8d54-4098-b790-6002730b3d96\",\n" +
- " \"Empty\" : null,\n" +
- " \"Id\" : \"07cbc080-16ae-46ea-a275-ec8cb27e178c\",\n" +
- " \"LastPreferredChunkSizeInBytes\" : 19004340787,\n" +
- " \"LogicalUsedCapacity\" : 1928234,\n" +
- " \"Name\" : \"mountain\",\n" +
- " \"UserId\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
- " },\n" +
- " \"result\" : [ {\n" +
- " \"etag\" : \"3d1bc5d88e795c5b23da7f812c073870\",\n" +
- " \"ETag\" : \"3d1bc5d88e795c5b23da7f812c073870\",\n" +
- " \"Key\" : \"YouDontKnowMe_295x166.jpg\",\n" +
- " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
- " \"Owner\" : {\n" +
- " \"DisplayName\" : \"jk\",\n" +
- " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
- " },\n" +
- " \"Size\" : 10634,\n" +
- " \"StorageClass\" : null\n" +
- " }, {\n" +
- " \"etag\" : \"ef751d03b7fe4fb2013be56c5a8da26e\",\n" +
- " \"ETag\" : \"ef751d03b7fe4fb2013be56c5a8da26e\",\n" +
- " \"Key\" : \"sky_bandana.jpg\",\n" +
- " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
- " \"Owner\" : {\n" +
- " \"DisplayName\" : \"jk\",\n" +
- " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
- " },\n" +
- " \"Size\" : 142164,\n" +
- " \"StorageClass\" : null\n" +
- " }, {\n" +
- " \"etag\" : \"a2750043425399804e83288f5f97d112\",\n" +
- " \"ETag\" : \"a2750043425399804e83288f5f97d112\",\n" +
- " \"Key\" : \"sky_point,web.jpg\",\n" +
- " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
- " \"Owner\" : {\n" +
- " \"DisplayName\" : \"jk\",\n" +
- " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
- " },\n" +
- " \"Size\" : 17120,\n" +
- " \"StorageClass\" : null\n" +
- " }, {\n" +
- " \"etag\" : \"71e93f1026d0362aa0b7dccedf031d8c\",\n" +
- " \"ETag\" : \"71e93f1026d0362aa0b7dccedf031d8c\",\n" +
- " \"Key\" : \"skylark,l5ct2.bmp\",\n" +
- " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
- " \"Owner\" : {\n" +
- " \"DisplayName\" : \"jk\",\n" +
- " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
- " },\n" +
- " \"Size\" : 921654,\n" +
- " \"StorageClass\" : null\n" +
- " }, {\n" +
- " \"etag\" : \"777fd3670853d4f197c52cfa6a21f773\",\n" +
- " \"ETag\" : \"777fd3670853d4f197c52cfa6a21f773\",\n" +
- " \"Key\" : \"skylark--car 001.jpg\",\n" +
- " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
- " \"Owner\" : {\n" +
- " \"DisplayName\" : \"jk\",\n" +
- " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
- " },\n" +
- " \"Size\" : 391998,\n" +
- " \"StorageClass\" : null\n" +
- " }, {\n" +
- " \"etag\" : \"6dc0c5e59418d651777c8432e13e9539\",\n" +
- " \"ETag\" : \"6dc0c5e59418d651777c8432e13e9539\",\n" +
- " \"Key\" : \"skylark004.jpg\",\n" +
- " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
- " \"Owner\" : {\n" +
- " \"DisplayName\" : \"jk\",\n" +
- " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
- " },\n" +
- " \"Size\" : 444664,\n" +
- " \"StorageClass\" : null\n" +
- " } ]\n" +
- " },\n" +
- " \"Status\" : \"OK\"\n" +
- "}";
+ final String expected = " \"Data\" : {\n" +
+ " \"bucket\" : {\n" +
+ " \"CreationDate\" : \"2016-11-18T15:48:08.000Z\",\n" +
+ " \"DataPolicyId\" : \"8a5d5e56-8d54-4098-b790-6002730b3d96\",\n" +
+ " \"Empty\" : null,\n" +
+ " \"Id\" : \"07cbc080-16ae-46ea-a275-ec8cb27e178c\",\n" +
+ " \"LastPreferredChunkSizeInBytes\" : 19004340787,\n" +
+ " \"LogicalUsedCapacity\" : 1928234,\n" +
+ " \"Name\" : \"mountain\",\n" +
+ " \"UserId\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
+ " },\n" +
+ " \"result\" : [ {\n" +
+ " \"etag\" : \"3d1bc5d88e795c5b23da7f812c073870\",\n" +
+ " \"ETag\" : \"3d1bc5d88e795c5b23da7f812c073870\",\n" +
+ " \"IsLatest\" : null,\n" +
+ " \"Key\" : \"YouDontKnowMe_295x166.jpg\",\n" +
+ " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
+ " \"Owner\" : {\n" +
+ " \"DisplayName\" : \"jk\",\n" +
+ " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
+ " },\n" +
+ " \"Size\" : 10634,\n" +
+ " \"StorageClass\" : null,\n" +
+ " \"VersionId\" : null\n" +
+ " }, {\n" +
+ " \"etag\" : \"ef751d03b7fe4fb2013be56c5a8da26e\",\n" +
+ " \"ETag\" : \"ef751d03b7fe4fb2013be56c5a8da26e\",\n" +
+ " \"IsLatest\" : null,\n" +
+ " \"Key\" : \"sky_bandana.jpg\",\n" +
+ " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
+ " \"Owner\" : {\n" +
+ " \"DisplayName\" : \"jk\",\n" +
+ " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
+ " },\n" +
+ " \"Size\" : 142164,\n" +
+ " \"StorageClass\" : null,\n" +
+ " \"VersionId\" : null\n" +
+ " }, {\n" +
+ " \"etag\" : \"a2750043425399804e83288f5f97d112\",\n" +
+ " \"ETag\" : \"a2750043425399804e83288f5f97d112\",\n" +
+ " \"IsLatest\" : null,\n" +
+ " \"Key\" : \"sky_point,web.jpg\",\n" +
+ " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
+ " \"Owner\" : {\n" +
+ " \"DisplayName\" : \"jk\",\n" +
+ " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
+ " },\n" +
+ " \"Size\" : 17120,\n" +
+ " \"StorageClass\" : null,\n" +
+ " \"VersionId\" : null\n" +
+ " }, {\n" +
+ " \"etag\" : \"71e93f1026d0362aa0b7dccedf031d8c\",\n" +
+ " \"ETag\" : \"71e93f1026d0362aa0b7dccedf031d8c\",\n" +
+ " \"IsLatest\" : null,\n" +
+ " \"Key\" : \"skylark,l5ct2.bmp\",\n" +
+ " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
+ " \"Owner\" : {\n" +
+ " \"DisplayName\" : \"jk\",\n" +
+ " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
+ " },\n" +
+ " \"Size\" : 921654,\n" +
+ " \"StorageClass\" : null,\n" +
+ " \"VersionId\" : null\n" +
+ " }, {\n" +
+ " \"etag\" : \"777fd3670853d4f197c52cfa6a21f773\",\n" +
+ " \"ETag\" : \"777fd3670853d4f197c52cfa6a21f773\",\n" +
+ " \"IsLatest\" : null,\n" +
+ " \"Key\" : \"skylark--car 001.jpg\",\n" +
+ " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
+ " \"Owner\" : {\n" +
+ " \"DisplayName\" : \"jk\",\n" +
+ " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
+ " },\n" +
+ " \"Size\" : 391998,\n" +
+ " \"StorageClass\" : null,\n" +
+ " \"VersionId\" : null\n" +
+ " }, {\n" +
+ " \"etag\" : \"6dc0c5e59418d651777c8432e13e9539\",\n" +
+ " \"ETag\" : \"6dc0c5e59418d651777c8432e13e9539\",\n" +
+ " \"IsLatest\" : null,\n" +
+ " \"Key\" : \"skylark004.jpg\",\n" +
+ " \"LastModified\" : \"2016-11-18T15:48:10.000Z\",\n" +
+ " \"Owner\" : {\n" +
+ " \"DisplayName\" : \"jk\",\n" +
+ " \"ID\" : \"5079e312-bcff-43c7-bd54-d8148af0a515\"\n" +
+ " },\n" +
+ " \"Size\" : 444664,\n" +
+ " \"StorageClass\" : null,\n" +
+ " \"VersionId\" : null\n" +
+ " } ]\n" +
+ " },\n" +
+ " \"Status\" : \"OK\"\n" +
+ "}";
final String packet = "3d1bc5d88e795c5b23da7f812c073870YouDontKnowMe_295x166.jpg2016-11-18T15:48:10.000Zjk5079e312-bcff-43c7-bd54-d8148af0a51510634ef751d03b7fe4fb2013be56c5a8da26esky_bandana.jpg2016-11-18T15:48:10.000Zjk5079e312-bcff-43c7-bd54-d8148af0a515142164a2750043425399804e83288f5f97d112sky_point,web.jpg2016-11-18T15:48:10.000Zjk5079e312-bcff-43c7-bd54-d8148af0a5151712071e93f1026d0362aa0b7dccedf031d8cskylark,l5ct2.bmp2016-11-18T15:48:10.000Zjk5079e312-bcff-43c7-bd54-d8148af0a515921654777fd3670853d4f197c52cfa6a21f773skylark--car 001.jpg2016-11-18T15:48:10.000Zjk5079e312-bcff-43c7-bd54-d8148af0a5153919986dc0c5e59418d651777c8432e13e9539skylark004.jpg2016-11-18T15:48:10.000Zjk5079e312-bcff-43c7-bd54-d8148af0a5154446642016-11-18T15:48:08.000Zfalse1000mountain";
@@ -492,7 +506,7 @@ public void getBucketJson() throws Exception {
final GetBucketResult getBucketResult = new GetBucketResult(bucket, objects.getObjects());
final String result = view.render(getBucketResult);
- assertTrue(result.endsWith(expected));
+ assert(result.endsWith(expected));
}
@Test
@@ -747,7 +761,7 @@ public void getCompletedJob() throws Exception {
final View view = command.getView();
final String expected = "JobId: " + jobId + " | Name: Good Job | Status: COMPLETED | Bucket: bucket | Type: GET | Priority: HIGH | User Name: spectra | Creation Date: 2015-09-28T17:30:43.000Z | Total Size: 32 | Total Transferred: 0";
- final String packet = "";
+ final String packet = "";
final MasterObjectList objects = XmlOutput.fromXml(packet, MasterObjectList.class);
final GetJobResult getJobResult = new GetJobResult(objects);
@@ -772,7 +786,7 @@ public void getCompletedJobJson() throws Exception {
" \"cachedSizeInBytes\" : 0,\n" +
" \"chunkClientProcessingOrderGuarantee\" : \"NONE\",\n" +
" \"completedSizeInBytes\" : 0,\n" +
- " \"entirelyInCache\" : false,\n" +
+ " \"entirelyInCache\" : null,\n" +
" \"jobId\" : \"aa5df0cc-b03a-4cb9-b69d-56e7367e917f\",\n" +
" \"naked\" : false,\n" +
" \"name\" : null,\n" +
@@ -790,7 +804,7 @@ public void getCompletedJobJson() throws Exception {
" \"Status\" : \"OK\"\n" +
"}";
- final String packet = "";
+ final String packet = "";
final MasterObjectList objects = XmlOutput.fromXml(packet, MasterObjectList.class);
final GetJobResult getJobResult = new GetJobResult(objects);
@@ -1572,10 +1586,10 @@ public void testGetPhysicalPlacementOnTape() throws Exception {
tape1.setPartitionId(tape1PartitionId);
tape1.setState(TapeState.PENDING_INSPECTION);
final UUID tape1StorageDomainId = UUID.randomUUID();
- tape1.setStorageDomainId(tape1StorageDomainId);
+ tape1.setStorageDomainMemberId(tape1StorageDomainId);
tape1.setTakeOwnershipPending(false);
tape1.setTotalRawCapacity(20000L);
- tape1.setType("LTO6");
+ tape1.setType(TapeDriveType.LTO6.toString());
tape1.setWriteProtected(false);
tape1.setEjectLabel("Tape1EjectLabel");
tape1.setEjectLocation("Tape1EjectLocation");
@@ -1591,10 +1605,10 @@ public void testGetPhysicalPlacementOnTape() throws Exception {
tape2.setPartitionId(tape2PartitionId);
tape2.setState(TapeState.PENDING_INSPECTION);
final UUID tape2StorageDomainId = UUID.randomUUID();
- tape2.setStorageDomainId(tape2StorageDomainId);
+ tape2.setStorageDomainMemberId(tape2StorageDomainId);
tape2.setTakeOwnershipPending(false);
tape2.setTotalRawCapacity(20000L);
- tape2.setType("LTO7");
+ tape2.setType(TapeDriveType.LTO7.toString());
tape2.setWriteProtected(false);
tape2.setEjectLabel("Tape2EjectLabel");
tape2.setEjectLocation("Tape2EjectLocation");
@@ -1618,8 +1632,7 @@ public void testGetPhysicalPlacementOnTape() throws Exception {
final String result = view.render(new GetPhysicalPlacementWithFullDetailsResult(bulkObjectList));
assertTrue(result.contains("| Object Name | ID | In Cache | Length | Offset | Latest | Version |"));
- assertTrue(result.contains("| testObject | | Unknown | 1024 | 0 | false | 0 |"));
-
+ assertTrue(result.contains("| testObject | | Unknown | 1024 | 0 | false | N/A |"));
assertTrue(result.contains("| Tape Bar Code | State | Type | Description | Eject Label | Eject Location |"));
assertTrue(result.contains("| 121557L6 | PENDING_INSPECTION | LTO6 | N/A | Tape1EjectLabel | Tape1EjectLocation |"));
assertTrue(result.contains("| 421555L7 | PENDING_INSPECTION | LTO7 | N/A | Tape2EjectLabel | Tape2EjectLocation |"));
@@ -1640,7 +1653,7 @@ public void testGetPhysicalPlacementOnPool() throws Exception {
pool1.setReservedCapacity(0L);
pool1.setState(PoolState.NORMAL);
final UUID pool1StorageDomainId = UUID.randomUUID();
- pool1.setStorageDomainId(pool1StorageDomainId);
+ pool1.setStorageDomainMemberId(pool1StorageDomainId);
pool1.setTotalCapacity(420000L);
pool1.setType(PoolType.NEARLINE);
pool1.setUsedCapacity(6L*7L);
@@ -1658,7 +1671,7 @@ public void testGetPhysicalPlacementOnPool() throws Exception {
pool2.setReservedCapacity(0L);
pool2.setState(PoolState.NORMAL);
final UUID pool2StorageDomainId = UUID.randomUUID();
- pool2.setStorageDomainId(pool2StorageDomainId);
+ pool2.setStorageDomainMemberId(pool2StorageDomainId);
pool2.setTotalCapacity(420000L);
pool2.setType(PoolType.NEARLINE);
pool2.setUsedCapacity(6L*7L);
@@ -1682,7 +1695,7 @@ public void testGetPhysicalPlacementOnPool() throws Exception {
final String result = view.render(new GetPhysicalPlacementWithFullDetailsResult(bulkObjectList));
assertTrue(result.contains("| Object Name | ID | In Cache | Length | Offset | Latest | Version |"));
- assertTrue(result.contains("| testObject | | Unknown | 1024 | 0 | false | 0 |"));
+ assertTrue(result.contains("| testObject | | Unknown | 1024 | 0 | false | N/A |"));
assertTrue(result.contains("| Pool Name | ID | Bucket ID | State | Health | Type | Partition ID |"));
assertTrue(result.contains("| pool1 | " + pool1Id.toString() + " | | NORMAL | OK | NEARLINE | |"));
@@ -1691,17 +1704,19 @@ public void testGetPhysicalPlacementOnPool() throws Exception {
@Test
public void testGetPhysicalPlacementOnCloud() throws Exception {
+ final String uuid = "a231d751-b1ae-4569-b59c-230892363d7f";
final Arguments args = new Arguments(new String[]{"ds3_java_cli", "-e", "localhost:8080", "-k", "key!", "-a", "access", "-c", "get_physical_placement", "-b", "bothclouds", "-o", "VBoxSVC.log"});
final CliCommand command = CliCommandFactory.getCommandExecutor(args.getCommand());
command.init(args);
assertTrue(command instanceof GetPhysicalPlacement);
final View view = command.getView();
- final String expected = "+-------------+--------------------------------------+----------+--------+--------+--------+---------+\n" +
- "| Object Name | ID | In Cache | Length | Offset | Latest | Version |\n" +
- "+-------------+--------------------------------------+----------+--------+--------+--------+---------+\n" +
- "| VBoxSVC.log | 809e1e66-13e7-4441-8eda-10b1ddb528ca | false | 8611 | 0 | true | 1 |\n" +
- "+-------------+--------------------------------------+----------+--------+--------+--------+---------+\n" +
+ final String expected =
+ "+-------------+--------------------------------------+----------+--------+--------+--------+--------------------------------------+\n" +
+ "| Object Name | ID | In Cache | Length | Offset | Latest | Version |\n" +
+ "+-------------+--------------------------------------+----------+--------+--------+--------+--------------------------------------+\n" +
+ "| VBoxSVC.log | 809e1e66-13e7-4441-8eda-10b1ddb528ca | false | 8611 | 0 | true | a231d751-b1ae-4569-b59c-230892363d7f |\n" +
+ "+-------------+--------------------------------------+----------+--------+--------+--------+--------------------------------------+\n" +
"+------------------------------------+--------------------------------------+-----------+--------+--------+----------+--------------------------------------+\n" +
"| Pool Name | ID | Bucket ID | State | Health | Type | Partition ID |\n" +
"+------------------------------------+--------------------------------------+-----------+--------+--------+----------+--------------------------------------+\n" +
@@ -1719,7 +1734,7 @@ public void testGetPhysicalPlacementOnCloud() throws Exception {
"+-------------+--------+--------------------------------------+----------+-----------+--------------------+\n";
final String packet = "" +
- "