User: starksm
Date: 01/10/05 00:51:00
Modified: src/main/org/jboss/test/web/test
WebIntegrationUnitTestCase.java
Log:
Validate that the error code seen on failure is 401 or else a client
browser will not be able to attempt a login
Revision Changes Path
1.6 +29 -1
jbosstest/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java
Index: WebIntegrationUnitTestCase.java
===================================================================
RCS file:
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WebIntegrationUnitTestCase.java 2001/09/27 00:18:48 1.5
+++ WebIntegrationUnitTestCase.java 2001/10/05 07:51:00 1.6
@@ -34,7 +34,7 @@
with a role of 'AuthorizedUser' in the servlet container.
@author [EMAIL PROTECTED]
- @version $Revision: 1.5 $
+ @version $Revision: 1.6 $
*/
public class WebIntegrationUnitTestCase extends JBossTestCase
{
@@ -96,6 +96,29 @@
URL url = new URL(baseURL+"jbosstest/restricted/SecureServlet");
accessURL(url);
}
+ /** Access the http://localhost/jbosstest/restricted/SecureServlet
+ */
+ public void testSecureServletWithBadPass() throws Exception
+ {
+ if( webServerAvailable == false )
+ return;
+
+ String baseURL = "http://jduke:badpass@localhost:" + port + '/';
+ URL url = new URL(baseURL+"jbosstest/restricted/SecureServlet");
+ accessURL(url, true);
+ }
+ /** Access the http://localhost/jbosstest/restricted/SecureServlet
+ */
+ public void testSecureServletWithNoLogin() throws Exception
+ {
+ if( webServerAvailable == false )
+ return;
+
+ String baseURL = "http://localhost:" + port + '/';
+ URL url = new URL(baseURL+"jbosstest/restricted/SecureServlet");
+ accessURL(url, true);
+ }
+
/** Access the http://localhost/jbosstest/restricted/SecureEJBAccess
*/
public void testSecureEJBAccess() throws Exception
@@ -137,6 +160,11 @@
getLog().debug(content);
if( shouldFail == false )
fail("Access to: "+url+" failed with responseCode="+responseCode);
+ else
+ {
+ // Validate that we are seeing a 401 error
+ assertTrue("Error code 401, actual="+responseCode, responseCode ==
HttpURLConnection.HTTP_UNAUTHORIZED);
+ }
}
}
catch(IOException e)
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development