Search in sources :

Example 1 with ListGroupMembersResponse

use of com.google.monitoring.v3.ListGroupMembersResponse in project google-cloud-java by GoogleCloudPlatform.

the class GroupServiceClientTest method listGroupMembersTest.

@Test
@SuppressWarnings("all")
public void listGroupMembersTest() {
    String nextPageToken = "";
    int totalSize = -705419236;
    MonitoredResource membersElement = MonitoredResource.newBuilder().build();
    List<MonitoredResource> members = Arrays.asList(membersElement);
    ListGroupMembersResponse expectedResponse = ListGroupMembersResponse.newBuilder().setNextPageToken(nextPageToken).setTotalSize(totalSize).addAllMembers(members).build();
    mockGroupService.addResponse(expectedResponse);
    GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
    ListGroupMembersPagedResponse pagedListResponse = client.listGroupMembers(name);
    List<MonitoredResource> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getMembersList().get(0), resources.get(0));
    List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListGroupMembersRequest actualRequest = (ListGroupMembersRequest) actualRequests.get(0);
    Assert.assertEquals(name, actualRequest.getNameAsGroupName());
}
Also used : GroupName(com.google.monitoring.v3.GroupName) ListGroupMembersResponse(com.google.monitoring.v3.ListGroupMembersResponse) ListGroupMembersRequest(com.google.monitoring.v3.ListGroupMembersRequest) MonitoredResource(com.google.api.MonitoredResource) ListGroupMembersPagedResponse(com.google.cloud.monitoring.spi.v3.PagedResponseWrappers.ListGroupMembersPagedResponse) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Aggregations

MonitoredResource (com.google.api.MonitoredResource)1 ListGroupMembersPagedResponse (com.google.cloud.monitoring.spi.v3.PagedResponseWrappers.ListGroupMembersPagedResponse)1 GroupName (com.google.monitoring.v3.GroupName)1 ListGroupMembersRequest (com.google.monitoring.v3.ListGroupMembersRequest)1 ListGroupMembersResponse (com.google.monitoring.v3.ListGroupMembersResponse)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 Test (org.junit.Test)1