use of org.apache.commons.cli2.Group in project java-monitoring by googleapis.
the class GroupServiceClientTest method createGroupExceptionTest4.
@Test
public void createGroupExceptionTest4() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
String name = "name3373707";
Group group = Group.newBuilder().build();
client.createGroup(name, group);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of org.apache.commons.cli2.Group in project java-monitoring by googleapis.
the class GroupServiceClientTest method createGroupTest4.
@Test
public void createGroupTest4() throws Exception {
Group expectedResponse = Group.newBuilder().setName(GroupName.ofProjectGroupName("[PROJECT]", "[GROUP]").toString()).setDisplayName("displayName1714148973").setParentName("parentName-244870571").setFilter("filter-1274492040").setIsCluster(true).build();
mockGroupService.addResponse(expectedResponse);
String name = "name3373707";
Group group = Group.newBuilder().build();
Group actualResponse = client.createGroup(name, group);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateGroupRequest actualRequest = ((CreateGroupRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertEquals(group, actualRequest.getGroup());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of org.apache.commons.cli2.Group in project java-monitoring by googleapis.
the class GroupServiceClientTest method getGroupTest.
@Test
public void getGroupTest() throws Exception {
Group expectedResponse = Group.newBuilder().setName(GroupName.ofProjectGroupName("[PROJECT]", "[GROUP]").toString()).setDisplayName("displayName1714148973").setParentName("parentName-244870571").setFilter("filter-1274492040").setIsCluster(true).build();
mockGroupService.addResponse(expectedResponse);
GroupName name = GroupName.ofProjectGroupName("[PROJECT]", "[GROUP]");
Group actualResponse = client.getGroup(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = ((GetGroupRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of org.apache.commons.cli2.Group in project java-monitoring by googleapis.
the class GroupServiceClientTest method getGroupTest2.
@Test
public void getGroupTest2() throws Exception {
Group expectedResponse = Group.newBuilder().setName(GroupName.ofProjectGroupName("[PROJECT]", "[GROUP]").toString()).setDisplayName("displayName1714148973").setParentName("parentName-244870571").setFilter("filter-1274492040").setIsCluster(true).build();
mockGroupService.addResponse(expectedResponse);
String name = "name3373707";
Group actualResponse = client.getGroup(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = ((GetGroupRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of org.apache.commons.cli2.Group in project java-monitoring by googleapis.
the class GroupServiceClientTest method createGroupExceptionTest2.
@Test
public void createGroupExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockGroupService.addException(exception);
try {
OrganizationName name = OrganizationName.of("[ORGANIZATION]");
Group group = Group.newBuilder().build();
client.createGroup(name, group);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations