Examples of PathSpec


Examples of com.linkedin.data.schema.PathSpec

  {
    try
    {
      // fields
      Method fieldsMethod = templateClass.getMethod("fields");
      PathSpec recordPathSpec = (PathSpec) fieldsMethod.invoke(null);
      Method fieldPathSpecMethod = recordPathSpec.getClass().getMethod(fieldName);
      PathSpec fieldPathSpec = (PathSpec) fieldPathSpecMethod.invoke(recordPathSpec);
      List<String> components = fieldPathSpec.getPathComponents();
      assertEquals(components.size(), 1);
      assertEquals(components.get(0), fieldName);
    }
    catch (NoSuchMethodException exc)
    {
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  public void testReplaceAtPathNested() throws Exception
  {
    SimpleTestData data = IteratorTestData.createSimpleTestData();

    Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
    .filterBy(Predicates.pathMatchesPathSpec(new PathSpec("nested", "nested")))
    .replace(new DataMap());

    int count = Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
      .filterBy(Predicates.pathMatchesPathSpec(new PathSpec("nested", "nested", "foo")))
      .count();

    assertEquals(count, 0);
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

    Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
    .filterBy(Predicates.nameEquals("foo"))
    .replace(new DataList());
   
    assertEquals(Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
      .filterBy(Predicates.pathMatchesPathSpec(new PathSpec("nested", "nested", "foo", PathSpec.WILDCARD)))
      .count(), 0);
   
    assertEquals(Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
      .filterBy(Predicates.pathMatchesPathSpec(new PathSpec("foo", PathSpec.WILDCARD)))
      .count(), 0);
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

    Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
        .filterBy(Predicates.dataSchemaNameEquals("Bar"))
        .replace(500);
   
    List<Object> accumulate = new ArrayList<Object>(Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
        .filterBy(Predicates.pathMatchesPathSpec(new PathSpec("nested", "nested", "foo", PathSpec.WILDCARD)))
        .accumulateValues());

    assertEquals(accumulate.size(), 2);
    assertEquals(accumulate.get(0), 500);
    assertEquals(accumulate.get(1), 500);
   
    accumulate = new ArrayList<Object>(Builder.create(data.getDataElement(), IterationOrder.PRE_ORDER)
        .filterBy(Predicates.pathMatchesPathSpec(new PathSpec("foo", PathSpec.WILDCARD)))
        .accumulateValues());
   
    assertEquals(accumulate.size(), 3);
    assertEquals(accumulate.get(0), 500);
    assertEquals(accumulate.get(1), 500);
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
  public void testProjectionPagingLinkField(RootBuilderWrapper<Long, Greeting> builders)
      throws RemoteInvocationException
  {
    final Request<CollectionResponse<Greeting>> request = builders.findBy("searchWithLinksResult")
        .pagingFields(CollectionMetadata.fields().count(), new PathSpec("links", PathSpec.WILDCARD, "rel"))
        .build();

    final Response<CollectionResponse<Greeting>> response = REST_CLIENT.sendRequest(request).getResponse();
    //Assert that no metadata was sent back
    Assert.assertNull(response.getEntity().getMetadataRaw(), "We should get no metadata back");
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

public class TestProjectionUtil
{
  @Test
  public void testNullFilter()
  {
    Assert.assertTrue(ProjectionUtil.isPathPresent(null, new PathSpec("foo")));
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  @Test
  public void testEmptyFilter()
  {
    final MaskTree filter = new MaskTree();

    Assert.assertFalse(ProjectionUtil.isPathPresent(filter, new PathSpec("foo")));
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  @Test
  public void testEmptyPath()
  {
    final MaskTree filter = new MaskTree();
    filter.addOperation(new PathSpec("foo"), MaskOperation.POSITIVE_MASK_OP);

    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec()));
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  @Test
  public void testPositiveSinglePath()
  {
    final MaskTree filter = new MaskTree();
    filter.addOperation(new PathSpec("foo", "bar", "baz"), MaskOperation.POSITIVE_MASK_OP);

    // ancestor nodes are considered present if matched in path
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar")));

    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "baz")));

    // all matched child nodes are considered present
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "baz", "xyz")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "baz", "abc", "xyz")));

    Assert.assertFalse(ProjectionUtil.isPathPresent(filter, new PathSpec("xyz")));
    Assert.assertFalse(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "baz")));
    Assert.assertFalse(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "xyz")));
    Assert.assertFalse(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "xyz")));
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  @Test
  public void testPositiveWithWildcardSinglePath()
  {
    final MaskTree filter = new MaskTree();
    filter.addOperation(new PathSpec("foo", PathSpec.WILDCARD, "baz"), MaskOperation.POSITIVE_MASK_OP);

    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "baz")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "baz", "xyz")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "baz", "abc", "xyz")));

    Assert.assertFalse(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "xyz")));
  }
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.