use of com.azure.resourcemanager.resources.models.ResourceGroup in project terra-cloud-resource-lib by DataBiosphere.
the class AzureResponseLoggerTest method testRecordEvent.
@Test
public void testRecordEvent() {
// Send an Azure request to list resource groups
List<ResourceGroup> resourceGroups = setUpResourceManager().resourceGroups().list().stream().collect(Collectors.toList());
// Verify AzureResponseLogger was invoked
verify(mockOperationAnnotator).recordOperation(operationDataCaptor.capture());
// Verify OperationData values
OperationData operationData = operationDataCaptor.getValue();
assertThat(operationData.duration().toMillis(), Matchers.greaterThan(0L));
assertTrue(operationData.tryCount().isPresent());
assertEquals(OptionalInt.of(200), operationData.httpStatusCode());
assertEquals(ResourceManagerOperation.AZURE_RESOURCE_MANAGER_UNKNOWN_OPERATION, operationData.cloudOperation());
assertThat(operationData.requestData().entrySet(), Matchers.hasItem(Map.entry("requestMethod", new JsonPrimitive("GET"))));
assertThat(operationData.requestData().keySet(), Matchers.hasItem("requestUrl"));
// For good measure verify the Azure response contains our test resource group
assertThat(resourceGroups.stream().map(ResourceGroup::name).collect(Collectors.toList()), Matchers.hasItem(AzureIntegrationUtils.DEFAULT_AZURE_RESOURCE_GROUP));
}
Aggregations