Getting started
Hi all, finally I decided to take some time and get started with in-container testing of ejbs. I already had a look at the website but my first attempts were not very successfull. My configuration is: IntelliJ Idea XDoclet Maven Maybe anyone could give me a hint on how to get started. Thanks, Filip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Getting started
Hi Filip, I see you've chosen to use Maven. Good choice as it is the easiest way of using Cactus. I suggest you have a look at a sample project using Cactus and Maven for testing ejbs... Here is one: http://fisheye.cenqua.com/viewrep/jakarta-cactus/integration/maven/samples/e jb (you can also check it out from CVS) You should of course read http://jakarta.apache.org/cactus/integration/maven/index.html if you haven't already done so. Thanks -Vincent -Original Message- From: Filip Polsakiewicz [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 10:20 To: cactus-user@jakarta.apache.org Subject: Getting started Hi all, finally I decided to take some time and get started with in-container testing of ejbs. I already had a look at the website but my first attempts were not very successfull. My configuration is: IntelliJ Idea XDoclet Maven Maybe anyone could give me a hint on how to get started. Thanks, Filip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cactus Error
Hi Adel, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 13:28 To: cactus-user@jakarta.apache.org Subject: Cactus Error Hello Massol, My name is Vincent ;-) Feel free to address the whole community! :-) I would like from you to help out if you can please. I am a new J2EE developer, i am working on testing using cactus. My fisrt version of catus was working fine, but i add some stuff to it and copy it to another machine, still working fine, but when i try it in my machine, it gave me the below error. Please caould you help me, what is the problem and how possible can be solved. test: [cactus] -- --- [cactus] Running tests against JBoss 3.2 [cactus] -- --- BUILD FAILED C:\pdaDemo\AlphaSerendipity\build.xml:516: Failed to start the container after more than [18] ms. Trying to connect to the [http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST] test URL yielded a [-1] error code. Please run in debug mode for more details about the error. Have you done what is suggested by the error message? What have you found when you've looked at the log file? Thanks -Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mock objects with Cactus
Hi Vincent, I am fairly new to Cactus and am trying to understand exactly how it should work. Our organization wants to perform code logic unit testing and integration testing (we'll worry about functional testing later). For our code logic unit testing, we are planning on doing JUnit tests with Mock objects. This is the strategy I am thinking we could use: 1) As we develop individual classes we will write JUnit tests using Mock objects to test class methods. 2) Then, as we begin to integrate components (classes), we will take the existing JUnit Tests, convert them to Cactus tests and use the real objects (not the Mocks). This will give us our in-container integration tests. Does this sound like an appropriate approach? Should I be doing something different? Our environment will be using Web Services and EJB. Will I be able to perform my code-logic unit tests outside the scope of a container, or will these need to be run in the same fashion as Cactus tests (ie. in container)? Figuring out some of these questions would be great in understanding how we can best use Cactus. Thanks for any help you can provide. Dawson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SV: Mock objects with Cactus
I am using Junit and jMock for unit tests and Cactus for integration tests. However I dont think you want to refactor your unit tests to become integration tests. You should have both to test different things. As you said I write unit tests that tests the logic of individual classes. Then when I integrate I write more coarse grained tests that really should test the integration between modules and infrastructure. Take an ejb as an example. The ejb:s logic is implemented in a number POJOS. These all have unit tests. Some POJOS might interact with a data access layer or other infrastructure but this is mocked. At the top we have a integration test that uses the ejb:s api to assure that the module works together in its correct environment. Magnus Grimsell -Ursprungligt meddelande- Från: Dawson Mossman [mailto:[EMAIL PROTECTED] Skickat: den 9 mars 2005 15:01 Till: Cactus Users List Ämne: Mock objects with Cactus Hi Vincent, I am fairly new to Cactus and am trying to understand exactly how it should work. Our organization wants to perform code logic unit testing and integration testing (we'll worry about functional testing later). For our code logic unit testing, we are planning on doing JUnit tests with Mock objects. This is the strategy I am thinking we could use: 1) As we develop individual classes we will write JUnit tests using Mock objects to test class methods. 2) Then, as we begin to integrate components (classes), we will take the existing JUnit Tests, convert them to Cactus tests and use the real objects (not the Mocks). This will give us our in-container integration tests. Does this sound like an appropriate approach? Should I be doing something different? Our environment will be using Web Services and EJB. Will I be able to perform my code-logic unit tests outside the scope of a container, or will these need to be run in the same fashion as Cactus tests (ie. in container)? Figuring out some of these questions would be great in understanding how we can best use Cactus. Thanks for any help you can provide. Dawson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Mock objects with Cactus
Thanks for all the dialog guys. I think I wrote something that caused a bit of a misunderstanding, when I said convert my JUnit Tests to Cactus tests i really meant copy the JUnit Test and use it as a base for writing my integration test. I didn't intend on getting rid of the original unit tests. I'm still curious, if I'm unit testing (code-logic) server-side components such as Web Services and EJB's with Mock objects, do I need to do it In-Container? I will also try to take a look at your book Vincent. Thanks, Daws On Wed, 2005-03-09 at 15:19 +0100, Vincent Massol wrote: Hi Dawson, -Original Message- From: Dawson Mossman [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 15:01 To: Cactus Users List Subject: Mock objects with Cactus Hi Vincent, I am fairly new to Cactus and am trying to understand exactly how it should work. Our organization wants to perform code logic unit testing and integration testing (we'll worry about functional testing later). For our code logic unit testing, we are planning on doing JUnit tests with Mock objects. This is the strategy I am thinking we could use: 1) As we develop individual classes we will write JUnit tests using Mock objects to test class methods. 2) Then, as we begin to integrate components (classes), we will take the existing JUnit Tests, convert them to Cactus tests and use the real objects (not the Mocks). This will give us our in-container integration tests. Does this sound like an appropriate approach? I really think you should keep your code logic unit tests and not remove them. Integration tests and tests in isolation are 2 different things and both are needed. Here's what I suggest: - you do most of your tests using mock objects in isolation - you add *some* integration tests just to prove that the integration work - you add functional tests. If they can be automated then all the best and you could possibly have the majority of your integration/functional tests as proper functional tests. Should I be doing something different? Our environment will be using Web Services and EJB. Will I be able to perform my code-logic unit tests outside the scope of a container, or will these need to be run in the same fashion as Cactus tests (ie. in container)? The only trick for writing code logic unit test is realizing that the design of your application is extremely important and it may or may not allow you to write them easily. If you do TDD, then by definition you'll have a design that support them. Otherwise you may need to do quite extensive refactoring. Figuring out some of these questions would be great in understanding how we can best use Cactus. Thanks for any help you can provide. Yes, I agree. This is exactly why I've written JUnit in Action (which is the sum of my 4-5 years of unit testing experience). It answers exactly the questions you're asking :-) Thanks -Vincent ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en franais ! Yahoo! Mail : http://fr.mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Mock objects with Cactus
-Original Message- From: Dawson Mossman [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 15:26 To: Cactus Users List Subject: RE: Mock objects with Cactus Thanks for all the dialog guys. I think I wrote something that caused a bit of a misunderstanding, when I said convert my JUnit Tests to Cactus tests i really meant copy the JUnit Test and use it as a base for writing my integration test. I didn't intend on getting rid of the original unit tests. I'm still curious, if I'm unit testing (code-logic) server-side components such as Web Services and EJB's with Mock objects, do I need to do it In-Container? Nope. You can also do it with mock objects but then you're not testing in integration. Both are useful. I will also try to take a look at your book Vincent. Cool ;-) [snip] Thanks -Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mock objects with Cactus
Hi Dawson On Wed, 09 Mar 2005 10:26:26 -0400, Dawson Mossman [EMAIL PROTECTED] wrote: Thanks for all the dialog guys. I think I wrote something that caused a bit of a misunderstanding, when I said convert my JUnit Tests to Cactus tests i really meant copy the JUnit Test and use it as a base for writing my integration test. I didn't intend on getting rid of the original unit tests. I'm still curious, if I'm unit testing (code-logic) server-side components such as Web Services and EJB's with Mock objects, do I need to do it In-Container? The to approch are explain in the doc take a look at the http://jakarta.apache.org/cactus/mock_vs_cactus.html I will also try to take a look at your book Vincent. Publicité : I buy it myselt and think You really can do it is a fantastic book. Great job Vincent :) Nicolas Thanks, Daws On Wed, 2005-03-09 at 15:19 +0100, Vincent Massol wrote: Hi Dawson, -Original Message- From: Dawson Mossman [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 15:01 To: Cactus Users List Subject: Mock objects with Cactus Hi Vincent, I am fairly new to Cactus and am trying to understand exactly how it should work. Our organization wants to perform code logic unit testing and integration testing (we'll worry about functional testing later). For our code logic unit testing, we are planning on doing JUnit tests with Mock objects. This is the strategy I am thinking we could use: 1) As we develop individual classes we will write JUnit tests using Mock objects to test class methods. 2) Then, as we begin to integrate components (classes), we will take the existing JUnit Tests, convert them to Cactus tests and use the real objects (not the Mocks). This will give us our in-container integration tests. Does this sound like an appropriate approach? I really think you should keep your code logic unit tests and not remove them. Integration tests and tests in isolation are 2 different things and both are needed. Here's what I suggest: - you do most of your tests using mock objects in isolation - you add *some* integration tests just to prove that the integration work - you add functional tests. If they can be automated then all the best and you could possibly have the majority of your integration/functional tests as proper functional tests. Should I be doing something different? Our environment will be using Web Services and EJB. Will I be able to perform my code-logic unit tests outside the scope of a container, or will these need to be run in the same fashion as Cactus tests (ie. in container)? The only trick for writing code logic unit test is realizing that the design of your application is extremely important and it may or may not allow you to write them easily. If you do TDD, then by definition you'll have a design that support them. Otherwise you may need to do quite extensive refactoring. Figuring out some of these questions would be great in understanding how we can best use Cactus. Thanks for any help you can provide. Yes, I agree. This is exactly why I've written JUnit in Action (which is the sum of my 4-5 years of unit testing experience). It answers exactly the questions you're asking :-) Thanks -Vincent ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en franais ! Yahoo! Mail : http://fr.mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cactus Error
Hi Vincent I have tried to run ant in the debug mode, the below error come up, do i missing something? cactus] Checking if server is up ... cactus] Failed to connect to http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST (null) cactus] Checking if server is up ... cactus] Failed to connect to http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST (null) cactus] Checking if server is up ... cactus] Failed to connect to http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST (null) cactus] Checking if server is up ... cactus] Failed to connect to http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST (null) cactus] Checking if server is up ... Regards, Adel
RE: Cactus Error
It's not Ant that you must run in debug mode but Cactus. I guess we would need to make the following page more visible on the site: http://jakarta.apache.org/cactus/integration/manual/howto_config.html#loggin g -Vincent -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 15:46 To: cactus-user@jakarta.apache.org Subject: RE: Cactus Error Hi Vincent I have tried to run ant in the debug mode, the below error come up, do i missing something? cactus] Checking if server is up ... cactus] Failed to connect to http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST (null) cactus] Checking if server is up ... cactus] Failed to connect to http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST (null) cactus] Checking if server is up ... cactus] Failed to connect to http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST (null) cactus] Checking if server is up ... cactus] Failed to connect to http://localhost:8998/test/ServletRedirector?Cactus_Service=RUN_TEST (null) cactus] Checking if server is up ... Regards, Adel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Mock objects with Cactus
-Original Message- From: Nicolas Chalumeau [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 15:39 To: Cactus Users List Subject: Re: Mock objects with Cactus Hi Dawson On Wed, 09 Mar 2005 10:26:26 -0400, Dawson Mossman [EMAIL PROTECTED] wrote: Thanks for all the dialog guys. I think I wrote something that caused a bit of a misunderstanding, when I said convert my JUnit Tests to Cactus tests i really meant copy the JUnit Test and use it as a base for writing my integration test. I didn't intend on getting rid of the original unit tests. I'm still curious, if I'm unit testing (code-logic) server-side components such as Web Services and EJB's with Mock objects, do I need to do it In-Container? The to approch are explain in the doc take a look at the http://jakarta.apache.org/cactus/mock_vs_cactus.html Oops... you're right, I had forgotten about this document I wrote several years ago! ;-) I will also try to take a look at your book Vincent. Publicité : I buy it myselt and think You really can do it is a fantastic book. Great job Vincent :) Thanks for the praise Nicolas. It's nice to see it's appreciated :-) [snip] -Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: two web applications within ear
It seems that I have figured it out: public void beginCreateNewMermig(WebRequest webRequest){ webRequest.setURL(localhost:8080, /testsuper, null, null, null); } This code snippet, placed within beginTestMethodName() will redirect request to appropriate context. Milan On Wed, 9 Mar 2005 15:27:16 +0100, Milan Trajkovic [EMAIL PROTECTED] wrote: Hello! I wonder if someone has similiar situation. I have two web applications, within same ear. Both of them are cactified (one with default /test context and the othre with /testsuper context). I use ant to execute tests (I test ejb). Now I want to test this applications as well. How to indicate (either from ant either from beginXXX() method of test case) which context to be used for testing? Thank you. Milan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mock objects with Cactus
You allready ask this question in an other thread ! And the answer should be no as it is not supported according to the doc... Nicolas, On Wed, 09 Mar 2005 11:15:08 -0400, Dawson Mossman [EMAIL PROTECTED] wrote: Guys, While everyone is chatting it up this morning! I have one more question. Has anyone used Cactus with Sun Java Application Server 8.0? I'm wondering if I should expect some problems? Thanks, On Wed, 2005-03-09 at 15:58 +0100, Vincent Massol wrote: -Original Message- From: Nicolas Chalumeau [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 15:39 To: Cactus Users List Subject: Re: Mock objects with Cactus Hi Dawson On Wed, 09 Mar 2005 10:26:26 -0400, Dawson Mossman [EMAIL PROTECTED] wrote: Thanks for all the dialog guys. I think I wrote something that caused a bit of a misunderstanding, when I said convert my JUnit Tests to Cactus tests i really meant copy the JUnit Test and use it as a base for writing my integration test. I didn't intend on getting rid of the original unit tests. I'm still curious, if I'm unit testing (code-logic) server-side components such as Web Services and EJB's with Mock objects, do I need to do it In-Container? The to approch are explain in the doc take a look at the http://jakarta.apache.org/cactus/mock_vs_cactus.html Oops... you're right, I had forgotten about this document I wrote several years ago! ;-) I will also try to take a look at your book Vincent. Publicité : I buy it myselt and think You really can do it is a fantastic book. Great job Vincent :) Thanks for the praise Nicolas. It's nice to see it's appreciated :-) [snip] -Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Mock objects with Cactus
-Original Message- From: Nicolas Chalumeau [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 16:33 To: Cactus Users List Subject: Re: Mock objects with Cactus You allready ask this question in an other thread ! And the answer should be no as it is not supported according to the doc... Just a clarification... It *is* supported by the Cactus framework. It is *not* supported by the cactus Ant task nor the Maven plugin. Cactus does support ALL existing containers. It's just that the Ant tasks and the Mavne plugin automatically start/stop/configure the container so we only support some containers. Thanks -Vincent Nicolas, On Wed, 09 Mar 2005 11:15:08 -0400, Dawson Mossman [EMAIL PROTECTED] wrote: Guys, While everyone is chatting it up this morning! I have one more question. Has anyone used Cactus with Sun Java Application Server 8.0? I'm wondering if I should expect some problems? Thanks, On Wed, 2005-03-09 at 15:58 +0100, Vincent Massol wrote: -Original Message- From: Nicolas Chalumeau [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 15:39 To: Cactus Users List Subject: Re: Mock objects with Cactus Hi Dawson On Wed, 09 Mar 2005 10:26:26 -0400, Dawson Mossman [EMAIL PROTECTED] wrote: Thanks for all the dialog guys. I think I wrote something that caused a bit of a misunderstanding, when I said convert my JUnit Tests to Cactus tests i really meant copy the JUnit Test and use it as a base for writing my integration test. I didn't intend on getting rid of the original unit tests. I'm still curious, if I'm unit testing (code-logic) server-side components such as Web Services and EJB's with Mock objects, do I need to do it In-Container? The to approch are explain in the doc take a look at the http://jakarta.apache.org/cactus/mock_vs_cactus.html Oops... you're right, I had forgotten about this document I wrote several years ago! ;-) I will also try to take a look at your book Vincent. Publicité : I buy it myselt and think You really can do it is a fantastic book. Great job Vincent :) Thanks for the praise Nicolas. It's nice to see it's appreciated :-) [snip] -Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Mock objects with Cactus
Thanks Vincent. Any plans on supporting that container in the future? On Wed, 2005-03-09 at 16:40 +0100, Vincent Massol wrote: -Original Message- From: Nicolas Chalumeau [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 16:33 To: Cactus Users List Subject: Re: Mock objects with Cactus You allready ask this question in an other thread ! And the answer should be no as it is not supported according to the doc... Just a clarification... It *is* supported by the Cactus framework. It is *not* supported by the cactus Ant task nor the Maven plugin. Cactus does support ALL existing containers. It's just that the Ant tasks and the Mavne plugin automatically start/stop/configure the container so we only support some containers. Thanks -Vincent Nicolas, On Wed, 09 Mar 2005 11:15:08 -0400, Dawson Mossman [EMAIL PROTECTED] wrote: Guys, While everyone is chatting it up this morning! I have one more question. Has anyone used Cactus with Sun Java Application Server 8.0? I'm wondering if I should expect some problems? Thanks, On Wed, 2005-03-09 at 15:58 +0100, Vincent Massol wrote: -Original Message- From: Nicolas Chalumeau [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 15:39 To: Cactus Users List Subject: Re: Mock objects with Cactus Hi Dawson On Wed, 09 Mar 2005 10:26:26 -0400, Dawson Mossman [EMAIL PROTECTED] wrote: Thanks for all the dialog guys. I think I wrote something that caused a bit of a misunderstanding, when I said convert my JUnit Tests to Cactus tests i really meant copy the JUnit Test and use it as a base for writing my integration test. I didn't intend on getting rid of the original unit tests. I'm still curious, if I'm unit testing (code-logic) server-side components such as Web Services and EJB's with Mock objects, do I need to do it In-Container? The to approch are explain in the doc take a look at the http://jakarta.apache.org/cactus/mock_vs_cactus.html Oops... you're right, I had forgotten about this document I wrote several years ago! ;-) I will also try to take a look at your book Vincent. Publicit : I buy it myselt and think You really can do it is a fantastic book. Great job Vincent :) Thanks for the praise Nicolas. It's nice to see it's appreciated :-) [snip] -Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Mock objects with Cactus
-Original Message- From: Dawson Mossman [mailto:[EMAIL PROTECTED] Sent: mercredi 9 mars 2005 18:16 To: Cactus Users List Subject: RE: Mock objects with Cactus Thanks Vincent. Any plans on supporting that container in the future? No (unless by a external contribution). BTW, we plan to stop supporting ALL containers in Cactus in the near future and delegate all that to the Cargo project (http://cargo.codehaus.org). All container support contributions should now be done on that Cargo project. [snip] Thanks -Vincent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Broadvision 6.0 and Cactus: Trying to run TestSampleServlet test case in BV Servlet engine
Hello, I am trying to set up Cactus for my development team, as I think it has the potential to transform the way my developers work. The servlet container I'm using is the one provided by Broadvision 6.0. I found a relevant discussion thread on the cactus-user mail archive (http://www.mail-archive.com/cactus-user@jakarta.apache.org/msg01952.htm l), and wanted to know if anyone found the solution to the problem. I am now experiencing the same issue when trying to execute the TestSampleServlet test case in Broadvision (this is the same given in the Cactus Tomcat how-to, and it worked fine on my Tomcat instance). I was hoping that my error was related to configuration, but suspect it might be caused by the way Broadvision implemented the Servlet container. Any help or insight you can provide about the error below will be greatly appreciated. Thanks, Sean ERROR MESSAGE BELOW (I have masked the host port and webapp information) Failed to get the test results at [http://host:port/webappName/ServletRedirector] org.apache.cactus.util.ChainedRuntimeException: Failed to get the test results at [http://host:port/webappName/ServletRedirector] at org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes t_aroundBody0(DefaultHttpClient.java:92) at org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes t_aroundBody1$advice(DefaultHttpClient.java:306) at org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes t(DefaultHttpClient.java) at org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run WebTest(HttpProtocolHandler.java:159) at org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run Test_aroundBody0(HttpProtocolHandler.java:80) at org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run Test_aroundBody1$advice(HttpProtocolHandler.java:306) at org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run Test(HttpProtocolHandler.java) at org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTes tCaseCaller.java:144) at org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(Abstract CactusTestCase.java:215) at org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactus TestCase.java:133) at org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner. java:308) at org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody0(Serv letTestRunner.java:186) at org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody1$advi ce(ServletTestRunner.java:224) at org.apache.cactus.server.runner.ServletTestRunner.doGet(ServletTestRunne r.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.broadvision.servlet.ServletContainer.service(ServletContainer.java:4 04) at com.broadvision.servlet.ServletContainer.processRequest(ServletContainer java:348) at com.broadvision.servlet.ServletContextContainer.processRequest(ServletCo ntextContainer.java:819) at com.broadvision.servlet.BVServletEngine.service(BVServletEngine.java:243 ) at com.broadvision.servlet.BVServletConnector.service(BVServletConnector.ja va:141) org.apache.cactus.internal.client.ParsingException: Not a valid response [404 Not Found] at org.apache.cactus.internal.client.connector.http.DefaultHttpClient.callG etResult(DefaultHttpClient.java:211) at org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes t_aroundBody0(DefaultHttpClient.java:87) at org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes t_aroundBody1$advice(DefaultHttpClient.java:306) at org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes t(DefaultHttpClient.java) at org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run WebTest(HttpProtocolHandler.java:159) at org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run Test_aroundBody0(HttpProtocolHandler.java:80) at org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run Test_aroundBody1$advice(HttpProtocolHandler.java:306) at org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run Test(HttpProtocolHandler.java) at org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTes tCaseCaller.java:144) at org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(Abstract CactusTestCase.java:215) at org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactus TestCase.java:133) at org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner. java:308) at org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody0(Serv letTestRunner.java:186) at org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody1$advi ce(ServletTestRunner.java:224) at org.apache.cactus.server.runner.ServletTestRunner.doGet(ServletTestRunne r.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at
Re: Info regarding WebSphere, Cactus/StrutsUnitTest, FormAuthentica tion
this will help me very much . Thanks. I also observed that when we used SWAM authentication mechanism, it worked fine, but when we changed to LTPA, we were getting errors with JSessionID cookie not found. McGinn, John [EMAIL PROTECTED]To: cactus-user@jakarta.apache.org homson.comcc: Subject: Info regarding WebSphere, Cactus/StrutsUnitTest, FormAuthentica tion 03/09/2005 02:20 PM Please respond to Cactus Users List Hi all, After quite sometime and frustration I finally got a secure ServletTestRedirector to work with WebSphere 5.1 FormAuthentication so hopefully what I found will help others in avoiding this frustration. I think I saw a few other posts on this subject but no real resolution clearly posted. The main problem is that the Cactus FormAuthentication will not work correctly with WebSphere for the following reasons: 1. FormAuthentication makes 2 requests. The first request is the main problem. It is a hard coded request to ServletTestRedirector (see getSecureSessionIdCookie) and it is expecting the response to return the JSESSIONID cookie. 2. WebSphere when accessing a secured resource with an UNATHORIZED user doesn't create the JSESSIONID cookie until you are redirected to the login.jsp. 3. FormAuthentication uses the same HttpClientConnectionHelper.connect method that all the other requests makers user and it prevents redirects. 4. Thus the jsessionCookie member variable never gets initialized and then the authenticate method gets an IllegalStateException from BaseWebRequest when it tries and add it as a cookie to the request. Additionally we are using LTPA and expect a LTPA token to be persisted for each request or else our filter will assume the session has timed out and redirect to the login.jsp. So for my solution after getting everything configured as directed in the How To's (including the Security How To) was to create a new Authentication class that extends AbstractAuthentication. I looked at extending FormAuthentication but too many methods and its data members were private for it to be of much use. In my Authentication class I was able to completely remove the getSecureSessionIdCookie and just call /j_security_check directly with one request. This executes our logon filter and returns a new JSESSIONID and LtpaToken cookie. I then persist those as data members and stick them into any subsequent requests. Here's the stuff of interest: public void configure(HttpState state, HttpMethod method, WebRequest request, Configuration config) { //Only authenticate the first time this instance is used. if (_jsessionCookie == null || _ltpaTokenCookie == null) { authenticate(request, config); } //Sets the session id cookie and ltpa token cookie for the next request. if (_jsessionCookie != null _ltpaTokenCookie != null) { request.addCookie(_jsessionCookie); request.addCookie(_ltpaTokenCookie); } } public void authenticate(WebRequest request, Configuration config) { try { //Create a helper that will connect to the security check URL. String url = getSecurityCheckURL(config).toString(); HttpClientConnectionHelper helper = new HttpClientConnectionHelper(url); //Configure a web request with the username and the password. WebRequest webRequest = getSecurityRequest(); ((WebRequestImpl)webRequest).setConfiguration(config); webRequest.addParameter(_userNameParamName, getName(), WebRequest.POST_METHOD); webRequest.addParameter(_passwordParamName, getPassword(), WebRequest.POST_METHOD); // Make the