use of com.google.devtools.clouderrorreporting.v1beta1.GroupName in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method listGroupMembersExceptionTest.
@Test
@SuppressWarnings("all")
public void listGroupMembersExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
client.listGroupMembers(name);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of com.google.devtools.clouderrorreporting.v1beta1.GroupName in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method getGroupTest.
@Test
@SuppressWarnings("all")
public void getGroupTest() {
GroupName name2 = GroupName.create("[PROJECT]", "[GROUP]");
String displayName = "displayName1615086568";
GroupName parentName = GroupName.create("[PROJECT]", "[GROUP]");
String filter = "filter-1274492040";
boolean isCluster = false;
Group expectedResponse = Group.newBuilder().setNameWithGroupName(name2).setDisplayName(displayName).setParentNameWithGroupName(parentName).setFilter(filter).setIsCluster(isCluster).build();
mockGroupService.addResponse(expectedResponse);
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
Group actualResponse = client.getGroup(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0);
Assert.assertEquals(name, actualRequest.getNameAsGroupName());
}
use of com.google.devtools.clouderrorreporting.v1beta1.GroupName 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());
}
use of com.google.devtools.clouderrorreporting.v1beta1.GroupName in project google-cloud-java by GoogleCloudPlatform.
the class GroupServiceClientTest method deleteGroupTest.
@Test
@SuppressWarnings("all")
public void deleteGroupTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockGroupService.addResponse(expectedResponse);
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
client.deleteGroup(name);
List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteGroupRequest actualRequest = (DeleteGroupRequest) actualRequests.get(0);
Assert.assertEquals(name, actualRequest.getNameAsGroupName());
}
use of com.google.devtools.clouderrorreporting.v1beta1.GroupName in project google-cloud-java by GoogleCloudPlatform.
the class ErrorGroupServiceClientTest method getGroupTest.
@Test
@SuppressWarnings("all")
public void getGroupTest() {
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
String groupId = "groupId506361563";
ErrorGroup expectedResponse = ErrorGroup.newBuilder().setNameWithGroupName(name).setGroupId(groupId).build();
mockErrorGroupService.addResponse(expectedResponse);
GroupName groupName = GroupName.create("[PROJECT]", "[GROUP]");
ErrorGroup actualResponse = client.getGroup(groupName);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockErrorGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0);
Assert.assertEquals(groupName, actualRequest.getGroupNameAsGroupName());
}
Aggregations