Skip to content

Commit

Permalink
add getBlobProperties perf test
Browse files Browse the repository at this point in the history
  • Loading branch information
samvaity committed Dec 6, 2021
1 parent 6a46c09 commit 535456b
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
public class App {
public static void main(String[] args) {
PerfStressProgram.run(new Class<?>[]{
UploadFromFileTest.class
UploadFromFileTest.class,
GetBlobProperties.class
}, args);
}
}
Original file line number Diff line number Diff line change
@@ -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<PerfStressOptions> {
public GetBlobProperties(PerfStressOptions options) {
super(options);
}

@Override
public Mono<Void> globalSetupAsync() {
return super.globalSetupAsync();
}

@Override
public Mono<Void> 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<Void> runAsync() {
String blobName = "perfblobtest-" + UUID.randomUUID();

BlobServiceAsyncClient storageAsyncClient = blobServiceClientBuilder.buildAsyncClient();

BlobContainerAsyncClient
blobContainerAsyncClient = storageAsyncClient.createBlobContainer("perfupload" + UUID.randomUUID()).block();
return blobContainerAsyncClient.getBlobAsyncClient(blobName)
.getProperties()
.then();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -48,9 +46,9 @@ public Mono<Void> 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));

}
}

0 comments on commit 535456b

Please sign in to comment.