Search in sources :

Example 1 with Group

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.
    }
}
Also used : Group(com.google.monitoring.v3.Group) InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) Test(org.junit.Test)

Example 2 with Group

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()));
}
Also used : Group(com.google.monitoring.v3.Group) AbstractMessage(com.google.protobuf.AbstractMessage) CreateGroupRequest(com.google.monitoring.v3.CreateGroupRequest) Test(org.junit.Test)

Example 3 with Group

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()));
}
Also used : GroupName(com.google.monitoring.v3.GroupName) Group(com.google.monitoring.v3.Group) AbstractMessage(com.google.protobuf.AbstractMessage) GetGroupRequest(com.google.monitoring.v3.GetGroupRequest) Test(org.junit.Test)

Example 4 with Group

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()));
}
Also used : Group(com.google.monitoring.v3.Group) AbstractMessage(com.google.protobuf.AbstractMessage) GetGroupRequest(com.google.monitoring.v3.GetGroupRequest) Test(org.junit.Test)

Example 5 with Group

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.
    }
}
Also used : OrganizationName(com.google.monitoring.v3.OrganizationName) Group(com.google.monitoring.v3.Group) InvalidArgumentException(com.google.api.gax.rpc.InvalidArgumentException) StatusRuntimeException(io.grpc.StatusRuntimeException) Test(org.junit.Test)

Aggregations

Group (ucar.nc2.Group)24 Test (org.junit.Test)22 Group (com.google.monitoring.v3.Group)21 AbstractMessage (com.google.protobuf.AbstractMessage)11 Group (org.openstack4j.model.identity.v3.Group)11 ArrayList (java.util.ArrayList)9 Group (org.gluu.oxtrust.model.scim2.Group)8 Variable (ucar.nc2.Variable)8 GluuGroup (org.gluu.oxtrust.model.GluuGroup)7 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)7 Attribute (ucar.nc2.Attribute)7 StatusRuntimeException (io.grpc.StatusRuntimeException)6 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)5 CreateGroupRequest (com.google.monitoring.v3.CreateGroupRequest)5 ProjectName (com.google.monitoring.v3.ProjectName)5 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)5 ListGroupsPagedResponse (com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupsPagedResponse)4 GroupName (com.google.monitoring.v3.GroupName)4 ListGroupsRequest (com.google.monitoring.v3.ListGroupsRequest)4 ListGroupsResponse (com.google.monitoring.v3.ListGroupsResponse)4