View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.buildcache.xml;
20  
21  import javax.xml.XMLConstants;
22  import javax.xml.parsers.DocumentBuilderFactory;
23  import javax.xml.validation.Schema;
24  import javax.xml.validation.SchemaFactory;
25  
26  import org.junit.jupiter.api.Disabled;
27  import org.junit.jupiter.api.Test;
28  
29  class XmlServiceTest {
30  
31      @Test
32      @Disabled("cache-build-1.0.0.xsd not found")
33      void testConfig() throws Exception {
34          SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
35          Schema schema = sf.newSchema(getClass().getResource("/build-cache-config-1.0.0.xsd"));
36          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
37          dbf.setNamespaceAware(true);
38          dbf.setSchema(schema);
39      }
40  
41      @Test
42      @Disabled("cache-build-1.0.0.xsd not found")
43      void testReport() throws Exception {
44          SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
45          Schema schema = sf.newSchema(getClass().getResource("/build-cache-report-1.0.0.xsd"));
46          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
47          dbf.setNamespaceAware(true);
48          dbf.setSchema(schema);
49      }
50  
51      @Test
52      @Disabled("cache-build-1.0.0.xsd not found")
53      void testBuild() throws Exception {
54          SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
55          Schema schema = sf.newSchema(getClass().getResource("/build-cache-build-1.0.0.xsd"));
56          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
57          dbf.setNamespaceAware(true);
58          dbf.setSchema(schema);
59      }
60  
61      @Test
62      @Disabled("cache-build-1.0.0.xsd not found")
63      void testDiff() throws Exception {
64          SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
65          Schema schema = sf.newSchema(getClass().getResource("/build-cache-diff-1.0.0.xsd"));
66          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
67          dbf.setNamespaceAware(true);
68          dbf.setSchema(schema);
69      }
70  }