File: EmptySchema.java

package info (click to toggle)
libjibx1.2-java 1.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,260 kB
  • sloc: java: 75,013; xml: 14,068; makefile: 17
file content (99 lines) | stat: -rw-r--r-- 3,920 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

package org.jibx.schema.elements;

import org.jibx.schema.SchemaTestBase;

/**
 * Test handling of simple schemas.
 */
public class EmptySchema extends SchemaTestBase
{
    public static final String EMPTY_SCHEMA =
        "<schema xmlns='http://www.w3.org/2001/XMLSchema'/>";
        
    public static final String EMPTY_SCHEMA_ATTRIBUTES =
        "<schema targetNamespace='urn:anything'" +
        "    xmlns='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified'/>";
    
    public static final String EMPTY_SCHEMA_PREFIX =
        "<xsd:schema targetNamespace='urn:anything'" +
        "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified'/>";
    
    public static final String EMPTY_SCHEMA_EXTRA_NAMESPACES =
        "<xsd:schema targetNamespace='urn:anything'" +
        "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'" +
        "    xmlns:abc='urn:a' xmlns='urn:b'" +
        "    elementFormDefault='qualified'/>";
    
    public static final String EMPTY_SCHEMA_EXTRA_ATTRIBUTE =
        "<xsd:schema targetNamespace='urn:anything'" +
        "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'" +
        "    xmlns:abc='urn:a' xmlns='urn:b' abc:xyz='123'" +
        "    xmlns:def='urn:d' elementFormDefault='qualified'/>";
    
    public static final String EMPTY_SCHEMA_UNKNOWN_ATTRIBUTE =
        "<xsd:schema targetNamespace='urn:anything'" +
        "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'" +
        "    xmlns:abc='urn:a' xmlns='urn:b' xyz='123'" +
        "    elementFormDefault='qualified'/>";
    
    public static final String EMPTY_SCHEMA_ALL_ATTRIBUTES1 =
        "<xsd:schema xml:lang='en' targetNamespace='urn:anything'" +
        "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='qualified' attributeFormDefault='qualified'" +
        "    blockDefault='#all' finalDefault='#all' version='1.0'/>";
    
    public static final String EMPTY_SCHEMA_ALL_ATTRIBUTES2 =
        "<xsd:schema xml:lang='en' targetNamespace='urn:anything'" +
        "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='unqualified' attributeFormDefault='unqualified'" +
        "    blockDefault='extension restriction substitution'" +
        "    finalDefault='extension restriction' version='1.0'/>";
    
    public static final String EMPTY_SCHEMA_UNKNOWN_VALUES =
        "<xsd:schema xml:lang='en' targetNamespace='urn:anything'" +
        "    xmlns:xsd='http://www.w3.org/2001/XMLSchema'" +
        "    elementFormDefault='xxx' attributeFormDefault='yyy'" +
        "    blockDefault='extension zzz restriction'" +
        "    finalDefault='extension restriction www' version='1.0'/>";
        
    public void testEmpty() throws Exception {
        runNoErrors(EMPTY_SCHEMA);
    }
    
    public void testEmptyAttributes() throws Exception {
        runNoErrors(EMPTY_SCHEMA_ATTRIBUTES);
    }
    
    public void testEmptyPrefix() throws Exception {
        runNoErrors(EMPTY_SCHEMA_PREFIX);
    }
    
    public void testEmptyExtraNamespaces() throws Exception {
        runNoErrors(EMPTY_SCHEMA_EXTRA_NAMESPACES);
    }
    
    public void testEmptyExtraAttribute() throws Exception {
        runNoErrors(EMPTY_SCHEMA_EXTRA_ATTRIBUTE);
    }
    
    public void testEmptyUnknownAttribute() throws Exception {
        runOneError(EMPTY_SCHEMA_UNKNOWN_ATTRIBUTE,
            "Unknown attribute not reported");
    }
    
    public void testEmptyAllAttributes1() throws Exception {
        runNoErrors(EMPTY_SCHEMA_ALL_ATTRIBUTES1);
    }
    
    public void testEmptyAllAttributes2() throws Exception {
        runNoErrors(EMPTY_SCHEMA_ALL_ATTRIBUTES2);
    }
    
    public void testEmptyUnknownValues() throws Exception {
        runErrors(EMPTY_SCHEMA_UNKNOWN_VALUES, 4, 
            "Unknown attribute value not reported");
    }
}