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.javax;
18:
19: import java.io.Reader;
20: import javax.xml.parsers.DocumentBuilderFactory;
21:
22: import org.compass.core.config.CompassEnvironment;
23: import org.compass.core.config.CompassSettings;
24: import org.compass.core.converter.mapping.xsem.XmlContentMappingConverter;
25: import org.compass.core.test.xml.AbstractXmlObjectTests;
26: import org.compass.core.xml.AliasedXmlObject;
27: import org.compass.core.xml.javax.NodeAliasedXmlObject;
28: import org.compass.core.xml.javax.converter.NodeXmlContentConverter;
29: import org.w3c.dom.Document;
30: import org.xml.sax.InputSource;
31:
32: /**
33: * @author kimchy
34: */
35: public class NodeXmlObjectTests extends 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: NodeXmlContentConverter.class.getName() });
49: }
50:
51: protected AliasedXmlObject buildAliasedXmlObject(String alias,
52: Reader data) throws Exception {
53: Document document = DocumentBuilderFactory.newInstance()
54: .newDocumentBuilder().parse(new InputSource(data));
55: return new NodeAliasedXmlObject(alias, document);
56: }
57:
58: public void testData4XmlContent() throws Exception {
59: innerTestData4XmlContent();
60: }
61:
62: }
|