Package com.linkedin.data.transform

Examples of com.linkedin.data.transform.DataComplexProcessor


      IOException,
      DataProcessingException
  {
    DataMap data = dataMapFromString("{ 'a': [1, 2, 3, 4, 5]}".replace('\'', '"'));
    DataMap filter = dataMapFromString("{ 'a': { '$*': { 'y': 1}}}".replace('\'', '"'));
    DataComplexProcessor processor = new DataComplexProcessor(new Filter(), filter, data);
    boolean thrown = false;
    try {
      processor.run(false);
    } catch (DataProcessingException e) {
      assertEquals(e.getMessages().size(), 5, "expected exactly 5 errors in non fast fail mode");
      thrown = true;
    }
    assertEquals(thrown, true, "exception should have been thrown");
View Full Code Here


      IOException,
      DataProcessingException
  {
    DataMap data = dataMapFromString("{ 'a': [1, 2, 3, 4, 5]}".replace('\'', '"'));
    DataMap filter = dataMapFromString("{ 'a': { '$*': { '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 in non fast fail mode");
      thrown = true;
    }
    assertEquals(thrown, true, "exception should have been thrown");
View Full Code Here

      IOException,
      DataProcessingException
  {
    DataMap data = dataMapFromString("{ 'a': [1, 2, 3, 4, 5]}".replace('\'', '"'));
    DataMap filter = dataMapFromString("{ 'a': { '$*': 'hola'}}".replace('\'', '"'));
    DataComplexProcessor processor = new DataComplexProcessor(new Filter(), filter, data);
    boolean thrown = false;
    try {
      processor.run(false);
    } catch (DataProcessingException e) {
      assertEquals(e.getMessages().size(), 1, "expected exactly 1 error in non fast fail mode");
      thrown = true;
    }
    assertEquals(thrown, true, "exception should have been thrown");
View Full Code Here

      DataProcessingException
  {
    DataMap data = dataMapFromString("{ 'a': { 'b': 'b'}}".replace('\'', '"'));
    DataMap filter = dataMapFromString("{ '$*': { 'c': { 'd': 0}}, 'a': 1}".replace('\'', '"'));
    String originalFilter = filter.toString();
    DataComplexProcessor processor = new DataComplexProcessor(new Filter(), filter, data);
    processor.run(false);
    assertEquals(filter.toString(), originalFilter, "filter should not be modified");
  }
View Full Code Here

      IOException,
      DataProcessingException
  {
    DataMap data = dataMapFromString("{ 'a': [1, 2, 3, 4, 5]}".replace('\'', '"'));
    DataMap filter = dataMapFromString("{ 'a': { '$start': -2, '$count': -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);
      thrown = true;
    }
    assertEquals(thrown, true, "exception should have been thrown");
View Full Code Here

    assert mask1 != null;

    try
    {
      final DataMap clone = mask1.copy();
      new DataComplexProcessor(new MaskComposition(), mask2, clone).run(true);
      return clone;
    }
    catch (CloneNotSupportedException e)
    {
      onError(fieldName, "could not clone mask: %1$s, exception: %2$s", mask1, e);
View Full Code Here

    map.put(lastSegment, op.getRepresentation());

    //compose existing tree with mask for specific field
    try
    {
      new DataComplexProcessor(new MaskComposition(), fieldMask, _representation).run(false);
    }
    catch (DataProcessingException e)
    {
      throw new IllegalStateException("error while building mask tree", e);
    }
View Full Code Here

  };

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

    }
  }

  @Test
  public void testImplicitSetOperationInPatchIsNotSupported() throws JsonParseException, IOException, DataProcessingException {
    DataComplexProcessor processor = new DataComplexProcessor(new Patch(),
                                                      dataMapFromString("{ \"a\": 1 }")//command $set should be used
                                                      dataMapFromString("{}"));
    boolean thrown = false;
    try
    {
      processor.run(false);
    }
    catch (DataProcessingException e)
    {
      thrown = true;
    }
View Full Code Here

  }

  @Test
  public void testMergingSimpleTypeValueWithComplexPatchNotSupported() throws JsonParseException, IOException, DataProcessingException {
    DataComplexProcessor processor = new DataComplexProcessor(new Patch(),
                                                      dataMapFromString("{ \"a\": { \"b\": 1} }")//command $set should be used
                                                      dataMapFromString("{\"a\": 1}"));
    boolean thrown = false;
    try
    {
      processor.run(false);
    }
    catch (DataProcessingException e)
    {
      thrown = true;
    }
View Full Code Here

TOP

Related Classes of com.linkedin.data.transform.DataComplexProcessor

Copyright © 2018 www.massapicom. 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.