Package com.linkedin.restli.server.twitter

Examples of com.linkedin.restli.server.twitter.StatusCollectionResource


  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "statusPagingContextBadStart")
  public void testPagingContextBadStart(ProtocolVersion version, String query) throws Exception
  {
    ResourceModel statusResourceModel = buildResourceModel(StatusCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = statusResourceModel.findNamedMethod("public_timeline");
    StatusCollectionResource statusResource = getMockResource(StatusCollectionResource.class);
    expectRoutingException(methodDescriptor,
                           statusResource,
                           "GET",
                           "/statuses" + query,
                           version);
View Full Code Here


  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "statusPagingContextNegativeCount")
  public void testPagingContextNegativeCount(ProtocolVersion version, String query) throws Exception
  {
    ResourceModel statusResourceModel = buildResourceModel(StatusCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = statusResourceModel.findNamedMethod("public_timeline");
    StatusCollectionResource statusResource = getMockResource(StatusCollectionResource.class);
    expectRoutingException(methodDescriptor,
                           statusResource,
                           "GET",
                           "/statuses" + query,
                           version);
View Full Code Here

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "statusPagingContextNegativeStart")
  public void testPagingContextNegativeStart(ProtocolVersion version, String query) throws Exception
  {
    ResourceModel statusResourceModel = buildResourceModel(StatusCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = statusResourceModel.findNamedMethod("public_timeline");
    StatusCollectionResource statusResource = getMockResource(StatusCollectionResource.class);
    expectRoutingException(methodDescriptor,
                           statusResource,
                           "GET",
                           "/statuses" + query,
                           version);
View Full Code Here

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "statusUserTimelineDefault")
  public void testPagingContextUserTimelineDefault(ProtocolVersion version, String query) throws Exception
  {
    ResourceModel statusResourceModel = buildResourceModel(StatusCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = statusResourceModel.findNamedMethod("user_timeline");
    StatusCollectionResource statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.getUserTimeline(eq(true), eq(new PagingContext(10, 100, false, false)))).andReturn(null).once();
    checkInvocation(statusResource,
                    methodDescriptor,
                    "GET",
                    version,
                    "/statuses" + query);
View Full Code Here

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "statusUserTimelineStartAndCount")
  public void testPagingContextUserTimelineStartAndCount(ProtocolVersion version, String query) throws Exception
  {
    ResourceModel statusResourceModel = buildResourceModel(StatusCollectionResource.class);
    ResourceMethodDescriptor methodDescriptor = statusResourceModel.findNamedMethod("user_timeline");
    StatusCollectionResource statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.getUserTimeline(eq(true), eq(new PagingContext(0, 20, true, true)))).andReturn(null).once();
    checkInvocation(statusResource,
                    methodDescriptor,
                    "GET",
                    version,
                    "/statuses" + query);
View Full Code Here

            FollowsAssociativeResource.class);
    ResourceModel discoveredItemsResourceModel = buildResourceModel(
        DiscoveredItemsResource.class);

    ResourceMethodDescriptor methodDescriptor;
    StatusCollectionResource statusResource;
    FollowsAssociativeResource followsResource;
    DiscoveredItemsResource discoveredItemsResource;

    // #1 Batch get on collection resource
    methodDescriptor = statusResourceModel.findMethod(ResourceMethod.BATCH_GET);
    statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.batchGet((Set<Long>)Matchers.eqCollectionUnordered(Sets.newHashSet(1L, 2L, 3L)))).andReturn(null).once();
    checkInvocation(statusResource,
                    methodDescriptor,
                    "GET",
                    version,
                    "/statuses?ids=List(1,2,3)",
View Full Code Here

    ResourceModel repliesResourceModel = statusResourceModel.getSubResource("replies");
    ResourceModel locationResourceModel = statusResourceModel.getSubResource("location");
    ResourceModel discoveredItemsResourceModel = resourceModelMap.get("/discovereditems");

    ResourceMethodDescriptor methodDescriptor;
    StatusCollectionResource statusResource;
    RepliesCollectionResource repliesResource;
    LocationResource locationResource;
    DiscoveredItemsResource discoveredItemsResource;

    // #1
    methodDescriptor = statusResourceModel.findMethod(ResourceMethod.CREATE);
    statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.create((Status)EasyMock.anyObject())).andReturn(null).once();
    checkInvocation(statusResource,
                    methodDescriptor,
                    "POST",
                    version,
                    "/statuses",
                    "{}");

    // #1.1: different endpoint
    methodDescriptor = repliesResourceModel.findMethod(ResourceMethod.CREATE);
    repliesResource = getMockResource(RepliesCollectionResource.class);
    EasyMock.expect(repliesResource.create((Status)EasyMock.anyObject())).andReturn(null).once();
    checkInvocation(repliesResource,
                    methodDescriptor,
                    "POST",
                    version,
                    "/statuses/1/replies",
                    "{}",
                    buildPathKeys("statusID", 1L));

    // #1.2: invalid entity
    methodDescriptor = statusResourceModel.findMethod(ResourceMethod.CREATE);
    statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.create((Status)EasyMock.anyObject())).andReturn(null).once();
    try
    {
      checkInvocation(statusResource,
                      methodDescriptor,
                      "POST",
                      version,
                      "/statuses",
                      "{");
      fail("Expected exception");
    }
    catch (RoutingException e)
    {
      // expected
      EasyMock.reset(statusResource);
    }

    // #2 Collection Partial Update
    methodDescriptor = statusResourceModel.findMethod(ResourceMethod.PARTIAL_UPDATE);
    statusResource = getMockResource(StatusCollectionResource.class);
    PatchTree p = new PatchTree();
    p.addOperation(new PathSpec("foo"), PatchOpFactory.setFieldOp(Integer.valueOf(42)));
    PatchRequest<Status> expected = PatchRequest.createFromPatchDocument(p.getDataMap());
    EasyMock.expect(statusResource.update(eq(1L), eq(expected))).andReturn(null).once();
    checkInvocation(statusResource,
                    methodDescriptor,
                    "POST",
                    version,
                    "/statuses/1",
View Full Code Here

                                                                       FollowsAssociativeResource.class);
    ResourceModel locationResourceModel = statusResourceModel.getSubResource("location");
    ResourceModel discoveredItemsResourceModel = resourceModelMap.get("/discovereditems");

    ResourceMethodDescriptor methodDescriptor;
    StatusCollectionResource statusResource;
    FollowsAssociativeResource followsResource;
    LocationResource locationResource;
    DiscoveredItemsResource discoveredItemsResource;

    // #1 Update on collection resource
    methodDescriptor = statusResourceModel.findMethod(ResourceMethod.UPDATE);
    statusResource = getMockResource(StatusCollectionResource.class);
    long id = eq(1L);
    Status status  =(Status)EasyMock.anyObject();
    EasyMock.expect(statusResource.update(id, status)).andReturn(null).once();
    checkInvocation(statusResource,
                    methodDescriptor,
                    "PUT",
                    version,
                    "/statuses/1",
View Full Code Here

    ResourceModel statusResourceModel = resourceModelMap.get("/statuses");
    ResourceModel locationResourceModel = statusResourceModel.getSubResource("location");
    ResourceModel discoveredItemsResourceModel = resourceModelMap.get("/discovereditems");

    ResourceMethodDescriptor methodDescriptor;
    StatusCollectionResource statusResource;
    LocationResource locationResource;
    DiscoveredItemsResource discoveredItemsResource;

    // #1 Delete on collection resource
    methodDescriptor = statusResourceModel.findMethod(ResourceMethod.DELETE);
    statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.delete(eq(1L))).andReturn(null).once();
    checkInvocation(statusResource,
                    methodDescriptor,
                    "DELETE",
                    version, "/statuses/1",
                    buildPathKeys("statusID", 1L));
View Full Code Here

    ResourceModel asyncStatusResourceModel = resourceModelMap.get("/asyncstatuses");
    ResourceModel promiseStatusResourceModel = resourceModelMap.get("/promisestatuses");
    ResourceModel taskStatusResourceModel = resourceModelMap.get("/taskstatuses");

    ResourceMethodDescriptor methodDescriptor;
    StatusCollectionResource statusResource;
    AsyncStatusCollectionResource asyncStatusResource;
    PromiseStatusCollectionResource promiseStatusResource;
    TaskStatusCollectionResource taskStatusResource;

    // #1: Sync Method Execution
    methodDescriptor = statusResourceModel.findMethod(ResourceMethod.GET);
    statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.get(eq(1L))).andReturn(null).once();
    checkInvocation(statusResource,
                    methodDescriptor,
                    "GET",
                    version,
                    "/statuses/1",
View Full Code Here

TOP

Related Classes of com.linkedin.restli.server.twitter.StatusCollectionResource

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.