Examples of ResourceSpec


Examples of com.linkedin.restli.common.ResourceSpec

  {
    if (subresource != null)
    {
      resourceSchema = resourceSchema.getSubresource(subresource);
    }
    ResourceSpec actualResourceSpec = translator.translate(resourceSchema.getResourceSchema());
    ResourceSpec expectedResourceSpec = getResourceSpecFromClientBuilders(resourceBuildersClass);

    compareResourceSpecs(actualResourceSpec, expectedResourceSpec, resourceSchema);
  }
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

  {
    try
    {
      Field schemaField = type.getDeclaredField("_resourceSpec");
      schemaField.setAccessible(true);
      ResourceSpec resourceSpec = (ResourceSpec) schemaField.get(null);
      if (resourceSpec == null)
      {
        throw new IllegalArgumentException("Class missing _resourceSpec: " + type.getName());
      }
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

    final BatchGetRequest<RT> firstRequest = requests.get(0);
    Class<?> keyClass = firstRequest.getResourceSpec().getKeyClass();

    throwIfClassCompoundOrComplex(keyClass, "batch", "batchKV");

    final ResourceSpec firstResourceSpec = firstRequest.getResourceSpec();
    final Map<String, Object> batchQueryParams = BatchGetRequestUtil.getBatchQueryParam(requests, batchFields);

    return new BatchGetRequest<RT>(firstRequest.getHeaders(),
                                   firstRequest.getResponseDecoder(),
                                   batchQueryParams,
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

   */
  public static <K, RT extends RecordTemplate> BatchGetKVRequest<K, RT> batchKV(List<BatchGetKVRequest<K, RT>> requests,
                                                                      boolean batchFields)
  {
    final BatchGetKVRequest<K, RT> firstRequest = requests.get(0);
    final ResourceSpec firstResourceSpec = firstRequest.getResourceSpec();
    final Map<String, Object> batchQueryParams = BatchGetRequestUtil.getBatchQueryParam(requests, batchFields);

    return new BatchGetKVRequest<K, RT>(firstRequest.getHeaders(),
                                   firstRequest.getResponseDecoder(),
                                   batchQueryParams,
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

    URI uri = new URI("greetings/1");
    ResourceMethod method = ResourceMethod.GET;
    RecordTemplate inputRecord = null;
    Map<String, String> headers = Collections.emptyMap();
    RestResponseDecoder<Greeting> decoder = new EntityResponseDecoder<Greeting>(Greeting.class);
    ResourceSpec resourceSpec = new ResourceSpecImpl(EnumSet.of(method), null, null, Long.class, Greeting.class, Collections.<String, Object>emptyMap());
    Request<Greeting> request = new Request<Greeting>(uri, method, inputRecord, headers, decoder, resourceSpec);
    ResponseFuture<Greeting> responseFuture = REST_CLIENT.sendRequest(request);
    Greeting entity = responseFuture.getResponse().getEntity();
    Assert.assertEquals(entity.getId(), new Long(1L));
    Assert.assertEquals(responseFuture.getResponse().getHeader(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION),
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

    DynamicRecordMetadata requestMetadata = new DynamicRecordMetadata("action", Collections.<FieldDef<?>>singleton(pParam));
    requestMetadataMap.put("action", requestMetadata);
    DynamicRecordMetadata responseMetadata = new DynamicRecordMetadata("action", Collections.<FieldDef<?>>emptyList());
    Map<String, DynamicRecordMetadata> responseMetadataMap = new HashMap<String, DynamicRecordMetadata>();
    responseMetadataMap.put("action", responseMetadata);
    ResourceSpec resourceSpec = new ResourceSpecImpl(Collections.<ResourceMethod>emptySet(),
                                                     requestMetadataMap,
                                                     responseMetadataMap,
                                                     Long.class,
                                                     TestRecord.class,
                                                     Collections.<String, CompoundKey.TypeInfo> emptyMap());
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

    Map<String, DynamicRecordMetadata> requestMetadataMap = new HashMap<String, DynamicRecordMetadata>();
    requestMetadataMap.put("action", requestMetadata);
    DynamicRecordMetadata responseMetadata = new DynamicRecordMetadata("action", Collections.<FieldDef<?>>emptyList());
    Map<String, DynamicRecordMetadata> responseMetadataMap = new HashMap<String, DynamicRecordMetadata>();
    responseMetadataMap.put("action", responseMetadata);
    ResourceSpec resourceSpec = getResourceSpecForBuilderPathKeys();
    String[] expectedResourcePath = new String[] {"foo", "bar", "baz"};

    Map<String, Integer> expectedPathKeys = new HashMap<String, Integer>();
    expectedPathKeys.put("key1", 1);
    expectedPathKeys.put("key2", 2);
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

  }

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "subSubResourceAction2")
  public void testBuilderPathKeys2(ProtocolVersion version, String expectedUri)
  {
    ResourceSpec resourceSpec = getResourceSpecForBuilderPathKeys();
    String[] expectedResourcePath = new String[] {"foo", "bar", "baz"};

    // test with keys containing URL escaped chars
    Request<TestRecord> request = new ActionRequestBuilder<Void, TestRecord>(SUBRESOURCE_URI, TestRecord.class, resourceSpec, RestliRequestOptions.DEFAULT_OPTIONS)
      .name("action").pathKey("key1", "http://example.com/images/1.png").pathKey("key2", "http://example.com/images/2.png").build();
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

  }

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "subResourceAction1")
  public void testBuilderPathKeys10(ProtocolVersion version, String expectedUri)
  {
    ResourceSpec resourceSpec = getResourceSpecForBuilderPathKeys();
    String[] expectedResourcePath = new String[] {"foo", "bar", "baz"};

    // simple resource & sub resources tests
    Request<TestRecord> request = new ActionRequestBuilder<Void, TestRecord>(SUBRESOURCE_SIMPLE_ROOT_URI, TestRecord.class, resourceSpec, RestliRequestOptions.DEFAULT_OPTIONS)
      .name("action").pathKey("key1", 1).build();
View Full Code Here

Examples of com.linkedin.restli.common.ResourceSpec

  }

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "subResourceAction2")
  public void testBuilderPathKeys11(ProtocolVersion version, String expectedUri)
  {
    ResourceSpec resourceSpec = getResourceSpecForBuilderPathKeys();
    String[] expectedResourcePath = new String[] {"foo", "bar", "baz"};

    Request<TestRecord> request = new ActionRequestBuilder<Void, TestRecord>(
      SUBRESOURCE_SIMPLE_ROOT_URI, TestRecord.class, resourceSpec, RestliRequestOptions.DEFAULT_OPTIONS).name("action")
      .pathKey("key1", "http://example.com/images/1.png")
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.