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

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


  private static Object[][] requestGroupsBuilderDataProviderSearchWithOptional2()
  {
    String uriV1 = "groups?keywords=linkedin&nameKeywords=test&q=search";
    String uriV2 = "groups?keywords=linkedin&nameKeywords=test&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


  private static Object[][] requestGroupsBuilderDataProviderSearchWithOptional3()
  {
    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

  private static Object[][] requestGroupsBuilderDataProviderEntityAction()
  {
    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

    String uriV1_1 = "SpecialGroups/42";
    String uriV1_2 = "SpecialGroups/1/contacts/42";
    String uriV2_1 = "SpecialGroups/42";
    String uriV2_2 = "SpecialGroups/1/contacts/42";
    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 GroupsBuilders groupBuilders = new GroupsBuilders(requestOptions);
    final GroupMembershipsBuilders membershipBuilders = new GroupMembershipsBuilders(requestOptions);

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

    // Get newly created group and verify name
    Integer createdId = createResponse.getId();
    Assert.assertEquals(REST_CLIENT.sendRequest(groupBuilders.get()
                                                  .id(createResponse.getId())
                                                  .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

  @DataProvider(name = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestGroupsBuilderDataProvider")
  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

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

TOP

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

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.