Search in sources :

Example 6 with Group

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group in project oxTrust by GluuFederation.

the class GroupCoreLoadingStrategy method createDummyGroup.

private Group createDummyGroup() {
    Group group = new Group();
    group.setId("");
    group.setExternalId("");
    group.setDisplayName("");
    Set<MemberRef> members = new HashSet<MemberRef>();
    MemberRef memberRef = new MemberRef();
    memberRef.setOperation("");
    memberRef.setPrimary(false);
    memberRef.setValue("test");
    memberRef.setDisplay("");
    memberRef.setType(MemberRef.Type.USER);
    memberRef.setReference("");
    members.add(memberRef);
    group.setMembers(members);
    return group;
}
Also used : Group(org.gluu.oxtrust.model.scim2.Group) MemberRef(org.gluu.oxtrust.model.scim2.MemberRef) HashSet(java.util.HashSet)

Example 7 with Group

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group in project google-cloud-java by GoogleCloudPlatform.

the class GroupServiceClientTest method createGroupTest.

@Test
@SuppressWarnings("all")
public void createGroupTest() {
    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);
    ProjectName name = ProjectName.create("[PROJECT]");
    Group group = Group.newBuilder().build();
    Group actualResponse = client.createGroup(name, group);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateGroupRequest actualRequest = (CreateGroupRequest) actualRequests.get(0);
    Assert.assertEquals(name, actualRequest.getNameAsProjectName());
    Assert.assertEquals(group, actualRequest.getGroup());
}
Also used : GroupName(com.google.monitoring.v3.GroupName) Group(com.google.monitoring.v3.Group) ProjectName(com.google.monitoring.v3.ProjectName) CreateGroupRequest(com.google.monitoring.v3.CreateGroupRequest) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Example 8 with Group

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group in project google-cloud-java by GoogleCloudPlatform.

the class GroupServiceClientTest method updateGroupTest.

@Test
@SuppressWarnings("all")
public void updateGroupTest() {
    GroupName name = 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(name).setDisplayName(displayName).setParentNameWithGroupName(parentName).setFilter(filter).setIsCluster(isCluster).build();
    mockGroupService.addResponse(expectedResponse);
    Group group = Group.newBuilder().build();
    Group actualResponse = client.updateGroup(group);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateGroupRequest actualRequest = (UpdateGroupRequest) actualRequests.get(0);
    Assert.assertEquals(group, actualRequest.getGroup());
}
Also used : GroupName(com.google.monitoring.v3.GroupName) Group(com.google.monitoring.v3.Group) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) UpdateGroupRequest(com.google.monitoring.v3.UpdateGroupRequest) Test(org.junit.Test)

Example 9 with Group

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group in project google-cloud-java by GoogleCloudPlatform.

the class GroupServiceClientTest method createGroupExceptionTest.

@Test
@SuppressWarnings("all")
public void createGroupExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
    mockGroupService.addException(exception);
    try {
        ProjectName name = ProjectName.create("[PROJECT]");
        Group group = Group.newBuilder().build();
        client.createGroup(name, group);
        Assert.fail("No exception raised");
    } catch (ApiException e) {
        Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
    }
}
Also used : Group(com.google.monitoring.v3.Group) ProjectName(com.google.monitoring.v3.ProjectName) StatusRuntimeException(io.grpc.StatusRuntimeException) ApiException(com.google.api.gax.grpc.ApiException) Test(org.junit.Test)

Example 10 with Group

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group in project google-cloud-java by GoogleCloudPlatform.

the class GroupServiceClientTest method updateGroupExceptionTest.

@Test
@SuppressWarnings("all")
public void updateGroupExceptionTest() throws Exception {
    StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
    mockGroupService.addException(exception);
    try {
        Group group = Group.newBuilder().build();
        client.updateGroup(group);
        Assert.fail("No exception raised");
    } catch (ApiException e) {
        Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
    }
}
Also used : Group(com.google.monitoring.v3.Group) StatusRuntimeException(io.grpc.StatusRuntimeException) ApiException(com.google.api.gax.grpc.ApiException) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)71 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)50 Test (org.junit.Test)45 BigInteger (java.math.BigInteger)35 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)31 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)27 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)21 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)20 GroupBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder)18 GroupKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey)18 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)17 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)15 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)14 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)13 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)13 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)13 ByteBuf (io.netty.buffer.ByteBuf)12 List (java.util.List)12 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)11 StaleGroup (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroup)11