| Commit in servicemix/ws/xmlbeans/src/test/java/org/servicemix/ws/eventing on MAIN | |||
| SubscribeParseTest.java | +56 | added 1.1 | |
migrated the XMLBeans code into a sub module
servicemix/ws/xmlbeans/src/test/java/org/servicemix/ws/eventing
SubscribeParseTest.java added at 1.1
diff -N SubscribeParseTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ SubscribeParseTest.java 23 Aug 2005 09:03:17 -0000 1.1 @@ -0,0 +1,56 @@
+/**
+ *
+ * Copyright 2004 Protique Ltd
+ *
+ * Licensed 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.servicemix.ws.eventing;
+
+import junit.framework.TestCase;
+import org.apache.xmlbeans.XmlObject;
+import org.servicemix.ws.xmlbeans.eventing.SubscribeDocument;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class SubscribeParseTest extends TestCase {
+ public void testParseXmlBeansUsingURL() throws Exception {
+ SubscribeDocument doc = SubscribeDocument.Factory.parse(getClass().getResource("wse-subscribe.xml"));
+ //System.out.println("Parsed: " + doc);
+ }
+
+ public void testParseXmlBeansUsingStAX() throws Exception {
+ XMLStreamReader in = createXMLStreamReader(getClass().getResource("wse-subscribe.xml"));
+
+ XmlObject xmlObject = XmlObject.Factory.parse(in);
+ assertTrue("should be a SubscribeDocument: " + xmlObject.getClass(), xmlObject instanceof SubscribeDocument);
+
+ SubscribeDocument doc = (SubscribeDocument) xmlObject;
+ //System.out.println("Parsed: " + doc);
+ }
+
+ protected XMLStreamReader createXMLStreamReader(URL resource) throws XMLStreamException, IOException {
+ assertTrue("Found resource", resource != null);
+
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLStreamReader in = inputFactory.createXMLStreamReader(resource.openStream());
+ return in;
+ }
+}
