jamesnetherton commented on a change in pull request #3568: URL: https://github.com/apache/camel-quarkus/pull/3568#discussion_r812214874
########## File path: integration-test-groups/azure/azure-storage-blob/src/test/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobTest.java ########## @@ -63,47 +87,443 @@ private static BlobContainerClient blobContainer() { .credential(credentials) .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS).setPrettyPrintBody(true)) .buildClient(); - BlobContainerClient blobContainer = client - .getBlobContainerClient(config.getValue("azure.blob.container.name", String.class)); - return blobContainer; + + String containerName = config.getValue("azure.blob.container.name", String.class); + return client.getBlobContainerClient(containerName); } @Test public void crud() { - String blobContent = "Hello Camel Quarkus Azure Blob"; - - // Create - RestAssured.given() - .contentType(ContentType.TEXT) - .body(blobContent) - .post("/azure-storage-blob/blob/create") - .then() - .statusCode(201); - - // Read - RestAssured.get("/azure-storage-blob/blob/read") - .then() - .statusCode(200) - .body(is(blobContent)); - - // Update - String updatedContent = blobContent + " updated"; - RestAssured.given() - .contentType(ContentType.TEXT) - .body(updatedContent) - .patch("/azure-storage-blob/blob/update") - .then() - .statusCode(200); - - RestAssured.get("/azure-storage-blob/blob/read") - .then() - .statusCode(200) - .body(is(updatedContent)); - - // Delete - RestAssured.delete("/azure-storage-blob/blob/delete") - .then() - .statusCode(204); + try { + // Create + RestAssured.given() + .contentType(ContentType.TEXT) + .body(BLOB_CONTENT) + .post("/azure-storage-blob/blob/create") + .then() + .statusCode(201); + + // Read + RestAssured.get("/azure-storage-blob/blob/read") + .then() + .statusCode(200) + .body(is(BLOB_CONTENT)); + + // List + RestAssured.get("/azure-storage-blob/blob/list") + .then() + .statusCode(200) + .body("blobs[0].name", is(AzureStorageBlobRoutes.BLOB_NAME)); + + // Update + String updatedContent = BLOB_CONTENT + " updated"; + RestAssured.given() + .contentType(ContentType.TEXT) + .body(updatedContent) + .patch("/azure-storage-blob/blob/update") + .then() + .statusCode(200); + + RestAssured.get("/azure-storage-blob/blob/read") + .then() + .statusCode(200) + .body(is(updatedContent)); + } finally { + // Delete + RestAssured.delete("/azure-storage-blob/blob/delete") + .then() + .statusCode(204); + } + } + + @Test + public void download() throws IOException { + Path path = null; + try { + // Create + RestAssured.given() + .contentType(ContentType.TEXT) + .body(BLOB_CONTENT) + .post("/azure-storage-blob/blob/create") + .then() + .statusCode(201); + + // Download file + String downloadPath = RestAssured.get("/azure-storage-blob/blob/download") + .then() + .statusCode(200) + .body(endsWith("target/test")) Review comment: Yeah, good spot. It would fail because the REST endpoint returns the absolute file path, which on Windows will naturally have different separators. So it'll need 'nixifying' before being returned and the test assertion can remain as-is. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org