Examples of topLevelDataSchemas()


Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

    if (parser.hasError())
    {
      TestUtil.out.println("ERROR: " + parser.errorMessage());
      return null;
    }
    return (NamedDataSchema) parser.topLevelDataSchemas().get(parser.topLevelDataSchemas().size() - 1);
  }

  private static void testInputs(Object inputs[][], boolean isAvroUnionMode) throws IOException
  {
    for (Object[] row : inputs)
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

    if (parser.hasError())
    {
      TestUtil.out.println("ERROR: " + parser.errorMessage());
      return null;
    }
    return (NamedDataSchema) parser.topLevelDataSchemas().get(parser.topLevelDataSchemas().size() - 1);
  }

  private static void testInputs(Object inputs[][], boolean isAvroUnionMode) throws IOException
  {
    for (Object[] row : inputs)
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

          _log.error("Error parsing " + sourceFile.getPath() + ": " + schemaParser.errorMessageBuilder().toString());
          exitCode = 1;
          continue;
        }

        final DataSchema originalSchema = schemaParser.topLevelDataSchemas().get(0);
        if (!(originalSchema instanceof NamedDataSchema))
        {
          _log.error(sourceFile.getPath() + " does not contain valid NamedDataSchema");
          exitCode = 1;
          continue;
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

      parser.parse(schemaStream);
      if (parser.hasError())
      {
        return Collections.emptyList();
      }
      return parser.topLevelDataSchemas();
    }
    finally
    {
      schemaStream.close();
      if (parser.hasError())
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

    parser.parse(avroSchemaInJson);
    if (parser.hasError())
    {
      throw new IllegalArgumentException(parser.errorMessage());
    }
    assert(parser.topLevelDataSchemas().size() == 1);
    DataSchema dataSchema = parser.topLevelDataSchemas().get(0);
    DataSchema resultDataSchema = null;

    AvroToDataSchemaTranslationMode translationMode = options.getTranslationMode();
    if (translationMode == AvroToDataSchemaTranslationMode.RETURN_EMBEDDED_SCHEMA ||
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

    if (parser.hasError())
    {
      throw new IllegalArgumentException(parser.errorMessage());
    }
    assert(parser.topLevelDataSchemas().size() == 1);
    DataSchema dataSchema = parser.topLevelDataSchemas().get(0);
    DataSchema resultDataSchema = null;

    AvroToDataSchemaTranslationMode translationMode = options.getTranslationMode();
    if (translationMode == AvroToDataSchemaTranslationMode.RETURN_EMBEDDED_SCHEMA ||
        translationMode == AvroToDataSchemaTranslationMode.VERIFY_EMBEDDED_SCHEMA)
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

          embeddedSchemaParser.parse(Arrays.asList(schemaProperty));
          if (embeddedSchemaParser.hasError())
          {
            throw new IllegalArgumentException("Embedded schema is invalid\n" + embeddedSchemaParser.errorMessage());
          }
          assert(embeddedSchemaParser.topLevelDataSchemas().size() == 1);
          resultDataSchema = embeddedSchemaParser.topLevelDataSchemas().get(0);

          if (translationMode == AvroToDataSchemaTranslationMode.VERIFY_EMBEDDED_SCHEMA)
          {
            // additional verification to make sure that embedded schema translates to Avro schema
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

          if (embeddedSchemaParser.hasError())
          {
            throw new IllegalArgumentException("Embedded schema is invalid\n" + embeddedSchemaParser.errorMessage());
          }
          assert(embeddedSchemaParser.topLevelDataSchemas().size() == 1);
          resultDataSchema = embeddedSchemaParser.topLevelDataSchemas().get(0);

          if (translationMode == AvroToDataSchemaTranslationMode.VERIFY_EMBEDDED_SCHEMA)
          {
            // additional verification to make sure that embedded schema translates to Avro schema
            DataToAvroSchemaTranslationOptions dataToAvdoSchemaOptions = new DataToAvroSchemaTranslationOptions();
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

        .replace("##ANYRECORD_NAME", ANYRECORD_AVRO_FULL_NAME);
    String fullAvroSchemaJson = AVRO_SCHEMA_JSON_TEMPLATE.replace("##FIELDS", avroSchemaFieldsJsonAfterVariableExpansion);

    SchemaParser parser = TestUtil.schemaParserFromString(fullSchemaJson);
    assertFalse(parser.hasError(), parser.errorMessage());
    RecordDataSchema schema = (RecordDataSchema) parser.topLevelDataSchemas().get(2);

    String avroJsonOutput = SchemaTranslator.dataToAvroSchemaJson(schema);
    assertEquals(TestUtil.dataMapFromString(avroJsonOutput), TestUtil.dataMapFromString(fullAvroSchemaJson));
    Schema avroSchema = Schema.parse(avroJsonOutput);
    Schema avroSchema2 = SchemaTranslator.dataToAvroSchema(schema);
View Full Code Here

Examples of com.linkedin.data.schema.SchemaParser.topLevelDataSchemas()

              assertNotNull(schemaProperty);
              assertTrue(schemaProperty instanceof DataMap);

              // make sure embedded schema is same as the original schema
              SchemaParser schemaParser = TestUtil.schemaParserFromObjects(Arrays.asList(schemaProperty));
              DataSchema embeddedSchema = schemaParser.topLevelDataSchemas().get(0);
              assertEquals(embeddedSchema, schema.getDereferencedDataSchema());

              // look for optional default mode
              Object optionalDefaultModeProperty = ((DataMap) dataProperty).get(SchemaTranslator.OPTIONAL_DEFAULT_MODE_PROPERTY);
              assertNotNull(optionalDefaultMode);
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.