Package com.linkedin.restli.common

Examples of com.linkedin.restli.common.ResourceSpecImpl


  public void testBatchingWithDifferentRequestOptionsFailure()
  {
    BatchGetRequestBuilder<Integer, TestRecord> batchRequestBuilder1 =
        new BatchGetRequestBuilder<Integer, TestRecord>("/",
                                                        TestRecord.class,
                                                        new ResourceSpecImpl(
                                                          Collections.<ResourceMethod> emptySet(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Integer.class,
                                                          null,
                                                          null,
                                                          null,
                                                          Collections.<String, Object> emptyMap()),
                                                        RestliRequestOptions.DEFAULT_OPTIONS);
    batchRequestBuilder1.ids(1);

    RestliRequestOptions customOptions =
        new RestliRequestOptionsBuilder().setProtocolVersionOption(ProtocolVersionOption.FORCE_USE_NEXT).build();
    BatchGetRequestBuilder<Integer, TestRecord> batchRequestBuilder2 =
        new BatchGetRequestBuilder<Integer, TestRecord>("/",
                                                        TestRecord.class,
                                                        new ResourceSpecImpl(
                                                          Collections.<ResourceMethod> emptySet(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Integer.class,
                                                          null,
View Full Code Here


    String expectedProtocol2Uri = "/?ids=List(1,2,3)";

    BatchGetRequestBuilder<Integer, TestRecord> batchRequestBuilder1 =
        new BatchGetRequestBuilder<Integer, TestRecord>("/",
                                                        TestRecord.class,
                                                        new ResourceSpecImpl(
                                                          Collections.<ResourceMethod> emptySet(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Integer.class,
                                                          null,
                                                          null,
                                                          null,
                                                          Collections.<String, Object> emptyMap()),
                                                        RestliRequestOptions.DEFAULT_OPTIONS);
    batchRequestBuilder1.ids(1);
    batchRequestBuilder1.fields();

    BatchGetRequestBuilder<Integer, TestRecord> batchRequestBuilder2 =
        new BatchGetRequestBuilder<Integer, TestRecord>("/",
                                                        TestRecord.class,
                                                        new ResourceSpecImpl(
                                                          Collections.<ResourceMethod> emptySet(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Integer.class,
                                                          null,
View Full Code Here

  public void testBatchingWithNullProjectionFirst()
  {
    BatchGetRequestBuilder<Integer, TestRecord> batchRequestBuilder1 =
        new BatchGetRequestBuilder<Integer, TestRecord>("/",
                                                        TestRecord.class,
                                                        new ResourceSpecImpl(
                                                          Collections.<ResourceMethod> emptySet(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Integer.class,
                                                          null,
                                                          null,
                                                          null,
                                                          Collections.<String, Object> emptyMap()),
                                                        RestliRequestOptions.DEFAULT_OPTIONS);
    batchRequestBuilder1.ids(1);

    BatchGetRequestBuilder<Integer, TestRecord> batchRequestBuilder2 =
        new BatchGetRequestBuilder<Integer, TestRecord>("/",
                                                        TestRecord.class,
                                                        new ResourceSpecImpl(
                                                          Collections.<ResourceMethod> emptySet(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Integer.class,
                                                          null,
View Full Code Here

  public void testBatchingWithNullProjectionLast()
  {
    BatchGetRequestBuilder<Integer, TestRecord> batchRequestBuilder1 =
        new BatchGetRequestBuilder<Integer, TestRecord>("/",
                                                        TestRecord.class,
                                                        new ResourceSpecImpl(
                                                          Collections.<ResourceMethod> emptySet(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Integer.class,
                                                          null,
                                                          null,
                                                          null,
                                                          Collections.<String, Object> emptyMap()),
                                                        RestliRequestOptions.DEFAULT_OPTIONS);
    batchRequestBuilder1.ids(1);
    batchRequestBuilder1.fields(FIELDS.message());

    BatchGetRequestBuilder<Integer, TestRecord> batchRequestBuilder2 =
        new BatchGetRequestBuilder<Integer, TestRecord>("/",
                                                        TestRecord.class,
                                                        new ResourceSpecImpl(
                                                          Collections.<ResourceMethod> emptySet(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                          Integer.class,
                                                          null,
View Full Code Here

  {
    return new GetRequest<T>(Collections.<String, String> emptyMap(),
                             clazz,
                             null,
                             new DataMap(),
                             new ResourceSpecImpl(),
                             "/foo",
                             Collections.<String, Object>emptyMap(),
                             new RestliRequestOptionsBuilder().setProtocolVersionOption(versionOption).build());
  }
View Full Code Here

  {
    CollectionRequest mockCollectionRequest = EasyMock.createMock(CollectionRequest.class);
    EasyMock.expect(mockCollectionRequest.getElements()).andReturn(Collections.emptyList()).once();
    EasyMock.expect(mockRequest.getInputRecord()).andReturn(mockCollectionRequest).times(2);
    EasyMock.replay(mockCollectionRequest);
    ResourceSpec resourceSpec = new ResourceSpecImpl(Collections.<ResourceMethod> emptySet(),
                                                     Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                     Collections.<String, DynamicRecordMetadata> emptyMap(),
                                                     null,
                                                     null,
                                                     null,
View Full Code Here

      buildInputForBatchPathAndUpdate(mockRequest);
    }
    else
    {
      EasyMock.expect(mockRequest.getInputRecord()).andReturn(mockRecordTemplate).times(2);
      EasyMock.expect(mockRequest.getResourceSpec()).andReturn(new ResourceSpecImpl()).once();
    }

    if (method == ResourceMethod.GET)
    {
      EasyMock.expect(((GetRequest)mockRequest).getObjectId()).andReturn(null).once();
      EasyMock.expect(((GetRequest)mockRequest).getResourceSpec()).andReturn(new ResourceSpecImpl()).once();
      EasyMock.expect(mockRequest.getMethodName()).andReturn(null);
    }
    else if (method == ResourceMethod.BATCH_GET)
    {
      EasyMock.expect(mockRequest.getMethodName()).andReturn(null);
    }
    else if (method == ResourceMethod.ACTION)
    {
      EasyMock.expect(((ActionRequest)mockRequest).getId()).andReturn(null);
      EasyMock.expect(mockRequest.getMethodName()).andReturn("testAction");
    }
    else if (method == ResourceMethod.FINDER)
    {
      EasyMock.expect(((FindRequest)mockRequest).getAssocKey()).andReturn(new CompoundKey());
      EasyMock.expect(mockRequest.getMethodName()).andReturn("testFinder");
    }
    else if (method == ResourceMethod.GET_ALL)
    {
      EasyMock.expect(((GetAllRequest)mockRequest).getAssocKey()).andReturn(new CompoundKey());
      EasyMock.expect(mockRequest.getMethodName()).andReturn(null);
    }
    else if (method == ResourceMethod.UPDATE)
    {
      EasyMock.expect(((UpdateRequest) mockRequest).getResourceSpec()).andReturn(new ResourceSpecImpl()).once();
      EasyMock.expect(((UpdateRequest)mockRequest).getId()).andReturn(null);
      EasyMock.expect(mockRequest.getMethodName()).andReturn(null);
    }
    else if (method == ResourceMethod.PARTIAL_UPDATE)
    {
      EasyMock.expect(mockRequest.getResourceSpec()).andReturn(new ResourceSpecImpl()).times(2);
      EasyMock.expect(((PartialUpdateRequest)mockRequest).getId()).andReturn(null);
      EasyMock.expect(mockRequest.getMethodName()).andReturn(null);
    }
    else if (method == ResourceMethod.DELETE)
    {
      EasyMock.expect(((DeleteRequest)mockRequest).getResourceSpec()).andReturn(new ResourceSpecImpl()).once();
      EasyMock.expect(((DeleteRequest)mockRequest).getId()).andReturn(null);
      EasyMock.expect(mockRequest.getMethodName()).andReturn(null);
    }
    else
    {
View Full Code Here

                          queryParams);
  }

  private ResourceSpec buildResourceSpec()
  {
    return new ResourceSpecImpl(EnumSet.of(ResourceMethod.GET,
                                           ResourceMethod.ACTION,
                                           ResourceMethod.DELETE,
                                           ResourceMethod.FINDER,
                                           ResourceMethod.PARTIAL_UPDATE,
                                           ResourceMethod.UPDATE),
View Full Code Here

                                   baseUriTemplate,
                                   pathKeys,
                                   requestOptions);
    data.add(Arrays.asList(request1, request4, false));

    ResourceSpec resourceSpec1 = new ResourceSpecImpl(EnumSet.of(ResourceMethod.GET,
                                                                 ResourceMethod.PARTIAL_UPDATE,
                                                                 ResourceMethod.UPDATE),
                                                      null,
                                                      null,
                                                      Long.class,
View Full Code Here

  {
    return new GetRequest<T>(Collections.<String, String> emptyMap(),
                             clazz,
                             null,
                             new DataMap(),
                             new ResourceSpecImpl(),
                             "/foo",
                             Collections.<String, Object>emptyMap(),
                             new RestliRequestOptionsBuilder().setProtocolVersionOption(versionOption).build());
  }
View Full Code Here

TOP

Related Classes of com.linkedin.restli.common.ResourceSpecImpl

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.