Search in sources :

Example 1 with BlobServiceProperties

use of com.azure.storage.blob.models.BlobServiceProperties in project vividus by vividus-framework.

the class BlobStorageStepsTests method shouldRetrieveBlobServiceProperties.

@Test
void shouldRetrieveBlobServiceProperties() {
    runWithStorageClient((steps, client) -> {
        BlobServiceProperties properties = mock(BlobServiceProperties.class);
        when(client.getProperties()).thenReturn(properties);
        String propertiesAsJson = "{\"blob-storage\":\"properties\"}";
        when(jsonUtils.toJson(properties)).thenReturn(propertiesAsJson);
        steps.retrieveBlobServiceProperties(KEY, SCOPES, VARIABLE);
        verify(variableContext).putVariable(SCOPES, VARIABLE, propertiesAsJson);
    });
}
Also used : BlobServiceProperties(com.azure.storage.blob.models.BlobServiceProperties) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with BlobServiceProperties

use of com.azure.storage.blob.models.BlobServiceProperties in project vividus by vividus-framework.

the class BlobStorageSteps method retrieveBlobServiceProperties.

/**
 * Retrieves the properties of a storage account’s Blob service and saves them as JSON to a variable.
 * For more information, see the
 * <a href="https://docs.microsoft.com/rest/api/storageservices/get-blob-service-properties">Azure Docs</a>.
 *
 * @param storageAccountKey The key to Storage Account endpoint.
 * @param scopes            The set (comma separated list of scopes e.g.: STORY, NEXT_BATCHES) of the variable
 *                          scopes.<br>
 *                          <i>Available scopes:</i>
 *                          <ul>
 *                          <li><b>STEP</b> - the variable will be available only within the step,
 *                          <li><b>SCENARIO</b> - the variable will be available only within the scenario,
 *                          <li><b>STORY</b> - the variable will be available within the whole story,
 *                          <li><b>NEXT_BATCHES</b> - the variable will be available starting from next batch
 *                          </ul>
 * @param variableName      The variable name to store the blob service properties.
 */
@When("I retrieve blob service properties of storage account `$storageAccountKey` and save them to $scopes variable" + " `$variableName`")
public void retrieveBlobServiceProperties(String storageAccountKey, Set<VariableScope> scopes, String variableName) {
    BlobServiceProperties properties = createBlobStorageClient(storageAccountKey).getProperties();
    saveJsonVariable(scopes, variableName, properties);
}
Also used : BlobServiceProperties(com.azure.storage.blob.models.BlobServiceProperties) When(org.jbehave.core.annotations.When)

Aggregations

BlobServiceProperties (com.azure.storage.blob.models.BlobServiceProperties)2 When (org.jbehave.core.annotations.When)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1