1   /*
2    * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
3    * 
4    * This software is open source. 
5    * See the bottom of this file for the licence.
6    * 
7    * $Id: TestManualSchema.java,v 1.6 2004/06/25 08:03:48 maartenc Exp $
8    */
9   
10  package org.dom4j.datatype;
11  
12  import java.net.URL;
13  import junit.framework.Test;
14  import junit.framework.TestSuite;
15  import junit.textui.TestRunner;
16  
17  import org.dom4j.Document;
18  import org.dom4j.DocumentFactory;
19  import org.dom4j.io.SAXReader;
20  
21  
22  /*** Test harness for the XML Schema Data Type integration. These tests
23    * manually load the schemas
24    *
25    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
26    * @version $Revision: 1.6 $
27    */
28  public class TestManualSchema extends TestAutoSchema {
29  
30      protected static boolean VERBOSE = true;
31      
32      public static void main( String[] args ) {
33          TestRunner.run( suite() );
34      }
35      
36      public static Test suite() {
37          return new TestSuite( TestManualSchema.class );
38      }
39      
40      public TestManualSchema(String name) {
41          super(name);
42      }
43  
44      
45      // Implementation methods
46      //-------------------------------------------------------------------------                    
47      protected String getDocumentURI() {
48          return "/xml/test/schema/personal.xml";
49      }
50      
51      protected DocumentFactory loadDocumentFactory() throws Exception {
52          DatatypeDocumentFactory factory = new DatatypeDocumentFactory();
53          
54          SAXReader reader = new SAXReader();
55          
56          URL url = getClass().getResource("/xml/test/schema/personal.xsd");
57          Document schemaDocument = reader.read(url);
58          factory.loadSchema(schemaDocument);
59          return factory;
60      }
61  }
62  
63  
64  
65  
66  /*
67   * Redistribution and use of this software and associated documentation
68   * ("Software"), with or without modification, are permitted provided
69   * that the following conditions are met:
70   *
71   * 1. Redistributions of source code must retain copyright
72   *    statements and notices.  Redistributions must also contain a
73   *    copy of this document.
74   *
75   * 2. Redistributions in binary form must reproduce the
76   *    above copyright notice, this list of conditions and the
77   *    following disclaimer in the documentation and/or other
78   *    materials provided with the distribution.
79   *
80   * 3. The name "DOM4J" must not be used to endorse or promote
81   *    products derived from this Software without prior written
82   *    permission of MetaStuff, Ltd.  For written permission,
83   *    please contact dom4j-info@metastuff.com.
84   *
85   * 4. Products derived from this Software may not be called "DOM4J"
86   *    nor may "DOM4J" appear in their names without prior written
87   *    permission of MetaStuff, Ltd. DOM4J is a registered
88   *    trademark of MetaStuff, Ltd.
89   *
90   * 5. Due credit should be given to the DOM4J Project - 
91   *    http://www.dom4j.org
92   *
93   * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
94   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
95   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
96   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
97   * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
98   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
99   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
100  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
101  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
102  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
103  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
104  * OF THE POSSIBILITY OF SUCH DAMAGE.
105  *
106  * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
107  *
108  * $Id: TestManualSchema.java,v 1.6 2004/06/25 08:03:48 maartenc Exp $
109  */