Package com.linkedin.data.transform.filter.request

Examples of com.linkedin.data.transform.filter.request.MaskTree.addOperation()


  @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()));
  }

  @Test
View Full Code Here


  @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")));
View Full Code Here

  @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")));
View Full Code Here

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

    final Collection<PathSpec> positivePaths = new HashSet<PathSpec>(Arrays.asList(
      new PathSpec("foo"),
      new PathSpec("foo", "bar"),
      new PathSpec("foo", "bar", "baz"),
View Full Code Here

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

    final Collection<PathSpec> positivePaths = new HashSet<PathSpec>(Arrays.asList(
      new PathSpec("foo"),
      new PathSpec("foo", "bar"),
      new PathSpec("foo", "bar", "baz"),
View Full Code Here

  @Test
  public void testMixedMask()
  {
    MaskTree mask = new MaskTree();
    mask.addOperation(new PathSpec("foo", "bar"), MaskOperation.POSITIVE_MASK_OP);
    mask.addOperation(new PathSpec("baz", "qux"), MaskOperation.NEGATIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), "{baz={qux=0}, foo={bar=1}}");
  }

  @Test
View Full Code Here

  @Test
  public void testMixedMask()
  {
    MaskTree mask = new MaskTree();
    mask.addOperation(new PathSpec("foo", "bar"), MaskOperation.POSITIVE_MASK_OP);
    mask.addOperation(new PathSpec("baz", "qux"), MaskOperation.NEGATIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), "{baz={qux=0}, foo={bar=1}}");
  }

  @Test
  public void testMaskWithWildcard()
View Full Code Here

    MaskTree mask = new MaskTree();
    PathSpec wildcardSpec = new PathSpec("foo", PathSpec.WILDCARD, "bar");
    PathSpec asterixSpec = new PathSpec("foo", "*", "bar");
    Assert.assertFalse(wildcardSpec.equals(asterixSpec));

    mask.addOperation(wildcardSpec, MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), "{foo={$*={bar=1}}}");
    Assert.assertEquals(mask.getOperations().get(wildcardSpec), MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.getOperations().get(asterixSpec), null);

    mask = new MaskTree();
View Full Code Here

    Assert.assertEquals(mask.toString(), "{foo={$*={bar=1}}}");
    Assert.assertEquals(mask.getOperations().get(wildcardSpec), MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.getOperations().get(asterixSpec), null);

    mask = new MaskTree();
    mask.addOperation(asterixSpec, MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), "{foo={*={bar=1}}}");
    Assert.assertEquals(mask.getOperations().get(asterixSpec), MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.getOperations().get(wildcardSpec), null);

    mask = new MaskTree();
View Full Code Here

    Assert.assertEquals(mask.toString(), "{foo={*={bar=1}}}");
    Assert.assertEquals(mask.getOperations().get(asterixSpec), MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.getOperations().get(wildcardSpec), null);

    mask = new MaskTree();
    mask.addOperation(asterixSpec, MaskOperation.POSITIVE_MASK_OP);
    mask.addOperation(wildcardSpec, MaskOperation.NEGATIVE_MASK_OP);
    Assert.assertEquals(mask.getOperations().get(wildcardSpec), MaskOperation.NEGATIVE_MASK_OP);
    Assert.assertEquals(mask.getOperations().get(asterixSpec), MaskOperation.POSITIVE_MASK_OP);
  }

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.