axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r109496 - in webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis: engine om om/builder om/builder/dummy om/impl/streamwrapper
Date Thu, 02 Dec 2004 13:19:07 GMT
Author: hemapani
Date: Thu Dec  2 05:19:05 2004
New Revision: 109496

URL: http://svn.apache.org/viewcvs?view=rev&rev=109496
Log:
refactored some of the test classes. checking in on behalf of Ajith
Removed:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeAnotherTest.java
Modified:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/CompareOMWithDOMTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/IteratorTester.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/MessagesTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java
Thu Dec  2 05:19:05 2004
@@ -15,6 +15,7 @@
  */
 package org.apache.axis.engine;
 
+//todo
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
@@ -64,29 +65,29 @@
 
 
     public void testEchoStringServer() throws Exception{
-    	File file = new File("src/test-resources/soap/soapmessage.txt");
+    	File file = getTestResourceFile("soap/soapmessage.txt");
     	FileInputStream in = new FileInputStream(file);
     	
     	Socket socket = new Socket("127.0.0.1",testingPort);
-    	System.out.println("scoket created");
     	OutputStream out = socket.getOutputStream();
     	byte[]  buf = new byte[1024];
     	int index = -1;
     	while((index = in.read(buf)) > 0){
     		out.write(buf,0,index);
     	}
-    	System.out.println("Message Send");
+
     	
     	InputStream respose = socket.getInputStream();
     	Reader rReader = new InputStreamReader(respose);
     	char[] charBuf = new char[1024];
     	while((index = rReader.read(charBuf)) > 0){
-        	System.out.println(charBuf);    		
+
     	}
     	
     	in.close();
     	out.close();
-    	rReader.close();
+
+        rReader.close();
     	socket.close();
     }
 }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/CompareOMWithDOMTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/CompareOMWithDOMTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/CompareOMWithDOMTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/CompareOMWithDOMTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/CompareOMWithDOMTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/CompareOMWithDOMTest.java
Thu Dec  2 05:19:05 2004
@@ -41,7 +41,8 @@
         if(files != null){
             for(int i = 0;i<files.length;i++){
                 if(files[i].isFile() && files[i].getName().endsWith(".xml")){
-                    OMEnvelope soapEnvelope = OMTestUtils.getOMBuilder(files[i].getAbsolutePath()).getOMEnvelope();
+                    OMEnvelope soapEnvelope = OMTestUtils.getOMBuilder(
+                            files[i]).getOMEnvelope();
                     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                     dbf.setNamespaceAware(true);
                     DocumentBuilder builder = dbf.newDocumentBuilder();

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/IteratorTester.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/IteratorTester.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/IteratorTester.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/IteratorTester.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/IteratorTester.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/IteratorTester.java
Thu Dec  2 05:19:05 2004
@@ -8,6 +8,7 @@
 import junit.framework.TestCase;
 
 import org.apache.axis.impl.llom.builder.OMStAXBuilder;
+import org.apache.axis.AbstractTestCase;
 
 /**
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -29,18 +30,18 @@
  * Time: 12:34:15 PM
  * 
  */
-public class IteratorTester extends TestCase{
-    private static final String IN_FILE_NAME = "resources/soapmessage.xml";
-    private static final String IN_FILE_NAME2 = "src/test-resources/soap/sample1.xml";
+public class IteratorTester extends AbstractTestCase{
+
     OMEnvelope envelope = null;
 
+    public IteratorTester(String testName) {
+        super(testName);
+    }
+
     protected void setUp() throws Exception {
-//        XmlPullParser parser= XmlPullParserFactory.newInstance().newPullParser();
-//		parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
-//		parser.setInput();
-//        ;
 		envelope = new OMStAXBuilder(XMLInputFactory.newInstance().
-                createXMLStreamReader(new FileReader(IN_FILE_NAME2))).getOMEnvelope();
+                createXMLStreamReader(
+                        new FileReader(getTestResourceFile("soap/sample1.xml")))).getOMEnvelope();
     }
 
     public void testIterator(){
@@ -49,9 +50,7 @@
 
         while (iter.hasNext()) {
             OMNode o = (OMNode) iter.next();
-            System.out.println("o = " + o);
-            if (o!=null)
-            System.out.println("value o " + o.getValue());
+            assertNotNull(o);//todo make this better
         }
 
     }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/MessagesTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/MessagesTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/MessagesTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/MessagesTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/MessagesTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/MessagesTest.java
Thu Dec  2 05:19:05 2004
@@ -29,22 +29,22 @@
     }
 
     public void testMessageWithLotOfWhiteSpaces() throws OMException, Exception {
-        soapEnvelope = OMTestUtils.getOMBuilder("src/test-resources/soap/whitespacedMessage.xml").getOMEnvelope();
+        soapEnvelope = OMTestUtils.getOMBuilder(getTestResourceFile("soap/whitespacedMessage.xml")).getOMEnvelope();
         OMTestUtils.walkThrough(soapEnvelope);
     }
     
     public void testMinimalMessage() throws OMException, Exception {
-        soapEnvelope = OMTestUtils.getOMBuilder("src/test-resources/soap/minimalMessage.xml").getOMEnvelope();
+        soapEnvelope = OMTestUtils.getOMBuilder(getTestResourceFile("/soap/minimalMessage.xml")).getOMEnvelope();
         OMTestUtils.walkThrough(soapEnvelope);
     }
     
     public void testReallyBigMessage() throws OMException, Exception {
-        soapEnvelope = OMTestUtils.getOMBuilder("src/test-resources/soap/reallyReallyBigMessage.xml").getOMEnvelope();
+        soapEnvelope = OMTestUtils.getOMBuilder(getTestResourceFile("soap/reallyReallyBigMessage.xml")).getOMEnvelope();
         OMTestUtils.walkThrough(soapEnvelope);
     }
     
     public void testEmptyBodiedMessage() throws OMException, Exception {
-        soapEnvelope = OMTestUtils.getOMBuilder("src/test-resources/soap/emtyBodymessage.xml").getOMEnvelope();
+        soapEnvelope = OMTestUtils.getOMBuilder(getTestResourceFile("/soap/emtyBodymessage.xml")).getOMEnvelope();
         OMTestUtils.walkThrough(soapEnvelope);
     }
 

Deleted: /webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeAnotherTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeAnotherTest.java?view=auto&rev=109495
==============================================================================

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMEnvelopeTest.java
Thu Dec  2 05:19:05 2004
@@ -1,22 +1,22 @@
 /**
-* Copyright 2001-2004 The Apache Software Foundation.
-* <p/>
-* 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
-* <p/>
-* http://www.apache.org/licenses/LICENSE-2.0
-* <p/>
-* 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.
-* <p/>
-* Author: Eran Chinthaka - Lanka Software Foundation
-* Date: Nov 2, 2004
-* Time: 2:39:39 PM
-*/
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ * Author: Eran Chinthaka - Lanka Software Foundation
+ * Date: Nov 2, 2004
+ * Time: 2:39:39 PM
+ */
 package org.apache.axis.om;
 
 
@@ -29,13 +29,27 @@
     protected void setUp() throws Exception {
         super.setUp();
     }
-    public void testGetHeader() {
+    public void testGetHeader1() {
         OMHeader header = soapEnvelope.getHeader();
         assertTrue("Header information retrieved not correct", ( header != null &&
header.getLocalName().equalsIgnoreCase("Header")) );
     }
 
-    public void testGetBody() {
+    public void testGetBody1() {
         OMBody body = soapEnvelope.getBody();
+        assertTrue("Header information retrieved not correct", ( body != null &&
body.getLocalName().equalsIgnoreCase("Body")) );
+    }
+
+    private OMEnvelope getSecondEnvelope() throws Exception {
+        return OMTestUtils.getOMBuilder(getTestResourceFile("/soap/sample1.xml")).getOMEnvelope();
+    }
+
+    public void testGetHeader2() throws Exception {
+        OMHeader header = getSecondEnvelope().getHeader();
+        assertTrue("Header information retrieved not correct", ( header != null &&
header.getLocalName().equalsIgnoreCase("Header")) );
+    }
+
+    public void testGetBody2() throws Exception {
+        OMBody body = getSecondEnvelope().getBody();
         assertTrue("Header information retrieved not correct", ( body != null &&
body.getLocalName().equalsIgnoreCase("Body")) );
     }
 }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMNavigatorTest.java
Thu Dec  2 05:19:05 2004
@@ -1,6 +1,9 @@
 package org.apache.axis.om;
 
 import java.io.FileReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
@@ -11,6 +14,7 @@
 import org.apache.axis.impl.llom.builder.OMStAXBuilder;
 import org.apache.axis.impl.llom.factory.OMLinkedListImplFactory;
 import org.apache.axis.impl.llom.serialize.SimpleOMSerializer;
+import org.apache.axis.AbstractTestCase;
 
 /**
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -32,86 +36,84 @@
  * Time: 4:35:04 PM
  * 
  */
-public class OMNavigatorTest extends TestCase{
-    private static final String IN_FILE_NAME2 = "src/test-resources/soap/soapmessage1.xml";
+public class OMNavigatorTest extends AbstractTestCase {
+
     private OMEnvelope envelope = null;
     private SimpleOMSerializer serilizer;
     private OMStAXBuilder builder;
+    private File tempFile;
+
+    public OMNavigatorTest(String testName) {
+        super(testName);
+    }
 
     protected void setUp() throws Exception {
         XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
-                createXMLStreamReader(new FileReader(IN_FILE_NAME2));
+                createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
         OMFactory factory = new OMLinkedListImplFactory();
-        builder = new OMStAXBuilder(factory,xmlStreamReader);
+        builder = new OMStAXBuilder(factory, xmlStreamReader);
         envelope = builder.getOMEnvelope();
         serilizer = new SimpleOMSerializer();
+
+        tempFile = File.createTempFile("temp", "xml");
     }
 
 
-    public void testnavigatorFullyBuilt(){
-        System.out.println(" #######  Testing fully built OM tree ########");
+    public void testnavigatorFullyBuilt() throws Exception {
+
         assertNotNull(envelope);
-        serilizer.serialize(envelope,System.out);
+        //dump the out put to a  temporary file
+        try {
+            serilizer.serialize(envelope, new FileOutputStream(tempFile));
+        } catch (FileNotFoundException e) {
+            throw e;
+        }
 
-        //now the OM is fully created
+        //now the OM is fully created test the navigation
         OMNavigator navigator = new OMNavigator(envelope);
-        OMNode node=null;
-        while(navigator.isNavigable()){
-            node = navigator.next();
+        OMNode node = null;
 
+        while (navigator.isNavigable()) {
+            node = navigator.next();
             assertNotNull(node);
-
-            System.out.println("node = " + node);
-            System.out.println("node.getValue() = " + node.getValue());
-
         }
-
     }
 
-    public void testnavigatorHalfBuilt(){
-        System.out.println(" #######  Testing partially built OM tree ########");
+    public void testnavigatorHalfBuilt() {
         assertNotNull(envelope);
-
-        //now the OM is not fully created
+        //now the OM is not fully created. Try to navigate it
         OMNavigator navigator = new OMNavigator(envelope);
-        OMNode node=null;
+        OMNode node = null;
 
-        while(navigator.isNavigable()){
+        while (navigator.isNavigable()) {
             node = navigator.next();
-
             assertNotNull(node);
-
-            System.out.println("node = " + node);
-            System.out.println("node.getValue() = " + node.getValue());
-
         }
-
     }
-    public void testnavigatorHalfBuiltStep(){
-        System.out.println(" #######  Testing partially built OM tree With Stepping########");
+
+    public void testnavigatorHalfBuiltStep() {
         assertNotNull(envelope);
 
         //now the OM is not fully created
         OMNavigator navigator = new OMNavigator(envelope);
-        OMNode node=null;
+        OMNode node = null;
 
-        while(!navigator.isCompleted()){
-            if (navigator.isNavigable()){
+        while (!navigator.isCompleted()) {
+            if (navigator.isNavigable()) {
                 node = navigator.next();
-            }else{
+            } else {
                 builder.next();
                 navigator.step();
-                node=navigator.next();
+                node = navigator.next();
             }
-
             assertNotNull(node);
 
-            System.out.println("node = " + node);
-            System.out.println("node.getValue() = " + node.getValue());
-
         }
 
     }
 
+    protected void tearDown() throws Exception {
+        tempFile.delete();
+    }
 
 }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTest.java
Thu Dec  2 05:19:05 2004
@@ -58,7 +58,7 @@
      */
 
     public void testNullInChilderen(){
-        isNullChildrenAreThere(envelope);
+        isNullChildrenThere(envelope);
     }
     
     /**
@@ -69,13 +69,13 @@
         isNameSpacesMissing(envelope);
     }
     
-    public void isNullChildrenAreThere(OMElement omeleent){
+    public void isNullChildrenThere(OMElement omeleent){
         Iterator it = omeleent.getChildren();
         while(it.hasNext()){
             OMNode node = (OMNode)it.next();
             assertNotNull(node);
             if(node.getType() == OMNode.ELEMENT_NODE){
-                isNullChildrenAreThere((OMElement)node);
+                isNullChildrenThere((OMElement)node);
             }
         }
     }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java
Thu Dec  2 05:19:05 2004
@@ -17,6 +17,7 @@
 package org.apache.axis.om;
 
 import java.io.FileReader;
+import java.io.File;
 import java.util.Iterator;
 
 import junit.framework.TestCase;
@@ -32,7 +33,8 @@
  * @author Srinath Perera(hemapani@opensource.lk)
  */
 public class OMTestUtils {
-    public static OMXPPWrapper getOMBuilder(String file) throws Exception {
+
+    public static OMXPPWrapper getOMBuilder(File file) throws Exception {
         XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
         parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
         parser.setInput(new FileReader(file));
@@ -63,10 +65,7 @@
         if(ele == null && omele == null){
             return;
         }else if(ele != null && omele != null){
-            System.out.println("@@@ ele = " +ele +" = " + "omele = "+ omele);
-            
-            System.out.println(ele.getLocalName() +" = " + omele.getLocalName());
-            System.out.println(ele.getNamespaceURI()+" = " + omele.getNamespace().getValue());
+
             TestCase.assertTrue(ele.getLocalName().equals(omele.getLocalName()));
             TestCase.assertTrue(ele.getNamespaceURI().equals(omele.getNamespace().getValue()));
             

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/ObjectToOMBuilderTest.java
Thu Dec  2 05:19:05 2004
@@ -49,17 +49,17 @@
     }
 
     public void testBuilding(){
-        System.out.println("element = " + element.isComplete());
+
 
         objectToOMBuilder.next();
 
         Iterator children = element.getChildren();
         while (children.hasNext()) {
             OMNode omNode = (OMNode) children.next();
-            System.out.println("omNode = " + omNode.getValue());
+            assertNotNull(omNode);
         }
 
-        System.out.println("element = " + element.isComplete());
+
     }
 
 

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java
Thu Dec  2 05:19:05 2004
@@ -41,7 +41,6 @@
         try {
             parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
             System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
-            System.out.println(System.getProperty("org.xml.sax.driver"));
 
         } catch (SAXException e) {
             e.printStackTrace();  //TODO implement this

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
Thu Dec  2 05:19:05 2004
@@ -7,11 +7,15 @@
 import org.apache.axis.impl.llom.builder.OMStAXBuilder;
 import org.apache.axis.impl.llom.wrapper.OMStAXWrapper;
 import org.apache.axis.om.OMEnvelope;
+import org.apache.axis.AbstractTestCase;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamConstants;
 import java.io.FileReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
 
 /**
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -33,28 +37,33 @@
  * Time: 5:23:01 PM
  * 
  */
-public class OMStaxStreamingWrapperTest extends TestCase {
+public class OMStaxStreamingWrapperTest extends AbstractTestCase {
 
-    private static final String IN_FILE_NAME2 = "src/test-resources/soap/soapmessage1.xml";
     private OMEnvelope envelope = null;
     private SimpleOMSerializer serilizer;
     private OMStAXBuilder omStAXBuilder;
+    private File tempFile;
+
+    public OMStaxStreamingWrapperTest(String testName) {
+        super(testName);
+    }
 
     protected void setUp() throws Exception {
         XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
-                createXMLStreamReader(new FileReader(IN_FILE_NAME2));
+                createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
         OMFactory factory = new OMLinkedListImplFactory();
         omStAXBuilder = new OMStAXBuilder(factory, xmlStreamReader);
         envelope = omStAXBuilder.getOMEnvelope();
         serilizer = new SimpleOMSerializer();
+
+        tempFile = File.createTempFile("temp","xml");
     }
 
 
-    public void testWrapperFullOM() {
-        System.out.println(" # -----------------------Full OM-------------------------------
#");
+    public void testWrapperFullOM() throws FileNotFoundException {
         assertNotNull(envelope);
         //this serializing will cause the OM to fully build!
-        serilizer.serialize(envelope, System.out);
+        serilizer.serialize(envelope, new FileOutputStream(tempFile));
 
         //now the OM is fully created. Create the wrapper and see
         OMStAXWrapper wrapper = new OMStAXWrapper(omStAXBuilder, envelope);
@@ -64,28 +73,21 @@
             assertTrue(event>0);
         }
 
-        System.out.println(" # -----------------------Full OM end -------------------------------
#");
     }
 
     public void testWrapperHalfOM() {
-        System.out.println(" # -----------------------Half OM-------------------------------
#");
         assertNotNull(envelope);
 
         //now the OM is not fully created. Create the wrapper and see
         OMStAXWrapper wrapper = new OMStAXWrapper(omStAXBuilder, envelope);
-
         while (wrapper.hasNext()) {
             int event = wrapper.next();
             assertTrue(event>0);
-//            System.out.println("returnEvent = " + getEventString(event));
         }
-
-        System.out.println(" # -----------------------Half OM end-------------------------------
#");
     }
+
     public void testWrapperHalfOMWithCacheOff() {
-        System.out.println(" # -----------------------Half OM with cache off-------------------------------
#");
         assertNotNull(envelope);
-
         //now the OM is not fully created. Create the wrapper and see
         OMStAXWrapper wrapper = new OMStAXWrapper(omStAXBuilder, envelope);
         //set the switching allowed flag
@@ -93,27 +95,10 @@
         while (wrapper.hasNext()) {
             int event = wrapper.next();
             assertTrue(event>0);
-//            System.out.println("returnEvent = " + getEventString(event));
         }
-        System.out.println(" # -----------------------Half OM with cache off end-------------------------------
#");
     }
 
-    private String getEventString(int event){
-        String outStr = "";
-        switch (event){
-            case XMLStreamConstants.START_ELEMENT:
-                outStr = "START_ELEMENT";
-                break;
-            case XMLStreamConstants.END_ELEMENT:
-                outStr = "END_ELEMENT";
-                break;
-            case XMLStreamConstants.CHARACTERS:
-                outStr = "char";
-                break;
-            default:outStr = event+"";
-
-        }
-        return outStr;
+    protected void tearDown() throws Exception {
+        tempFile.delete();
     }
-
 }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java?view=diff&rev=109496&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java&r1=109495&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java&r2=109496
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
Thu Dec  2 05:19:05 2004
@@ -6,10 +6,13 @@
 import org.apache.axis.impl.llom.serialize.SimpleOMSerializer;
 import org.apache.axis.impl.llom.builder.OMStAXBuilder;
 import org.apache.axis.om.OMEnvelope;
+import org.apache.axis.AbstractTestCase;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 import java.io.FileReader;
+import java.io.File;
+import java.io.FileOutputStream;
 
 /**
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -31,30 +34,39 @@
  * Time: 3:54:54 PM
  * 
  */
-public class OmStAXBuilderTest extends TestCase{
+public class OmStAXBuilderTest extends AbstractTestCase{
 
-    private static final String FILE_NAME = "src/test-resources/soap/soapmessage1.xml";
     private OMFactory factory =null;
     private OMStAXBuilder builder;
     private SimpleOMSerializer serilizer;
-    protected void setUp() throws Exception {
+    private File tempFile;
+
+    public OmStAXBuilderTest(String testName) {
+        super(testName);
+    }
 
+    protected void setUp() throws Exception {
         factory = new OMLinkedListImplFactory();
-        XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new
FileReader(FILE_NAME));
+        XMLStreamReader reader = XMLInputFactory.newInstance().
+                createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage1.xml")));
         builder = new OMStAXBuilder(factory,reader);
         serilizer = new SimpleOMSerializer();
+
+        tempFile = File.createTempFile("temp", "xml");
     }
 
-    public void testStaxBuilder(){
+    public void testStaxBuilder()throws Exception{
 
         OMEnvelope envelope = builder.getOMEnvelope();
         assertNotNull(envelope);
-        serilizer.serialize(envelope,System.out);
+        serilizer.serialize(envelope,new FileOutputStream(tempFile));
 
 
     }
 
-
+    protected void tearDown() throws Exception {
+        tempFile.delete();
+    }
 
 
 }

Mime
View raw message