use of com.google.monitoring.v3.GetServiceLevelObjectiveRequest in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClientTest method getServiceLevelObjectiveTest.
@Test
public void getServiceLevelObjectiveTest() throws Exception {
ServiceLevelObjective expectedResponse = ServiceLevelObjective.newBuilder().setName(ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]").toString()).setDisplayName("displayName1714148973").setServiceLevelIndicator(ServiceLevelIndicator.newBuilder().build()).setGoal(3178259).putAllUserLabels(new HashMap<String, String>()).build();
mockServiceMonitoringService.addResponse(expectedResponse);
ServiceLevelObjectiveName name = ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
ServiceLevelObjective actualResponse = client.getServiceLevelObjective(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockServiceMonitoringService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetServiceLevelObjectiveRequest actualRequest = ((GetServiceLevelObjectiveRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.GetServiceLevelObjectiveRequest in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClientTest method getServiceLevelObjectiveTest2.
@Test
public void getServiceLevelObjectiveTest2() throws Exception {
ServiceLevelObjective expectedResponse = ServiceLevelObjective.newBuilder().setName(ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]").toString()).setDisplayName("displayName1714148973").setServiceLevelIndicator(ServiceLevelIndicator.newBuilder().build()).setGoal(3178259).putAllUserLabels(new HashMap<String, String>()).build();
mockServiceMonitoringService.addResponse(expectedResponse);
String name = "name3373707";
ServiceLevelObjective actualResponse = client.getServiceLevelObjective(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockServiceMonitoringService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetServiceLevelObjectiveRequest actualRequest = ((GetServiceLevelObjectiveRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations