Search in sources :

Example 1 with UpdateServiceLevelObjectiveRequest

use of com.google.monitoring.v3.UpdateServiceLevelObjectiveRequest in project java-monitoring by googleapis.

the class ServiceMonitoringServiceClientTest method updateServiceLevelObjectiveTest.

@Test
public void updateServiceLevelObjectiveTest() 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);
    ServiceLevelObjective serviceLevelObjective = ServiceLevelObjective.newBuilder().build();
    ServiceLevelObjective actualResponse = client.updateServiceLevelObjective(serviceLevelObjective);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockServiceMonitoringService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateServiceLevelObjectiveRequest actualRequest = ((UpdateServiceLevelObjectiveRequest) actualRequests.get(0));
    Assert.assertEquals(serviceLevelObjective, actualRequest.getServiceLevelObjective());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ServiceLevelObjective(com.google.monitoring.v3.ServiceLevelObjective) HashMap(java.util.HashMap) UpdateServiceLevelObjectiveRequest(com.google.monitoring.v3.UpdateServiceLevelObjectiveRequest) Test(org.junit.Test)

Aggregations

ServiceLevelObjective (com.google.monitoring.v3.ServiceLevelObjective)1 UpdateServiceLevelObjectiveRequest (com.google.monitoring.v3.UpdateServiceLevelObjectiveRequest)1 AbstractMessage (com.google.protobuf.AbstractMessage)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1