Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/xml/jaxp/testng/validation/jdk8037819/BasicTest.java
41159 views
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
package validation.jdk8037819;
19
20
import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
21
import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
22
import org.testng.annotations.AfterClass;
23
import org.testng.annotations.BeforeClass;
24
import org.testng.annotations.Test;
25
import validation.BaseTest;
26
27
public class BasicTest extends BaseTest {
28
29
protected String getXMLDocument() {
30
return "base.xml";
31
}
32
33
protected String getSchemaFile() {
34
return "base.xsd";
35
}
36
37
public BasicTest(String name) {
38
super(name);
39
}
40
41
@BeforeClass
42
protected void setUp() throws Exception {
43
super.setUp();
44
}
45
46
@AfterClass
47
protected void tearDown() throws Exception {
48
super.tearDown();
49
}
50
51
@Test
52
public void testSimpleValidation() {
53
try {
54
reset();
55
validateDocument();
56
} catch (Exception e) {
57
fail("Validation failed: " + e.getMessage());
58
}
59
doValidityAsserts();
60
}
61
62
@Test
63
public void testSimpleValidationWithTrivialXSIType() {
64
try {
65
reset();
66
((PSVIElementNSImpl) fRootNode).setAttributeNS(
67
"http://www.w3.org/2001/XMLSchema-instance", "type", "X");
68
validateDocument();
69
} catch (Exception e) {
70
fail("Validation failed: " + e.getMessage());
71
}
72
doValidityAsserts();
73
}
74
75
private void doValidityAsserts() {
76
assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
77
assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
78
.getValidationAttempted());
79
assertElementName("A", fRootNode.getElementDeclaration().getName());
80
assertElementNamespaceNull(fRootNode.getElementDeclaration()
81
.getNamespace());
82
assertTypeName("X", fRootNode.getTypeDefinition().getName());
83
assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
84
}
85
}
86
87