Examples of PathSpec


Examples of com.linkedin.data.schema.PathSpec

  @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"),
      new PathSpec("foo", "bar", "baz", "xyz"),
      new PathSpec("foo", "bar", "baz", "abc", "xyz")
    ));
    final Collection<PathSpec> negativePaths = new HashSet<PathSpec>(Arrays.asList(
      new PathSpec("xyz"),
      new PathSpec("foo", "baz"),
      new PathSpec("foo", "xyz"),
      new PathSpec("foo", "bar", "xyz")
    ));

    // test false positive
    final Set<PathSpec> positiveResult = ProjectionUtil.getPresentPaths(filter, new HashSet<PathSpec>(positivePaths));
    Assert.assertEquals(positiveResult, positivePaths);
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  @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"),
      new PathSpec("foo", "bar", "baz", "xyz"),
      new PathSpec("foo", "bar", "baz", "abc", "xyz")
    ));
    final Collection<PathSpec> negativePaths = new HashSet<PathSpec>(Arrays.asList(
      new PathSpec("foo", "bar", "xyz")
    ));

    final Set<PathSpec> positiveResult = ProjectionUtil.getPresentPaths(filter, new HashSet<PathSpec>(positivePaths));
    Assert.assertEquals(positiveResult, positivePaths);
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

public class TestMaskCreation
{
  @Test
  public void testPositiveMaskSingleField()
  {
    MaskTree mask = MaskCreator.createPositiveMask(new PathSpec("foo"));
    Assert.assertEquals(mask.toString(), "{foo=1}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  }

  @Test
  public void testPositiveMaskMultipleFields()
  {
    MaskTree mask = MaskCreator.createPositiveMask(new PathSpec("foo"), new PathSpec("bar"));
    Assert.assertEquals(mask.toString(), "{foo=1, bar=1}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  }

  @Test
  public void testPositiveMaskNestedFields()
  {
    MaskTree mask = MaskCreator.createPositiveMask(new PathSpec("foo", "bar"), new PathSpec("bar", "baz"), new PathSpec("qux"));
    Assert.assertEquals(mask.toString(), "{foo={bar=1}, bar={baz=1}, qux=1}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  }

  @Test
  public void testNegativeMaskSingleField()
  {
    MaskTree mask = MaskCreator.createNegativeMask(new PathSpec("foo"));
    Assert.assertEquals(mask.toString(), "{foo=0}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  }

  @Test
  public void testNegativeMaskMultipleFields()
  {
    MaskTree mask = MaskCreator.createNegativeMask(new PathSpec("foo"), new PathSpec("bar"));
    Assert.assertEquals(mask.toString(), "{foo=0, bar=0}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  }

  @Test
  public void testNegativeMaskNestedFields()
  {
    MaskTree mask = MaskCreator.createNegativeMask(new PathSpec("foo", "bar"), new PathSpec("bar", "baz"),
                                                   new PathSpec("qux"));
    Assert.assertEquals(mask.toString(), "{foo={bar=0}, bar={baz=0}, qux=0}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

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

Examples of com.linkedin.data.schema.PathSpec

  @Test
  public void testMaskWithWildcard()
  {
    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);
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.