Package org.waveprotocol.wave.model.experimental.schema.SchemaPattern

Examples of org.waveprotocol.wave.model.experimental.schema.SchemaPattern.Prologue


    checkValidation_ANA(test.validateAttributes(SAMPLE_ATTRIBUTES), "name1");
    checkValidation_ANA(test.validateAttributesUpdate(SAMPLE_ATTRIBUTES_UPDATE), "name1");
    assertEquals(0, test.validateCharacters("abcd"));
    assertNull(test.child("bad"));
    SchemaPattern test_prologueTest = test.child("prologueTest");
    Prologue test_prologueTest_prologue = test_prologueTest.prologue();
    assertEquals(3, test_prologueTest_prologue.size());
    assertEquals("element1", test_prologueTest_prologue.get(0).elementType());
    assertEquals("element2", test_prologueTest_prologue.get(1).elementType());
    assertEquals("element3", test_prologueTest_prologue.get(2).elementType());
    SchemaPattern test_prologueTest_prologue0 = test_prologueTest_prologue.get(0).pattern();
    assertEquals(0, test_prologueTest_prologue0.prologue().size());
    checkValidation_ANA(test_prologueTest_prologue0.validateAttributes(SAMPLE_ATTRIBUTES), "name1");
    checkValidation_ANA(test_prologueTest_prologue0.validateAttributesUpdate(
        SAMPLE_ATTRIBUTES_UPDATE), "name1");
    assertEquals(0, test_prologueTest_prologue0.validateCharacters("abcd"));
    assertNull(test_prologueTest_prologue0.child("bad"));
    SchemaPattern test_prologueTest_prologue1 = test_prologueTest_prologue.get(1).pattern();
    checkEmptyPattern(test_prologueTest_prologue1);
    SchemaPattern test_prologueTest_prologue2 = test_prologueTest_prologue.get(2).pattern();
    Prologue test_prologueTest_prologue2_prologue = test_prologueTest_prologue2.prologue();
    assertEquals(2, test_prologueTest_prologue2_prologue.size());
    assertEquals("element7", test_prologueTest_prologue2_prologue.get(0).elementType());
    assertEquals("element8", test_prologueTest_prologue2_prologue.get(1).elementType());
    checkValidation_ANA(test_prologueTest_prologue2.validateAttributes(SAMPLE_ATTRIBUTES), "name1");
    checkValidation_ANA(test_prologueTest_prologue2.validateAttributesUpdate(
        SAMPLE_ATTRIBUTES_UPDATE), "name1");
    assertEquals(0, test_prologueTest_prologue2.validateCharacters("abcd"));
    assertNull(test_prologueTest_prologue2.child("bad"));
    checkEmptyPattern(test_prologueTest_prologue0.child("element4"));
    checkEmptyPattern(test_prologueTest_prologue2_prologue.get(0).pattern());
    checkEmptyPattern(test_prologueTest_prologue2_prologue.get(1).pattern());
    checkEmptyPattern(test_prologueTest_prologue2.child("element5"));
    checkEmptyPattern(test_prologueTest_prologue2.child("element6"));
  }
View Full Code Here


  /**
   * Tests a schema featuring a top-level prologue.
   */
  public void testGoodSchema4() throws InvalidSchemaException, IOException, ParseException {
    SchemaPattern test = readSchema("good4.schema");
    Prologue test_prologue = test.prologue();
    assertEquals(3, test_prologue.size());
    assertEquals("element1", test_prologue.get(0).elementType());
    assertEquals("element2", test_prologue.get(1).elementType());
    assertEquals("element3", test_prologue.get(2).elementType());
    checkValidation_ANA(test.validateAttributes(SAMPLE_ATTRIBUTES), "name1");
    checkValidation_ANA(test.validateAttributesUpdate(SAMPLE_ATTRIBUTES_UPDATE), "name1");
    assertEquals(0, test.validateCharacters("abcd"));
    assertNull(test.child("bad"));
    SchemaPattern test_prologue0 = test_prologue.get(0).pattern();
    assertEquals(0, test_prologue0.prologue().size());
    checkValidation_ANA(test_prologue0.validateAttributes(SAMPLE_ATTRIBUTES), "name1");
    checkValidation_ANA(test_prologue0.validateAttributesUpdate(SAMPLE_ATTRIBUTES_UPDATE), "name1");
    assertEquals(0, test_prologue0.validateCharacters("abcd"));
    assertNull(test_prologue0.child("bad"));
    SchemaPattern test_prologue1 = test_prologue.get(1).pattern();
    checkEmptyPattern(test_prologue1);
    SchemaPattern test_prologue2 = test_prologue.get(2).pattern();
    Prologue test_prologue2_prologue = test_prologue2.prologue();
    assertEquals(2, test_prologue2_prologue.size());
    assertEquals("element7", test_prologue2_prologue.get(0).elementType());
    assertEquals("element8", test_prologue2_prologue.get(1).elementType());
    checkValidation_ANA(test_prologue2.validateAttributes(SAMPLE_ATTRIBUTES), "name1");
    checkValidation_ANA(test_prologue2.validateAttributesUpdate(SAMPLE_ATTRIBUTES_UPDATE), "name1");
    assertEquals(0, test_prologue2.validateCharacters("abcd"));
    assertNull(test_prologue2.child("bad"));
    checkEmptyPattern(test_prologue0.child("element4"));
    checkEmptyPattern(test_prologue2_prologue.get(0).pattern());
    checkEmptyPattern(test_prologue2_prologue.get(1).pattern());
    checkEmptyPattern(test_prologue2.child("element5"));
    checkEmptyPattern(test_prologue2.child("element6"));
  }
View Full Code Here

   * Tests a schema featuring the interleaving of prologues and referenced
   * patterns containing prologues.
   */
  public void testGoodSchema15() throws InvalidSchemaException, IOException, ParseException {
    SchemaPattern test = readSchema("good15.schema");
    Prologue prologue = test.prologue();
    assertEquals(8, test.prologue().size());
    assertEquals("element1", prologue.get(0).elementType());
    assertEquals("element2", prologue.get(1).elementType());
    assertEquals("element5", prologue.get(2).elementType());
    assertEquals("element6", prologue.get(3).elementType());
    assertEquals("element3", prologue.get(4).elementType());
    assertEquals("element4", prologue.get(5).elementType());
    assertEquals("element5", prologue.get(6).elementType());
    assertEquals("element6", prologue.get(7).elementType());
    assertNotNull(prologue.get(0).pattern().child("element7"));
    assertNotNull(prologue.get(1).pattern().child("element8"));
    assertNotNull(prologue.get(2).pattern().child("element11"));
    assertNotNull(prologue.get(3).pattern().child("element12"));
    assertNotNull(prologue.get(4).pattern().child("element9"));
    assertNotNull(prologue.get(5).pattern().child("element10"));
    assertNotNull(prologue.get(6).pattern().child("element11"));
    assertNotNull(prologue.get(7).pattern().child("element12"));
  }
View Full Code Here

    for (IntermediatePrologueFragment prologueFragment : prologue) {
      // TODO(user): Concatenating prologues can by slightly optimized here.
      prologueEntries.addAll(prologueFragment.resolveTopLevel(state));
    }
    SchemaPattern compiledPattern = new SchemaPattern();
    compiledPattern.initialize(attributesPattern.createValidator(), new Prologue(prologueEntries),
        allowedChildrenMap, characterPattern.createValidator());
    state.undergoingResolution.remove(reference);
    referenceData = new ReferenceData(compiledPattern, allowedChildrenMap, attributesPattern,
        characterPattern);
    state.references.put(reference, referenceData);
View Full Code Here

    importReferences(allowedChildrenMap, state);
    List<PrologueEntry> compiledPrologue = new ArrayList<PrologueEntry>();
    for (IntermediatePrologueFragment prologueFragment : prologue) {
      compiledPrologue.addAll(prologueFragment.compile(state));
    }
    pattern.initialize(attributesPattern.createValidator(), new Prologue(compiledPrologue),
        allowedChildrenMap, characterPattern.createValidator());
  }
View Full Code Here

    for (IntermediatePrologueFragment prologueFragment : prologue) {
      // TODO(user): Concatenating prologues can by slightly optimized here.
      prologueEntries.addAll(prologueFragment.resolveTopLevel(state));
    }
    SchemaPattern compiledPattern = new SchemaPattern();
    compiledPattern.initialize(attributesPattern.createValidator(), new Prologue(prologueEntries),
        allowedChildrenMap, characterPattern.createValidator());
    state.undergoingResolution.remove(reference);
    referenceData = new ReferenceData(compiledPattern, allowedChildrenMap, attributesPattern,
        characterPattern);
    state.references.put(reference, referenceData);
View Full Code Here

    importReferences(allowedChildrenMap, state);
    List<PrologueEntry> compiledPrologue = new ArrayList<PrologueEntry>();
    for (IntermediatePrologueFragment prologueFragment : prologue) {
      compiledPrologue.addAll(prologueFragment.compile(state));
    }
    pattern.initialize(attributesPattern.createValidator(), new Prologue(compiledPrologue),
        allowedChildrenMap, characterPattern.createValidator());
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.experimental.schema.SchemaPattern.Prologue

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.