KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > types > XMLCatalogBuildFileTest


1 /*
2  * Copyright 2001-2002,2004-2005 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 package org.apache.tools.ant.types;
19
20 import org.apache.tools.ant.BuildException;
21 import org.apache.tools.ant.Project;
22 import org.apache.tools.ant.BuildFileTest;
23
24 import junit.framework.TestCase;
25 import junit.framework.AssertionFailedError;
26
27 /**
28  * BuildFileTest testcases for org.apache.tools.ant.types.XMLCatalog
29  *
30  * @see org.apache.tools.ant.types.XMLCatalogTest
31  *
32  */

33 public class XMLCatalogBuildFileTest extends BuildFileTest {
34
35     public XMLCatalogBuildFileTest(String JavaDoc name) {
36         super(name);
37     }
38
39     public void setUp() {
40     }
41
42     public void tearDown() {
43     }
44
45     //
46
// Ensure that an external entity resolves as expected with NO
47
// XMLCatalog involvement:
48
//
49
// Transform an XML file that refers to the entity into a text
50
// file, stuff result into property: val1
51
//
52
public void testEntityNoCatalog() {
53         configureProject("src/etc/testcases/types/xmlcatalog.xml");
54         expectPropertySet("testentitynocatalog", "val1",
55                           "A stitch in time saves nine");
56     }
57
58     //
59
// Ensure that an external entity resolves as expected Using an
60
// XMLCatalog:
61
//
62
// Transform an XML file that refers to the entity into a text
63
// file, entity is listed in the XMLCatalog pointing to a
64
// different file. Stuff result into property: val2
65
//
66
public void testEntityWithCatalog() {
67         configureProject("src/etc/testcases/types/xmlcatalog.xml");
68         expectPropertySet("testentitywithcatalog", "val2",
69                           "No news is good news");
70     }
71
72     //
73
// Ensure that an external entity resolves as expected with NO
74
// XMLCatalog involvement:
75
//
76
// Transform an XML file that contains a reference to a _second_ XML file
77
// via the document() function. The _second_ XML file refers to an entity.
78
// Stuff result into the property: val3
79
//
80
public void testDocumentNoCatalog() {
81         configureProject("src/etc/testcases/types/xmlcatalog.xml");
82         expectPropertySet("testdocumentnocatalog", "val3",
83                           "A stitch in time saves nine");
84     }
85
86     //
87
// Ensure that an external entity resolves as expected Using an
88
// XMLCatalog:
89
//
90
// Transform an XML file that contains a reference to a _second_ XML file
91
// via the document() function. The _second_ XML file refers to an entity.
92
// The entity is listed in the XMLCatalog pointing to a different file.
93
// Stuff result into the property: val4
94
//
95
public void testDocumentWithCatalog() {
96         configureProject("src/etc/testcases/types/xmlcatalog.xml");
97         expectPropertySet("testdocumentwithcatalog", "val4",
98                           "No news is good news");
99     }
100 }
101
Popular Tags