You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2007/03/04 19:17:07 UTC
svn commit: r514453 [25/26] - in
/webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/
src/org/apache/axis2/addressing/ src/org/apache/axis2/addressing/wsdl/
src/org/apache/axis2/builder/ src/org/apache/axis2/client/
src/org/apache/axis2/...
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java Sun Mar 4 10:16:54 2007
@@ -17,11 +17,9 @@
package org.apache.axis2.engine;
import junit.framework.TestCase;
-
import org.apache.axis2.util.MetaDataEntry;
import org.apache.axis2.util.ObjectStateUtils;
-import javax.xml.namespace.QName;
import java.io.Externalizable;
import java.io.File;
import java.io.FileInputStream;
@@ -31,70 +29,63 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
-public class ObjectSaveTest extends TestCase
-{
+public class ObjectSaveTest extends TestCase {
private String testArg = null;
// simple constructor needed for nested class Externalizable interface
- public ObjectSaveTest()
- {
+ public ObjectSaveTest() {
}
- public ObjectSaveTest(String arg0)
- {
+ public ObjectSaveTest(String arg0) {
super(arg0);
testArg = new String(arg0);
}
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
//org.apache.log4j.BasicConfigurator.configure();
}
- public void testObjectSerializable() throws Exception
- {
- File theFile = null;
- String theFilename = null;
- boolean saved = false;
- boolean restored = false;
- boolean done = false;
+ public void testObjectSerializable() throws Exception {
+ File theFile = null;
+ String theFilename = null;
+ boolean saved = false;
+ boolean restored = false;
+ boolean done = false;
System.out.println("ObjectSaveTest:testObjectSerializable(): BEGIN ---------------");
// ---------------------------------------------------------
// setup an object to use
// ---------------------------------------------------------
- MetaDataEntry obj = new MetaDataEntry("object_1","object_1");
+ MetaDataEntry obj = new MetaDataEntry("object_1", "object_1");
// ---------------------------------------------------------
// setup a temporary file to use
// ---------------------------------------------------------
- try
- {
- theFile = File.createTempFile("objectTest",null);
+ try {
+ theFile = File.createTempFile("objectTest", null);
theFilename = theFile.getName();
- System.out.println("ObjectSaveTest:testObjectSerializable(): temp file = ["+theFilename+"]");
+ System.out.println(
+ "ObjectSaveTest:testObjectSerializable(): temp file = [" + theFilename + "]");
}
- catch (Exception ex)
- {
- System.out.println("ObjectSaveTest:testObjectSerializable(): error creating temp file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println(
+ "ObjectSaveTest:testObjectSerializable(): error creating temp file = [" +
+ ex.getMessage() + "]");
theFile = null;
}
- if (theFile != null)
- {
+ if (theFile != null) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -114,14 +105,17 @@
outStream.close();
saved = true;
- System.out.println("ObjectSaveTest:testObjectSerializable(): ....save operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testObjectSerializable(): ....save operation completed.....");
long filesize = theFile.length();
- System.out.println("ObjectSaveTest:testObjectSerializable(): file size after save ["+filesize+"] temp file = ["+theFilename+"]");
- }
- catch (Exception ex2)
- {
- System.out.println("ObjectSaveTest:testObjectSerializable(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ System.out.println(
+ "ObjectSaveTest:testObjectSerializable(): file size after save [" +
+ filesize + "] temp file = [" + theFilename + "]");
+ }
+ catch (Exception ex2) {
+ System.out.println("ObjectSaveTest:testObjectSerializable(): error during save [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -130,8 +124,7 @@
// ---------------------------------------------------------
// restore from the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an input stream to the file
FileInputStream inStream = new FileInputStream(theFile);
@@ -142,17 +135,20 @@
// try to restore the options
System.out.println("ObjectSaveTest:testObjectSerializable(): restoring .....");
restored = false;
- MetaDataEntry restored_obj = (MetaDataEntry) ObjectStateUtils.readObject(inObjStream, "testObject:serializable");
+ MetaDataEntry restored_obj = (MetaDataEntry) ObjectStateUtils
+ .readObject(inObjStream, "testObject:serializable");
inObjStream.close();
inStream.close();
restored = true;
- System.out.println("ObjectSaveTest:testObjectSerializable(): ....restored operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testObjectSerializable(): ....restored operation completed.....");
}
- catch (Exception ex2)
- {
- System.out.println("ObjectSaveTest:testObjectSerializable(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println(
+ "ObjectSaveTest:testObjectSerializable(): error during restore [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -161,14 +157,11 @@
// if the save/restore of the object succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = saved && restored;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
@@ -184,45 +177,42 @@
}
- public void testObjectNotSerializable() throws Exception
- {
- File theFile = null;
- String theFilename = null;
- boolean saved = false;
- boolean restored = false;
- boolean expected_exception = false;
- boolean done = false;
+ public void testObjectNotSerializable() throws Exception {
+ File theFile = null;
+ String theFilename = null;
+ boolean saved = false;
+ boolean restored = false;
+ boolean expected_exception = false;
+ boolean done = false;
System.out.println("ObjectSaveTest:testObjectNotSerializable(): BEGIN ---------------");
// ---------------------------------------------------------
// setup an object to use
// ---------------------------------------------------------
- NotSerializableObject obj = new NotSerializableObject("nso_1");
-
+ NotSerializableObject obj = new NotSerializableObject("nso_1");
// ---------------------------------------------------------
// setup a temporary file to use
// ---------------------------------------------------------
- try
- {
- theFile = File.createTempFile("objectTest",null);
+ try {
+ theFile = File.createTempFile("objectTest", null);
theFilename = theFile.getName();
- System.out.println("ObjectSaveTest:testObjectNotSerializable(): temp file = ["+theFilename+"]");
+ System.out.println("ObjectSaveTest:testObjectNotSerializable(): temp file = [" +
+ theFilename + "]");
}
- catch (Exception ex)
- {
- System.out.println("ObjectSaveTest:testObjectNotSerializable(): error creating temp file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println(
+ "ObjectSaveTest:testObjectNotSerializable(): error creating temp file = [" +
+ ex.getMessage() + "]");
theFile = null;
}
- if (theFile != null)
- {
+ if (theFile != null) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -242,31 +232,29 @@
outStream.close();
saved = true;
- System.out.println("ObjectSaveTest:testObjectNotSerializable(): ....save operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testObjectNotSerializable(): ....save operation completed.....");
long filesize = theFile.length();
- System.out.println("ObjectSaveTest:testObjectNotSerializable(): file size after save ["+filesize+"] temp file = ["+theFilename+"]");
+ System.out.println(
+ "ObjectSaveTest:testObjectNotSerializable(): file size after save [" +
+ filesize + "] temp file = [" + theFilename + "]");
}
- catch (Exception ex2)
- {
+ catch (Exception ex2) {
// expect an error here
// ObjectStateUtils catches the NotSerializableException and logs it
- if (ex2 instanceof NotSerializableException)
- {
+ if (ex2 instanceof NotSerializableException) {
expected_exception = true;
- }
- else
- {
- System.out.println("ObjectSaveTest:testObjectNotSerializable(): save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ } else {
+ System.out.println("ObjectSaveTest:testObjectNotSerializable(): save [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
}
}
-
// ---------------------------------------------------------
// restore from the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an input stream to the file
FileInputStream inStream = new FileInputStream(theFile);
@@ -277,17 +265,20 @@
// try to restore the options
System.out.println("ObjectSaveTest:testObjectSerializable(): restoring .....");
restored = false;
- Object restored_obj = ObjectStateUtils.readObject(inObjStream, "testObject:NotSerializable");
+ Object restored_obj =
+ ObjectStateUtils.readObject(inObjStream, "testObject:NotSerializable");
inObjStream.close();
inStream.close();
restored = true;
- System.out.println("ObjectSaveTest:testObjectNotSerializable(): ....restored operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testObjectNotSerializable(): ....restored operation completed.....");
}
- catch (Exception ex)
- {
- System.out.println("ObjectSaveTest:testObjectNotSerializable(): error during restore ["+ex.getClass().getName()+" : "+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println(
+ "ObjectSaveTest:testObjectNotSerializable(): error during restore [" +
+ ex.getClass().getName() + " : " + ex.getMessage() + "]");
ex.printStackTrace();
}
@@ -296,14 +287,11 @@
// if the save/restore of the object succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = saved && restored;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
@@ -315,14 +303,13 @@
}
- public void testArrayList() throws Exception
- {
- File theFile = null;
- String theFilename = null;
- boolean saved = false;
- boolean restored = false;
- boolean done = false;
- boolean comparesOK = false;
+ public void testArrayList() throws Exception {
+ File theFile = null;
+ String theFilename = null;
+ boolean saved = false;
+ boolean restored = false;
+ boolean done = false;
+ boolean comparesOK = false;
System.out.println("ObjectSaveTest:testArrayList(): BEGIN ---------------");
@@ -346,25 +333,22 @@
// ---------------------------------------------------------
// setup a temporary file to use
// ---------------------------------------------------------
- try
- {
- theFile = File.createTempFile("arraylistTest",null);
+ try {
+ theFile = File.createTempFile("arraylistTest", null);
theFilename = theFile.getName();
- System.out.println("ObjectSaveTest:testArrayList(): temp file = ["+theFilename+"]");
+ System.out.println("ObjectSaveTest:testArrayList(): temp file = [" + theFilename + "]");
}
- catch (Exception ex)
- {
- System.out.println("ObjectSaveTest:testArrayList(): error creating temp file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println("ObjectSaveTest:testArrayList(): error creating temp file = [" +
+ ex.getMessage() + "]");
theFile = null;
}
- if (theFile != null)
- {
+ if (theFile != null) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -384,14 +368,16 @@
outStream.close();
saved = true;
- System.out.println("ObjectSaveTest:testArrayList(): ....save operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testArrayList(): ....save operation completed.....");
long filesize = theFile.length();
- System.out.println("ObjectSaveTest:testArrayList(): file size after save ["+filesize+"] temp file = ["+theFilename+"]");
+ System.out.println("ObjectSaveTest:testArrayList(): file size after save [" +
+ filesize + "] temp file = [" + theFilename + "]");
}
- catch (Exception ex2)
- {
- System.out.println("ObjectSaveTest:testArrayList(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println("ObjectSaveTest:testArrayList(): error during save [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -402,8 +388,7 @@
// ---------------------------------------------------------
ArrayList restored_obj = null;
- try
- {
+ try {
// setup an input stream to the file
FileInputStream inStream = new FileInputStream(theFile);
@@ -419,37 +404,33 @@
inStream.close();
restored = true;
- System.out.println("ObjectSaveTest:testArrayList(): ....restored operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testArrayList(): ....restored operation completed.....");
}
- catch (Exception ex2)
- {
- System.out.println("ObjectSaveTest:testArrayList(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println("ObjectSaveTest:testArrayList(): error during restore [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
// if the save/restore of the object succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = saved && restored;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
assertTrue(restored);
- if (restored_obj != null)
- {
+ if (restored_obj != null) {
int restored_size = restored_obj.size();
- if (restored_size == (initial_size-1))
- {
+ if (restored_size == (initial_size - 1)) {
comparesOK = true;
}
}
@@ -457,7 +438,7 @@
// TODO: check for exact entries
assertTrue(comparesOK);
-
+
// indicate that the temp file was created ok
done = true;
}
@@ -469,14 +450,13 @@
}
- public void testHashMap() throws Exception
- {
- File theFile = null;
- String theFilename = null;
- boolean saved = false;
- boolean restored = false;
- boolean done = false;
- boolean comparesOK = false;
+ public void testHashMap() throws Exception {
+ File theFile = null;
+ String theFilename = null;
+ boolean saved = false;
+ boolean restored = false;
+ boolean done = false;
+ boolean comparesOK = false;
System.out.println("ObjectSaveTest:testHashMap(): BEGIN ---------------");
@@ -494,7 +474,7 @@
obj.put(new String("key8"), new Integer(5));
obj.put(new String("key9"), new Integer(6));
obj.put(new NotSerializableObject("TestForHashMapKey"), new Integer(7));
- obj.put(new String("key10"),new Integer(8));
+ obj.put(new String("key10"), new Integer(8));
int initial_size = obj.size();
@@ -502,25 +482,22 @@
// ---------------------------------------------------------
// setup a temporary file to use
// ---------------------------------------------------------
- try
- {
- theFile = File.createTempFile("hashmapTest",null);
+ try {
+ theFile = File.createTempFile("hashmapTest", null);
theFilename = theFile.getName();
- System.out.println("ObjectSaveTest:testHashMap(): temp file = ["+theFilename+"]");
+ System.out.println("ObjectSaveTest:testHashMap(): temp file = [" + theFilename + "]");
}
- catch (Exception ex)
- {
- System.out.println("ObjectSaveTest:testHashMap(): error creating temp file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println("ObjectSaveTest:testHashMap(): error creating temp file = [" +
+ ex.getMessage() + "]");
theFile = null;
}
- if (theFile != null)
- {
+ if (theFile != null) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -540,14 +517,16 @@
outStream.close();
saved = true;
- System.out.println("ObjectSaveTest:testHashMap(): ....save operation completed.....");
+ System.out
+ .println("ObjectSaveTest:testHashMap(): ....save operation completed.....");
long filesize = theFile.length();
- System.out.println("ObjectSaveTest:testHashMap(): file size after save ["+filesize+"] temp file = ["+theFilename+"]");
+ System.out.println("ObjectSaveTest:testHashMap(): file size after save [" +
+ filesize + "] temp file = [" + theFilename + "]");
}
- catch (Exception ex2)
- {
- System.out.println("ObjectSaveTest:testHashMap(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println("ObjectSaveTest:testHashMap(): error during save [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -558,8 +537,7 @@
// ---------------------------------------------------------
HashMap restored_obj = null;
- try
- {
+ try {
// setup an input stream to the file
FileInputStream inStream = new FileInputStream(theFile);
@@ -575,37 +553,33 @@
inStream.close();
restored = true;
- System.out.println("ObjectSaveTest:testHashMap(): ....restored operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testHashMap(): ....restored operation completed.....");
}
- catch (Exception ex2)
- {
- System.out.println("ObjectSaveTest:testHashMap(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println("ObjectSaveTest:testHashMap(): error during restore [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
// if the save/restore of the object succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = saved && restored;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
assertTrue(restored);
- if (restored_obj != null)
- {
+ if (restored_obj != null) {
int restored_size = restored_obj.size();
- if (restored_size == (initial_size-3))
- {
+ if (restored_size == (initial_size - 3)) {
// there are entries in the map that are not serializable
comparesOK = true;
}
@@ -614,7 +588,7 @@
// TODO: check for exact entries
assertTrue(comparesOK);
-
+
// indicate that the temp file was created ok
done = true;
}
@@ -626,14 +600,13 @@
}
- public void testLinkedList() throws Exception
- {
- File theFile = null;
- String theFilename = null;
- boolean saved = false;
- boolean restored = false;
- boolean done = false;
- boolean comparesOK = false;
+ public void testLinkedList() throws Exception {
+ File theFile = null;
+ String theFilename = null;
+ boolean saved = false;
+ boolean restored = false;
+ boolean done = false;
+ boolean comparesOK = false;
System.out.println("ObjectSaveTest:testLinkedList(): BEGIN ---------------");
@@ -657,25 +630,23 @@
// ---------------------------------------------------------
// setup a temporary file to use
// ---------------------------------------------------------
- try
- {
- theFile = File.createTempFile("linkedlistTest",null);
+ try {
+ theFile = File.createTempFile("linkedlistTest", null);
theFilename = theFile.getName();
- System.out.println("ObjectSaveTest:testLinkedList(): temp file = ["+theFilename+"]");
+ System.out
+ .println("ObjectSaveTest:testLinkedList(): temp file = [" + theFilename + "]");
}
- catch (Exception ex)
- {
- System.out.println("ObjectSaveTest:testLinkedList(): error creating temp file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println("ObjectSaveTest:testLinkedList(): error creating temp file = [" +
+ ex.getMessage() + "]");
theFile = null;
}
- if (theFile != null)
- {
+ if (theFile != null) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -695,14 +666,16 @@
outStream.close();
saved = true;
- System.out.println("ObjectSaveTest:testLinkedList(): ....save operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testLinkedList(): ....save operation completed.....");
long filesize = theFile.length();
- System.out.println("ObjectSaveTest:testLinkedList(): file size after save ["+filesize+"] temp file = ["+theFilename+"]");
+ System.out.println("ObjectSaveTest:testLinkedList(): file size after save [" +
+ filesize + "] temp file = [" + theFilename + "]");
}
- catch (Exception ex2)
- {
- System.out.println("ObjectSaveTest:testLinkedList(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println("ObjectSaveTest:testLinkedList(): error during save [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -713,8 +686,7 @@
// ---------------------------------------------------------
LinkedList restored_obj = null;
- try
- {
+ try {
// setup an input stream to the file
FileInputStream inStream = new FileInputStream(theFile);
@@ -725,42 +697,39 @@
// try to restore the options
System.out.println("ObjectSaveTest:testLinkedList(): restoring .....");
restored = false;
- restored_obj = ObjectStateUtils.readLinkedList(inObjStream, "testObject:LinkedList");
+ restored_obj =
+ ObjectStateUtils.readLinkedList(inObjStream, "testObject:LinkedList");
inObjStream.close();
inStream.close();
restored = true;
- System.out.println("ObjectSaveTest:testLinkedList(): ....restored operation completed.....");
+ System.out.println(
+ "ObjectSaveTest:testLinkedList(): ....restored operation completed.....");
}
- catch (Exception ex2)
- {
- System.out.println("ObjectSaveTest:testLinkedList(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println("ObjectSaveTest:testLinkedList(): error during restore [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
// if the save/restore of the object succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = saved && restored;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
assertTrue(restored);
- if (restored_obj != null)
- {
+ if (restored_obj != null) {
int restored_size = restored_obj.size();
- if (restored_size == (initial_size-1))
- {
+ if (restored_size == (initial_size - 1)) {
comparesOK = true;
}
}
@@ -768,7 +737,7 @@
// TODO: check for exact entries
assertTrue(comparesOK);
-
+
// indicate that the temp file was created ok
done = true;
}
@@ -780,10 +749,7 @@
}
-
-
- public class NotSerializableObject implements Externalizable
- {
+ public class NotSerializableObject implements Externalizable {
private String label = "TestObject";
private String ID = null;
@@ -791,34 +757,29 @@
private PrintStream ps = System.out;
// default constructor needed for Externalizable interface
- public NotSerializableObject()
- {
+ public NotSerializableObject() {
}
- public NotSerializableObject(String identifier)
- {
+ public NotSerializableObject(String identifier) {
ID = identifier;
ps = System.out;
}
-
- public void setID(String s)
- {
+
+ public void setID(String s) {
ID = s;
}
- public String getID()
- {
+ public String getID() {
return ID;
}
- public void writeExternal(java.io.ObjectOutput out) throws IOException
- {
+ public void writeExternal(java.io.ObjectOutput out) throws IOException {
throw new NotSerializableException("Test Object is not serializable");
}
- public void readExternal(java.io.ObjectInput in) throws IOException, ClassNotFoundException
- {
+ public void readExternal(java.io.ObjectInput in)
+ throws IOException, ClassNotFoundException {
throw new IOException("Test object is not serializable");
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java Sun Mar 4 10:16:54 2007
@@ -17,12 +17,16 @@
package org.apache.axis2.engine;
import junit.framework.TestCase;
-
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.*;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
@@ -40,30 +44,27 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.Serializable;
import java.util.ArrayList;
-public class OperationContextSaveTest extends TestCase
-{
+public class OperationContextSaveTest extends TestCase {
- private QName serviceName = new QName("TestService");
+ private QName serviceName = new QName("TestService");
private QName operationName = new QName("Operation_1");
private ConfigurationContext configurationContext = null;
- private ServiceGroupContext serviceGroupContext = null;
- private ServiceContext serviceContext = null;
- private OperationContext operationContext = null;
-
- private AxisConfiguration axisConfiguration = null;
- private AxisServiceGroup axisServiceGroup = null;
- private AxisService axisService = null;
- private AxisOperation axisOperation = null;
+ private ServiceGroupContext serviceGroupContext = null;
+ private ServiceContext serviceContext = null;
+ private OperationContext operationContext = null;
+
+ private AxisConfiguration axisConfiguration = null;
+ private AxisServiceGroup axisServiceGroup = null;
+ private AxisService axisService = null;
+ private AxisOperation axisOperation = null;
private TransportOutDescription transportOut = null;
- private TransportInDescription transportIn = null;
+ private TransportInDescription transportIn = null;
private MessageContext mc = null;
@@ -72,36 +73,36 @@
private String testArg = null;
- public OperationContextSaveTest(String arg0)
- {
+ public OperationContextSaveTest(String arg0) {
super(arg0);
testArg = new String(arg0);
- try
- {
+ try {
prepare();
}
- catch (Exception e)
- {
- System.out.println("OperationContextSaveTest:constructor: error in setting up object graph ["+e.getClass().getName()+" : "+e.getMessage()+"]");
+ catch (Exception e) {
+ System.out.println(
+ "OperationContextSaveTest:constructor: error in setting up object graph [" +
+ e.getClass().getName() + " : " + e.getMessage() + "]");
}
}
-
+
//
// prepare the object hierarchy for testing
//
- private void prepare() throws Exception
- {
+ private void prepare() throws Exception {
//-----------------------------------------------------------------
axisConfiguration = new AxisConfiguration();
configurationContext = new ConfigurationContext(axisConfiguration);
- configurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
- configurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
-
+ configurationContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
+ configurationContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
+
DispatchPhase dispatchPhase = new DispatchPhase();
dispatchPhase.setName("Dispatch");
@@ -139,13 +140,11 @@
axisOperation = new InOutAxisOperation(operationName);
- axisOperation.setMessageReceiver(new MessageReceiver()
- {
- public void receive(MessageContext messageCtx)
- {
+ axisOperation.setMessageReceiver(new MessageReceiver() {
+ public void receive(MessageContext messageCtx) {
- }
- });
+ }
+ });
axisService.addOperation(axisOperation);
axisService.mapActionToOperation(operationName.getLocalPart(), axisOperation);
@@ -155,13 +154,15 @@
//-----------------------------------------------------------------
- serviceGroupContext = ContextFactory.createServiceGroupContext(configurationContext, (AxisServiceGroup) axisService.getParent());
+ serviceGroupContext = ContextFactory.createServiceGroupContext(configurationContext,
+ (AxisServiceGroup) axisService
+ .getParent());
serviceGroupContext.setId("ServiceGroupContextTest");
- serviceContext = ContextFactory.createServiceContext(serviceGroupContext,axisService);
-
- operationContext = serviceContext.createOperationContext(operationName);
-
+ serviceContext = ContextFactory.createServiceContext(serviceGroupContext, axisService);
+
+ operationContext = serviceContext.createOperationContext(operationName);
+
//-----------------------------------------------------------------
transportOut = new TransportOutDescription(new QName("null"));
@@ -208,14 +209,13 @@
mc.setMessageID(UUIDGenerator.getUUID());
//operationContext.addMessageContext(mc); gets done via the register
- axisOperation.registerOperationContext(mc,operationContext);
+ axisOperation.registerOperationContext(mc, operationContext);
mc.setOperationContext(operationContext);
mc.setServiceContext(serviceContext);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
-
//-----------------------------------------------------------------
executedHandlers = new ArrayList();
@@ -223,45 +223,42 @@
}
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
//org.apache.log4j.BasicConfigurator.configure();
}
- public void testSaveAndRestore() throws Exception
- {
- File theFile = null;
- String theFilename = null;
- boolean saved = false;
- boolean restored = false;
- boolean done = false;
- boolean comparesOk = false;
+ public void testSaveAndRestore() throws Exception {
+ File theFile = null;
+ String theFilename = null;
+ boolean saved = false;
+ boolean restored = false;
+ boolean done = false;
+ boolean comparesOk = false;
System.out.println("OperationContextSaveTest:testSaveAndRestore(): BEGIN ---------------");
// ---------------------------------------------------------
// setup a temporary file to use
// ---------------------------------------------------------
- try
- {
- theFile = File.createTempFile("OpCtxSave",null);
+ try {
+ theFile = File.createTempFile("OpCtxSave", null);
theFilename = theFile.getName();
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): temp file = ["+theFilename+"]");
+ System.out.println("OperationContextSaveTest:testSaveAndRestore(): temp file = [" +
+ theFilename + "]");
}
- catch (Exception ex)
- {
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): error creating temp file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): error creating temp file = [" +
+ ex.getMessage() + "]");
theFile = null;
}
- if (theFile != null)
- {
+ if (theFile != null) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -281,15 +278,19 @@
outStream.close();
saved = true;
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): ....save operation completed.....");
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): ....save operation completed.....");
long filesize = theFile.length();
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): file size after save ["+filesize+"] temp file = ["+theFilename+"]");
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): file size after save [" +
+ filesize + "] temp file = [" + theFilename + "]");
}
- catch (Exception ex2)
- {
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): error during save [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -298,8 +299,7 @@
// ---------------------------------------------------------
// restore from the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an input stream to the file
FileInputStream inStream = new FileInputStream(theFile);
@@ -308,7 +308,8 @@
ObjectInputStream inObjStream = new ObjectInputStream(inStream);
// try to restore the context
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): restoring .....");
+ System.out
+ .println("OperationContextSaveTest:testSaveAndRestore(): restoring .....");
restored = false;
OperationContext opctx_restored = (OperationContext) inObjStream.readObject();
inObjStream.close();
@@ -317,27 +318,35 @@
opctx_restored.activate(configurationContext);
restored = true;
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): ....restored operation completed.....");
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): ....restored operation completed.....");
// compare to original
comparesOk = opctx_restored.isEquivalent(operationContext);
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): OperationContext equivalency ["+comparesOk+"]");
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): OperationContext equivalency [" +
+ comparesOk + "]");
assertTrue(comparesOk);
ServiceContext restored_srvCtx = opctx_restored.getServiceContext();
comparesOk = restored_srvCtx.isEquivalent(serviceContext);
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): ServiceContext equivalency ["+comparesOk+"]");
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): ServiceContext equivalency [" +
+ comparesOk + "]");
assertTrue(comparesOk);
ServiceGroupContext restored_sgCtx = restored_srvCtx.getServiceGroupContext();
comparesOk = restored_sgCtx.isEquivalent(serviceGroupContext);
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): ServiceGroupContext equivalency ["+comparesOk+"]");
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): ServiceGroupContext equivalency [" +
+ comparesOk + "]");
assertTrue(comparesOk);
}
- catch (Exception ex2)
- {
- System.out.println("OperationContextSaveTest:testSaveAndRestore(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println(
+ "OperationContextSaveTest:testSaveAndRestore(): error during restore [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -346,18 +355,15 @@
// if the save/restore of the operation context succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = saved && restored && comparesOk;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
-
+
// indicate that the temp file was created ok
done = true;
}
@@ -369,16 +375,14 @@
}
- public class TempHandler extends AbstractHandler
- {
+ public class TempHandler extends AbstractHandler {
private Integer index;
//-----------------------------------------------------------------
// constructors
//-----------------------------------------------------------------
- public TempHandler(int index)
- {
+ public TempHandler(int index) {
this.index = new Integer(index);
init(new HandlerDescription(new String("handler" + index)));
}
@@ -387,9 +391,8 @@
// methods
//-----------------------------------------------------------------
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault
- {
- System.out.println("TempHandler:invoke(): index = ["+index+"]");
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+ System.out.println("TempHandler:invoke(): index = [" + index + "]");
executedHandlers.add(index);
return InvocationResponse.CONTINUE;
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OptionsSaveTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OptionsSaveTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OptionsSaveTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OptionsSaveTest.java Sun Mar 4 10:16:54 2007
@@ -17,32 +17,24 @@
package org.apache.axis2.engine;
import junit.framework.TestCase;
-
+import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
-import org.apache.axis2.receivers.RawXMLINOutMessageReceiver;
import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axiom.soap.SOAP12Constants;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-public class OptionsSaveTest extends TestCase
-{
+public class OptionsSaveTest extends TestCase {
private transient QName serviceName = new QName("NullService");
private transient QName operationName = new QName("DummyOp");
@@ -51,8 +43,7 @@
private String testArg = null;
- public OptionsSaveTest(String arg0)
- {
+ public OptionsSaveTest(String arg0) {
super(arg0);
testArg = new String(arg0);
@@ -60,26 +51,23 @@
}
- protected void initAll()
- {
+ protected void initAll() {
}
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
//org.apache.log4j.BasicConfigurator.configure();
}
- public void testSaveAndRestore() throws Exception
- {
- File theFile = null;
- String theFilename = null;
- boolean saved = false;
- boolean restored = false;
- boolean done = false;
- boolean comparesOk = false;
+ public void testSaveAndRestore() throws Exception {
+ File theFile = null;
+ String theFilename = null;
+ boolean saved = false;
+ boolean restored = false;
+ boolean done = false;
+ boolean comparesOk = false;
- AxisConfiguration axisConfiguration = new AxisConfiguration();
+ AxisConfiguration axisConfiguration = new AxisConfiguration();
ConfigurationContext configurationContext = new ConfigurationContext(axisConfiguration);
@@ -100,7 +88,7 @@
options.setTo(new EndpointReference("http://ws.apache.org/axis2/to"));
options.setReplyTo(new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL));
- TransportOutDescription transportOut = new TransportOutDescription(new QName("null"));
+ TransportOutDescription transportOut = new TransportOutDescription(new QName("null"));
TransportOutDescription transportOut2 = new TransportOutDescription(new QName("happy"));
TransportOutDescription transportOut3 = new TransportOutDescription(new QName("golucky"));
transportOut.setSender(new CommonsHTTPTransportSender());
@@ -111,7 +99,7 @@
axisConfiguration.addTransportOut(transportOut2);
axisConfiguration.addTransportOut(transportOut);
- TransportInDescription transportIn = new TransportInDescription(new QName("null"));
+ TransportInDescription transportIn = new TransportInDescription(new QName("null"));
TransportInDescription transportIn2 = new TransportInDescription(new QName("always"));
TransportInDescription transportIn3 = new TransportInDescription(new QName("thebest"));
transportIn.setReceiver(new SimpleHTTPServer());
@@ -137,29 +125,27 @@
// TODO: setup a parent
-
// ---------------------------------------------------------
// setup a temporary file to use
// ---------------------------------------------------------
- try
- {
- theFile = File.createTempFile("optionsSave",null);
+ try {
+ theFile = File.createTempFile("optionsSave", null);
theFilename = theFile.getName();
- System.out.println("OptionsSaveTest:testSaveAndRestore(): temp file = ["+theFilename+"]");
+ System.out.println(
+ "OptionsSaveTest:testSaveAndRestore(): temp file = [" + theFilename + "]");
}
- catch (Exception ex)
- {
- System.out.println("OptionsSaveTest:testSaveAndRestore(): error creating temp file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println(
+ "OptionsSaveTest:testSaveAndRestore(): error creating temp file = [" +
+ ex.getMessage() + "]");
theFile = null;
}
- if (theFile != null)
- {
+ if (theFile != null) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -179,21 +165,22 @@
outStream.close();
saved = true;
- System.out.println("OptionsSaveTest:testSaveAndRestore(): ....save operation completed.....");
+ System.out.println(
+ "OptionsSaveTest:testSaveAndRestore(): ....save operation completed.....");
long filesize = theFile.length();
- System.out.println("OptionsSaveTest:testSaveAndRestore(): file size after save ["+filesize+"] temp file = ["+theFilename+"]");
+ System.out.println("OptionsSaveTest:testSaveAndRestore(): file size after save [" +
+ filesize + "] temp file = [" + theFilename + "]");
}
- catch (Exception ex2)
- {
- if (saved != true)
- {
- System.out.println("OptionsSaveTest:testSaveAndRestore(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ if (saved != true) {
+ System.out.println("OptionsSaveTest:testSaveAndRestore(): error during save [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
- }
- else
- {
- System.out.println("OptionsSaveTest:testSaveAndRestore(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ } else {
+ System.out.println(
+ "OptionsSaveTest:testSaveAndRestore(): error during restore [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
}
@@ -203,8 +190,7 @@
// ---------------------------------------------------------
// restore from the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an input stream to the file
FileInputStream inStream = new FileInputStream(theFile);
@@ -222,14 +208,16 @@
options_restored.activate(configurationContext);
restored = true;
- System.out.println("OptionsSaveTest:testSaveAndRestore(): ....restored operation completed.....");
+ System.out.println(
+ "OptionsSaveTest:testSaveAndRestore(): ....restored operation completed.....");
comparesOk = options_restored.isEquivalent(options);
- System.out.println("OptionsSaveTest:testSaveAndRestore(): Options equivalency ["+comparesOk+"]");
+ System.out.println("OptionsSaveTest:testSaveAndRestore(): Options equivalency [" +
+ comparesOk + "]");
}
- catch (Exception ex2)
- {
- System.out.println("OptionsSaveTest:testSaveAndRestore(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println("OptionsSaveTest:testSaveAndRestore(): error during restore [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -240,18 +228,15 @@
// if the save/restore of the object succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = saved && restored && comparesOk;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
-
+
// indicate that the temp file was created ok
done = true;
}
@@ -261,7 +246,6 @@
System.out.println("OptionsSaveTest:testSaveAndRestore(): END ---------------");
}
-
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ParameterAddTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ParameterAddTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ParameterAddTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ParameterAddTest.java Sun Mar 4 10:16:54 2007
@@ -25,6 +25,7 @@
import org.apache.axis2.description.Parameter;
import javax.xml.namespace.QName;
+
/**
* To chcek locked is working corrcetly
*/
@@ -32,7 +33,8 @@
public class ParameterAddTest extends TestCase {
private AxisConfiguration reg = new AxisConfiguration();
- public void testAddParameterServiceLockedAtAxisConfig(){
+
+ public void testAddParameterServiceLockedAtAxisConfig() {
try {
Parameter para = new Parameter();
para.setValue(null);
@@ -49,7 +51,7 @@
}
}
- public void testAddParameterModuleLockedAtAxisConfig(){
+ public void testAddParameterModuleLockedAtAxisConfig() {
try {
Parameter para = new Parameter();
para.setValue(null);
@@ -65,7 +67,7 @@
}
}
- public void testAddParameterOperationlockedByAxisConfig(){
+ public void testAddParameterOperationlockedByAxisConfig() {
try {
Parameter para = new Parameter();
para.setValue(null);
@@ -87,7 +89,7 @@
}
}
- public void testAddParameterOperationLockebyService(){
+ public void testAddParameterOperationLockebyService() {
try {
Parameter para = new Parameter();
para.setValue(null);
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ParameterLocked.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ParameterLocked.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ParameterLocked.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ParameterLocked.java Sun Mar 4 10:16:54 2007
@@ -37,7 +37,9 @@
protected void setUp() throws Exception {
- ar = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, repo + "/axis2.xml").getAxisConfiguration();
+ ar = ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(null, repo + "/axis2.xml")
+ .getAxisConfiguration();
}
public void testOveride_Non_locked_Para_Service() {
@@ -128,7 +130,8 @@
assertNotNull(ar);
AxisModule module = new AxisModule();
module.setParent(ar);
- InputStream in = new FileInputStream(repo + "/module_overide_global_non_locked_para.xml");
+ InputStream in =
+ new FileInputStream(repo + "/module_overide_global_non_locked_para.xml");
ModuleBuilder mbuilder = new ModuleBuilder(in, module, ar);
mbuilder.populateModule();
} catch (FileNotFoundException e) {
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java Sun Mar 4 10:16:54 2007
@@ -13,77 +13,76 @@
*/
package org.apache.axis2.engine;
-import javax.xml.namespace.QName;
-
+import junit.framework.TestCase;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.InOnlyAxisOperation;
-import junit.framework.TestCase;
+import javax.xml.namespace.QName;
public class SOAPActionBasedDispatcherTest extends TestCase {
- public void testFindOperation() throws Exception{
+ public void testFindOperation() throws Exception {
MessageContext messageContext = new MessageContext();
AxisService as = new AxisService("Service1");
messageContext.setAxisService(as);
-
+
AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
operation1.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
-
+
AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
operation2.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-
+
as.addOperation(operation1);
as.addOperation(operation2);
-
+
messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
-
+
SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
soapActionDispatcher.invoke(messageContext);
assertEquals(operation1, messageContext.getAxisOperation());
}
-
+
public void testEmptyAction() throws Exception {
// We shouldn't be able to route on an emtpy-string action.
MessageContext messageContext = new MessageContext();
AxisService as = new AxisService("Service1");
messageContext.setAxisService(as);
-
+
AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
operation1.setSoapAction("");
-
+
AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
operation2.setSoapAction("");
-
+
as.addOperation(operation1);
as.addOperation(operation2);
-
+
messageContext.setSoapAction("");
-
+
SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
soapActionDispatcher.invoke(messageContext);
assertNull(messageContext.getAxisOperation());
}
-
+
public void testNullAction() throws Exception {
// We shouldn't be able to route on a null action.
MessageContext messageContext = new MessageContext();
AxisService as = new AxisService("Service1");
messageContext.setAxisService(as);
-
+
AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
operation1.setSoapAction(null);
-
+
AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
operation2.setSoapAction(null);
-
+
as.addOperation(operation1);
as.addOperation(operation2);
-
+
messageContext.setSoapAction(null);
-
+
SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
soapActionDispatcher.invoke(messageContext);
assertNull(messageContext.getAxisOperation());
@@ -94,22 +93,22 @@
MessageContext messageContext = new MessageContext();
AxisService as = new AxisService("Service1");
messageContext.setAxisService(as);
-
+
AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
operation1.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
-
+
AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
operation2.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-
+
as.addOperation(operation1);
as.addOperation(operation2);
-
+
messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-
+
SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
soapActionDispatcher.invoke(messageContext);
assertEquals(operation2, messageContext.getAxisOperation());
-
+
// Now add a duplicate action, then validate we can't route on it anymore.
AxisOperation operation3 = new InOnlyAxisOperation(new QName("operation3"));
// Note that the SOAPAction is intentionally duplicated with operation 2 above.
@@ -121,20 +120,20 @@
messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
soapActionDispatcher.invoke(messageContext);
assertNull(messageContext.getAxisOperation());
-
+
// Now verify that adding another operation with the duplicate SOAPAction
// doesn't somehow get it added back into the valid alias map
AxisOperation operation4 = new InOnlyAxisOperation(new QName("operation4"));
// Note that the SOAPAction is intentionally duplicated with operation 2 above.
operation3.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
as.addOperation(operation3);
-
+
messageContext = new MessageContext();
messageContext.setAxisService(as);
messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
soapActionDispatcher.invoke(messageContext);
assertNull(messageContext.getAxisOperation());
-
+
// And finally, verify that after all the above, we can still route on a valid
// SOAPAction for operation 1 (whose SOAPAction was never duplicated, so should still be
// valid)
@@ -143,7 +142,7 @@
messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
soapActionDispatcher.invoke(messageContext);
assertEquals(operation1, messageContext.getAxisOperation());
-
+
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/handlers/Handler2.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/handlers/Handler2.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/handlers/Handler2.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/handlers/Handler2.java Sun Mar 4 10:16:54 2007
@@ -37,7 +37,7 @@
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
log.info("I am " + message + " Handler Running :)");
- return InvocationResponse.CONTINUE;
+ return InvocationResponse.CONTINUE;
}
public void revoke(MessageContext msgContext) {
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java Sun Mar 4 10:16:54 2007
@@ -14,20 +14,19 @@
* limitations under the License.
*
*/
-
+
package org.apache.axis2.java.security.action;
-import org.apache.axis2.java.security.interf.Actor;
import org.apache.axis2.java.security.driver.Java2SecTest;
+import org.apache.axis2.java.security.interf.Actor;
import java.io.CharArrayWriter;
import java.io.FileReader;
import java.io.IOException;
-
-/**
- * Action reads the data from an input file
+/**
+ * Action reads the data from an input file
* and then saves the file input to Java2SecTest class
*/
@@ -42,56 +41,56 @@
}
// Implementing Actor's takeAction method
- public void takeAction () {
- try {
- // Print out maven's base,build, and test direcotories
- String baseDir = System.getProperty("basedir");
- System.out.println("basedir => " + baseDir);
-
- String buildDir = System.getProperty("maven_build_dir");
- System.out.println("buildDir => " + buildDir);
-
- String testDir = System.getProperty("maven_test_dest");
- System.out.println("testDir => " + testDir);
-
- // Convert the \ (back slash) to / (forward slash)
- String baseDirM = baseDir.replace('\\', '/');
- System.out.println("baseDirM => "+ baseDirM);
-
- String fs = "/";
-
- // Build the file URL
- String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
- System.out.println("File URL => " + fileURL);
-
- if (fileName != null)
- fileReader = new FileReader(fileURL);
- else
- fileReader = new FileReader("public.txt");
-
+ public void takeAction() {
+ try {
+ // Print out maven's base,build, and test direcotories
+ String baseDir = System.getProperty("basedir");
+ System.out.println("basedir => " + baseDir);
+
+ String buildDir = System.getProperty("maven_build_dir");
+ System.out.println("buildDir => " + buildDir);
+
+ String testDir = System.getProperty("maven_test_dest");
+ System.out.println("testDir => " + testDir);
+
+ // Convert the \ (back slash) to / (forward slash)
+ String baseDirM = baseDir.replace('\\', '/');
+ System.out.println("baseDirM => " + baseDirM);
+
+ String fs = "/";
+
+ // Build the file URL
+ String fileURL = baseDirM + fs + "test-resources" + fs + "java2sec" + fs + fileName;
+ System.out.println("File URL => " + fileURL);
+
+ if (fileName != null)
+ fileReader = new FileReader(fileURL);
+ else
+ fileReader = new FileReader("public.txt");
+
try {
CharArrayWriter caw = new CharArrayWriter();
int c;
- while ((c = fileReader.read()) != -1) {
+ while ((c = fileReader.read()) != -1) {
caw.write(c);
}
- // Set/save the file input as test result onto Java2SecTest
+ // Set/save the file input as test result onto Java2SecTest
Java2SecTest.testResult = caw.toString();
}
catch (IOException e) {
- e.printStackTrace(System.out);
+ e.printStackTrace(System.out);
}
finally {
try {
fileReader.close();
}
catch (IOException e) {
- e.printStackTrace(System.out);
+ e.printStackTrace(System.out);
}
}
}
catch (IOException e) {
- e.printStackTrace(System.out);
+ e.printStackTrace(System.out);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org