Examples of PathSpec


Examples of com.linkedin.data.schema.PathSpec

  @Test
  public void testMaskWithDollarField()
  {
    MaskTree mask = new MaskTree();
    mask.addOperation(new PathSpec("$foo"), MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), "{$$foo=1}");
    Assert.assertEquals(mask.getOperations().get(new PathSpec("$$foo")), null);
    Assert.assertEquals(mask.getOperations().get(new PathSpec("$foo")), MaskOperation.POSITIVE_MASK_OP);
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

   */
  @Test
  public void testComposingPositiveSubmasks()
  {
    MaskTree mask = new MaskTree();
    mask.addOperation(new PathSpec("a", "b", "c"), MaskOperation.POSITIVE_MASK_OP);
    mask.addOperation(new PathSpec("a", "b"), MaskOperation.POSITIVE_MASK_OP);
    mask.addOperation(new PathSpec("a"), MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), "{a=1}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

   */
  @Test
  public void testComposingNegativeSubmasks()
  {
    MaskTree mask = new MaskTree();
    mask.addOperation(new PathSpec("a", "b", "c"), MaskOperation.NEGATIVE_MASK_OP);
    mask.addOperation(new PathSpec("a", "b"), MaskOperation.NEGATIVE_MASK_OP);
    mask.addOperation(new PathSpec("a"), MaskOperation.NEGATIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), "{a=0}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

   */
  @Test
  public void testComposingPositiveMaskWithNegativeSubmasks() throws IOException
  {
    MaskTree mask = new MaskTree();
    mask.addOperation(new PathSpec("a", "b", "c"), MaskOperation.NEGATIVE_MASK_OP);
    mask.addOperation(new PathSpec("a"), MaskOperation.POSITIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), dataMapFromString("{'a': {'$*': 1, 'b': {'c': 0}}}".replace('\'', '"')).toString());
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

   */
  @Test
  public void testComposingNegativeMaskWithPositiveSubmasks() throws IOException
  {
    MaskTree mask = new MaskTree();
    mask.addOperation(new PathSpec("a", "b", "c"), MaskOperation.POSITIVE_MASK_OP);
    mask.addOperation(new PathSpec("a"), MaskOperation.NEGATIVE_MASK_OP);
    Assert.assertEquals(mask.toString(), "{a=0}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

{
  @Test
  public void testExplicitPatchCreationSet()
  {
    PatchTree patch = new PatchTree();
    patch.addOperation(new PathSpec("foo"), PatchOpFactory.setFieldOp(42));
    patch.addOperation(new PathSpec("bar", "baz"), PatchOpFactory.setFieldOp("The quick brown fox"));
    Assert.assertEquals(patch.toString(), "{$set={foo=42}, bar={$set={baz=The quick brown fox}}}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  @Test
  public void testExplicitPatchCreationRemove()
  {
    PatchTree patch = new PatchTree();
    patch.addOperation(new PathSpec("foo"), PatchOpFactory.REMOVE_FIELD_OP);
    patch.addOperation(new PathSpec("bar", "baz"), PatchOpFactory.REMOVE_FIELD_OP);
    Assert.assertEquals(patch.toString(), "{bar={$delete=[baz]}, $delete=[foo]}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  @Test
  public void testExplicitPatchCreationMixed()
  {
    PatchTree patch = new PatchTree();
    patch.addOperation(new PathSpec("foo"), PatchOpFactory.setFieldOp(42));
    patch.addOperation(new PathSpec("bar", "baz"), PatchOpFactory.REMOVE_FIELD_OP);
    patch.addOperation(new PathSpec("qux"), PatchOpFactory.REMOVE_FIELD_OP);
    Assert.assertEquals(patch.toString(), "{$set={foo=42}, bar={$delete=[baz]}, $delete=[qux]}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

    ((DataMap)map2.get("bar")).remove("baz");
    map2.put("foo", 42);
    map2.remove("qux");

    PatchTree patch = new PatchTree();
    patch.addOperation(new PathSpec("foo"), PatchOpFactory.setFieldOp(42));
    patch.addOperation(new PathSpec("bar", "baz"), PatchOpFactory.REMOVE_FIELD_OP);
    patch.addOperation(new PathSpec("qux"), PatchOpFactory.REMOVE_FIELD_OP);
    Assert.assertEquals(patch.toString(), "{$set={foo=42}, bar={$delete=[baz]}, $delete=[qux]}");
  }
View Full Code Here

Examples of com.linkedin.data.schema.PathSpec

  }

  @Test
  public void testSelfReferencePathSpec()
  {
    PathSpec p = AliasTest.fields().a1().a1().a1().a1();
    Assert.assertEquals(p.toString(), "/a1/a1/a1/a1");
  }
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.