diff --git a/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/App.java b/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/App.java index 07a8574bf5a23..098edf1b5d0ff 100644 --- a/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/App.java +++ b/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/App.java @@ -18,7 +18,8 @@ public class App { public static void main(String[] args) { PerfStressProgram.run(new Class[]{ - UploadFromFileTest.class + UploadFromFileTest.class, + GetBlobProperties.class }, args); } } diff --git a/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/GetBlobProperties.java b/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/GetBlobProperties.java new file mode 100644 index 0000000000000..d8210d76ef204 --- /dev/null +++ b/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/GetBlobProperties.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.perf; + +import com.azure.core.perf.core.ServiceTest; +import com.azure.perf.test.core.PerfStressOptions; +import com.azure.storage.blob.BlobContainerAsyncClient; +import com.azure.storage.blob.BlobContainerClient; +import com.azure.storage.blob.BlobServiceAsyncClient; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.models.BlobProperties; +import reactor.core.publisher.Mono; + +import java.util.UUID; + +public class GetBlobProperties extends ServiceTest { + public GetBlobProperties(PerfStressOptions options) { + super(options); + } + + @Override + public Mono globalSetupAsync() { + return super.globalSetupAsync(); + } + + @Override + public Mono globalCleanupAsync() { + return super.globalCleanupAsync(); + } + + @Override + public void run() { + String blobName = "perfblobtest-" + UUID.randomUUID(); + + BlobServiceClient storageClient = blobServiceClientBuilder.buildClient(); + + BlobContainerClient blobContainerClient = storageClient.createBlobContainer("perfupload" + UUID.randomUUID()); + BlobProperties blobProperties = blobContainerClient.getBlobClient(blobName).getProperties(); + assert blobProperties.getCreationTime() != null; + assert blobProperties.getExpiresOn() != null; + } + + @Override + public Mono runAsync() { + String blobName = "perfblobtest-" + UUID.randomUUID(); + + BlobServiceAsyncClient storageAsyncClient = blobServiceClientBuilder.buildAsyncClient(); + + BlobContainerAsyncClient + blobContainerAsyncClient = storageAsyncClient.createBlobContainer("perfupload" + UUID.randomUUID()).block(); + return blobContainerAsyncClient.getBlobAsyncClient(blobName) + .getProperties() + .then(); + } +} diff --git a/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/UploadFromFileTest.java b/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/UploadFromFileTest.java index c5c68ca908fed..13c2ca5254233 100644 --- a/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/UploadFromFileTest.java +++ b/sdk/core/azure-core-perf/src/main/java/com/azure/core/perf/UploadFromFileTest.java @@ -5,9 +5,7 @@ import com.azure.core.perf.core.ServiceTest; import com.azure.perf.test.core.PerfStressOptions; -import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.BlobClient; -import com.azure.storage.blob.BlobContainerAsyncClient; import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.BlobServiceAsyncClient; import com.azure.storage.blob.BlobServiceClient; @@ -48,9 +46,9 @@ public Mono runAsync() { BlobServiceAsyncClient storageAsyncClient = blobServiceClientBuilder.buildAsyncClient(); - BlobContainerAsyncClient - blobContainerAsyncClient = storageAsyncClient.createBlobContainer("perfupload" + UUID.randomUUID()).block(); - BlobAsyncClient blobAsyncClient = blobContainerAsyncClient.getBlobAsyncClient(blobName); - return blobAsyncClient.uploadFromFile(filePath, true); + return storageAsyncClient.createBlobContainer("perfupload" + UUID.randomUUID()) + .flatMap(blobContainerAsyncClient -> blobContainerAsyncClient.getBlobAsyncClient(blobName) + .uploadFromFile(filePath, true)); + } }