Source Code Cross Referenced for XmlValidateTest.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs.optional 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:        package org.apache.tools.ant.taskdefs.optional;
019:
020:        import org.apache.tools.ant.BuildException;
021:        import org.apache.tools.ant.BuildFileTest;
022:
023:        /**
024:         * Tests the XMLValidate optional task, by running targets in the test script
025:         * <code>src/etc/testcases/taskdefs/optional/xmlvalidate.xml</code>
026:         * <p>
027:         *
028:         * @see XmlValidateCatalogTest
029:         * @since Ant 1.5
030:         */
031:        public class XmlValidateTest extends BuildFileTest {
032:
033:            /**
034:             * where tasks run
035:             */
036:            private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
037:
038:            /**
039:             * Constructor
040:             *
041:             * @param name testname
042:             */
043:            public XmlValidateTest(String name) {
044:                super (name);
045:            }
046:
047:            /**
048:             * The JUnit setup method
049:             */
050:            public void setUp() {
051:                configureProject(TASKDEFS_DIR + "xmlvalidate.xml");
052:            }
053:
054:            /**
055:             * The teardown method for JUnit
056:             */
057:            public void tearDown() {
058:            }
059:
060:            /**
061:             * Basic inline 'dtd' element test.
062:             */
063:            public void testValidate() throws Exception {
064:                executeTarget("testValidate");
065:            }
066:
067:            /**
068:             * Test indirect validation.
069:             */
070:            public void testDeepValidate() throws Exception {
071:                executeTarget("testDeepValidate");
072:            }
073:
074:            /**
075:             *
076:             */
077:            public void testXmlCatalog() {
078:                executeTarget("xmlcatalog");
079:            }
080:
081:            /**
082:             *
083:             */
084:            public void testXmlCatalogViaRefid() {
085:                executeTarget("xmlcatalogViaRefid");
086:            }
087:
088:            /**
089:             * Test that the nested dtd element is used when resolver.jar is not
090:             * present.  This test should pass either way.
091:             */
092:            public void testXmlCatalogFiles() {
093:                executeTarget("xmlcatalogfiles-override");
094:            }
095:
096:            /**
097:             * Test nested catalogpath.
098:             * Test that the nested dtd element is used when resolver.jar is not
099:             * present.  This test should pass either way.
100:             */
101:            public void testXmlCatalogPath() {
102:                executeTarget("xmlcatalogpath-override");
103:            }
104:
105:            /**
106:             * Test nested xmlcatalog definitions
107:             */
108:            public void testXmlCatalogNested() {
109:                executeTarget("xmlcatalognested");
110:            }
111:
112:            /**
113:             * Test xml schema validation
114:             */
115:            public void testXmlSchemaGood() throws BuildException {
116:                try {
117:                    executeTarget("testSchemaGood");
118:                } catch (BuildException e) {
119:                    if (e
120:                            .getMessage()
121:                            .endsWith(
122:                                    " doesn't recognize feature http://apache.org/xml/features/validation/schema")
123:                            || e
124:                                    .getMessage()
125:                                    .endsWith(
126:                                            " doesn't support feature http://apache.org/xml/features/validation/schema")) {
127:                        System.err
128:                                .println(" skipped, parser doesn't support schema");
129:                    } else {
130:                        throw e;
131:                    }
132:                }
133:            }
134:
135:            /**
136:             * Test xml schema validation
137:             */
138:            public void testXmlSchemaBad() {
139:                try {
140:                    executeTarget("testSchemaBad");
141:                    fail("Should throw BuildException because 'Bad Schema Validation'");
142:
143:                    expectBuildExceptionContaining("testSchemaBad",
144:                            "Bad Schema Validation", "not a valid XML document");
145:                } catch (BuildException e) {
146:                    if (e
147:                            .getMessage()
148:                            .endsWith(
149:                                    " doesn't recognize feature http://apache.org/xml/features/validation/schema")
150:                            || e
151:                                    .getMessage()
152:                                    .endsWith(
153:                                            " doesn't support feature http://apache.org/xml/features/validation/schema")) {
154:                        System.err
155:                                .println(" skipped, parser doesn't support schema");
156:                    } else {
157:                        assertTrue(e.getMessage().indexOf(
158:                                "not a valid XML document") > -1);
159:                    }
160:                }
161:            }
162:
163:            /**
164:             * iso-2022-jp.xml is valid but wouldn't get recognized on systems
165:             * with a different native encoding.
166:             *
167:             * Bug 11279
168:             */
169:            public void testIso2022Jp() {
170:                executeTarget("testIso2022Jp");
171:            }
172:
173:            /**
174:             * utf-8.xml is invalid as it contains non-UTF-8 characters, but
175:             * would pass on systems with a native iso-8859-1 (or similar)
176:             * encoding.
177:             *
178:             * Bug 11279
179:             */
180:            public void testUtf8() {
181:                expectBuildException("testUtf8", "invalid characters in file");
182:            }
183:
184:            // Tests property element, using XML schema properties as an example.
185:
186:            public void testPropertySchemaForValidXML() {
187:                executeTarget("testProperty.validXML");
188:            }
189:
190:            public void testPropertySchemaForInvalidXML() {
191:                expectBuildException("testProperty.invalidXML",
192:                        "XML file does not satisfy schema.");
193:            }
194:
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.