diff options
Diffstat (limited to 'branches/pre-spec-changes/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java')
-rw-r--r-- | branches/pre-spec-changes/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/branches/pre-spec-changes/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java b/branches/pre-spec-changes/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java deleted file mode 100644 index 080bc25039..0000000000 --- a/branches/pre-spec-changes/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.core.loader; - -import java.io.StringReader; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.DocumentBuilder; - -import junit.framework.TestCase; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -/** - * @version $Rev$ $Date$ - */ -public class PropertyParsingTestCase extends TestCase { - private XMLInputFactory xmlFactory; - private DocumentBuilder docBuilder; - private Element root; - - public void testComplexProperty() throws XMLStreamException { - String xml = "<property xmlns:foo='http://foo.com'>" - + "<foo:a>aValue</foo:a>" - + "<foo:b>InterestingURI</foo:b>" - + "</property>"; - - XMLStreamReader reader = getReader(xml); - StAXUtil.loadPropertyValue(reader, root); - NodeList childNodes = root.getChildNodes(); - assertEquals(2, childNodes.getLength()); - - Element e = (Element) childNodes.item(0); - assertEquals("http://foo.com", e.getNamespaceURI()); - assertEquals("a", e.getLocalName()); - assertEquals("aValue", e.getTextContent()); - e = (Element) childNodes.item(1); - assertEquals("http://foo.com", e.getNamespaceURI()); - assertEquals("b", e.getLocalName()); - assertEquals("InterestingURI", e.getTextContent()); - } - - public XMLStreamReader getReader(String xml) throws XMLStreamException { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); - reader.next(); - return reader; - } - - protected void setUp() throws Exception { - super.setUp(); - xmlFactory = XMLInputFactory.newInstance(); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docBuilder = docFactory.newDocumentBuilder(); - Document doc = docBuilder.newDocument(); - root = doc.createElement("value"); - } -} |