Package com.linkedin.data.transform

Examples of com.linkedin.data.transform.DataComplexProcessor.run()


    assertEquals(update.toString(), "{$delete=[description]}");
    assertFalse(g1.equals(g2));

    DataComplexProcessor processor = new DataComplexProcessor(new Patch(), update.getDataMap(), g1.data());
    processor.run(false);

    assertEquals(g1, g2);
  }

  @Test
View Full Code Here


    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$set={id=42, name=Some Group}}");
    assertFalse(g1.equals(g2));

    DataComplexProcessor processor = new DataComplexProcessor(new Patch(), update.getDataMap(), g1.data());
    processor.run(false);

    assertEquals(g1, g2);
  }

  @Test
View Full Code Here

    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$set={$foo=value}}");
    assertFalse(g1.equals(g2));

    DataComplexProcessor processor = new DataComplexProcessor(new Patch(), update.getDataMap(), g1.data());
    processor.run(false);

    assertEquals(g1, g2);
  }

  @Test(groups = {TestConstants.TESTNG_GROUP_KNOWN_ISSUE})
View Full Code Here

    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$$foo={$set={bar=42}}}");
    assertFalse(g1.equals(g2));

    DataComplexProcessor processor = new DataComplexProcessor(new Patch(), update.getDataMap(), g1.data());
    processor.run(false);

    assertEquals(g1, g2);
  }
}
View Full Code Here

  protected void genericFilterTest(DataMap data, DataMap filter,
                                        DataMap expected, String description) throws DataProcessingException {
    String dataBefore = data.toString();
    DataComplexProcessor processor = new DataComplexProcessor(new Filter(), filter, data);
    processor.run(false);
    assertEquals(data, expected, "The following test failed: \n" + description  +
                 "\nData: " + dataBefore + "\nFilter: " + filter +
                 "\nExpected: " + expected + "\nActual result: " + data);
  }
View Full Code Here

    DataMap f1 = dataMapFromString("{ 'a': { '$start': -2, '$count': -3}}".replace('\'', '"'));
    DataMap f2 = dataMapFromString("{ 'a': { '$start': 0}}".replace('\'', '"'));
    DataComplexProcessor processor = new DataComplexProcessor(new MaskComposition(), f2, f1);
    boolean thrown = false;
    try {
      processor.run(false);
    } catch (DataProcessingException e) {
      assertEquals(e.getMessages().size(), 2, "expected exactly 2 errors");
      thrown = true;
    }
    assertEquals(thrown, true, "exception should have been thrown");
View Full Code Here

  private void genericCompositionTest(DataMap data1, DataMap data2,
                                        DataMap expected, String description) throws DataProcessingException, CloneNotSupportedException {
    String dataBefore = data1.toString();
    String data2Clone = data2.toString();
    DataComplexProcessor processor = new DataComplexProcessor(new MaskComposition(), data2, data1);
    processor.run(false);
    assertEquals(data1, expected, "The following test failed: \n" + description  +
                 "\nData1: " + dataBefore + "\nData2: " + data2 +
                 "\nExpected: " + expected + "\nActual result: " + data1);
    assertEquals(data2.toString(), data2Clone, "Operation data should not be modified");
  }
View Full Code Here

    DataMap data = dataMapFromString("{ 'a': { 'x': 'a'}}".replace('\'', '"'));
    DataMap filter = dataMapFromString("{ 'a': { 'x': { 'y': 1}}}".replace('\'', '"'));
    DataComplexProcessor processor = new DataComplexProcessor(new Filter(), filter, data);
    boolean thrown = false;
    try {
      processor.run(true);
    } catch (DataProcessingException e) {
      assertEquals(e.getMessages().size(), 1, "expected exactly 1 error");
      Message m = e.getMessages().get(0);
      assertNotNull(m.getPath(), "path should be set on a message");
      assertEquals(m.getPath(), new Object[] {"a", "x"});
View Full Code Here

    DataMap data = dataMapFromString("{ 'a': { 'x': 'a'}, 'b': 'b'}".replace('\'', '"'));
    DataMap filter = dataMapFromString("{ 'a': { 'x': { 'y': 1}}, 'b': { 'z': 1}}".replace('\'', '"'));
    DataComplexProcessor processor = new DataComplexProcessor(new Filter(), filter, data);
    boolean thrown = false;
    try {
      processor.run(true);
    } catch (DataProcessingException e) {
      assertEquals(e.getMessages().size(), 1, "expected exactly 1 error in fast fail mode");
      thrown = true;
    }
    assertEquals(thrown, true, "exception should have been thrown");
View Full Code Here

    DataMap data = dataMapFromString("{ 'a': { 'x': 'a'}, 'b': 'b'}".replace('\'', '"'));
    DataMap filter = dataMapFromString("{ 'a': { 'x': { 'y': 1}}, 'b': { 'z': 1}}".replace('\'', '"'));
    DataComplexProcessor processor = new DataComplexProcessor(new Filter(), filter, data);
    boolean thrown = false;
    try {
      processor.run(false);
    } catch (DataProcessingException e) {
      assertEquals(e.getMessages().size(), 2, "expected exactly 2 errors in non fast fail mode");
      thrown = true;
    }
    assertEquals(thrown, true, "exception should have been thrown");
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.