01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.compass.core.test.xml.dom4j;
18:
19: import java.io.Reader;
20:
21: import org.compass.core.config.CompassEnvironment;
22: import org.compass.core.config.CompassSettings;
23: import org.compass.core.converter.mapping.xsem.XmlContentMappingConverter;
24: import org.compass.core.test.xml.AbstractXmlObjectTests;
25: import org.compass.core.xml.AliasedXmlObject;
26: import org.compass.core.xml.dom4j.Dom4jAliasedXmlObject;
27: import org.compass.core.xml.dom4j.converter.XPPReaderXmlContentConverter;
28: import org.dom4j.Document;
29: import org.dom4j.io.SAXReader;
30:
31: /**
32: * @author kimchy
33: */
34: public class Dom4jXmlXPPReaderObjectTests extends
35: AbstractXmlObjectTests {
36:
37: protected void addSettings(CompassSettings settings) {
38: settings
39: .setGroupSettings(
40: CompassEnvironment.Converter.PREFIX,
41: CompassEnvironment.Converter.DefaultTypeNames.Mapping.XML_CONTENT_MAPPING,
42: new String[] {
43: CompassEnvironment.Converter.TYPE,
44: CompassEnvironment.Converter.XmlContent.TYPE },
45: new String[] {
46: XmlContentMappingConverter.class
47: .getName(),
48: XPPReaderXmlContentConverter.class
49: .getName() });
50: }
51:
52: protected AliasedXmlObject buildAliasedXmlObject(String alias,
53: Reader data) throws Exception {
54: SAXReader reader = new SAXReader();
55: Document document = reader.read(data);
56: return new Dom4jAliasedXmlObject(alias, document
57: .getRootElement());
58: }
59:
60: public void testData4XmlContent() throws Exception {
61: innerTestData4XmlContent();
62: }
63: }
|