Author: jim.ma
Date: 2013-05-09 03:07:22 -0400 (Thu, 09 May 2013)
New Revision: 17540
Modified:
shared-testsuite/branches/jbossws-shared-testsuite-4.1.x/testsuite/src/test/java/org/jboss/test/ws/jaxws/samples/securityDomain/SecurityDomainTestCase.java
Log:
[BZ927558]:Workaround to fix the test failure only happens with IBM JDK6
Modified:
shared-testsuite/branches/jbossws-shared-testsuite-4.1.x/testsuite/src/test/java/org/jboss/test/ws/jaxws/samples/securityDomain/SecurityDomainTestCase.java
===================================================================
---
shared-testsuite/branches/jbossws-shared-testsuite-4.1.x/testsuite/src/test/java/org/jboss/test/ws/jaxws/samples/securityDomain/SecurityDomainTestCase.java 2013-05-08
15:53:16 UTC (rev 17539)
+++
shared-testsuite/branches/jbossws-shared-testsuite-4.1.x/testsuite/src/test/java/org/jboss/test/ws/jaxws/samples/securityDomain/SecurityDomainTestCase.java 2013-05-09
07:07:22 UTC (rev 17540)
@@ -72,6 +72,54 @@
return Service.create(wsdlURL, serviceName).getPort(SecureEndpoint.class);
}
+
+ public void testUnauthenticated() throws Exception
+ {
+ SecureEndpoint port1 = getAuthzPort();
+
+ try {
+ port1.echoForAll("Hello");
+ fail("Authentication exception expected!");
+ } catch (Exception e) {
+ //expected web layer exception
+ assertTrue(e.getMessage().contains("Could not send Message"));
+ assertTrue("Exception Cause message: " + e.getCause().getMessage(),
e.getCause().getMessage().contains("401: Unauthorized"));
+ }
+
+ try {
+ port1.echo("Hello");
+ fail("Authentication exception expected!");
+ } catch (Exception e) {
+ //expected web layer exception
+ assertTrue(e.getMessage().contains("Could not send Message"));
+ assertTrue("Exception Cause message: " + e.getCause().getMessage(),
e.getCause().getMessage().contains("401: Unauthorized"));
+ }
+
+ try {
+ port1.restrictedEcho("Hello");
+ fail("Authentication exception expected!");
+ } catch (Exception e) {
+ //expected web layer exception
+ assertTrue(e.getMessage().contains("Could not send Message"));
+ assertTrue("Exception Cause message: " + e.getCause().getMessage(),
e.getCause().getMessage().contains("401: Unauthorized"));
+ }
+ }
+
+ public void testUnauthorized() throws Exception
+ {
+ SecureEndpoint port2 = getAuthzPort();
+ ((BindingProvider)port2).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"john");
+ ((BindingProvider)port2).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"bar");
+ try {
+ port2.restrictedEcho("Hello");
+ fail("Authorization exception expected!");
+ } catch (Exception e) {
+ //expected EJB3 layer authorization exception
+ assertTrue("Exception message: " + e.getMessage(),
e.getMessage().contains("not allowed"));
+ }
+ }
+
+
public void testAuthorizedAccess() throws Exception
{
SecureEndpoint port = getAuthzPort();
@@ -119,51 +167,4 @@
}
}
- public void testUnauthenticated() throws Exception
- {
- SecureEndpoint port = getAuthzPort();
-
- try {
- port.echoForAll("Hello");
- fail("Authentication exception expected!");
- } catch (Exception e) {
- //expected web layer exception
- assertTrue(e.getMessage().contains("Could not send Message"));
- assertTrue("Exception Cause message: " + e.getCause().getMessage(),
e.getCause().getMessage().contains("401: Unauthorized"));
- }
-
- try {
- port.echo("Hello");
- fail("Authentication exception expected!");
- } catch (Exception e) {
- //expected web layer exception
- e.printStackTrace();
- assertTrue(e.getMessage().contains("Could not send Message"));
- assertTrue("Exception Cause message: " + e.getCause().getMessage(),
e.getCause().getMessage().contains("401: Unauthorized"));
- }
-
- try {
- port.restrictedEcho("Hello");
- fail("Authentication exception expected!");
- } catch (Exception e) {
- //expected web layer exception
- assertTrue(e.getMessage().contains("Could not send Message"));
- assertTrue("Exception Cause message: " + e.getCause().getMessage(),
e.getCause().getMessage().contains("401: Unauthorized"));
- }
- }
-
- public void testUnauthorized() throws Exception
- {
- SecureEndpoint port = getAuthzPort();
- ((BindingProvider)port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"john");
- ((BindingProvider)port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"bar");
- try {
- port.restrictedEcho("Hello");
- fail("Authorization exception expected!");
- } catch (Exception e) {
- //expected EJB3 layer authorization exception
- assertTrue("Exception message: " + e.getMessage(),
e.getMessage().contains("not allowed"));
- }
- }
-
}
Show replies by date