Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
allenaverbukh committed Jan 30, 2025
1 parent d1a38f4 commit a6f1d10
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public S3BatchDeleteHandler(DeleteBlobHandler deleteBlobHandler, FrontendMetrics
this.deleteBlobHandler = deleteBlobHandler;
this.metrics = frontendMetrics;
this.xmlMapper = new XmlMapper();
this.xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
}

/**
Expand Down Expand Up @@ -105,7 +106,7 @@ private Callback<Long> parseRequestBodyAndDeleteCallback(RetainingAsyncWritableC
}

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
RequestPath requestPath = (RequestPath) restRequest.getArgs().get(InternalKeys.REQUEST_PATH)
RequestPath requestPath = (RequestPath) restRequest.getArgs().get(InternalKeys.REQUEST_PATH);

// create objects for processing the request
ConcurrentLinkedQueue<S3MessagePayload.S3ErrorObject> errors = new ConcurrentLinkedQueue<>();
Expand Down Expand Up @@ -142,9 +143,8 @@ else if (exception instanceof RestServiceException) {
CompletableFuture.allOf(deleteFutures.toArray(new CompletableFuture[0]))
.whenComplete((result, exception) -> {
try {
// Add XML declaration at the top
// construct and serialize response
S3MessagePayload.DeleteResult response = new S3MessagePayload.DeleteResult();
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
response.setDeleted(new ArrayList<>(deleted));
response.setErrors(new ArrayList<>(errors));
xmlMapper.writeValue(outputStream, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public S3DeleteHandlerTest() throws Exception {
@Test
public void deleteObjectTest() throws Exception {
// 1. Delete the object
String uri = String.format("/s3/%s/%s/%s", account.getName(), container.getName(), "hello2");
String uri = String.format("/s3/%s/%s/%s", account.getName(), container.getName(), KEY_NAME);
RestRequest request =
FrontendRestRequestServiceTest.createRestRequest(RestMethod.DELETE, uri, new JSONObject(), null);
RestResponseChannel restResponseChannel = new MockRestResponseChannel();
Expand Down Expand Up @@ -120,7 +120,7 @@ private void setup() throws Exception {
}

private void putABlob() throws Exception {
String requestPath = String.format("/named/%s/%s/%s", account.getName(), container.getName(), "hello");
String requestPath = String.format("/named/%s/%s/%s", account.getName(), container.getName(), KEY_NAME);
JSONObject headers = new JSONObject();
FrontendRestRequestServiceTest.setAmbryHeadersForPut(headers, TestUtils.TTL_SECS, container.isCacheable(),
"test-app", CONTENT_TYPE, "tester", null, null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Object setArg(String key, Object value) {
}

@Override
public void removeArg(String key) { restRequest.removeArg(key); }
public void removeArg(String key) { map.remove(key); }

@Override
public SSLSession getSSLSession() {
Expand Down

0 comments on commit a6f1d10

Please sign in to comment.