[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: starksm Date: 02/04/17 01:30:46 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: Add a test of accessing an entity bean from a servlet Revision ChangesPath 1.14 +8 -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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- WebIntegrationUnitTestCase.java 16 Feb 2002 05:36:56 - 1.13 +++ WebIntegrationUnitTestCase.java 17 Apr 2002 08:30:46 - 1.14 @@ -34,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.13 $ + @version $Revision: 1.14 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -65,6 +65,13 @@ public void testEJBServlet() throws Exception { URL url = new URL(baseURL+"jbosstest/EJBServlet"); + accessURL(url); + } + /** Access the http://localhost/jbosstest/EntityServlet +*/ + public void testEntityServlet() throws Exception + { + URL url = new URL(baseURL+"jbosstest/EntityServlet"); accessURL(url); } /** Access the http://localhost/jbosstest/UserTransactionServlet ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: starksm Date: 02/04/17 01:29:13 Modified:src/main/org/jboss/test/web/test Tag: Branch_3_0 WebIntegrationUnitTestCase.java Log: Add a test of accessing an entity bean from a servlet Revision ChangesPath No revision No revision 1.13.2.1 +8 -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.13 retrieving revision 1.13.2.1 diff -u -r1.13 -r1.13.2.1 --- WebIntegrationUnitTestCase.java 16 Feb 2002 05:36:56 - 1.13 +++ WebIntegrationUnitTestCase.java 17 Apr 2002 08:29:12 - 1.13.2.1 @@ -34,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.13 $ + @version $Revision: 1.13.2.1 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -65,6 +65,13 @@ public void testEJBServlet() throws Exception { URL url = new URL(baseURL+"jbosstest/EJBServlet"); + accessURL(url); + } + /** Access the http://localhost/jbosstest/EntityServlet +*/ + public void testEntityServlet() throws Exception + { + URL url = new URL(baseURL+"jbosstest/EntityServlet"); accessURL(url); } /** Access the http://localhost/jbosstest/UserTransactionServlet ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: d_jencks Date: 02/01/29 14:00:07 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: simplified deployment calls Revision ChangesPath 1.12 +3 -3 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.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- WebIntegrationUnitTestCase.java 2001/12/22 18:48:16 1.11 +++ WebIntegrationUnitTestCase.java 2002/01/29 22:00:07 1.12 @@ -34,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.11 $ + @version $Revision: 1.12 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -181,12 +181,12 @@ protected void setUp() throws Exception { super.setUp(); -deployJ2ee("jbosstest-web.ear"); +deploy("jbosstest-web.ear"); flushAuthCache(); } protected void tearDown() throws Exception { -undeployJ2ee("jbosstest-web.ear"); +undeploy("jbosstest-web.ear"); super.tearDown(); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: ejort Date: 01/12/22 10:48:17 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: No, the URL is correct but the test is broken. Revision ChangesPath 1.11 +3 -3 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.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- WebIntegrationUnitTestCase.java 2001/12/22 15:52:26 1.10 +++ WebIntegrationUnitTestCase.java 2001/12/22 18:48:16 1.11 @@ -34,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.10 $ + @version $Revision: 1.11 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -120,11 +120,11 @@ URL url = new URL(baseURL+"jbosstest/restricted/SecureEJBAccess"); accessURL(url); } - /** Access the http://localhost/jbosstest/restricted/IncludeServlet + /** Access the http://localhost/jbosstest/restricted/include_ejb.jsp */ public void testIncludeEJB() throws Exception { - URL url = new URL(baseURL+"jbosstest/restricted/IncludeServlet"); + URL url = new URL(baseURL+"jbosstest/restricted/include_ejb.jsp"); accessURL(url); } /** Access the http://localhost/jbosstest/restricted/SecureEJBAccess ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: ejort Date: 01/12/22 07:52:27 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: Incorrect url in WebIntegrationUnitTestCase Revision ChangesPath 1.10 +3 -3 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- WebIntegrationUnitTestCase.java 2001/10/08 16:53:00 1.9 +++ WebIntegrationUnitTestCase.java 2001/12/22 15:52:26 1.10 @@ -34,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.9 $ + @version $Revision: 1.10 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -120,11 +120,11 @@ URL url = new URL(baseURL+"jbosstest/restricted/SecureEJBAccess"); accessURL(url); } - /** Access the http://localhost/jbosstest/restricted/include_ejb.jsp + /** Access the http://localhost/jbosstest/restricted/IncludeServlet */ public void testIncludeEJB() throws Exception { - URL url = new URL(baseURL+"jbosstest/restricted/include_ejb.jsp"); + URL url = new URL(baseURL+"jbosstest/restricted/IncludeServlet"); accessURL(url); } /** Access the http://localhost/jbosstest/restricted/SecureEJBAccess ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: sparre Date: 01/10/05 04:39:52 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: Fixed a simple compile error. Revision ChangesPath 1.8 +3 -3 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- WebIntegrationUnitTestCase.java 2001/10/05 09:10:40 1.7 +++ WebIntegrationUnitTestCase.java 2001/10/05 11:39:52 1.8 @@ -34,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.7 $ + @version $Revision: 1.8 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -100,7 +100,7 @@ */ public void testSecureServletWithBadPass() throws Exception { - String baseURL = "http://jduke:badpass@localhost:"; + port + '/'; + String baseURL = "http://jduke:badpass@localhost:"; + Integer.getInteger("web.port", 8080) + '/'; URL url = new URL(baseURL+"jbosstest/restricted/SecureServlet"); accessURL(url, true); } @@ -108,7 +108,7 @@ */ public void testSecureServletWithNoLogin() throws Exception { - String baseURL = "http://localhost:"; + port + '/'; + String baseURL = "http://localhost:"; + Integer.getInteger("web.port", 8080) + '/'; URL url = new URL(baseURL+"jbosstest/restricted/SecureServlet"); accessURL(url, true); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: starksm Date: 01/10/05 02:10:40 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: Remove the webServerAvailable checks Revision ChangesPath 1.7 +1 -7 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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- WebIntegrationUnitTestCase.java 2001/10/05 07:51:00 1.6 +++ WebIntegrationUnitTestCase.java 2001/10/05 09:10:40 1.7 @@ -34,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.6 $ + @version $Revision: 1.7 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -100,9 +100,6 @@ */ 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); @@ -111,9 +108,6 @@ */ 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); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
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 ChangesPath 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
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: d_jencks Date: 01/09/26 17:18:48 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: Turned web tests back on -- oops. Also used logging Revision ChangesPath 1.5 +6 -37 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- WebIntegrationUnitTestCase.java 2001/09/25 18:07:19 1.4 +++ WebIntegrationUnitTestCase.java 2001/09/27 00:18:48 1.5 @@ -34,13 +34,12 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.4 $ + @version $Revision: 1.5 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { - private static boolean setUp; - private static boolean webServerAvailable; - private static String baseURL; + + private String baseURL = "http://jduke:theduke@localhost:"; + Integer.getInteger("web.port", 8080) + "/"; public WebIntegrationUnitTestCase(String name) { @@ -52,9 +51,6 @@ */ public void testEJBOnStartupServlet() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/EJBOnStartupServlet"); accessURL(url); } @@ -62,9 +58,6 @@ */ public void testENCServlet() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/ENCServlet"); accessURL(url); } @@ -72,9 +65,6 @@ */ public void testEJBServlet() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/EJBServlet"); accessURL(url); } @@ -82,9 +72,6 @@ */ public void testUserTransactionServlet() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/UserTransactionServlet"); accessURL(url); } @@ -92,9 +79,6 @@ */ public void testSnoopJSP() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/snoop.jsp"); accessURL(url); } @@ -102,9 +86,6 @@ */ public void testClientLoginServlet() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/ClientLoginServlet"); accessURL(url); } @@ -112,9 +93,6 @@ */ public void testSecureServlet() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/restricted/SecureServlet"); accessURL(url); } @@ -122,9 +100,6 @@ */ public void testSecureEJBAccess() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/restricted/SecureEJBAccess"); accessURL(url); } @@ -132,9 +107,6 @@ */ public void testIncludeEJB() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/restricted/include_ejb.jsp"); accessURL(url); } @@ -142,9 +114,6 @@ */ public void testUnsecureEJBAccess() throws Exception { - if( webServerAvailable == false ) - return; - URL url = new URL(baseURL+"jbosstest/UnsecureEJBAccess"); accessURL(url, true); } @@ -157,15 +126,15 @@ { try { - System.out.println("Connecting to: "+url); + getLog().debug("Connecting to: "+url); HttpClient httpConn = new HttpClient(url); int responseCode = httpConn.getResponseCode(); String response = httpConn.getResponseMessage(); - System.out.println("responseCode="+responseCode+", response="+response); + getLog().debug("responseCode="+responseCode+", response="+response); if( responseCode != HttpURLConnection.HTTP_OK ) { StringBuffer content = httpConn.getContent(); -System.out.println(content); +getLog().debug(content); if( shouldFail == false ) fail("Access to: "+url+" failed with responseCode="+responseCode); } ___ Jboss-development mailing list [EMAIL PROTECTED]
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: sparre Date: 01/09/25 11:07:19 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: Added a test for using UserTransaction in servlets. Revision ChangesPath 1.4 +11 -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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- WebIntegrationUnitTestCase.java 2001/09/18 22:00:45 1.3 +++ WebIntegrationUnitTestCase.java 2001/09/25 18:07:19 1.4 @@ -34,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.3 $ + @version $Revision: 1.4 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -76,6 +76,16 @@ return; URL url = new URL(baseURL+"jbosstest/EJBServlet"); + accessURL(url); + } + /** Access the http://localhost/jbosstest/UserTransactionServlet +*/ + public void testUserTransactionServlet() throws Exception + { + if( webServerAvailable == false ) + return; + + URL url = new URL(baseURL+"jbosstest/UserTransactionServlet"); accessURL(url); } /** Access the http://localhost/jbosstest/snoop.jsp ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: d_jencks Date: 01/09/18 15:00:45 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: Changed tests to deploy/undeploy only once per testcase file. Moved clearAuthCache to JBossTestServices Revision ChangesPath 1.3 +25 -100 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- WebIntegrationUnitTestCase.java 2001/09/17 17:33:54 1.2 +++ WebIntegrationUnitTestCase.java 2001/09/18 22:00:45 1.3 @@ -19,8 +19,9 @@ import junit.framework.TestCase; import junit.framework.TestSuite; -import org.jboss.jmx.connector.rmi.RMIConnector; +//import org.jboss.jmx.connector.rmi.RMIConnector; import org.jboss.test.JBossTestCase; +import org.jboss.test.JBossTestSetup; /** Tests of servlet container integration into the JBoss server. This test requires than a web container be integrated into the JBoss server. The tests @@ -33,7 +34,7 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.2 $ + @version $Revision: 1.3 $ */ public class WebIntegrationUnitTestCase extends JBossTestCase { @@ -46,76 +47,6 @@ super(name); } - /** Test for the availability of a local webserver and deploy the -jbosstest-web.ear one time if a webserver is found. -*/ - protected void setUp() throws Exception - { - super.setUp(); - /*if( setUp == true ) - return; - setUp = true; - */ - Integer port = Integer.getInteger("web.port", 8080); - baseURL = "http://jduke:theduke@localhost:"; + port + '/'; - try - { - //String serverName = InetAddress.getLocalHost().getHostName(); - //String connectorName = "jmx:" +serverName+ ":rmi"; - //RMIConnector server = (RMIConnector) new InitialContext().lookup(connectorName); - //ObjectName deployerName = new ObjectName("J2EE:service=J2eeDeployer"); - // Ask the deployer for the getWarDeployerName - Object[] params = - {}; - String[] signature = - {}; - String warDeployerName = (String) invoke(getJ2eeDeployerName(), - "getWarDeployerName", params, signature); - // See if the warDeployerName exists - ObjectName deployerName = new ObjectName(warDeployerName); - webServerAvailable = getServer().isRegistered(deployerName); - if( webServerAvailable == true ) - { -System.out.println("Found warDeployer named: "+warDeployerName); -try -{ - deployJ2ee("jbosstest-web.ear"); -} -catch(Exception e) -{ - e.printStackTrace(); - fail("Failed to deploy jbosstest-web.ear"); -} -// Flush the security domain cache to avoid conflicts with other testcases -ObjectName jaasMgr = new ObjectName("Security:name=JaasSecurityManager"); -params = new Object[] -{"other"}; -signature = new String[] -{"java.lang.String"}; -invoke(jaasMgr, "flushAuthenticationCache", params, signature); - } - else - { -System.out.println("No war deployer found, skipping tests"); - } - } - catch(Exception x) - { - webServerAvailable = false; - x.printStackTrace(); - if (x instanceof RuntimeMBeanException) - { -((RuntimeMBeanException)x).getTargetException().printStackTrace(); - } - System.out.println("No war deployer found, skipping tests"); - } - } - - protected void tearDown() throws Exception - { - undeployJ2ee("jbosstest-web.ear"); - super.tearDown(); - } /** Access the http://localhost/jbosstest/EJBOnStartupServlet */ @@ -234,38 +165,32 @@ throw e; } } -/* - public static void main(java.lang.String[] args) - { - System.setErr(System.out); - Test suite = suite(); - junit.textui.TestRunner.run(suite); - } - + + /** +* Setup the test suite. +*/ public static Test suite() { TestSuite suite = new TestSuite(); - - try + suite.addTest(new TestSuite(WebIntegrationUnitTestCase.class)); + + // Create an initializer for the test suite + Test wrapper = new JBossTestSetup(s
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java
User: d_jencks Date: 01/09/17 10:33:54 Modified:src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Log: Finished converting to JBossTestCase for deploy and logging. Security tests still do not work due to deploy problems Revision ChangesPath 1.2 +31 -17 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.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- WebIntegrationUnitTestCase.java 2001/09/12 04:55:41 1.1 +++ WebIntegrationUnitTestCase.java 2001/09/17 17:33:54 1.2 @@ -1,3 +1,10 @@ +/* + * JBoss, the OpenSource J2EE webOS + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + package org.jboss.test.web.test; import java.io.IOException; @@ -13,7 +20,7 @@ import junit.framework.TestSuite; import org.jboss.jmx.connector.rmi.RMIConnector; -import org.jboss.test.util.Deploy; +import org.jboss.test.JBossTestCase; /** Tests of servlet container integration into the JBoss server. This test requires than a web container be integrated into the JBoss server. The tests @@ -26,9 +33,9 @@ with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] - @version $Revision: 1.1 $ + @version $Revision: 1.2 $ */ -public class WebIntegrationUnitTestCase extends TestCase +public class WebIntegrationUnitTestCase extends JBossTestCase { private static boolean setUp; private static boolean webServerAvailable; @@ -44,34 +51,35 @@ */ protected void setUp() throws Exception { - if( setUp == true ) + super.setUp(); + /*if( setUp == true ) return; setUp = true; - + */ Integer port = Integer.getInteger("web.port", 8080); baseURL = "http://jduke:theduke@localhost:"; + port + '/'; try { - String serverName = InetAddress.getLocalHost().getHostName(); - String connectorName = "jmx:" +serverName+ ":rmi"; - RMIConnector server = (RMIConnector) new InitialContext().lookup(connectorName); - ObjectName deployerName = new ObjectName("J2EE:service=J2eeDeployer"); + //String serverName = InetAddress.getLocalHost().getHostName(); + //String connectorName = "jmx:" +serverName+ ":rmi"; + //RMIConnector server = (RMIConnector) new InitialContext().lookup(connectorName); + //ObjectName deployerName = new ObjectName("J2EE:service=J2eeDeployer"); // Ask the deployer for the getWarDeployerName Object[] params = {}; String[] signature = {}; - String warDeployerName = (String) server.invoke(deployerName, - "getWarDeployerName", params, signature); + String warDeployerName = (String) invoke(getJ2eeDeployerName(), + "getWarDeployerName", params, signature); // See if the warDeployerName exists - deployerName = new ObjectName(warDeployerName); - webServerAvailable = server.isRegistered(deployerName); + ObjectName deployerName = new ObjectName(warDeployerName); + webServerAvailable = getServer().isRegistered(deployerName); if( webServerAvailable == true ) { System.out.println("Found warDeployer named: "+warDeployerName); try { - Deploy.deploy("jbosstest-web.ear"); + deployJ2ee("jbosstest-web.ear"); } catch(Exception e) { @@ -84,7 +92,7 @@ {"other"}; signature = new String[] {"java.lang.String"}; -server.invoke(jaasMgr, "flushAuthenticationCache", params, signature); +invoke(jaasMgr, "flushAuthenticationCache", params, signature); } else { @@ -102,6 +110,12 @@ System.out.println("No war deployer found, skipping tests"); } } + + protected void tearDown() throws Exception + { + undeployJ2ee("jbosstest-web.ear"); + super.tearDown(); + } /** Access the http://localhost/jbosstest/EJBOnStartupServlet */ @@ -220,7 +234,7 @@ throw e; } } - +/* public static void main(java.lang.String[] args) { System.setErr(System.out); @@ -253,5 +267,5 @@ return suite; } - +*/ } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourcefor
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java TestWebIntegration.java
User: d_jencks Date: 01/09/11 21:55:41 Added: src/main/org/jboss/test/web/test WebIntegrationUnitTestCase.java Removed: src/main/org/jboss/test/web/test TestWebIntegration.java Log: Changed naming scheme of tests to *UnitTestCase.java for short running tests and *StressTestCase.java for lengthy tests. Made tests-unit and tests-stress targets in build.xml Revision ChangesPath 1.1 jbosstest/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java Index: WebIntegrationUnitTestCase.java === package org.jboss.test.web.test; import java.io.IOException; import java.net.HttpURLConnection; import java.net.InetAddress; import java.net.URL; import javax.management.ObjectName; import javax.management.RuntimeMBeanException; import javax.naming.InitialContext; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.jboss.jmx.connector.rmi.RMIConnector; import org.jboss.test.util.Deploy; /** Tests of servlet container integration into the JBoss server. This test requires than a web container be integrated into the JBoss server. The tests currently use the java.net.HttpURLConnection and associated http client and these do not return very good information on errors so if a failure occurs it is best to connect the webserver using a browser to look for additional error info. The secure access tests require a user named 'jduke' with a password of 'theduke' with a role of 'AuthorizedUser' in the servlet container. @author [EMAIL PROTECTED] @version $Revision: 1.1 $ */ public class WebIntegrationUnitTestCase extends TestCase { private static boolean setUp; private static boolean webServerAvailable; private static String baseURL; public WebIntegrationUnitTestCase(String name) { super(name); } /** Test for the availability of a local webserver and deploy the jbosstest-web.ear one time if a webserver is found. */ protected void setUp() throws Exception { if( setUp == true ) return; setUp = true; Integer port = Integer.getInteger("web.port", 8080); baseURL = "http://jduke:theduke@localhost:"; + port + '/'; try { String serverName = InetAddress.getLocalHost().getHostName(); String connectorName = "jmx:" +serverName+ ":rmi"; RMIConnector server = (RMIConnector) new InitialContext().lookup(connectorName); ObjectName deployerName = new ObjectName("J2EE:service=J2eeDeployer"); // Ask the deployer for the getWarDeployerName Object[] params = {}; String[] signature = {}; String warDeployerName = (String) server.invoke(deployerName, "getWarDeployerName", params, signature); // See if the warDeployerName exists deployerName = new ObjectName(warDeployerName); webServerAvailable = server.isRegistered(deployerName); if( webServerAvailable == true ) { System.out.println("Found warDeployer named: "+warDeployerName); try { Deploy.deploy("jbosstest-web.ear"); } catch(Exception e) { e.printStackTrace(); fail("Failed to deploy jbosstest-web.ear"); } // Flush the security domain cache to avoid conflicts with other testcases ObjectName jaasMgr = new ObjectName("Security:name=JaasSecurityManager"); params = new Object[] {"other"}; signature = new String[] {"java.lang.String"}; server.invoke(jaasMgr, "flushAuthenticationCache", params, signature); } else { System.out.println("No war deployer found, skipping tests"); } } catch(Exception x) { webServerAvailable = false; x.printStackTrace(); if (x instanceof RuntimeMBeanException) { ((RuntimeMBeanException)x).getTargetException().printStackTrace(); } System.out.println("No war deployer found, skipping tests"); } } /** Access the http://localhost/jbosstest/EJBOnStartupServlet */ public void testEJBOnStartupServlet() throws Exception { if( webServerAvailable == false ) return; URL url = new URL(baseURL+"jbosstest/EJBOnStartupServlet"); accessURL(url); } /** Access the http://localhost/jbosstest/ENCServlet */ public void testENCServlet() throws Exception { if( webServerAvailable == false