com.sun.org.apache.xerces.internal.xs.ItemPSVI Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.xs.ItemPSVI. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IgnoreXSITypeTest_C_C.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkFalseResult() {
    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("Y", fRootNode.getTypeDefinition().getName());
    assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
}
 
Example #2
Source File: IgnoreXSITypeTest_A_A.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkResult() {
    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementName("A", fRootNode.getElementDeclaration().getName());
    assertTypeName("Y", fRootNode.getTypeDefinition().getName());
    assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
}
 
Example #3
Source File: RootTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testSettingToEqualType() {
    try {
        reset();
        fValidator.setProperty(ROOT_TYPE, typeX);
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("X", fRootNode.getTypeDefinition().getName());
}
 
Example #4
Source File: RootTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testSettingToDerivedType() {
    try {
        reset();
        // this is required to make it a valid type Y node
        ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "attr", "typeY");
        fValidator.setProperty(ROOT_TYPE, typeY);
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("Y", fRootNode.getTypeDefinition().getName());
}
 
Example #5
Source File: IgnoreXSITypeTest_C_AC.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkFalseResult() {
    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("Y", fRootNode.getTypeDefinition().getName());
    assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());

    child = super.getChild(2);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
}
 
Example #6
Source File: IgnoreXSITypeTest_C_AC.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkTrueResult() {
    assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertAnyType(fRootNode.getTypeDefinition());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());

    child = super.getChild(2);
    assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertAnyType(child.getTypeDefinition());
}
 
Example #7
Source File: IgnoreXSITypeTest_C_CA.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkFalseResult() {
    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("Y", fRootNode.getTypeDefinition().getName());
    assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());

    child = super.getChild(2);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
}
 
Example #8
Source File: IgnoreXSITypeTest_C_CA.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkTrueResult() {
    assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertAnyType(fRootNode.getTypeDefinition());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertAnyType(child.getTypeDefinition());

    child = super.getChild(2);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
}
 
Example #9
Source File: RootTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testSettingToNonDerivedType() {
    try {
        reset();
        fValidator.setProperty(ROOT_TYPE, typeZ);
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("Z", fRootNode.getTypeDefinition().getName());
}
 
Example #10
Source File: FixedAttrTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testDefault() {
    try {
        reset();
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementName("A", fRootNode.getElementDeclaration().getName());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("B", child.getElementDeclaration().getName());

    child = super.getChild(2);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("D", child.getElementDeclaration().getName());
}
 
Example #11
Source File: UseGrammarPoolOnlyTest_True.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The purpose of this test is to check if setting the USE_GRAMMAR_POOL_ONLY
 * feature to true causes external schemas to not be read. This
 * functionality already existed prior to adding the XSLT 2.0 validation
 * features; however, because the class that controlled it changed, this
 * test simply ensures that the existing functionality did not disappear.
 * -PM
 */
@Test
public void testUsingOnlyGrammarPool() {
    try {
        reset();
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_NONE, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertAnyType(fRootNode.getTypeDefinition());
}
 
Example #12
Source File: UseGrammarPoolOnlyTest_False.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The purpose of this test is to check if setting the USE_GRAMMAR_POOL_ONLY
 * feature to true causes external schemas to not be read. This
 * functionality already existed prior to adding the XSLT 2.0 validation
 * features; however, because the class that controlled it changed, this
 * test simply ensures that the existing functionality did not disappear.
 * -PM
 */
@Test
public void testUsingOnlyGrammarPool() {
    try {
        reset();
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementName("A", fRootNode.getElementDeclaration().getName());
    assertElementNamespace("xslt.unittests", fRootNode
            .getElementDeclaration().getNamespace());
    assertTypeName("W", fRootNode.getTypeDefinition().getName());
    assertTypeNamespace("xslt.unittests", fRootNode.getTypeDefinition()
            .getNamespace());
}
 
Example #13
Source File: RootTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testSettingToOtherSchemaType() {
    try {
        reset();
        ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
            SchemaSymbols.XSI_SCHEMALOCATION,
            "xslt.unittests otherNamespace.xsd");
        fValidator.setProperty(ROOT_TYPE, typeOtherNamespace);
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("W", fRootNode.getTypeDefinition().getName());
    assertTypeNamespace("xslt.unittests", fRootNode.getTypeDefinition()
            .getNamespace());
}
 
Example #14
Source File: RootTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testSettingTypeAndXSIType() {
    try {
        reset();
        // this is required to make it a valid type Y node
        ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "attr", "typeY");
        ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
                SchemaSymbols.XSI_TYPE, "Y");
        fValidator.setProperty(ROOT_TYPE, typeX);
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("Y", fRootNode.getTypeDefinition().getName());
}
 
Example #15
Source File: RootTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testSettingTypeAndInvalidXSIType() {
    try {
        reset();
        ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
                SchemaSymbols.XSI_TYPE, "Z");
        fValidator.setProperty(ROOT_TYPE, typeX);
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertError(INVALID_DERIVATION_ERROR);
    assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("Z", fRootNode.getTypeDefinition().getName());
}
 
Example #16
Source File: IgnoreXSITypeTest_A_C.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkResult() {
    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementName("A", fRootNode.getElementDeclaration().getName());
    assertTypeName("Y", fRootNode.getTypeDefinition().getName());
    assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
}
 
Example #17
Source File: RootTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * XERCESJ-1141 root-type-definition property not read by XMLSchemaValidator during reset()
 */
@Test
public void testUsingDocumentBuilderFactory() throws Exception {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setAttribute(ROOT_TYPE, typeX);
    dbf.setAttribute(DOCUMENT_CLASS_NAME,"com.sun.org.apache.xerces.internal.dom.PSVIDocumentImpl");
    dbf.setNamespaceAware(true);
    dbf.setValidating(false);

    SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    dbf.setSchema(sf.newSchema(fSchemaURL));

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document document = db.parse(fDocumentURL.toExternalForm());
    ElementPSVI rootNode = (ElementPSVI) document.getDocumentElement();

    assertValidity(ItemPSVI.VALIDITY_VALID, rootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, rootNode
            .getValidationAttempted());
    assertElementNull(rootNode.getElementDeclaration());
    assertTypeName("X", rootNode.getTypeDefinition().getName());
}
 
Example #18
Source File: Xerces1128doc1Test.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkResult() {
    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertTypeName("anyType", child.getTypeDefinition().getName());
    assertTypeNamespace("http://www.w3.org/2001/XMLSchema",
            child.getTypeDefinition().getNamespace());

    child = super.getChild(2);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertTypeName("X", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
}
 
Example #19
Source File: Xerces1128doc2Test.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void checkResult() {
    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertTypeName("X", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());

    child = super.getChild(2);
    assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
            .getValidationAttempted());
    assertElementNull(child.getElementDeclaration());
    assertTypeName("anyType", child.getTypeDefinition().getName());
    assertTypeNamespace("http://www.w3.org/2001/XMLSchema",
            child.getTypeDefinition().getNamespace());

}
 
Example #20
Source File: RootSimpleTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testSettingInvalidSimpleType() throws Exception {
    try {
        reset();
        fValidator.setProperty(ROOT_TYPE, typeNonNegInt);
    } catch (SAXException e1) {
        fail("Problem setting property: " + e1.getMessage());
    }

    try {
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertError(INVALID_TYPE_ERROR);
    assertError(MININCLUSIVE_DERIVATION_ERROR);
    assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("nonNegativeInteger", fRootNode.getTypeDefinition().getName());
}
 
Example #21
Source File: RootSimpleTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testSettingSimpleType() throws Exception {
    try {
        reset();
        fValidator.setProperty(ROOT_TYPE, typeString);
    } catch (SAXException e1) {
        fail("Problem setting property: " + e1.getMessage());
    }

    try {
        validateDocument();
    } catch (Exception e) {
        fail("Validation failed: " + e.getMessage());
    }

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("string", fRootNode.getTypeDefinition().getName());
}
 
Example #22
Source File: UnparsedEntityCheckingTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkDefault() {
    assertNoError(UNDECLARED_ENTITY);
    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementName("A", fRootNode.getElementDeclaration().getName());
    assertTypeName("X", fRootNode.getTypeDefinition().getName());
}
 
Example #23
Source File: UnparsedEntityCheckingTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkInvalid() {
    assertError(UNDECLARED_ENTITY);
    assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementName("A", fRootNode.getElementDeclaration().getName());
    assertTypeName("X", fRootNode.getTypeDefinition().getName());
}
 
Example #24
Source File: BaseTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void assertValidationAttempted(short expectedAttempted,
        short actualAttempted) {
    String expectedString = expectedAttempted == ItemPSVI.VALIDATION_FULL ? "full"
            : (expectedAttempted == ItemPSVI.VALIDATION_PARTIAL ? "partial"
                    : "none");
    String actualString = actualAttempted == ItemPSVI.VALIDATION_FULL ? "full"
            : (actualAttempted == ItemPSVI.VALIDATION_PARTIAL ? "partial"
                    : "none");
    String message = "{validity} was <" + actualString
            + "> but it should have been <" + expectedString + ">";
    assertEquals(message, expectedAttempted, actualAttempted);
}
 
Example #25
Source File: RootTypeDefinitionTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkDefault() {
    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementName("A", fRootNode.getElementDeclaration().getName());
    assertTypeName("X", fRootNode.getTypeDefinition().getName());
}
 
Example #26
Source File: BaseTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void assertValidity(short expectedValidity, short actualValidity) {
    String expectedString = expectedValidity == ItemPSVI.VALIDITY_VALID ? "valid"
            : (expectedValidity == ItemPSVI.VALIDITY_INVALID ? "invalid"
                    : "notKnown");
    String actualString = actualValidity == ItemPSVI.VALIDITY_VALID ? "valid"
            : (actualValidity == ItemPSVI.VALIDITY_INVALID ? "invalid"
                    : "notKnown");
    String message = "{validity} was <" + actualString
            + "> but it should have been <" + expectedString + ">";
    assertEquals(message, expectedValidity, actualValidity);
}
 
Example #27
Source File: IgnoreXSITypeTest_C_A.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkChild() {
    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("Y", child.getTypeDefinition().getName());
    assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
}
 
Example #28
Source File: IgnoreXSITypeTest_C_A.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkFalseResult() {
    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertTypeName("Y", fRootNode.getTypeDefinition().getName());
    assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());

    checkChild();
}
 
Example #29
Source File: IgnoreXSITypeTest_C_A.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkTrueResult() {
    assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
            .getValidationAttempted());
    assertElementNull(fRootNode.getElementDeclaration());
    assertAnyType(fRootNode.getTypeDefinition());

    checkChild();
}
 
Example #30
Source File: IdIdrefCheckingTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkValidResult() {
    assertNoError(DUPLICATE_ID);
    assertNoError(NO_ID_BINDING);

    assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
            .getValidationAttempted());
    assertElementName("A", fRootNode.getElementDeclaration().getName());
    assertTypeName("X", fRootNode.getTypeDefinition().getName());

    PSVIElementNSImpl child = super.getChild(1);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("idType", child.getTypeDefinition().getName());

    child = super.getChild(2);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("idType", child.getTypeDefinition().getName());

    child = super.getChild(3);
    assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
    assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
            .getValidationAttempted());
    assertElementName("A", child.getElementDeclaration().getName());
    assertTypeName("idrefType", child.getTypeDefinition().getName());
}