Package org.apache.avro.io.parsing

Examples of org.apache.avro.io.parsing.ResolvingGrammarGenerator


import org.junit.Test;

/** ResolvingGrammarGenerator tests that are not Parameterized.*/
public class TestResolvingGrammarGenerator2
  @Test public void testFixed() throws java.io.IOException {
    new ResolvingGrammarGenerator().generate
      (Schema.createFixed("MyFixed", null, null, 10),
       Schema.create(Schema.Type.BYTES));
    new ResolvingGrammarGenerator().generate
      (Schema.create(Schema.Type.BYTES),
       Schema.createFixed("MyFixed", null, null, 10));
  }
View Full Code Here


      throw new NullPointerException("writer cannot be null!");
    }
    if (null == reader) {
      throw new NullPointerException("reader cannot be null!");
    }
    return new ResolvingGrammarGenerator().generate(writer, reader);
  }
View Full Code Here

   */
  static void canRead(Schema writtenWith, Schema readUsing)
      throws SchemaValidationException {
    boolean error;
    try {
      error = Symbol.hasErrors(new ResolvingGrammarGenerator().generate(
          writtenWith, readUsing));
    } catch (IOException e) {
      throw new SchemaValidationException(readUsing, writtenWith, e);
    }
    if (error) {
View Full Code Here

  private Decoder backup;
 
  public ResolvingDecoder(Schema writer, Schema reader, Decoder in)
    throws IOException {
    super(new ResolvingGrammarGenerator().generate(writer, reader), in);
  }
View Full Code Here

   * @return  The opaque reolver.
   * @throws IOException
   */
  public static Object resolve(Schema writer, Schema reader)
    throws IOException {
    return new ResolvingGrammarGenerator().generate(writer, reader);
  }
View Full Code Here

   * @return  The opaque reolver.
   * @throws IOException
   */
  public static Object resolve(Schema writer, Schema reader)
    throws IOException {
    return new ResolvingGrammarGenerator().generate(writer, reader);
  }
View Full Code Here

// TODO: replace with AVRO-1315 when generally available
public class SchemaValidationUtil {

  public static boolean canRead(Schema writtenWith, Schema readUsing) {
    try {
      return !hasErrors(new ResolvingGrammarGenerator().generate(
          writtenWith, readUsing));
    } catch (IOException e) {
      return false;
    }
  }
View Full Code Here

   */
  private static boolean avroReadWriteSchemasCompatible(Schema writer,
      Schema reader) {
    Symbol rootSymbol;
    try {
      ResolvingGrammarGenerator g = new ResolvingGrammarGenerator();
      rootSymbol = g.generate(writer, reader);
    } catch (IOException e) {
      throw new DatasetException("IOException while generating grammar.", e);
    }

    return !hasErrorSymbol(rootSymbol);
View Full Code Here

// TODO: replace with AVRO-1315 when generally available
class SchemaValidationUtil {

  public static boolean canRead(Schema writtenWith, Schema readUsing) {
    try {
      return !hasErrors(new ResolvingGrammarGenerator().generate(
          writtenWith, readUsing));
    } catch (IOException e) {
      return false;
    }
  }
View Full Code Here

      throw new NullPointerException("writer cannot be null!");
    }
    if (null == reader) {
      throw new NullPointerException("reader cannot be null!");
    }
    return new ResolvingGrammarGenerator().generate(writer, reader);
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.io.parsing.ResolvingGrammarGenerator

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.