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 [26/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/java/security/driver/Java2SecTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/driver/Java2SecTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/driver/Java2SecTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/driver/Java2SecTest.java Sun Mar 4 10:16:54 2007
@@ -13,386 +13,380 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.axis2.java.security.driver;
-import org.apache.axis2.java.security.action.Action;
-import org.apache.axis2.java.security.less.LessPermission;
-import org.apache.axis2.java.security.more.MorePermission;
-import org.apache.axis2.java.security.less.LessPermissionPrivilegedExceptionAction;
-import org.apache.axis2.java.security.more.MorePermissionPrivilegedExceptionAction;
-import org.apache.axis2.java.security.less.LessPermissionAccessControlContext;
-import org.apache.axis2.java.security.more.MorePermissionAccessControlContext;
-import org.apache.axis2.java.security.AccessController;
+package org.apache.axis2.java.security.driver;
-import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
+import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.java.security.action.Action;
+import org.apache.axis2.java.security.less.LessPermission;
+import org.apache.axis2.java.security.less.LessPermissionAccessControlContext;
+import org.apache.axis2.java.security.less.LessPermissionPrivilegedExceptionAction;
+import org.apache.axis2.java.security.more.MorePermission;
+import org.apache.axis2.java.security.more.MorePermissionAccessControlContext;
+import org.apache.axis2.java.security.more.MorePermissionPrivilegedExceptionAction;
-import java.util.Calendar;
-import java.util.TimeZone;
import java.security.AccessControlException;
import java.security.Permission;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
+import java.util.Calendar;
+import java.util.TimeZone;
/**
- * Java2SecTest demostrates the usages of AccessController class and Policy file(s) while Security Manager is enabled:
- * 1. testNoPrivilegePassed shows the usage of no AccessController but it still work fine
- * because it has all the permissions.
- * 2. testNoPrivilegeFailure shows the usage of AccessController with LessPermission.java,
- * which is not right approach.
- * 3. testDoPrivilegePassed shows the correct practice of java 2 security by granting the appropriate
- * permission in the policy file(s0 and wrapping the AccessController calls with MorePermission.java.
- * 4. testDoPrivilegeFailure shows the reverse call order of MorePermission and LessPermission
- * from testDoPrivilegedPassed.
- * 5. testAccessControlContextFailure shows the AccessContext which contains a no-permission class
- * on the stack can cause a failure. In our case, the no-permission class is
- * LessPermissionAccessControlContext.
- *
+ * Java2SecTest demostrates the usages of AccessController class and Policy file(s) while Security Manager is enabled:
+ * 1. testNoPrivilegePassed shows the usage of no AccessController but it still work fine
+ * because it has all the permissions.
+ * 2. testNoPrivilegeFailure shows the usage of AccessController with LessPermission.java,
+ * which is not right approach.
+ * 3. testDoPrivilegePassed shows the correct practice of java 2 security by granting the appropriate
+ * permission in the policy file(s0 and wrapping the AccessController calls with MorePermission.java.
+ * 4. testDoPrivilegeFailure shows the reverse call order of MorePermission and LessPermission
+ * from testDoPrivilegedPassed.
+ * 5. testAccessControlContextFailure shows the AccessContext which contains a no-permission class
+ * on the stack can cause a failure. In our case, the no-permission class is
+ * LessPermissionAccessControlContext.
*/
public class Java2SecTest extends TestCase {
// Static variable to keep the test result
public static String testResult = "";
-
+
// Default constructor
public Java2SecTest() {
- super();
- System.out.println("\nJava2SecTest ctor 1");
- Calendar cal = Calendar.getInstance(TimeZone.getDefault());
- String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
- sdf.setTimeZone(TimeZone.getDefault());
- System.out.println("Current time => " + sdf.format(cal.getTime()) + "\n");
+ super();
+ System.out.println("\nJava2SecTest ctor 1");
+ Calendar cal = Calendar.getInstance(TimeZone.getDefault());
+ String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
+ sdf.setTimeZone(TimeZone.getDefault());
+ System.out.println("Current time => " + sdf.format(cal.getTime()) + "\n");
}
// Constructor
public Java2SecTest(String arg) {
- super(arg);
- System.out.println("\nJava2SecTest ctor 2");
- Calendar cal = Calendar.getInstance(TimeZone.getDefault());
- String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
- java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
- sdf.setTimeZone(TimeZone.getDefault());
- System.out.println("Current time => " + sdf.format(cal.getTime()) + "\n");
+ super(arg);
+ System.out.println("\nJava2SecTest ctor 2");
+ Calendar cal = Calendar.getInstance(TimeZone.getDefault());
+ String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
+ sdf.setTimeZone(TimeZone.getDefault());
+ System.out.println("Current time => " + sdf.format(cal.getTime()) + "\n");
+ }
+
+ // This method is added for running this test as a pure junit test
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+
}
-
+
// This method is added for running this test as a pure junit test
- public static void main(String[] args) {
- TestRunner.run(suite());
-
- }
-
- // This method is added for running this test as a pure junit test
- public static Test suite() {
- TestSuite suite = new TestSuite(Java2SecTest.class);
-
- return suite;
-
- }
-
-
-
- /**
- * testNoPrivilegedSuccessed
- */
-
- public void testNoPrivilegeSuccessed() throws Exception {
- Java2SecTest.testResult = "testNoPrivilegeSuccessed failed.";
- SecurityManager oldSM = null;
- String expectedString = "This line is from public.txt.";
-
- System.out.println("\ntestNoPrivilegedSuccessed() begins");
- // Check whether the security manager is enabled or not.
- // If not, turn it on
- oldSM = System.getSecurityManager();
- if (oldSM != null) {
- System.out.println("\nSecurity Manager is enabled.");
- } else {
- System.out.println("\nSecurity Manager is disabled.");
- System.out.println("Enabling the default Java Security Manager");
- System.setSecurityManager(new SecurityManager());
- }
-
- // Run test WITHOUT AccessController.doPrivileged wrapper
- Action dp= new Action("public/public.txt");
- MorePermission mp = new MorePermission(dp, false);
- LessPermission lp = new LessPermission(mp, false);
- lp.takeAction();
-
- // Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
- System.setSecurityManager(null);
- if (System.getSecurityManager() == null) {
- System.out.println("Security Manager is successfully disabled.");
- } else {
- System.out.println("Security Manager is still enabled");
- }
- }
- // Remove extra characters within the result string
- testResult = testResult.replaceAll("\\r", "");
- testResult = testResult.replaceAll("\\n", "");
- System.out.println("Resulting string is " + testResult);
-
- // Verify the test result by comparing the test result with expected string
- assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
-
- System.out.println("\ntestNoPrivilegedSuccessed() ends\n\n");
- }
-
+ public static Test suite() {
+ TestSuite suite = new TestSuite(Java2SecTest.class);
+
+ return suite;
+
+ }
+
+
+ /**
+ * testNoPrivilegedSuccessed
+ */
+
+ public void testNoPrivilegeSuccessed() throws Exception {
+ Java2SecTest.testResult = "testNoPrivilegeSuccessed failed.";
+ SecurityManager oldSM = null;
+ String expectedString = "This line is from public.txt.";
+
+ System.out.println("\ntestNoPrivilegedSuccessed() begins");
+ // Check whether the security manager is enabled or not.
+ // If not, turn it on
+ oldSM = System.getSecurityManager();
+ if (oldSM != null) {
+ System.out.println("\nSecurity Manager is enabled.");
+ } else {
+ System.out.println("\nSecurity Manager is disabled.");
+ System.out.println("Enabling the default Java Security Manager");
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ // Run test WITHOUT AccessController.doPrivileged wrapper
+ Action dp = new Action("public/public.txt");
+ MorePermission mp = new MorePermission(dp, false);
+ LessPermission lp = new LessPermission(mp, false);
+ lp.takeAction();
+
+ // Disable security manager if it is enabled by this testcsae
+ if (System.getSecurityManager() != null && oldSM == null) {
+ System.setSecurityManager(null);
+ if (System.getSecurityManager() == null) {
+ System.out.println("Security Manager is successfully disabled.");
+ } else {
+ System.out.println("Security Manager is still enabled");
+ }
+ }
+ // Remove extra characters within the result string
+ testResult = testResult.replaceAll("\\r", "");
+ testResult = testResult.replaceAll("\\n", "");
+ System.out.println("Resulting string is " + testResult);
+
+ // Verify the test result by comparing the test result with expected string
+ assertTrue("The string contents do not match.",
+ expectedString.equalsIgnoreCase(testResult));
+
+ System.out.println("\ntestNoPrivilegedSuccessed() ends\n\n");
+ }
+
-
/**
* testNoPrivilegedFailure
*/
-
+
public void testNoPrivilegeFailure() throws Exception {
Java2SecTest.testResult = "testNoPrivilegeFailure failed.";
SecurityManager oldSM = null;
-
+
System.out.println("\ntestNoPrivilegedFailured() begins");
// Check whether the security is enable or not.
// if it is not enabled, turn it on
oldSM = System.getSecurityManager();
if (oldSM != null) {
- System.out.println("\nSecurity Manager is enabled.");
+ System.out.println("\nSecurity Manager is enabled.");
} else {
- System.out.println("\nSecurity Manager is disabled.");
- System.out.println("Enabling the default Security Manager");
- System.setSecurityManager(new SecurityManager());
- }
+ System.out.println("\nSecurity Manager is disabled.");
+ System.out.println("Enabling the default Security Manager");
+ System.setSecurityManager(new SecurityManager());
+ }
// Run test with AccessController.doPrivilege wrapper
- Action dp= new Action("private/private.txt");
+ Action dp = new Action("private/private.txt");
MorePermission mp = new MorePermission(dp, false);
LessPermission lp = new LessPermission(mp, false);
try {
- lp.takeAction();
- } catch (Exception e){
- // verify the test result
- assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
+ lp.takeAction();
+ } catch (Exception e) {
+ // verify the test result
+ assertTrue("It is not the security exception.",
+ (e instanceof java.security.AccessControlException));
} finally {
- // Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
- System.setSecurityManager(null);
- if (System.getSecurityManager() == null) {
- System.out.println("Security Manager is successfully disabled.");
- } else {
- System.out.println("Security Manager is still enabled");
+ // Disable security manager if it is enabled by this testcsae
+ if (System.getSecurityManager() != null && oldSM == null) {
+ System.setSecurityManager(null);
+ if (System.getSecurityManager() == null) {
+ System.out.println("Security Manager is successfully disabled.");
+ } else {
+ System.out.println("Security Manager is still enabled");
+ }
}
- }
- System.out.println("\ntesNoPrivilegedFailure() ends\n\n");
+ System.out.println("\ntesNoPrivilegedFailure() ends\n\n");
}
}
-
/**
* testDoPrivilegedSuccessed
*/
-
+
public void testDoPrivilegeSuccessed() throws Exception {
Java2SecTest.testResult = "testDoPrivilegeSuccessed failed.";
SecurityManager oldSM = null;
String expectedString = "This line is from private.txt.";
-
+
System.out.println("\ntestDoPrivilegedSuccessed() begins");
// Check whether the security is enable or not.
// If it is not enabled, turn it on
oldSM = System.getSecurityManager();
if (oldSM != null) {
- System.out.println("\nSecurity Manager is enabled.");
+ System.out.println("\nSecurity Manager is enabled.");
} else {
- System.out.println("\nSecurity Manager is disabled.");
- System.out.println("Enabling the default Java Security Manager");
- System.setSecurityManager(new SecurityManager());
+ System.out.println("\nSecurity Manager is disabled.");
+ System.out.println("Enabling the default Java Security Manager");
+ System.setSecurityManager(new SecurityManager());
}
-
+
// Run test with AccessController.doPrivilege
- Action dp= new Action("private/private.txt");
+ Action dp = new Action("private/private.txt");
MorePermission mp = new MorePermission(dp, true);
LessPermission lp = new LessPermission(mp, false);
lp.takeAction();
-
// Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
- System.setSecurityManager(null);
- if (System.getSecurityManager() == null) {
- System.out.println("Security Manager is successfully disabled.");
- } else {
- System.out.println("Security Manager is still enabled");
- }
+ if (System.getSecurityManager() != null && oldSM == null) {
+ System.setSecurityManager(null);
+ if (System.getSecurityManager() == null) {
+ System.out.println("Security Manager is successfully disabled.");
+ } else {
+ System.out.println("Security Manager is still enabled");
+ }
}
-
+
// Remove extra characters within the result string
testResult = testResult.replaceAll("\\r", "");
testResult = testResult.replaceAll("\\n", "");
- System.out.println("Resulting string is " + testResult);
-
+ System.out.println("Resulting string is " + testResult);
+
// Verify the test result by comparing the test result with expected string
- assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
+ assertTrue("The string contents do not match.",
+ expectedString.equalsIgnoreCase(testResult));
System.out.println("\ntestDoPrivilegedSuccessed() ends\n\n");
}
-
/**
* testDoPrivilegedFailure
*/
-
+
public void testDoPrivilegeFailure() throws Exception {
Java2SecTest.testResult = "testDoPrivilegeFailure failed.";
SecurityManager oldSM = null;
String expectedString = "This line is from private.txt.";
-
+
System.out.println("\ntestDoPrivilegedFailure() begins");
// Check whether the security is enable or not.
// If it is not enabled, turn it on
oldSM = System.getSecurityManager();
if (oldSM != null) {
- System.out.println("\nSecurity Manager is enabled.");
+ System.out.println("\nSecurity Manager is enabled.");
} else {
- System.out.println("\nSecurity Manager is disabled.");
- System.out.println("Enabling the default Java Security Manager");
- System.setSecurityManager(new SecurityManager());
+ System.out.println("\nSecurity Manager is disabled.");
+ System.out.println("Enabling the default Java Security Manager");
+ System.setSecurityManager(new SecurityManager());
}
-
+
// Run test with AccessController.doPrivilege
- Action dp= new Action("private/private.txt");
+ Action dp = new Action("private/private.txt");
MorePermission mp = new MorePermission(dp, false);
LessPermission lp = new LessPermission(mp, true);
try {
- mp.takeAction();
+ mp.takeAction();
} catch (Exception e) {
- // Verify the test result
- assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
+ // Verify the test result
+ assertTrue("It is not the security exception.",
+ (e instanceof java.security.AccessControlException));
} finally {
- // Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
- System.setSecurityManager(null);
- if (System.getSecurityManager() == null) {
- System.out.println("Security Manager is successfully disabled.");
- } else {
- System.out.println("Security Manager is still enabled");
+ // Disable security manager if it is enabled by this testcsae
+ if (System.getSecurityManager() != null && oldSM == null) {
+ System.setSecurityManager(null);
+ if (System.getSecurityManager() == null) {
+ System.out.println("Security Manager is successfully disabled.");
+ } else {
+ System.out.println("Security Manager is still enabled");
+ }
}
- }
- System.out.println("\ntestDoPrivilegedFailure() ends\n\n");
+ System.out.println("\ntestDoPrivilegedFailure() ends\n\n");
}
}
-
-
/**
* testAccessControlContextFailure
*/
-
+
public void testAccessControlContextFailure() throws Exception {
Java2SecTest.testResult = "testAccessControlContextFailure failed.";
SecurityManager oldSM = null;
String expectedString = "This line is from private.txt.";
-
+
System.out.println("\ntestAccessControlContextFailure() begins");
// Check whether the security is enable or not.
// If it is not enabled, turn it on
oldSM = System.getSecurityManager();
if (oldSM != null) {
- System.out.println("\nSecurity Manager is enabled.");
+ System.out.println("\nSecurity Manager is enabled.");
} else {
- System.out.println("\nSecurity Manager is disabled.");
- System.out.println("Enabling the default Java Security Manager");
- System.setSecurityManager(new SecurityManager());
+ System.out.println("\nSecurity Manager is disabled.");
+ System.out.println("Enabling the default Java Security Manager");
+ System.setSecurityManager(new SecurityManager());
}
-
+
// Run test with AccessController.doPrivilege
- Action dp= new Action("private/private.txt");
+ Action dp = new Action("private/private.txt");
MorePermissionAccessControlContext mp = new MorePermissionAccessControlContext(dp, false);
LessPermissionAccessControlContext lp = new LessPermissionAccessControlContext(mp, true);
try {
- lp.takeAction();
+ lp.takeAction();
} catch (Exception e) {
- // Verify the test result
- assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
+ // Verify the test result
+ assertTrue("It is not the security exception.",
+ (e instanceof java.security.AccessControlException));
} finally {
- // Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
- System.setSecurityManager(null);
- if (System.getSecurityManager() == null) {
- System.out.println("Security Manager is successfully disabled.");
- } else {
- System.out.println("Security Manager is still enabled");
+ // Disable security manager if it is enabled by this testcsae
+ if (System.getSecurityManager() != null && oldSM == null) {
+ System.setSecurityManager(null);
+ if (System.getSecurityManager() == null) {
+ System.out.println("Security Manager is successfully disabled.");
+ } else {
+ System.out.println("Security Manager is still enabled");
+ }
}
- }
- System.out.println("\ntestAccessControlContextFailure() ends\n\n");
+ System.out.println("\ntestAccessControlContextFailure() ends\n\n");
}
}
// 2 begins
-
+
/**
* testPrivilegedExceptionActionSuccessed
*/
-
+
public void testPrivilegedExceptionSuccessed() throws Exception {
Java2SecTest.testResult = "testPrivielgedExceptionSuccessed failed";
SecurityManager oldSM = null;
String expectedString = "This line is from private.txt.";
-
+
System.out.println("\ntestPrivilegedExceptionActionSuccessed() begins");
// Check whether the security is enable or not.
// If it is not enabled, turn it on
oldSM = System.getSecurityManager();
if (oldSM != null) {
- System.out.println("\nSecurity Manager is enabled.");
+ System.out.println("\nSecurity Manager is enabled.");
} else {
- System.out.println("\nSecurity Manager is disabled.");
- System.out.println("Enabling the default Java Security Manager");
- System.setSecurityManager(new SecurityManager());
+ System.out.println("\nSecurity Manager is disabled.");
+ System.out.println("Enabling the default Java Security Manager");
+ System.setSecurityManager(new SecurityManager());
}
-
+
// Run test with AccessController.doPrivilege
- Action dp= new Action("private/private.txt");
- MorePermissionPrivilegedExceptionAction mp = new MorePermissionPrivilegedExceptionAction(dp, true);
- LessPermissionPrivilegedExceptionAction lp = new LessPermissionPrivilegedExceptionAction(mp, false);
+ Action dp = new Action("private/private.txt");
+ MorePermissionPrivilegedExceptionAction mp =
+ new MorePermissionPrivilegedExceptionAction(dp, true);
+ LessPermissionPrivilegedExceptionAction lp =
+ new LessPermissionPrivilegedExceptionAction(mp, false);
lp.takeAction();
-
// Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
- System.setSecurityManager(null);
- if (System.getSecurityManager() == null) {
- System.out.println("Security Manager is successfully disabled.");
- } else {
- System.out.println("Security Manager is still enabled");
- }
+ if (System.getSecurityManager() != null && oldSM == null) {
+ System.setSecurityManager(null);
+ if (System.getSecurityManager() == null) {
+ System.out.println("Security Manager is successfully disabled.");
+ } else {
+ System.out.println("Security Manager is still enabled");
+ }
}
-
+
// Remove extra characters within the result string
testResult = testResult.replaceAll("\\r", "");
testResult = testResult.replaceAll("\\n", "");
- System.out.println("testDoPrivilege's result string is " + testResult);
-
+ System.out.println("testDoPrivilege's result string is " + testResult);
+
// Verify the test result by comparing the test result with expected string
- assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
+ assertTrue("The string contents do not match.",
+ expectedString.equalsIgnoreCase(testResult));
System.out.println("\ntestDoPrivilegeSuccessed() ends\n\n");
}
-
/**
* testPrivilegedExceptionActionFailure
*/
-
+
public void testPrivilegedExceptionActionFailure() throws Exception {
Java2SecTest.testResult = "testPrivilegedExceptionActionFailure failed.";
SecurityManager oldSM = null;
String expectedString = "This line is from private.txt.";
-
+
System.out.println("\ntestPrivilegedExceptionActionFailure() begins");
// Check whether the security is enable or not.
// If it is not enabled, turn it on
@@ -404,34 +398,37 @@
System.out.println("Enabling the default Java Security Manager");
System.setSecurityManager(new SecurityManager());
}
-
+
// Run test with AccessController.doPrivilege
- Action dp= new Action("private/private.txt");
- MorePermissionPrivilegedExceptionAction mp = new MorePermissionPrivilegedExceptionAction(dp, false);
- LessPermissionPrivilegedExceptionAction lp = new LessPermissionPrivilegedExceptionAction(mp, true);
+ Action dp = new Action("private/private.txt");
+ MorePermissionPrivilegedExceptionAction mp =
+ new MorePermissionPrivilegedExceptionAction(dp, false);
+ LessPermissionPrivilegedExceptionAction lp =
+ new LessPermissionPrivilegedExceptionAction(mp, true);
try {
mp.takeAction();
} catch (Exception e) {
// Verify the test result
- assertTrue("It is not the security exception.", (e instanceof java.security.PrivilegedActionException));
+ assertTrue("It is not the security exception.",
+ (e instanceof java.security.PrivilegedActionException));
} finally {
- // Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
- System.setSecurityManager(null);
- if (System.getSecurityManager() == null) {
- System.out.println("Security Manager is successfully disabled.");
- } else {
- System.out.println("Security Manager is still enabled");
+ // Disable security manager if it is enabled by this testcsae
+ if (System.getSecurityManager() != null && oldSM == null) {
+ System.setSecurityManager(null);
+ if (System.getSecurityManager() == null) {
+ System.out.println("Security Manager is successfully disabled.");
+ } else {
+ System.out.println("Security Manager is still enabled");
+ }
}
- }
- System.out.println("\ntestPrivilegedExceptionActionFailure() ends\n\n");
+ System.out.println("\ntestPrivilegedExceptionActionFailure() ends\n\n");
}
}
/**
* testCheckPermissionAllowed
*/
-
+
public void testCheckPermissionAllowed() throws Exception {
Java2SecTest.testResult = "testCheckPermissionAllowed failed.";
SecurityManager oldSM = null;
@@ -442,53 +439,52 @@
oldSM = System.getSecurityManager();
if (oldSM != null) {
- System.out.println("\nSecurity Manager is enabled.");
+ System.out.println("\nSecurity Manager is enabled.");
} else {
- System.out.println("\nSecurity Manager is disabled.");
- System.out.println("Enabling the default Java Security Manager");
- System.setSecurityManager(new SecurityManager());
- }
-
- try {
- // Print out maven's base,build, and test direcotories
- String baseDir = System.getProperty("basedir");
- System.out.println("basedir => " + baseDir);
- // 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;
- Permission perm = new java.io.FilePermission(fileURL, "read");
- AccessController.checkPermission(perm);
- allowed = true;
- } catch (Exception e) {
- if (e instanceof AccessControlException) {
- e.printStackTrace(System.out);
- }
+ System.out.println("\nSecurity Manager is disabled.");
+ System.out.println("Enabling the default Java Security Manager");
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ try {
+ // Print out maven's base,build, and test direcotories
+ String baseDir = System.getProperty("basedir");
+ System.out.println("basedir => " + baseDir);
+ // 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;
+ Permission perm = new java.io.FilePermission(fileURL, "read");
+ AccessController.checkPermission(perm);
+ allowed = true;
+ } catch (Exception e) {
+ if (e instanceof AccessControlException) {
+ e.printStackTrace(System.out);
+ }
} finally {
- assertTrue("Accessing to public.txt file is denied; Test failed.", allowed);
- // Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
- System.setSecurityManager(null);
- if (System.getSecurityManager() == null) {
- System.out.println("Security Manager is successfully disabled.");
- } else {
- System.out.println("Security Manager is still enabled");
+ assertTrue("Accessing to public.txt file is denied; Test failed.", allowed);
+ // Disable security manager if it is enabled by this testcsae
+ if (System.getSecurityManager() != null && oldSM == null) {
+ System.setSecurityManager(null);
+ if (System.getSecurityManager() == null) {
+ System.out.println("Security Manager is successfully disabled.");
+ } else {
+ System.out.println("Security Manager is still enabled");
+ }
}
- }
- System.out.println("\ntestCheckPermissionAllowed() ends.\n");
+ System.out.println("\ntestCheckPermissionAllowed() ends.\n");
}
}
-
/**
* testCheckPermissionDenied
*/
-
+
public void testCheckPermissionDenied() throws Exception {
Java2SecTest.testResult = "testCheckPermissionDenied failed";
SecurityManager oldSM = null;
@@ -510,15 +506,15 @@
// Print out maven's base,build, and test direcotories
String baseDir = System.getProperty("basedir");
System.out.println("basedir => " + baseDir);
-
+
// Convert the \ (back slash) to / (forward slash)
String baseDirM = baseDir.replace('\\', '/');
- System.out.println("baseDirM => "+ baseDirM);
-
+ System.out.println("baseDirM => " + baseDirM);
+
String fs = "/";
-
+
// Build the file URL
- String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
+ String fileURL = baseDirM + fs + "test-resources" + fs + "java2sec" + fs + fileName;
Permission perm = new java.io.FilePermission(fileURL, "read");
AccessController.checkPermission(perm);
denied = false;
@@ -526,12 +522,12 @@
if (!(e instanceof AccessControlException)) {
denied = false;
}
- e.printStackTrace(System.out);
+ e.printStackTrace(System.out);
} finally {
assertTrue("Accessing to private.txt file is allowed; Test failed.", denied);
// Disable security manager if it is enabled by this testcsae
- if (System.getSecurityManager() != null && oldSM == null) {
+ if (System.getSecurityManager() != null && oldSM == null) {
System.setSecurityManager(null);
if (System.getSecurityManager() == null) {
System.out.println("Security Manager is successfully disabled.");
@@ -541,5 +537,5 @@
}
System.out.println("\ntestCheckPermissionDenied() ends.\n");
}
- }
+ }
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/interf/Actor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/interf/Actor.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/interf/Actor.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/interf/Actor.java Sun Mar 4 10:16:54 2007
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.axis2.java.security.interf;
/**
@@ -21,6 +21,6 @@
*/
public interface Actor {
- public void takeAction();
+ public void takeAction();
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermission.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermission.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermission.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermission.java Sun Mar 4 10:16:54 2007
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.axis2.java.security.less;
import org.apache.axis2.java.security.AccessController;
@@ -22,7 +22,6 @@
import java.security.PrivilegedAction;
-
/**
* LessPermission has no read permission to the private.txt file
*/
@@ -31,33 +30,32 @@
private Actor _actor;
private boolean _usingDoPrivilege;
-
+
// Construtor
public LessPermission(Actor a, boolean usingDoPrivilege) {
- _actor = a;
- _usingDoPrivilege = usingDoPrivilege;
+ _actor = a;
+ _usingDoPrivilege = usingDoPrivilege;
}
-
+
// Implement Actor's takeAction method
public void takeAction() {
- try {
- if (_usingDoPrivilege) {
- // Use AccessController's doPrivilege
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
+ try {
+ if (_usingDoPrivilege) {
+ // Use AccessController's doPrivilege
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ _actor.takeAction();
+ return null;
+ }
+ });
+ } else {
+ // Use no AccessController's doPrivilege
_actor.takeAction();
- return null;
}
- });
- }
- else {
- // Use no AccessController's doPrivilege
- _actor.takeAction();
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermissionAccessControlContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermissionAccessControlContext.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermissionAccessControlContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermissionAccessControlContext.java Sun Mar 4 10:16:54 2007
@@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.axis2.java.security.less;
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.java.security.interf.Actor;
-import java.security.PrivilegedAction;
import java.security.AccessControlContext;
-
+import java.security.PrivilegedAction;
/**
@@ -32,34 +31,33 @@
private Actor _actor;
private boolean _usingDoPrivilege;
-
+
// Construtor
public LessPermissionAccessControlContext(Actor a, boolean usingDoPrivilege) {
- _actor = a;
- _usingDoPrivilege = usingDoPrivilege;
+ _actor = a;
+ _usingDoPrivilege = usingDoPrivilege;
}
-
+
// Implement Actor's takeAction method
public void takeAction() {
- try {
- if (_usingDoPrivilege) {
- final AccessControlContext acc = AccessController.getContext();
- // Demostrate the usage of AccessController.doPrivileged(PrivilegeAction action, AccessContext ctx)
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
+ try {
+ if (_usingDoPrivilege) {
+ final AccessControlContext acc = AccessController.getContext();
+ // Demostrate the usage of AccessController.doPrivileged(PrivilegeAction action, AccessContext ctx)
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ _actor.takeAction();
+ return null;
+ }
+ }, acc);
+ } else {
+ // Use no doPrivileged
_actor.takeAction();
- return null;
}
- }, acc);
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
}
- else {
- // Use no doPrivileged
- _actor.takeAction();
- }
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermissionPrivilegedExceptionAction.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermissionPrivilegedExceptionAction.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermissionPrivilegedExceptionAction.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/less/LessPermissionPrivilegedExceptionAction.java Sun Mar 4 10:16:54 2007
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.axis2.java.security.less;
import org.apache.axis2.java.security.AccessController;
@@ -22,7 +22,6 @@
import java.security.PrivilegedExceptionAction;
-
/**
* LessPermission has no read permission to the private.txt file
*/
@@ -31,33 +30,32 @@
private Actor _actor;
private boolean _usingDoPrivilege;
-
+
// Construtor
public LessPermissionPrivilegedExceptionAction(Actor a, boolean usingDoPrivilege) {
- _actor = a;
- _usingDoPrivilege = usingDoPrivilege;
+ _actor = a;
+ _usingDoPrivilege = usingDoPrivilege;
}
-
+
// Implement Actor's takeAction method
public void takeAction() {
- try {
- if (_usingDoPrivilege) {
- // Demostrate the usage of AccessController.doPrivileged(PrivilegedExceptionAction action)
- AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() {
+ try {
+ if (_usingDoPrivilege) {
+ // Demostrate the usage of AccessController.doPrivileged(PrivilegedExceptionAction action)
+ AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Object run() {
+ _actor.takeAction();
+ return null;
+ }
+ });
+ } else {
+ // Use no doPrivileged
_actor.takeAction();
- return null;
}
- });
- }
- else {
- // Use no doPrivileged
- _actor.takeAction();
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermission.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermission.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermission.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermission.java Sun Mar 4 10:16:54 2007
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.axis2.java.security.more;
import org.apache.axis2.java.security.AccessController;
@@ -26,37 +26,36 @@
*/
public class MorePermission implements Actor {
-
- private Actor _actor;
+
+ private Actor _actor;
private boolean _usingDoPrivilege;
// Constructor
public MorePermission(Actor a, boolean usingDoPrivilege) {
- _actor = a;
- _usingDoPrivilege = usingDoPrivilege;
+ _actor = a;
+ _usingDoPrivilege = usingDoPrivilege;
}
// Implementing Actor's takeAction method
public void takeAction() {
- try {
- if (_usingDoPrivilege) {
- // Use AccessController's doPrivilege
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
+ try {
+ if (_usingDoPrivilege) {
+ // Use AccessController's doPrivilege
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ _actor.takeAction();
+ return null;
+ }
+ });
+ } else {
+ // Use no AccessController's doPrivilege
_actor.takeAction();
- return null;
- }
- });
- }
- else {
- // Use no AccessController's doPrivilege
- _actor.takeAction();
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
}
- }
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermissionAccessControlContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermissionAccessControlContext.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermissionAccessControlContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermissionAccessControlContext.java Sun Mar 4 10:16:54 2007
@@ -13,68 +13,67 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.axis2.java.security.more;
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.java.security.interf.Actor;
-import java.security.PrivilegedAction;
import java.security.AccessControlContext;
import java.security.Permission;
+import java.security.PrivilegedAction;
/**
* MorePermissionAccessControllerContext has read permission to both public.txt and private.txt
*/
public class MorePermissionAccessControlContext implements Actor {
-
- private Actor _actor;
+
+ private Actor _actor;
private boolean _usingDoPrivilege;
// Constructor
public MorePermissionAccessControlContext(Actor a, boolean usingDoPrivilege) {
- _actor = a;
- _usingDoPrivilege = usingDoPrivilege;
+ _actor = a;
+ _usingDoPrivilege = usingDoPrivilege;
}
// Implementing Actor's takeAction method
public void takeAction() {
- try {
- if (_usingDoPrivilege) {
- final AccessControlContext acc = AccessController.getContext();
- // Print out maven's base,build, and test direcotories
- String baseDir = System.getProperty("basedir");
- System.out.println("basedir => " + baseDir);
-
- // Convert the \ (back slash) to / (forward slash)
- String baseDirM = baseDir.replace('\\', '/');
- System.out.println("baseDirM => "+ baseDirM);
-
- String fs = "/";
- String fileName = "private/private.txt";
-
- // Build the file URL
- String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
- Permission perm = new java.io.FilePermission(fileURL, "read");
- acc.checkPermission(perm);
- // Demostrate the usage of AccessController's doPrivilege(PrivilegeAction action, AccessContext ctx)
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public Object run() {
+ try {
+ if (_usingDoPrivilege) {
+ final AccessControlContext acc = AccessController.getContext();
+ // Print out maven's base,build, and test direcotories
+ String baseDir = System.getProperty("basedir");
+ System.out.println("basedir => " + baseDir);
+
+ // Convert the \ (back slash) to / (forward slash)
+ String baseDirM = baseDir.replace('\\', '/');
+ System.out.println("baseDirM => " + baseDirM);
+
+ String fs = "/";
+ String fileName = "private/private.txt";
+
+ // Build the file URL
+ String fileURL = baseDirM + fs + "test-resources" + fs + "java2sec" + fs + fileName;
+ Permission perm = new java.io.FilePermission(fileURL, "read");
+ acc.checkPermission(perm);
+ // Demostrate the usage of AccessController's doPrivilege(PrivilegeAction action, AccessContext ctx)
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ _actor.takeAction();
+ return null;
+ }
+ }, acc);
+ } else {
+ // Use no doPrivileged
_actor.takeAction();
- return null;
- }
- }, acc);
- }
- else {
- // Use no doPrivileged
- _actor.takeAction();
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
}
- }
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermissionPrivilegedExceptionAction.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermissionPrivilegedExceptionAction.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermissionPrivilegedExceptionAction.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/more/MorePermissionPrivilegedExceptionAction.java Sun Mar 4 10:16:54 2007
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.axis2.java.security.more;
import org.apache.axis2.java.security.AccessController;
@@ -26,37 +26,36 @@
*/
public class MorePermissionPrivilegedExceptionAction implements Actor {
-
- private Actor _actor;
+
+ private Actor _actor;
private boolean _usingDoPrivilege;
// Constructor
public MorePermissionPrivilegedExceptionAction(Actor a, boolean usingDoPrivilege) {
- _actor = a;
- _usingDoPrivilege = usingDoPrivilege;
+ _actor = a;
+ _usingDoPrivilege = usingDoPrivilege;
}
// Implementing Actor's takeAction method
public void takeAction() {
- try {
- if (_usingDoPrivilege) {
- // Demostrate the usage of AccessController.doPrivileged(PrivilegedExceptionAction action)
- AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() {
+ try {
+ if (_usingDoPrivilege) {
+ // Demostrate the usage of AccessController.doPrivileged(PrivilegedExceptionAction action)
+ AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Object run() {
+ _actor.takeAction();
+ return null;
+ }
+ });
+ } else {
+ // Use no doPrivilege
_actor.takeAction();
- return null;
- }
- });
- }
- else {
- // Use no doPrivilege
- _actor.takeAction();
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
}
- }
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/misc/MiscTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/misc/MiscTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/misc/MiscTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/misc/MiscTest.java Sun Mar 4 10:16:54 2007
@@ -30,8 +30,6 @@
super(testName);
}
-
-
public void testAxisFault() {
Exception e = new InvocationTargetException(new Exception());
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/AddingHandlerToEachPhaseTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/AddingHandlerToEachPhaseTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/AddingHandlerToEachPhaseTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/AddingHandlerToEachPhaseTest.java Sun Mar 4 10:16:54 2007
@@ -142,7 +142,7 @@
Phase phase = (Phase) inPhase.get(i);
ArrayList hnadles = phase.getHandlers();
Handler handler = (Handler) hnadles.get(0);
- assertEquals("",handler.getHandlerDesc().getRules().getAfter());
+ assertEquals("", handler.getHandlerDesc().getRules().getAfter());
}
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/BeforeWithNoFirstHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/BeforeWithNoFirstHandlerTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/BeforeWithNoFirstHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/BeforeWithNoFirstHandlerTest.java Sun Mar 4 10:16:54 2007
@@ -19,8 +19,8 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.HandlerDescription;
import org.apache.axis2.description.PhaseRule;
import org.apache.axis2.engine.AxisConfiguration;
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseFirstRulesTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseFirstRulesTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseFirstRulesTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseFirstRulesTest.java Sun Mar 4 10:16:54 2007
@@ -19,8 +19,8 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.HandlerDescription;
import org.apache.axis2.description.PhaseRule;
import org.apache.axis2.engine.AxisConfiguration;
@@ -42,7 +42,7 @@
phases.add(p2);
MessageContext msg = ContextFactory.createMessageContext(
- new ConfigurationContext(new AxisConfiguration()));
+ new ConfigurationContext(new AxisConfiguration()));
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseFirstTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseFirstTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseFirstTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseFirstTest.java Sun Mar 4 10:16:54 2007
@@ -19,8 +19,8 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.HandlerDescription;
import org.apache.axis2.description.PhaseRule;
import org.apache.axis2.engine.AxisConfiguration;
@@ -42,7 +42,7 @@
phases.add(p2);
MessageContext msg = ContextFactory.createMessageContext(
- new ConfigurationContext(new AxisConfiguration()));
+ new ConfigurationContext(new AxisConfiguration()));
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseLastRuleTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseLastRuleTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseLastRuleTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaseLastRuleTest.java Sun Mar 4 10:16:54 2007
@@ -19,8 +19,8 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.HandlerDescription;
import org.apache.axis2.description.PhaseRule;
import org.apache.axis2.engine.AxisConfiguration;
@@ -42,7 +42,7 @@
phases.add(p2);
MessageContext msg = ContextFactory.createMessageContext(
- new ConfigurationContext(new AxisConfiguration()));
+ new ConfigurationContext(new AxisConfiguration()));
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaselastTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaselastTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaselastTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/InvalidPhaselastTest.java Sun Mar 4 10:16:54 2007
@@ -19,8 +19,8 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.HandlerDescription;
import org.apache.axis2.description.PhaseRule;
import org.apache.axis2.engine.AxisConfiguration;
@@ -42,7 +42,7 @@
phases.add(p2);
MessageContext msg = ContextFactory.createMessageContext(
- new ConfigurationContext(new AxisConfiguration()));
+ new ConfigurationContext(new AxisConfiguration()));
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/PhaseRuleHandlers.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/PhaseRuleHandlers.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/PhaseRuleHandlers.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/PhaseRuleHandlers.java Sun Mar 4 10:16:54 2007
@@ -29,13 +29,13 @@
public class PhaseRuleHandlers extends AbstractHandler implements Handler {
private static final long serialVersionUID = 2941436920684525811L;
-
+
private static final Log log = LogFactory.getLog(PhaseRuleHandlers.class);
private QName name;
-
+
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
log.info("I am " + name + " Handler Running :)");
- return InvocationResponse.CONTINUE;
+ return InvocationResponse.CONTINUE;
}
public void revoke(MessageContext msgContext) {
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/SingleHandlerPhaseTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/SingleHandlerPhaseTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/SingleHandlerPhaseTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/phaserule/SingleHandlerPhaseTest.java Sun Mar 4 10:16:54 2007
@@ -19,8 +19,8 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.HandlerDescription;
import org.apache.axis2.description.PhaseRule;
import org.apache.axis2.engine.AxisConfiguration;
@@ -42,7 +42,7 @@
phases.add(p2);
MessageContext msg = ContextFactory.createMessageContext(
- new ConfigurationContext(new AxisConfiguration()));
+ new ConfigurationContext(new AxisConfiguration()));
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/registry/Handler3.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/registry/Handler3.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/registry/Handler3.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/registry/Handler3.java Sun Mar 4 10:16:54 2007
@@ -6,8 +6,6 @@
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -40,7 +38,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/sample/echo/EchoImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/echo/EchoImpl.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/echo/EchoImpl.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/echo/EchoImpl.java Sun Mar 4 10:16:54 2007
@@ -17,10 +17,13 @@
package org.apache.axis2.sample.echo;
public class EchoImpl {
- public EchoImpl(){}
+ public EchoImpl() {
+ }
+
public java.lang.String echoString(java.lang.String in) {
return in;
}
+
public java.lang.String[] echoStringArray(java.lang.String[] in) {
return in;
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/handlers/LoggingHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/handlers/LoggingHandler.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/handlers/LoggingHandler.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/handlers/LoggingHandler.java Sun Mar 4 10:16:54 2007
@@ -25,12 +25,12 @@
public class LoggingHandler extends AbstractHandler {
private static final long serialVersionUID = 7656851260678664746L;
-
+
private static final Log log = LogFactory.getLog(LoggingHandler.class);
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
log.info("Incoming message From " + msgContext.getTo().getAddress());
- return InvocationResponse.CONTINUE;
+ return InvocationResponse.CONTINUE;
}
public void revoke(MessageContext msgContext) {
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/http/util/URLTemplatingUtilTest.java Sun Mar 4 10:16:54 2007
@@ -16,18 +16,17 @@
package org.apache.axis2.transport.http.util;
-import org.apache.axiom.om.OMElement;
+import junit.framework.TestCase;
import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.WSDL2Constants;
-import java.net.URL;
import java.net.MalformedURLException;
-
-import junit.framework.TestCase;
+import java.net.URL;
public class URLTemplatingUtilTest extends TestCase {
@@ -52,7 +51,8 @@
}
public void testGetTemplatedURL() throws AxisFault, MalformedURLException {
- URL testURL = new URL("http://locahost:8080/paramOne/{FirstName}?test=1&lastName={LastName}");
+ URL testURL =
+ new URL("http://locahost:8080/paramOne/{FirstName}?test=1&lastName={LastName}");
URL modifiedURL = URLTemplatingUtil.getTemplatedURL(testURL, messageContext, true);
System.out.println("original = " + testURL);
@@ -65,7 +65,7 @@
public void testAppendParametersToURL() throws MalformedURLException, AxisFault {
URL testURL = new URL("http://locahost:8080/paramOne");
- URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext,testURL);
+ URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext, testURL);
System.out.println("original = " + testURL);
System.out.println("modifiedURL = " + modifiedURL);
@@ -76,8 +76,8 @@
public void testQueryParameterSeperator() throws MalformedURLException, AxisFault {
URL testURL = new URL("http://locahost:8080/paramOne");
- messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,";");
- URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext,testURL);
+ messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, ";");
+ URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext, testURL);
System.out.println("original = " + testURL);
System.out.println("modifiedURL = " + modifiedURL);
@@ -89,8 +89,8 @@
public void testIgnoreUncitedTrue() throws MalformedURLException, AxisFault {
URL testURL = new URL("http://locahost:8080/paramOne/Foo?test=1");
- messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED,"true");
- URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext,testURL);
+ messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED, "true");
+ URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext, testURL);
System.out.println("original = " + testURL);
System.out.println("modifiedURL = " + modifiedURL);
@@ -103,8 +103,8 @@
public void testIgnoreUncitedFalse() throws MalformedURLException, AxisFault {
URL testURL = new URL("http://locahost:8080/paramOne/Foo?test=1");
- messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED,"false");
- URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext,testURL);
+ messageContext.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED, "false");
+ URL modifiedURL = URLTemplatingUtil.appendParametersToURL(messageContext, testURL);
System.out.println("original = " + testURL);
System.out.println("modifiedURL = " + modifiedURL);
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/tcp/TCPTransportTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/tcp/TCPTransportTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/tcp/TCPTransportTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/transport/tcp/TCPTransportTest.java Sun Mar 4 10:16:54 2007
@@ -23,7 +23,6 @@
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.apache.axis2.AxisFault;
-import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import java.io.InputStream;
@@ -34,7 +33,7 @@
public void testTransportSender() throws AxisFault {
}
-
+
public SOAPEnvelope createSOAPEnvelope(InputStream in) throws AxisFault {
try {
XMLStreamReader xmlreader =
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/util/ThreadContextMigratorTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/util/ThreadContextMigratorTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/util/ThreadContextMigratorTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/util/ThreadContextMigratorTest.java Sun Mar 4 10:16:54 2007
@@ -16,84 +16,84 @@
package org.apache.axis2.util;
+import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ContextFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.engine.AxisConfiguration;
-import junit.framework.TestCase;
+public class ThreadContextMigratorTest extends TestCase {
+ private static String TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID
+ = "Test-ThreadContextMigrator-List";
+ private MessageContext messageContext;
-public class ThreadContextMigratorTest extends TestCase
-{
- private static String TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID
- = "Test-ThreadContextMigrator-List";
- private MessageContext messageContext;
-
- public void setUp()
- {
- messageContext = ContextFactory.createMessageContext(
+ public void setUp() {
+ messageContext = ContextFactory.createMessageContext(
new ConfigurationContext(new AxisConfiguration()));
- }
-
- public void testEmptyMigratorStructure()
- throws Exception
- {
- ThreadContextMigratorUtil.performMigrationToThread(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
- ThreadContextMigratorUtil.performMigrationToContext(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
- ThreadContextMigratorUtil.performThreadCleanup(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
- ThreadContextMigratorUtil.performContextCleanup(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
- }
-
- public void testMigration()
- throws Exception
- {
- TestMigrator testMigrator1 = new TestMigrator();
- TestMigrator testMigrator2 = new TestMigrator();
- ThreadContextMigratorUtil.addThreadContextMigrator(messageContext.getConfigurationContext(), TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, testMigrator1);
- ThreadContextMigratorUtil.addThreadContextMigrator(messageContext.getConfigurationContext(), TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, testMigrator2);
- ThreadContextMigratorUtil.performMigrationToThread(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
- assertTrue(testMigrator1.migratedToThread);
- assertTrue(testMigrator2.migratedToThread);
- ThreadContextMigratorUtil.performMigrationToContext(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
- assertTrue(testMigrator1.migratedToContext);
- assertTrue(testMigrator2.migratedToContext);
- ThreadContextMigratorUtil.performThreadCleanup(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
- assertTrue(testMigrator1.cleanedThread);
- assertTrue(testMigrator2.cleanedThread);
- ThreadContextMigratorUtil.performContextCleanup(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
- assertTrue(testMigrator1.cleanedContext);
- assertTrue(testMigrator2.cleanedContext);
- }
-
- class TestMigrator implements ThreadContextMigrator
- {
- boolean migratedToThread;
- boolean cleanedThread;
- boolean migratedToContext;
- boolean cleanedContext;
-
- public void migrateContextToThread(MessageContext messageContext) throws AxisFault
- {
- migratedToThread = true;
}
- public void cleanupThread(MessageContext messageContext)
- {
- cleanedThread = true;
+ public void testEmptyMigratorStructure()
+ throws Exception {
+ ThreadContextMigratorUtil
+ .performMigrationToThread(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
+ ThreadContextMigratorUtil
+ .performMigrationToContext(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
+ ThreadContextMigratorUtil
+ .performThreadCleanup(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
+ ThreadContextMigratorUtil
+ .performContextCleanup(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
}
- public void migrateThreadToContext(MessageContext messageContext) throws AxisFault
- {
- migratedToContext = true;
+ public void testMigration()
+ throws Exception {
+ TestMigrator testMigrator1 = new TestMigrator();
+ TestMigrator testMigrator2 = new TestMigrator();
+ ThreadContextMigratorUtil.addThreadContextMigrator(messageContext.getConfigurationContext(),
+ TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID,
+ testMigrator1);
+ ThreadContextMigratorUtil.addThreadContextMigrator(messageContext.getConfigurationContext(),
+ TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID,
+ testMigrator2);
+ ThreadContextMigratorUtil
+ .performMigrationToThread(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
+ assertTrue(testMigrator1.migratedToThread);
+ assertTrue(testMigrator2.migratedToThread);
+ ThreadContextMigratorUtil
+ .performMigrationToContext(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
+ assertTrue(testMigrator1.migratedToContext);
+ assertTrue(testMigrator2.migratedToContext);
+ ThreadContextMigratorUtil
+ .performThreadCleanup(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
+ assertTrue(testMigrator1.cleanedThread);
+ assertTrue(testMigrator2.cleanedThread);
+ ThreadContextMigratorUtil
+ .performContextCleanup(TEST_THREAD_CONTEXT_MIGRATOR_LIST_ID, messageContext);
+ assertTrue(testMigrator1.cleanedContext);
+ assertTrue(testMigrator2.cleanedContext);
}
- public void cleanupContext(MessageContext messageContext)
- {
- cleanedContext = true;
+ class TestMigrator implements ThreadContextMigrator {
+ boolean migratedToThread;
+ boolean cleanedThread;
+ boolean migratedToContext;
+ boolean cleanedContext;
+
+ public void migrateContextToThread(MessageContext messageContext) throws AxisFault {
+ migratedToThread = true;
+ }
+
+ public void cleanupThread(MessageContext messageContext) {
+ cleanedThread = true;
+ }
+
+ public void migrateThreadToContext(MessageContext messageContext) throws AxisFault {
+ migratedToContext = true;
+ }
+
+ public void cleanupContext(MessageContext messageContext) {
+ cleanedContext = true;
+ }
+
}
-
- }
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/util/UtilsParseRequestTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/util/UtilsParseRequestTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/util/UtilsParseRequestTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/util/UtilsParseRequestTest.java Sun Mar 4 10:16:54 2007
@@ -30,39 +30,40 @@
public void testfailure() throws Exception {
fail("here");
}
+
public void testService() throws Exception {
assertParsesTo("http://localhost:8081/services/System",
- "System");
+ "System");
}
public void testServiceCalledServices() throws Exception {
assertParsesTo("http://localhost:8081/services/services",
- "services");
+ "services");
}
public void testServiceWithQuery() throws Exception {
assertParsesTo("http://localhost:8081/services/System?system=ecb2f",
- "System");
+ "System");
}
public void testServiceWithDoubleQuery() throws Exception {
assertParsesTo("http://localhost:8081/services/System?system=ecb2f?job=3",
- "System");
+ "System");
}
public void testOperation() throws Exception {
assertParsesTo("http://localhost:8081/services/System/operation",
- "System", "operation");
+ "System", "operation");
}
public void testOperationWithQuery() throws Exception {
assertParsesTo("http://localhost:8081/services/System/operation?system=ecb2f",
- "System","operation");
+ "System", "operation");
}
public void testOperationServiceCalledServices() throws Exception {
assertParsesTo("http://localhost:8081/services/services/operation",
- "services","operation");
+ "services", "operation");
}
private void assertParsesTo(String path, String service) {
@@ -71,7 +72,7 @@
private void assertParsesTo(String path, String service, String operation) {
String[] strings = Utils.parseRequestURLForServiceAndOperation(path, "/axis2/services");
- assertEquals(service,strings[0]);
+ assertEquals(service, strings[0]);
assertEquals(operation, strings[1]);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org