jdk/test/javax/xml/jaxp/testng/validation/8037819/FixedAttrTest.java
changeset 27129 98b357b2e8a6
parent 27128 d1480cb49283
parent 27116 64a78dd93766
child 27130 41df50e7303d
equal deleted inserted replaced
27128:d1480cb49283 27129:98b357b2e8a6
     1 /*
       
     2  * Licensed to the Apache Software Foundation (ASF) under one or more
       
     3  * contributor license agreements.  See the NOTICE file distributed with
       
     4  * this work for additional information regarding copyright ownership.
       
     5  * The ASF licenses this file to You under the Apache License, Version 2.0
       
     6  * (the "License"); you may not use this file except in compliance with
       
     7  * the License.  You may obtain a copy of the License at
       
     8  *
       
     9  *      http://www.apache.org/licenses/LICENSE-2.0
       
    10  *
       
    11  * Unless required by applicable law or agreed to in writing, software
       
    12  * distributed under the License is distributed on an "AS IS" BASIS,
       
    13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14  * See the License for the specific language governing permissions and
       
    15  * limitations under the License.
       
    16  */
       
    17 
       
    18 import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
       
    19 import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
       
    20 import org.testng.annotations.AfterClass;
       
    21 import org.testng.annotations.BeforeClass;
       
    22 import org.testng.annotations.Test;
       
    23 
       
    24 /**
       
    25  * The purpose of this test is to execute all of the isComparable calls in
       
    26  * XMLSchemaValidator. There are two calls in processElementContent and two
       
    27  * calls in processOneAttribute.
       
    28  *
       
    29  * @author peterjm
       
    30  */
       
    31 public class FixedAttrTest extends BaseTest {
       
    32 
       
    33     protected String getXMLDocument() {
       
    34         return "fixedAttr.xml";
       
    35     }
       
    36 
       
    37     protected String getSchemaFile() {
       
    38         return "base.xsd";
       
    39     }
       
    40 
       
    41     public FixedAttrTest(String name) {
       
    42         super(name);
       
    43     }
       
    44 
       
    45     @BeforeClass
       
    46     protected void setUp() throws Exception {
       
    47         super.setUp();
       
    48     }
       
    49 
       
    50     @AfterClass
       
    51     protected void tearDown() throws Exception {
       
    52         super.tearDown();
       
    53     }
       
    54 
       
    55     @Test
       
    56     public void testDefault() {
       
    57         try {
       
    58             reset();
       
    59             validateDocument();
       
    60         } catch (Exception e) {
       
    61             fail("Validation failed: " + e.getMessage());
       
    62         }
       
    63 
       
    64         assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
       
    65         assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
       
    66                 .getValidationAttempted());
       
    67         assertElementName("A", fRootNode.getElementDeclaration().getName());
       
    68 
       
    69         PSVIElementNSImpl child = super.getChild(1);
       
    70         assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
       
    71         assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
       
    72                 .getValidationAttempted());
       
    73         assertElementName("B", child.getElementDeclaration().getName());
       
    74 
       
    75         child = super.getChild(2);
       
    76         assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
       
    77         assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
       
    78                 .getValidationAttempted());
       
    79         assertElementName("D", child.getElementDeclaration().getName());
       
    80     }
       
    81 }