Package com.linkedin.restli.examples.groups.client

Examples of com.linkedin.restli.examples.groups.client.GroupsRequestBuilders


    String uriV1 = "groups?groupID=1&q=search";
    String uriV2 = "groups?groupID=1&q=search";
    return new Object[][] {
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders()), AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), uriV1 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders()), AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), uriV2 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders()), AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), uriV1 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders()), AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), uriV2 }
    };
  }
View Full Code Here


    String uriV1 = "groups/1?action=transferOwnership";
    String uriV2 = "groups/1?action=transferOwnership";
    return new Object[][] {
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders()), AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), uriV1 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders()), AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), uriV2 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders()), AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), uriV1 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders()), AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), uriV2 }
    };
  }
View Full Code Here

    return new Object[][] {
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders("SpecialGroups")), new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders("SpecialGroups")),
        AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), uriV1_1, uriV1_2 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders("SpecialGroups")), new RootBuilderWrapper<Integer, GroupContact>(new ContactsBuilders("SpecialGroups")),
        AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), uriV2_1, uriV2_2 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders("SpecialGroups")), new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders("SpecialGroups")),
        AllProtocolVersions.RESTLI_PROTOCOL_1_0_0.getProtocolVersion(), uriV1_1, uriV1_2 },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders("SpecialGroups")), new RootBuilderWrapper<Integer, GroupContact>(new ContactsRequestBuilders("SpecialGroups")),
        AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion(), uriV2_1, uriV2_2},
    };
  }
View Full Code Here

  @DataProvider
  private static Object[][] requestGroupsBuilderDataProvider()
  {
    return new Object[][] {
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders()) },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders()) }
    };
  }
View Full Code Here

    group.setOwner(buildGroupMembership(memberID, "a@a.a", "f", "l"));
    GroupMembershipParam param = new GroupMembershipParam();
    param.setIntParameter(1);
    param.setStringParameter("String");

    final GroupsRequestBuilders groupBuilders = new GroupsRequestBuilders(requestOptions);
    final GroupMembershipsRequestBuilders membershipBuilders = new GroupMembershipsRequestBuilders(requestOptions);

    // Create
    Response<IdResponse<Integer>> response = REST_CLIENT.sendRequest(groupBuilders.create()
                                                                 .input(group)
                                                                 .build()).getResponse();
    Assert.assertEquals(response.getStatus(), 201);
    Integer createdId = response.getEntity().getId();
    Assert.assertNotNull(createdId);
    @SuppressWarnings("deprecation")
    String stringId = response.getId();
    Assert.assertEquals(createdId.intValue(), Integer.parseInt(stringId));

    // Get newly created group and verify name

    Assert.assertEquals(REST_CLIENT.sendRequest(groupBuilders.get()
                                                  .id(createdId)
                                                  .build())
                          .getResponse()
                          .getEntity()
                          .getName(),
                        name);

    // Partial update - change name
    String newName = "new name";
    group.setName(newName);
    PatchRequest<Group> patch = PatchGenerator.diffEmpty(group);
    ResponseFuture<EmptyRecord> responseFuture = REST_CLIENT.sendRequest(groupBuilders.partialUpdate()
                                                                           .id(createdId)
                                                                           .input(patch)
                                                                           .build());
    Assert.assertEquals(204, responseFuture.getResponse().getStatus());

    // Get updated group and verify name
    Assert.assertEquals(REST_CLIENT.sendRequest(groupBuilders.get()
                                                  .id(createdId)
                                                  .build())
                          .getResponse()
                          .getEntity()
                          .getName(),
                        newName);

    // Delete
    responseFuture = REST_CLIENT.sendRequest(groupBuilders.delete().id(createdId).build());
    Assert.assertEquals(204, responseFuture.getResponse().getStatus());

    // Verify deleted
    try
    {
      REST_CLIENT.sendRequest(groupBuilders.get().id(createdId).build()).getResponse();
      Assert.fail("Expected RestLiResponseException");
    }
    catch (RestLiResponseException e)
    {
      Assert.assertEquals(e.getStatus(), 404);
View Full Code Here

  private static Object[][] requestGroupsBuilderDataProvider()
  {
    return new Object[][] {
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders()) },
      { new RootBuilderWrapper<Integer, Group>(new GroupsBuilders(TestConstants.FORCE_USE_NEXT_OPTIONS)) },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders()) },
      { new RootBuilderWrapper<Integer, Group>(new GroupsRequestBuilders(TestConstants.FORCE_USE_NEXT_OPTIONS)) }
    };
  }
View Full Code Here

TOP

Related Classes of com.linkedin.restli.examples.groups.client.GroupsRequestBuilders

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.