congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
HollowSchemaParser.parseCollectionOfSchemas
Code IndexAdd Tabnine to your IDE (free)

How to use
parseCollectionOfSchemas
method
in
com.netflix.hollow.core.schema.HollowSchemaParser

Best Java code snippets using com.netflix.hollow.core.schema.HollowSchemaParser.parseCollectionOfSchemas (Showing top 7 results out of 315)

origin: Netflix/hollow

/**
 * Parse a collection of {@link HollowSchema}s from the provided String.
 *
 * @param schemas the schemas as a string
 * @return the list of schema
 * @throws IOException if the schema cannot be parsed
 */
public static List<HollowSchema> parseCollectionOfSchemas(String schemas) throws IOException {
  return parseCollectionOfSchemas(new StringReader(schemas));
}
origin: Netflix/hollow

/**
 * Reads a schema file into the provided HollowWriteStateEngine. The schema file must be on the classpath.
 *
 * @param schemaFilePath the path to the schema
 * @param engine the write state engine
 * @throws IOException if the schema could not be read
 */
public static void readSchemaFileIntoWriteState(String schemaFilePath, HollowWriteStateEngine engine)
    throws IOException {
  InputStream input = null;
  try {
    input = HollowWriteStateCreator.class.getClassLoader().getResourceAsStream(schemaFilePath);
    Collection<HollowSchema> schemas =
      HollowSchemaParser.parseCollectionOfSchemas(new BufferedReader(new InputStreamReader(input)));
    populateStateEngineWithTypeWriteStates(engine, schemas);
  } finally {
    if (input != null) {
      input.close();
    }
  }
}
origin: Netflix/hollow

@Test
public void parsesManySchemas() throws IOException {
  String manySchemas =
      "/* This is a comment\n" +
          "   consisting of multiple lines */\n" +
          " TypeA {\n" +
          "    int a1;\n" +
          "    \tstring a2; //This is a comment\n" +
          "    String a3;\n" +
          "}\n\n"+
          "MapOfStringToTypeA Map<String, TypeA>;\n"+
          "ListOfTypeA List<TypeA>;\n"+
          "TypeB { float b1; double b2; boolean b3; }";
  List<HollowSchema> schemas = HollowSchemaParser.parseCollectionOfSchemas(manySchemas);
  Assert.assertEquals(4, schemas.size());
}
origin: Netflix/hollow

  @Test
  public void testParseCollectionOfSchemas_reader() throws Exception {
    InputStream input = null;
    try {
      input = getClass().getResourceAsStream("/schema1.txt");
      List<HollowSchema> schemas =
          HollowSchemaParser.parseCollectionOfSchemas(new BufferedReader(new InputStreamReader(input)));
      Assert.assertEquals("Should have two schemas", 2, schemas.size());
      Assert.assertEquals("Should have Minion schema", "Minion", schemas.get(0).getName());
      Assert.assertEquals("Should have String schema", "String", schemas.get(1).getName());
    } finally {
      if (input != null) {
        input.close();
      }
    }
  }
}
origin: Netflix/hollow

@Test
public void sortsSchemasEvenIfDependencyTypesNotPresent() throws IOException {
  String schemasText = "TypeA { TypeB b; }"
            + "TypeB { TypeC c; }";
  
  
  List<HollowSchema> schemas = HollowSchemaParser.parseCollectionOfSchemas(schemasText);
  
  List<HollowSchema> sortedSchemas = HollowSchemaSorter.dependencyOrderedSchemaList(schemas);
  Assert.assertEquals(2, sortedSchemas.size());
  Assert.assertEquals("TypeB", sortedSchemas.get(0).getName());
  Assert.assertEquals("TypeA", sortedSchemas.get(1).getName());
}

origin: Netflix/hollow

@Test
public void schemasAreSortedBasedOnDependencies() throws IOException {
  String schemasText = "TypeB {"
            + "    ListOfString str;"
            + "}"
            + ""
            + "String {"
            + "    string value;"
            + "}"
            + ""
            + "ListOfString List<String>;"
            + ""
            + "TypeA {"
            + "    TypeB b;"
            + "    String str;"
            + "}";
  
  List<HollowSchema> schemas = HollowSchemaParser.parseCollectionOfSchemas(schemasText);
  
  List<HollowSchema> sortedSchemas = HollowSchemaSorter.dependencyOrderedSchemaList(schemas);
  
  Assert.assertEquals(4, sortedSchemas.size());
  Assert.assertEquals("String", sortedSchemas.get(0).getName());
  Assert.assertEquals("ListOfString", sortedSchemas.get(1).getName());
  Assert.assertEquals("TypeB", sortedSchemas.get(2).getName());
  Assert.assertEquals("TypeA", sortedSchemas.get(3).getName());
}

origin: Netflix/hollow

@Test
public void determinesIfSchemasAreTransitivelyDependent() throws IOException {
  String schemasText = "TypeA { TypeB b; }"
            + "TypeB { TypeC c; }"
            + "TypeC { TypeD d; }";
  
  List<HollowSchema> schemas = HollowSchemaParser.parseCollectionOfSchemas(schemasText);
  
  HollowWriteStateEngine stateEngine = new HollowWriteStateEngine();
  HollowWriteStateCreator.populateStateEngineWithTypeWriteStates(stateEngine, schemas);
  
  Assert.assertTrue(HollowSchemaSorter.typeIsTransitivelyDependent(stateEngine, "TypeA", "TypeB"));
  Assert.assertTrue(HollowSchemaSorter.typeIsTransitivelyDependent(stateEngine, "TypeA", "TypeC"));
  Assert.assertTrue(HollowSchemaSorter.typeIsTransitivelyDependent(stateEngine, "TypeB", "TypeC"));
  Assert.assertFalse(HollowSchemaSorter.typeIsTransitivelyDependent(stateEngine, "TypeC", "TypeB"));
  Assert.assertFalse(HollowSchemaSorter.typeIsTransitivelyDependent(stateEngine, "TypeB", "TypeA"));
  Assert.assertFalse(HollowSchemaSorter.typeIsTransitivelyDependent(stateEngine, "TypeC", "TypeA"));
}
com.netflix.hollow.core.schemaHollowSchemaParserparseCollectionOfSchemas

Javadoc

Parse a collection of HollowSchemas from the provided Reader.

Popular methods of HollowSchemaParser

  • parseSchema
    Parse a single HollowSchema from the provided String.
  • configureTokenizer
  • parseHashKey
  • parseKeyFieldPaths
  • parseListSchema
  • parseMapSchema
  • parseObjectSchema
  • parsePrimaryKey
  • parseSetSchema

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • getApplicationContext (Context)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • JButton (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now