Package com.linkedin.data

Examples of com.linkedin.data.DataMap


    Assert.assertEquals(metadataMask.toString(), "{region=1, city=1}");

    final MaskTree pagingMask = context.getPagingProjectionMask();
    Assert.assertEquals(pagingMask.toString(), "{start=1, links=1}");

    DataMap parameters = context.getParameters();
    DataMap expectedParameters = new DataMap();
    expectedParameters.put("fields", "foo,bar,baz");
    expectedParameters.put("metadataFields", "city,region");
    expectedParameters.put("pagingFields", "start,links");
    expectedParameters.put("q", "test");
    DataMap testParam = new DataMap();
    DataList aValue = new DataList();
    aValue.add("b");
    aValue.add("c");
    aValue.add("d");
    testParam.put("a", aValue);
    expectedParameters.put("testParam", testParam);
    Assert.assertEquals(parameters, expectedParameters);
  }
View Full Code Here


    private static final RecordDataSchema SCHEMA = ((RecordDataSchema) DataTemplateUtil.parseSchema(
      "{\"type\" : \"record\", \"name\" : \"A\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"b\", \"type\" : {\"type\" : \"record\", \"name\" : \"B\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"a\", \"type\" : \"A\" } ] } } ] }"));

    public A()
    {
      super(new DataMap(), SCHEMA);
    }
View Full Code Here

    private static final RecordDataSchema SCHEMA = ((RecordDataSchema) DataTemplateUtil.parseSchema(
      "{\"type\" : \"record\", \"name\" : \"B\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"a\", \"type\" : {\"type\" : \"record\", \"name\" : \"A\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"b\", \"type\" : \"B\" } ] } } ] }"));

    public B()
    {
      super(new DataMap(), SCHEMA);
    }
View Full Code Here

    private static final RecordDataSchema SCHEMA = ((RecordDataSchema) DataTemplateUtil.parseSchema(
        "{\"type\" : \"record\", \"name\" : \"C\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"a\", \"type\" : {\"type\" : \"record\", \"name\" : \"A\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"b\", \"type\" : {\"type\" : \"record\", \"name\" : \"B\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"a\", \"type\" : \"A\" } ] } } ] } } ] }"));

    public C()
    {
      super(new DataMap(), SCHEMA);
    }
View Full Code Here

    private static final RecordDataSchema SCHEMA = ((RecordDataSchema) DataTemplateUtil.parseSchema(
        "{\"type\" : \"record\", \"name\" : \"D\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"b\", \"type\" : {\"type\" : \"record\", \"name\" : \"B\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"a\", \"type\" : {\"type\" : \"record\", \"name\" : \"A\", \"namespace\" : \"com.linkedin.restli.tools.snapshot.circular\", \"fields\" : [ { \"name\" : \"b\", \"type\" : \"B\" } ] } } ] } } ] }"));

    public D()
    {
      super(new DataMap(), SCHEMA);
    }
View Full Code Here

                                     methodDescriptor,
                                     new CollectionResult<Status, CollectionMetadata>(buildStatusList(5), 10, metadata),
                                     acceptTypeData.acceptHeaders,
                                     protocolVersion);
    checkCollectionResponse(response, 5, 0, 5, 1, 10, null, null, acceptTypeData);
    DataMap dataMap = acceptTypeData.dataCodec.readMap(response.getEntity().asInputStream());
    CollectionResponse<Status> collectionResponse = new CollectionResponse<Status>(dataMap, Status.class);
    assertEquals(new CollectionMetadata(collectionResponse.getMetadataRaw()), metadata);


    // #2 pagination: first page, no next
View Full Code Here

    response = _responseHandler.buildResponse(request,
                                              buildRoutingResult(request, acceptTypeData.acceptHeaders),
                                              ex);

    checkResponse(response, 400, 3, acceptTypeData.responseContentType, ErrorResponse.class.getName(), null, true, true, errorResponseHeaderName);
    DataMap dataMap = acceptTypeData.dataCodec.readMap(response.getEntity().asInputStream());

    assertEquals(dataMap.getInteger("status"), Integer.valueOf(400));
    assertEquals(dataMap.getString("message"), "missing fields");

    // #2
    ex = new RestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "missing fields").setServiceErrorCode(11);
    response = _responseHandler.buildResponse(request,
                                              buildRoutingResult(request, acceptTypeData.acceptHeaders),
                                              ex);

    checkResponse(response, 400, 3, acceptTypeData.responseContentType, ErrorResponse.class.getName(), null, true, true, errorResponseHeaderName);
    dataMap = acceptTypeData.dataCodec.readMap(response.getEntity().asInputStream());

    assertEquals(dataMap.getInteger("status"), Integer.valueOf(400));
    assertEquals(dataMap.getString("message"), "missing fields");
    assertEquals(dataMap.getInteger("serviceErrorCode"), Integer.valueOf(11));
  }
View Full Code Here

                                                  String errorResponseHeaderName)
          throws Exception
  {
    RestResponse response;

    DataMap data = new DataMap(asMap(
            "f1", "value",
            "f2", new DataMap(asMap(
            "f3", "value",
            "f4", "value"
    ))));

    // #1 all fields
View Full Code Here

                                              statusCollection);

    checkResponse(response, 200, 2, acceptTypeData.responseContentType,
                  CollectionResponse.class.getName(), null, true, errorResponseHeaderName);

    DataMap dataMap = acceptTypeData.dataCodec.readMap(response.getEntity().asInputStream());
    CollectionResponse<Status> collectionResponse = new CollectionResponse<Status>(dataMap, Status.class);
    assertEquals(collectionResponse.getElements().size(), 10);
    for (Status status : collectionResponse.getElements())
    {
      assertTrue(status.data().containsKey("f1"));
View Full Code Here

                                              buildRoutingResultFinder(request, acceptTypeData.acceptHeaders),
                                              statusCollection);

    checkResponse(response, 200, 2, acceptTypeData.responseContentType, CollectionResponse.class.getName(), null, true, errorResponseHeaderName);

    DataMap dataMap = acceptTypeData.dataCodec.readMap(response.getEntity().asInputStream());
    CollectionResponse<Status> collectionResponse = new CollectionResponse<Status>(dataMap, Status.class);
    assertEquals(collectionResponse.getElements().size(), 10);
    for (Status status : collectionResponse.getElements())
    {
      assertTrue(status.data().containsKey("f1"));
View Full Code Here

TOP

Related Classes of com.linkedin.data.DataMap

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.