Re: FormAuthentication problem
Hi, Sorry for my late response. In article [EMAIL PROTECTED], Wed, 30 Apr 2008 09:24:42 -0700, Eric Barendt [EMAIL PROTECTED] wrote: eric We are using JBoss 4.2.1 with whatever version of Tomcat it comes with. I eric just applied your patch to the 1.8.0 code, and it works great! Thank you for the feedback. eric Is this a bug in Cactus? I couldn't find anything in the project's Jira eric page, but it'd be great to get this integrated. I think, it is a fault in Cactus: not implemented yet. AFAIK, the client-server protocol for the form-based authentication have not been specified in detail, so, many possible implementations exist. It seems that Tomcat changed the implementation in a way Cactus mishandles the protocol with Tomcat. I think the new protocol of Tomcat is a possible one, and issue is in Cactus side. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormAuthentication problem
Hi Eric, In article [EMAIL PROTECTED], Tue, 29 Apr 2008 15:28:56 -0700, Eric Barendt [EMAIL PROTECTED] wrote: eric I'm working on switching our application from Basic to Form authentication. [snip] eric With FormAuthentication, I get Missing service name parameter eric [Cactus_Service] in HTTP request. and Error getting test result. This eric could happen for example if you're using a load-balancer. This is what I eric see in my access log: eric eric 127.0.0.1 - - [29/Apr/2008:16:50:18 -0500] GET eric /application/ServletRedirectorSecure HTTP/1.1 200 2357 eric 127.0.0.1 - - [29/Apr/2008:16:50:18 -0500] POST eric /application/j_security_check HTTP/1.1 302 - eric 127.0.0.1 - user [29/Apr/2008:16:50:18 -0500] GET eric /application/ServletRedirectorSecure HTTP/1.1 500 2527 eric 127.0.0.1 - user [29/Apr/2008:16:50:18 -0500] GET eric /application/ServletRedirectorSecure?Cactus_Service=GET_RESULTS HTTP/1.1 eric 500 2556 What is your servlet container? If you are using Tomcat later than 5.5.20, my post to tomcat-users ML might helps you: http://marc.info/?l=tomcat-userm=119098089904045w=2 If it works for you, please let me know. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Failed to connect to the secured redirector
Hi Gerald, In article [EMAIL PROTECTED], Fri, 5 Oct 2007 14:03:10 -0400, Gerald Mays [EMAIL PROTECTED] wrote: Gerald I am attempting to run the following beginXXX method. Gerald On the serverside I see the following trace. [snip] Gerald Oct 5, 2007 1:49:14 PM EDT Error HTTP BEA-101017 Gerald [EMAIL PROTECTED] - name: Gerald '/myibfs', context-path: '/myibfs'] Root cause of ServletException. Gerald javax.servlet.ServletException: Missing service name parameter Gerald [Cactus_Service] Gerald in HTTP request. Received query string is []. [snip] Gerald On the client side I get this trace. I have read many posts of others Gerald seemingly having very similar problems but I don't seem to get closer to Gerald a fix. Any assistance would be deeply appreciated. BTW...running BEA Gerald 9.1. [snip] Gerald java.lang.Exception: Received a status code [500] and was expecting less Gerald than 400 Gerald at Gerald org.apache.cactus.client.authentication.FormAuthentication.checkPreAuthR Gerald esponse(FormAuthentication.java:270) Please take a look at web.xml and make sure the ServletRedirectorSecure has been configured as a secured resource of the cactified application. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ChainedRuntimeException
Hi, In article [EMAIL PROTECTED], Thu, 6 Sep 2007 11:22:59 +0530, Indranil Poddar [EMAIL PROTECTED] wrote: indranil I am using Websphere Studio Application developer to run Unit tests for my indranil web application. indranil I have incorporated Cactus to do the server side testing. indranil However, when I run the tests, I get a ChainedRuntimeException. The indranil detailed log is given below: indranil indranil.poddar org.apache.cactus.util.ChainedRuntimeException: Failed to get the test indranil results at indranil [http://localhost:9080/CspLoanAdmin/JSP/Admin/ServletRedirector] [snip] indranil org.apache.cactus.client.ParsingException: Not a valid response [404 Not indranil Found] Make sure you have deployed the Cactified application to the server so that the URL of the ServletReditector, http://localhost:9080/CspLoanAdmin/JSP/Admin/ServletRedirector is available. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ChainedRuntimeException
Hi, In article [EMAIL PROTECTED], Thu, 6 Sep 2007 12:50:15 +0530, Indranil Poddar [EMAIL PROTECTED] wrote: indranil Added jars to Java Build path: indranil cactus-1.5.jar, indranil aspectjrt-1.1.1.jar indranil commons-httpclient-2.0-rc2.jar. Do you mean WEB-INF/lib of the application contains these jars? If so, you may also need to add commons-logging and junit jars. It's depending on the class-path of the application in the server. indranil Added the following mappings to my web.xml: indranil servlet-nameServletRedirector/servlet-name indranil servlet-class indranil org.apache.cactus.server.ServletTestRedirector/servlet-class indranil /servlet indranil servlet indranil servlet-nameServletTestRunner/servlet-name indranil servlet-class indranil org.apache.cactus.server.runner.ServletTestRunner/servlet-class indranil /servlet indranil indranil indranil servlet-mapping indranil servlet-nameServletRedirector/servlet-name indranil url-pattern/ServletRedirector/url-pattern indranil /servlet-mapping indranil servlet-mapping indranil servlet-nameServletTestRunner/servlet-name indranil url-pattern/ServletTestRunner/url-pattern indranil /servlet-mapping It looks good. Next point to be confirmed is the consistency between the context-root of the application and cactus.contextURL property. According to the stack-trace in your previous message, the cactus.contextURL would be http://localhost:9080/CspLoanAdmin/JSP/Admin. If the application had been deployed as CspLoadAdmin, however, the cactus.contextURL should be http://localhost:9080/CspLoanAdmin. BTW, I'm assuming the application had been deployed successfully, because the server returned 404 instead of 5xx. Since I have never used WebSphere, it might be a wrong assumption. I recommend you to check the fact first :-) Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unable to run cactus tests on Tomcat 5.5.23(Urgent help required)
Hi, In article [EMAIL PROTECTED], Tue, 28 Aug 2007 13:00:04 +0530, [EMAIL PROTECTED] wrote: sujeet [INFO] Http11BaseProtocol - Starting Coyote HTTP/1.1 on http-8088 [snip] sujeet This shows that Tomcat 5.5.23 is getting started, however when I am sujeet doing http://localhost:8080/ I am not getting any response. Take care for the port number :-) Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getInitParameter null in custom tag test
Hi David, In article [EMAIL PROTECTED], Thu, 16 Aug 2007 09:48:13 -0700 (PDT), davids_k [EMAIL PROTECTED] wrote: david I try to set init parameter in custom tag test. However, in the custom tag david class, I get null from getInitParameter. david david Here is the example: david david In test class: david public void setUp(){ david tag=new HelloWorldTag(); david config.setInitParameter(initTest, Test Init); david tag.setPageContext(this.pageContext); david } david david In HelloWorldTag class: david david public int doStartTag(){ david String david initTest=this.pageContext.getServletContext().getInitParameter(initTest); david System.out.println(initTest); //This is null. david} As far as I can see from Cactus code, it doesn't support your use case. I think I can provide a patch if you can build Cactus jars from code, although I don't have enough time to commit it to the code-base. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to display multiple testcases in the same report using XSLT
Hi, In article [EMAIL PROTECTED], Wed, 8 Aug 2007 10:28:15 +0200, Bervoets,_Sébastien [EMAIL PROTECTED] wrote: Bervoets The goal is to display multiple testcases ine the same Bervoets 'Unit Test Results' report TestCase by TestCase. To display test results as you wish, you have to customize org.apache.cactus.internal.server.runner.XMLFormatter class and XSLT stylesheet. You might find similar (but different) topics from the ML archive at http://www.mail-archive.com/cactus-user%40jakarta.apache.org/ # Subject In html report how can I display Class names # in early February 2006, for example. I prefer to use Ant (or Maven) integration rather than browser though. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getInitParameter null in custom tag test
Hi David, In article [EMAIL PROTECTED], Wed, 22 Aug 2007 19:41:24 +0900 (JST), Kazuhito SUGURI [EMAIL PROTECTED] wrote: suguri I think I can provide a patch if you can build Cactus jars from code, suguri although I don't have enough time to commit it to the code-base. Please find the patch attached. For your use case, you should write test case as follows: import org.apache.cactus.server.ServletContextWrapper; ... public void setUp() { tag = new HelloWorldTag(); ServletContextWrapper context = (ServletContextWrapper) pageContext.getServletContext(); cofntext.setInitParameter(test, test-value at context); tag.setPageContext(pageContext); } Hope this helps, Kazuhito SUGURI Index: framework/src/java/share-12-13-14/org/apache/cactus/server/AbstractPageContextWrapper.java === --- framework/src/java/share-12-13-14/org/apache/cactus/server/AbstractPageContextWrapper.java (revision 568555) +++ framework/src/java/share-12-13-14/org/apache/cactus/server/AbstractPageContextWrapper.java (working copy) @@ -56,6 +56,11 @@ protected ServletURL url; /** + * The wrapped ServletContext for this PageContext. + */ +private ServletContextWrapper servletContext = null; + +/** * Construct an codePageContext/code instance that delegates * it's method calls to the page context object passed as parameter and * that uses the URL passed as parameter to simulate a URL from which @@ -110,8 +115,12 @@ */ public ServletContext getServletContext() { -return new ServletContextWrapper( -this.originalPageContext.getServletContext()); +if (this.servletContext == null) +{ +this.servletContext = new ServletContextWrapper( +this.originalPageContext.getServletContext()); +} +return this.servletContext; } // Unmodified overridden methods - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Could not run junit test class in eclipse
Hi, In article [EMAIL PROTECTED], Wed, 1 Aug 2007 08:32:52 +0100 (BST), jeya seelan [EMAIL PROTECTED] wrote: rnjeyaseelan this is seelan. i follow the folder structure what is given in the cactus document. rnjeyaseelan i am using eclipse3.1 IDE and JBOSS server. rnjeyaseelan i created struts framework application war file and put it rnjeyaseelan in the deploy folder of jboss. rnjeyaseelan if i run jboss server i can access application and work on that. rnjeyaseelan after running my sample struts application, i run the cactus rnjeyaseelan test class. (Right click on the cactus java class file and rnjeyaseelan i click run as JUnit Test). but it throws exception. that is rnjeyaseelan org.apache.cactus.util.ChainedRuntimeException: Missing Cactus property rnjeyaseelan [cactus.contextURL]. You have to configure the client-side of Cactus properly. The cactus.properties should exist in the class-path of which the JVM of the test-runner would search for. Although I cannot point out exact way to set it up with Eclipse (because I'm not an Eclipse user), following pages may give you information for the configuration: http://jakarta.apache.org/cactus/how_it_works.html http://jakarta.apache.org/cactus/integration/manual/howto_classpath.html Hope this helps. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: class hierarchy and extending a Cactus Test Case
Hi, In article [EMAIL PROTECTED], Wed, 18 Jul 2007 16:16:56 -0500, Jay Baker [EMAIL PROTECTED] wrote: jbaker.work Thank you for your interest. Let's say that I have a base class that is used jbaker.work for regular (not in container) test cases. Call this MyBaseTestCase. I have jbaker.work other test classes that extend this base class. The base class provides jbaker.work services that I need and the current design uses inheritance. For example, jbaker.work it uses a template pattern approach to enforce that some metadata is jbaker.work available. So we have: Thank you. I could understand better. Many of testing-frameworks use the template pattern and have their own base-class (not an interface) to be inherited. As Java doesn't support multiple inheritance, I think it is better to have separated utility class which provides services currently provided by your MyBaseTestCase class so that you can utilize such service independently of object hierarchy of its client. By doing so, you could avoid similar issue when you will try other frameworks, eg. StrutsTestCase. In article [EMAIL PROTECTED], Tue, 17 Jul 2007 11:11:25 -0500, Jay Baker [EMAIL PROTECTED] wrote: jbaker.work It seems that I have four choices. [snip] jbaker.work 4. Change the design of existing code base that I have so this is not an jbaker.work issue. I can't really afford to do this at this time due to the effort and jbaker.work risk involved. If I were you, I would take this approach. To minimize the risk you are worrying about, you would change only codes that relate to Cactus for this time. # I suggest step-by-step refactoring. Best Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: class hierarchy and extending a Cactus Test Case
Hi, In article [EMAIL PROTECTED], Tue, 17 Jul 2007 11:11:25 -0500, Jay Baker [EMAIL PROTECTED] wrote: jbaker.work I am using ServletTestCase. Extending this test case works just fine. No jbaker.work problem. However, I have an existing object hierarchy that I would like to jbaker.work preserve. Although all of the Cactus documentation discusses extending one jbaker.work of the Cactus tests, I figured I could just implement some appropriate jbaker.work interface(s) and use delegation. As I read further, I understood the use of jbaker.work publicly accessible attributes of the various Cactus test cases. If this jbaker.work access were done through getters and setters, I would have no problem. I cannot understand what you want to do, so am having questions. Q1: What is the object for which you want to preserve its object hierarchy? Q2: What is the relation of the object and Cactus? Q3: How should the object and Cactus work together? A safe example would be helpful. Best Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 404 error when trying to view results in HTML format
Hi, In article [EMAIL PROTECTED], Tue, 19 Jun 2007 15:58:06 -0500, Vaidya, Supriya A (US - Chicago) [EMAIL PROTECTED] wrote: supriyavaidya Thanks Franz! With the URL modified in the manner you specified - it works great! Wondering why it doesn't work with the init-param tho... The URL should have a transform parameter to enable the server-side transformation as documented in http://jakarta.apache.org/cactus/integration/integration_browser.html: If all of the above is correctly set up, you can enable the actual transformation by including a transform parameter with the request (the value of the parameter does not matter). For example http://server:port/mywebapp/ServletTestRunner?suite=mytestcasetransform=yes FYI. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: URGENT: Unable to run test cases in SwingUI
Hi, I have some questions. In article [EMAIL PROTECTED], Thu, 21 Jun 2007 15:26:38 -0500, Vaidya, Supriya A (US - Chicago) [EMAIL PROTECTED] wrote: supriyavaidya I reverted to using the command prompt and abandoned Eclipse completely! supriyavaidya Now I am able to get beyond the NoClassDefFoundError - and am stuck with supriyavaidya the weblogic.jar and commons-logging problem! Was this problem solved? If not solved yet, what TestRunner are you using? Are you using junit.swingui.TestRunner as in the subject? supriyavaidya Caused by: org.apache.commons.logging.LogConfigurationException: supriyavaidya org.apache.commons.logging.LogConfigurationException: Invalid class supriyavaidya loader hierarchy. You have more than one version of supriyavaidya 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused supriyavaidya by org.apache.commons.logging.LogConfigurationException: Invalid class supriyavaidya loader hierarchy. You have more than one version of supriyavaidya 'org.apache.commons.logging.Log' visible, which is not allowed.) supriyavaidya supriyavaidya I cannot remove weblogic.jar since I need it for some classes (like the supriyavaidya TPException class)... And I cannot remove the commons.jar since that supriyavaidya throws errors too... So how do I resolve this?!? I'm not a WebLogic user, so please let me know. Do you mean that both of weblogic.jar and commons.jar contain org.apache.commons.logging.Log? Best Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Annotations Support with Cactus 1.7.2/JUnit 4.2/ServletTestRunner
Hi James, In article [EMAIL PROTECTED], Wed, 17 Jan 2007 11:33:27 +, james brook [EMAIL PROTECTED] wrote: jmbrook Tests that have been developed in the old junit style (extending TestCase jmbrook and having methods called test) work but tests using the annotations jmbrook don't seem to found. I get a No tests could be found exception. jmbrook jmbrook Should this work? No. ATM, Cactus doesn't support annotations. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can't use Cactus with Java 5.0
Hi, In article [EMAIL PROTECTED], Tue, 5 Sep 2006 18:06:20 +0800, Xu Xin [EMAIL PROTECTED] wrote: anfernee.xu I downloaded the latest Cactus distribution(1.7.2), and used ANT 1.6.5 and anfernee.xu JRokcet 1.5.0_06 to drive my ANT-integrated tests. FYI, Cactus-1.7.2 is working with Sun JRE 1.5.0_08 and ant-1.6.5 for me. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus 1.7.2 setting the wrong locale?
Hi Matt, In article [EMAIL PROTECTED], Tue, 15 Aug 2006 22:13:59 -0600, Matt Raible [EMAIL PROTECTED] wrote: mraible I managed to solve this problem - thanks for your help. What was the cause? Your feedback would be informative for other Spring users in this community. Best Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus 1.7.2 setting the wrong locale?
Hi Matt, In article [EMAIL PROTECTED], Wed, 16 Aug 2006 07:37:54 -0600, Matt Raible [EMAIL PROTECTED] wrote: mraible The problem was that the following only loads the context files mraible specified by ContextLoaderListener. [snip] mraible In early versions of Spring (1.1.x series), the above line would have mraible the beans loaded by Spring's DispatcherServlet as well. This seems to mraible have changed since 1.2.x, and therefore, I had to mock out any beans I mraible expected to be in this context. Here's what my new setUp() method mraible looks like: Thank you for the feedback! Best Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus 1.7.2 setting the wrong locale?
Hi Matt, In article [EMAIL PROTECTED], Tue, 15 Aug 2006 18:18:18 -0600, Matt Raible [EMAIL PROTECTED] wrote: mraible I'm testing a Spring MVC 2.0 (RC1) application with Cactus. When I mraible run my cactified WAR in Tomcat, everything works fine. However, when mraible I run it in Cactus, I get: mraible mraible[cactus] No message found under code 'user.saved' for locale 'en_US'. mraible[cactus] org.springframework.context.NoSuchMessageException: No mraible message found under code 'user.saved' for locale 'en_US'. mraible[cactus] at mraible org.springframework.context.support.DelegatingMessageSource.getMessage(DelegatingMessageSource.java:65) mraible[cactus] at mraible org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:698) mraible[cactus] at mraible org.springframework.context.support.MessageSourceAccessor.getMessage(MessageSourceAccessor.java:149) mraible[cactus] at mraible org.appfuse.web.UserFormController.onSubmit(UserFormController.java:90) I cannot find any Cactus classes from the stack trace. Could you post the full stack trace? Best Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Determine Servlet Name
Hi Perry, In article [EMAIL PROTECTED], Tue, 8 Aug 2006 10:55:07 -0500, [EMAIL PROTECTED] wrote: dutchman_mn Is there a cactus mailing list archive and failing that, dutchman_mn how does Cactus determine the servlet to test. dutchman_mn If I have a method called testFooAction and the servlet mapping is dutchman_mn /fooAction, how does Cactus determin to have the ServletRedirector dutchman_mn determine fooAction? I tried looked at the source code but dutchman_mn could not determine it. ServletRedirector does not refer servlet-mapping for its execution. Information that is needed for execution of a test, such as test class and method names, is transmitted from the client-side of the Cactus framework as a set of HTTP parameter. In article [EMAIL PROTECTED], Thu, 10 Aug 2006 9:58:21 -0500, [EMAIL PROTECTED] wrote: dutchman_mn My question revolves around the DefaultHttpClient class. dutchman_mn Looking at the source, I see within the callRunTest method dutchman_mn the following method: dutchman_mn dutchman_mn // Specify the service to call on the redirector side dutchman_mn theRequest.addParameter(HttpServiceDefinition.SERVICE_NAME_PARAM, dutchman_mn ServiceEnumeration.CALL_TEST_SERVICE.toString(), dutchman_mnWebRequest.GET_METHOD); This is a part of the parameter set. This parameter directs the service that ServletRedirector should provide to the client-side, such as CALL_TEST, GET_RESULTS. As the test execution sequence is determined, the client-side of the framework can determine specific service suitable for the state. Please take a look at http://jakarta.apache.org/cactus/how_it_works.html dutchman_mn My question is, how does cactus determine the service name of dutchman_mn the servlet under test? If you mean servlet-name and its mapping definition in web.xml by the service name of the servlet, the answer is: Cactus doesn't determine that. (or Cactus doesn't care of that.) If you mean something different, please let us know. Best Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Testing servlet redirects
Hi Karthik, In article [EMAIL PROTECTED], Wed, 21 Jun 2006 18:32:48 +0530, karthik [EMAIL PROTECTED] wrote: karthikn The example provided on the site is something confusing Please point out what confuses you. karthikn If u hava a sample working test case with war file,please karthikn provid me the same. so i can correct my self. A sample. public class SampleTest extends ServletTestCase { public SampleTest(String name) { super(name); } public void testJsp() throws Exception { session.setAttribute(testKey, testValue); RequestDispatcher rd = request.getRequestDispatcher(/test.jsp); rd.forward(request, response); } public void endJsp(WebResponse response) { System.out.println(response.getText()); } } test.jsp: %= session.getAttribute(testKey) % Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Testing servlet redirects
Hi Dennis, Followings are information and recommendation from me. These are based on short examination with default settings of Tomat-5.5.12. But, please note that behavior of a servlet named default might be different for each container and its configuration. In article [EMAIL PROTECTED], Mon, 19 Jun 2006 23:14:40 +0200, Dennis Kempin [EMAIL PROTECTED] wrote: dennis thank you for your answer. My servlet is mapped to process any request that dennis is made. dennis Lets say we have a request on /core/test.html: My servlets checks if it can dennis handle, if not it redirects to the default dennis servlet which should serve test.html (which does exist). dennis But instead of the contents of test.html i get the described 404 Error which dennis says that it cannot find /core/ServletRedirector. I think it's hard to test the forwarding by using Cactus as long as you are using getNamedDispatcher(default). RequestDispatcherWrapper#forward(), which is used in the test, calls the original RequestDispatcher with the original HTTP request. # See Cactus API JavaDoc. A servier-side test case is invoked from a servlet, /context/ ServletRedirecter. So, the request URI of the original HTTP request is /context/ServletRedirector. When the original RequestDispatcher is the default servlet of Tomcat, it's trying to obtain the resource from /context/ServletRedirector, that has the possiblity of causing an infinite loop. # Fortunately, the default servlet responds 404 and stops the loop. Please try following fragments of servlet and web.xml. You will find similar behavior with your Cactus tests when you access to context/dummy. public DummyServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { getServletContext().getNamedDispatcher(default).forward(request, response); } } servlet servlet-namedummy/servlet-name servlet-classDummyServlet/servlet-name /servlet servlet-mapping servlet-namedummy/servlet-name url-pattern/dummy/url-pattern /servlet-mapping I would like to recommend you to use getRequestDispatcher(String) instead of getNamedDispatcher(default), it it's possible. If you can do so, you will be able to simulate any path condition for a testXXX() by using org.apache.cactus.WebRequest#setURL() method in beginXXX(), and you can evaluate a forwarded responce in the corresponding endXXX() method. # You should not simulate context/ServletRedirector, # which is the default of Cactus, of cource :-) Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to the output report genereted by Cactus
Hi Rakesh, In article [EMAIL PROTECTED], Mon, 19 Jun 2006 20:38:06 +0530, rakesh kumar thawait [EMAIL PROTECTED] wrote: rakesh I am using jakarta-cactus-13-1.7.2 to test EJB which shows the test rakesh result in following form : rakesh rakesh rakesh [image: XML output of ServletTestRunner] rakesh rakesh I need to show the result in following form : rakesh rakesh ?xml version=1.0 encoding=UTF-8 ? rakesh - # testsuites rakesh - #testsuite name=*TestSampleServlet* tests=*1* failures rakesh =*O* errors=*0* time=*0.016* rakesh - #testcase name=*testSaveToSessionOK* time=*0.016* rakesh expected=expected value passed in assert method actual = actual rakesh value passed in assert method/ rakesh /testsuite rakesh /testsuites rakesh rakesh rakesh So that I can translate the output XML into required HTML .XML should rakesh contain expected value and actual value that comes from test method . It's interesting, but, it's difficult. AFAIK, TestResult of JUnit framework can collect test information in test method basis, not in assertion baseis. Even if information could be collected in assertion basis by using AOP or other approaches, I think, expected and actual tags are not suitable for the testcase element because a test method could have multiple assertions. Examinations of necessary information and it's representation format might be the first step. Cheer, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Testing JSP with sessions
Hi Karthik, In article [EMAIL PROTECTED], Tue, 20 Jun 2006 14:52:59 +0530, karthik [EMAIL PROTECTED] wrote: karthikn Can some body on this form ,be kind to spare me some code on karthikn HOWTO test a JSP pages which hare secured by session objects. karthikn Suppoes i have 100 jsp pages which have session Tracked, karthikn so how to set the sessions and Test such jsp pages using CACTUS . Please take a look at: http://jakarta.apache.org/cactus/writing/howto_testcase_jsp.html http://jakarta.apache.org/cactus/writing/howto_jsp.html You can set session attributes in testXXX() method before you call JSP under test by using one of forward methods. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus -Ant Integration (Sample Servlet): Build failed to start the container (tomcat)
Hi, In article [EMAIL PROTECTED], Fri, 09 Jun 2006 15:51:11 -0400, Atul Afre [EMAIL PROTECTED] wrote: afrea I was using tomcat tomcat-5.5.11, when I changed to tomcat-5.0.4.. It afrea worked. afrea Is there issue with deploy on tomcat-5.5.11 using Cactus -Ant afrea Integration? I think so. Could you add servletxml attribute to the tomcat5x element like as follows: tomcat5x if=cactus.home.tomcat5x servletxml=${cactus.home.tomcat5x}/conf/server.xml Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Testing servlet redirects
Hi Dennis, In article [EMAIL PROTECTED], Sat, 17 Jun 2006 14:20:15 +0200, Dennis Kempin [EMAIL PROTECTED] wrote: dennis i am using the JettyTestSetup to test a simple Servlet. This servlet dennis sometimes calls dennis getServletContext().getNamedDispatcher(default).forward(request, dennis response); to redirect requests to the default servlet to serve static dennis resources. dennis dennis Well this is what Jetty returns as response when such a redirect happens: dennis HTTP ERROR: 404 /core/ServletRedirector Not Found dennis RequestURI=/core/ServletRedirector dennis Where core is the context path. Do you mean that the 404 response is the expected behavior of RequestDispatcher#foward() performed by your servlet? dennis It is not important for me to test what the redirect returns, its more dennis important that the servlet performs the redirect. That is what I want to dennis test. dennis Any ideas on how to test that (Testing for this error message would be a dennis very hacky solution)? I don't think the error message is the expected result, however, I think you need to evaluate the response at endXXX(WebResponse) method to test RequestDispatcher#forward works as expected. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus -Ant Integration (Sample Servlet): Build failed tostart the container (tomcat)
Hi, In article [EMAIL PROTECTED], Mon, 19 Jun 2006 13:54:39 -0400, Atul Afre [EMAIL PROTECTED] wrote: afrea When I did as you said, I get error: afrea Class afrea org.apache.cactus.integration.ant.container.tomcat.Tomcat5xContainer afrea doesn't support the servletxml attribute. Ah, I was wrong. sorry. It should be serverxml. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting Initialization Parameters from web.xml
Hi Bryan, In article [EMAIL PROTECTED], Thu, 08 Jun 2006 11:56:21 -0600, Bryan Cornies [EMAIL PROTECTED] wrote: bryan I am trying to test a servlet which contains an init() method which bryan grabs a handful of initialization parameters from the web.xml file. It bryan looks like: [snip] bryan I understand that, from reading the documention, I need to call init on bryan the servlet and pass it the ServletConfigWrapper member variable. Thus, bryan my test method looks like: [snip] bryan The problem is, unless I explicitly call setInitializationParameter() in bryan testDoPost(), which just redundently sets the same parameters that are bryan already specified in web.xml, the servlet cannot find them when it calls bryan config.getInitParameter(). It works fine when I send a POST to the bryan servlet through a jsp. What I can point out are as follows: 1. A MyServlet instance which is instantiated in the testXXX method is not the one instantiated as a servlet by the servlet container. As the responsibility to set ServletConfig to a servlet is in the servlet container, the responsibility to set ServetConfig(Wrapper) to the class under test is in your testXXX method. 2. ServletContext available from testXXX method is the one for ServletRedirector defined in web.xml, not the one for your MyServlet. Please recall a fact that ServletRedirector is mapped as a servlet and your test-case is called from the servlet. ServletContextWrapper is provided to help emulate ServletContext for a class under test. 3. I think what you need to test against your MyServlet class are behavior of init(config) and post-init conditions when - config consists of just expected parameters - config missing some of mandatory parameers - config missing some of optional parameters (test its default works) - config contains no parameters - parameter(s) has wrong or inconsistent value(s) - etc. This means that you have to have multiple init-paremter sets for a class under test. I'm not sure it's reasonable to define all such parameter sets in web.xml. 4. As a servlet-class can be mapped to multiple servlet-names, init-parameters cannot be determined from the class-name. You can provide a utility class to set init-parameters to ServletConfigWrapper. The utility class should have method looks like void setInitParamByName(ServletConfigWrapper theWrapper, String theName); If you already have such helper, it would be nice if you could add the code(s) in the wiki: http://wiki.apache.org/jakarta-cactus/UsefulCode bryan I feel like I'm missing a key concept somewhere. I've spent the last bryan couple of days trying anything I could think of with no luck. Any bryan assistance would be greatly appreciated! From stand point of test-first practice, you shoud not map MyServlet as a servlet in web.xml until MyServlet passes all unit-tests. :-) Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem running cactus from ant
Hi Ian, In article [EMAIL PROTECTED], Thu, 27 Apr 2006 14:34:16 +0100, Dickinson, Ian J. (HP Labs, Bristol, UK) [EMAIL PROTECTED] wrote: ian I'm just getting going with using Cactus to test a J2EE project. I've ian built my cactified .war and deployed the .ear. I can run a simple test ian successfully using the ServletRunner on the server, but if I try to ian invoke the same test from the cactus task in ant, I get a ian ClassNotFoundException: [snip] ian[cactus] Caused an ERROR ian[cactus] com.hp.vrmm.station.StationInfoFacadeBeanTest ian[cactus] java.lang.ClassNotFoundException: ian com.hp.vrmm.station.StationInfoFacadeBeanTest [snip] ian The named class is present under WEB-INF/classes in the cactified .war, ian and, indeed, is invoked from the servlet test runner. My cactus task ian looks like this: You have to set a client-side classpath properly. ian target name=run-cactus ian cactus earfile=${build.dir}/test-${ear.name} fork=yes ian printsummary=yes haltonerror=true ian haltonfailure=false ian containerset ian generic name=JBossGeneric port=8088 ian startup target=generic.jboss.deploy/ ian shutdown target=generic.jboss.undeploy/ ian /generic ian /containerset ian formatter type=plain usefile=false/ ian test name=com.hp.vrmm.station.StationInfoFacadeBeanTest / ian /cactus ian /target As cactus ant-task is an extension of junit ant-task, you can set the client-side classpath by using classpath nested-element for the cactus task. You may have already solved the problem, though. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: app stops working after running cactus tests
Hi, In article [EMAIL PROTECTED], Fri, 28 Apr 2006 10:55:31 +0100, Butt, Akif [EMAIL PROTECTED] wrote: akif I'm not sure if this is a base Cactus issue or the StrutsTestCase akif extension of Cactus but... akif I started running some in-container tests against my struts application akif but have noticed that after the tests complete (successfully) that I can akif no longer use the application via its proper means (i.e. through a web akif browser). When I try using the app after running the cactus tests (this akif problem applies whether I run them via Ant cactus task or through the akif browser ServletTestRunner) I keep getting an Internal Server 500 error akif but so far cannot find any details about this error since nothing comes akif up on the weblogic console or in any domain/server log files. Have you solved the problem? If you have not ... I think we need to know details of the Internal Server Error (500) to help you. You might add some logging statements in your classes to trace process for a request. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: negative testing with FormAuthentication
Hi Gabriel, In article [EMAIL PROTECTED], Tue, 16 May 2006 17:04:14 -0400, Gabe [EMAIL PROTECTED] wrote: gabriel I've been setting up a cactus test to test a web application gabriel containers login. My test succeeds until I try a bad login. The gabriel FormAuthentication throws a gabriel org.apache.cactus.util.ChainedRuntimeException: Failed to gabriel authenticate the principal exception. This is expected behavior. gabriel The problem I can't wrap my head around is how is my test case gabriel supposed to catch the exception? I put try catch blocks in the gabriel beginXXX() and in the testXXX() methods and neither catch the gabriel exception. I can understand what you want to do. However, you can not do it that way. The WebRequest instance is a container that maintains instructions to set the pre-test condition that should be tuned befor the testXXX() method is executed. After your begin() and beginXXX() methods provide the WebRequest instance, the client-side of the Cactus framework uses it to set the server-side pre-test condition for testXXX(). This means that the authentication would be performed AFTER the beginXXX() method. This is why you cannot catch the exception. gabriel Right now the exception causes an error and makes the test fail. But gabriel the login was supposed to fail. gabriel gabriel How should one test and assert a failed login using Cactus? HttpUnit or other functional testing frameworks would be appropriated. To test a failed login situation in Cactus world, you should consider how the behavior of the container is different between a request not authenticated and a request that failed to authenticate. # For unit testing, both may be considered as same, but I'm not sure. ## It may be depending on the container implementation. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NoClassDefFoundError - can't find the servlet class under test
Hi, You may already solved the problem. In article [EMAIL PROTECTED], Thu, 4 May 2006 17:24:51 -0400, Varma, Nitesh [EMAIL PROTECTED] wrote: nitesh_varma My cactified ear file contains the following: nitesh_varma nitesh_varma - application jar file nitesh_varma nitesh_varma - application war file nitesh_varma nitesh_varma - cactus.war file nitesh_varma [snip] nitesh_varma It seems like the cactus.war is not seeing classes under nitesh_varma [application.war] because of class loader issue. I think it's the class-loader issue as you mentioned. nitesh_varma But my understanding is that application classes shouldn't nitesh_varma be included in cactus.war. I think you should cactify application.war in your ear file instead of cactus.war. Separation of the production archive and the test archive may be important, however, that does not mean that application classes and test classes shouldn't be archived into the same war-archive. In fact, cactifywar creates such test archive from an existing production archive. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: java.lang.ClassNotFoundException: org.apache.cactus.server.FilterTestRedirector
Hi Jason, In article [EMAIL PROTECTED], Wed, 29 Mar 2006 13:13:27 +0530, Jason Stewart [EMAIL PROTECTED] wrote: jason After setting up my project to use cactus many months ago, I had to jason stop integration. I recently resumed and started getting the following jason exceptions from my cactus task: jason jason[cactus] StandardContext[/pantoto-2005-06-09-cactified]: Exception jason starting filter FilterRedirector: java.lang.ClassNotFoundException: jason org.apache.cactus.server.FilterTestRedirector jason[cactus] java.lang.ClassNotFoundException: jason org.apache.cactus.server.FilterTestRedirector jason[cactus] at jason org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1407) [snip] jason I can eliminate the error and get cactus running by opening up my jason cactified war file, editing the web.xml file and removing the jason following: jason jason filter jason filter-nameFilterRedirector/filter-name jason filter-classorg.apache.cactus.server.FilterTestRedirector/filter-class jason /filter jason filter-mapping jason filter-nameFilterRedirector/filter-name jason url-pattern/FilterRedirector/url-pattern jason /filter-mapping Have you checked contents of jar-files under WEB-INF/lib? Can you find org.apache.cactus.server.FilterTestRedirector.class? jason Two questions: jason * why is this creating a problem? ATM, I'm not sure. Let's find the cause. A possible cause is that cactifywar ant task is referring cactus.jar for Servlet-2.2. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Separating test cases from a web project
Hi Kim, In article [EMAIL PROTECTED], Wed, 29 Mar 2006 17:11:58 -0600, Kim, Yong [EMAIL PROTECTED] wrote: Kim.Yong My biggest dilemma of using the Cactus to test a web application is that Kim.Yong I have to have the test cases along with all the other Cactus related Kim.Yong JARs in the same web project that I am going to deploy to production. Kim.Yong Kim.Yong At least that's the way I understood it has to be. Kim.Yong Kim.Yong Kim.Yong Kim.Yong I just don't like to have the test cases and other non-project related Kim.Yong library jars in a web application which is going to be deployed to Kim.Yong production later. Kim.Yong Kim.Yong Would you someone share an idea of how to lower the coupling of test Kim.Yong cases to a web project? Have you tried cactifywar ant task? http://jakarta.apache.org/cactus/integration/ant/task_cactifywar.html Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NamingException running Cactus tests
Hi Francesco, In article [EMAIL PROTECTED], Tue, 21 Mar 2006 13:47:21 -0600, Guerra, Francesco [EMAIL PROTECTED] wrote: Francesco I have installed Tomcat 5.5 and Cactus jakarta-cactus-13-1.7.1. Francesco Francesco When I run ant test I get the exception below in tomcat5x.out and the Francesco test hangs. [snip] Francesco Mar 21, 2006 2:16:43 PM org.apache.catalina.realm.UserDatabaseRealm Francesco start Francesco SEVERE: Exception looking up UserDatabase under key UserDatabase ${tomcat5x.home}/conf/server.xml may have faults. Can you start the tomcat instance manyally? Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about testing custom tags
Hi, In article [EMAIL PROTECTED], Wed, 15 Mar 2006 10:47:09 -0500, [EMAIL PROTECTED] wrote: samarth_kumar web.xml samarth_kumar samarth_kumar servlet samarth_kumar servlet-nameJspRedirector/servlet-name samarth_kumar servlet-class/jspRedirector.jsp/servlet-class samarth_kumar /servlet servlet servlet-nameJspRedirector/servlet-name jsp-file/jspRedirector.jsp/jsp-file /servlet samarth_kumar servlet-mapping samarth_kumar servlet-nameJspRedirector/servlet-name samarth_kumar url-pattern/JspRedirector/url-pattern samarth_kumar /servlet-mapping samarth_kumar samarth_kumar The jspRedirector.jsp is located in the WEB-INF directory of the web samarth_kumar application. Put the jspRedirector.jsp as /jspRedirector.jsp of the web application. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Help me, the beginXXX() method is not getting called
Hi Kumuda, In article [EMAIL PROTECTED], Mon, 13 Mar 2006 17:56:44 +0530, Kumuda Bhaskar [EMAIL PROTECTED] wrote: Kumuda I am using tomcat 5.0.4 and the beginXXX method is not getting called. You must show us logs so that we can see there is the problem. Are you seeing a client-side log to judge that the beginXXX method is not getting called? If you are only seeing log files of tomcat (i.e. server-side), you cannnot find any info coded in the beginXXX method in there. Kumuda My Tester is as follows: [snip] Kumuda public static void main(String[] args) { Kumuda Kumuda junit.textui.TestRunner.run(Tester.class); Kumuda Kumuda } You have a good method :-) Have you tried `java Tester` from command line? What info did you see on your console? Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sending 2D string for setting the ActionForm using addRequestParameter
Hi, In article [EMAIL PROTECTED], Sun, 12 Mar 2006 22:27:21 +0530, Konjengbam Singh [EMAIL PROTECTED] wrote: Konjengbam From what i understand this will end up with a new method Konjengbam in ActionForm class to set the String[][] and Konjengbam making m*n addRequestParameter calls . Konjengbam My requirement is such that without disturbing the existing class, Konjengbam is there any way to populate the Sting[][]? This topic is like off the subject of this mailing-list. If Struts is supporting the population of String[][] from a HTTP request, StrutsTestCase community might have knowledge about how to test your class. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Obtaining server-side resource in suite() method using junit.textui.TestRunner
Hi Nicholas, In article [EMAIL PROTECTED], Mon, 6 Mar 2006 11:29:01 -0800, Nicholas Dierauf [EMAIL PROTECTED] wrote: nicholas In order to set up a suite of tests to be executed client-side, I wish nicholas to access a server-side resource in my suite() method. This works fine nicholas when I run the test from my browser using ServletTestRunner, but I get a nicholas java.lang.reflect.InvocationTargetException when I attempt to run from nicholas a different jvm, ie with junit.textui.TestRunner. nicholas nicholas Is it possible to access server-side resources in the suite() method nicholas when executed from junit.textui.TestRunner? (Please see below for some nicholas sample code.) It may be possible, but I dont't recommend that way. At least, you have to implement such mechanism by yourself. Also, you have to take care for the server-side instantiation which will be done without using suite() method. nicholas Here is the sample code. Some details have been left out for brevity. In nicholas this example, I want the test to run differently depending on the nicholas environment. Because the system property servertype is not defined in nicholas the textui JVM environment, I get the Exception. You might pass the system property as a command-line argument of the JVM, i.e. java -Dservertype=XXX junit.textui.TestRunner class-name. nicholas public MyTest(String environment) { nicholas super(testSomething ); nicholas this.environment = environment; nicholas } Is this test really works with ServletTestRunner? Have you ever test the value of this.environment in testSometing() method? I think, the MyTest will be constructed with argument value of testSomething for the second instantiateion in the servier-side. So, this.environment above will have value of testSomething that you are not expecting. I may misunderstanding something, though. Hope this helps. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem getting test results
Hi Paulo, In article [EMAIL PROTECTED], Fri, 3 Mar 2006 11:08:46 -0300 (ART), Paulo R C Siqueira [EMAIL PROTECTED] wrote: gangrelbr1 It is frustrating... but with ServletRedirector instead of gangrelbr1 ServletRedirectorSecure it works. gangrelbr1 This means I will need to run my tests with testing authentication? gangrelbr1 Or is there something that could be done to solve this problem? I'm not understanding why authentication makes the problem. Could you please post following items for further analysis? - source codes of the test case and web.xml that are using ServletRedirectorSecure - source codes of the test case and web.xml that are using ServletRedirector Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem getting test results
Hi Paulo, In article [EMAIL PROTECTED], Wed, 1 Mar 2006 14:47:18 + (GMT), Paulo R C Siqueira [EMAIL PROTECTED] wrote: gangrelbr1 I tried to run the test with junit.textui.TestRunner. [snip] gangrelbr1 This is the error on the client side: gangrelbr1 gangrelbr1 org.apache.cactus.util.ChainedRuntimeException: Failed to get the test results at [http://127.0.0.1:8080/myapp/ServletRedirectorSecure] Could you try ServletRedirector instead of ServletRedirectorSecure? I'm not sure that the authentication could be a cause, though. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is Cactus thread safe?
Hi Shay, In article [EMAIL PROTECTED], Tue, 28 Feb 2006 17:22:22 -0600, Shay Thompson [EMAIL PROTECTED] wrote: sthompso I need to test multiple remote machines, from a single main machine, sthompso using Cactus. I'm wondering if Cactus is thread safe for doing sthompso something like this? I'd obviously have to have it run off of separate sthompso ear files, 1 for each remote machine, but even then will it work? I think it's possible. Some possible constraints for the use-case I can imagine: 1. exclusive JVM is required for each cactified application under test since client-side of Cactus set the contextURL as a System property. So, you have to invoke multiple JVM processes each of which runs Cactus for one remote machine, if you need to test remote machines simultaneously. 2. Cactus does not have a capability of remote deployment, yet. So, you have to deploy cactified applications to remote machines before you run tests. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem getting test results
Hi Paulo, In article [EMAIL PROTECTED], Fri, 24 Feb 2006 12:34:00 + (GMT), Paulo R C Siqueira [EMAIL PROTECTED] wrote: gangrelbr1 Since I don't know how exactly NetBeans handle the tests gangrelbr1 internally, and I'm using the default configurations for JBoss, gangrelbr1 it seens more likely that (2) is what is happening. gangrelbr1 What should I do? You might try run test without NetBeans to know whether Cactus works with your target container (JBoss-4.0.3). I had tried following steps last weekend and it worked fine: (1) create cactified-war with a simple test (2) start JBoss (3) deploy the cactified-war file to JBoss manually (4) run test by using junit.textui.TestRunner: java junit.textui.TestRunner test class name My environment is as follows: Linux kernel 2.6.8 Sun jdk 1.5.0_06 JBoss-4.0.3SP1 Cactus-1.7.1 Once you found a working configuration, you can use that for other tests, and can narrow the problem you have encountered. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem getting test results
Hi Paulo, In article [EMAIL PROTECTED], Mon, 20 Feb 2006 16:58:25 -0300 (ART), Paulo R C Siqueira [EMAIL PROTECTED] wrote: gangrelbr1 I'm having problems getting the Cactus test results. When I run my tests I always get this exception: gangrelbr1 gangrelbr1 15:53:51,882 ERROR [AbstractWebTestCaller] Error getting test result. This could happen for example if you're using a load-balancer. Please disable it before running Cactus tests. How are you runnning the test? By using ServletTestRunner, for example? The client side of Cactus sends requests to server side twice for each testXXX() method. The first request is to execute the test. The test result will be saved as a context scope attribute. The second request is to retrieve test result from the context scope. The error you have encountered happens on the second request and it can happen if the context scope attribute for the test result does not exist. Possible causes are (1) the server-side context receiving the second request from the client-side is not the one that received the first request. (2) the client-side is making the second request before the first request fully finished. So, we must see test execution sequence including the client-side to know what is really happening in your case. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: In html report how can I display Class names.
Hi, In article [EMAIL PROTECTED], Mon, 6 Feb 2006 11:48:21 -0800 (PST), senthil kumar [EMAIL PROTECTED] wrote: senthil_cbe But can you just give me a brief idea when I have to senthil_cbe use ServletTestSuite instead of TestSuite? ATM, I have no idea :- Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem faced while integrating Cactus with WSAD 5.1
Hi Prashant, In article [EMAIL PROTECTED], Tue, 7 Feb 2006 02:09:40 +0530, prashant jha [EMAIL PROTECTED] wrote: prashant_jha I am trying to integrate Cactus with WSAD 5.1. prashant_jha I followed the steps mentioned in Sheldon's tutorial. prashant_jha But when I run my Cactus test case I get the following exception prashant_jha related to logger configuration failure on the client side. What's kind of TestRunner are you using? junit.swingui.TestRunner? prashant_jha Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.NoOpLog does not implement Log It looks like a known class-loader related issue. Following FAQ entry might helps you: http://jakarta.apache.org/cactus/faq.html#faq_classcastexception_logfactoryimpl Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: In html report how can I display Class names.
Hi Senthil, In article [EMAIL PROTECTED], Thu, 2 Feb 2006 15:23:32 -0800 (PST), senthil kumar [EMAIL PROTECTED] wrote: senthil_cbe 1. I am not using ANT to generate a report. Right now senthil_cbe I am running my test cases from browser. I created a senthil_cbe simple UI to display and run test cases for my senthil_cbe application. I see. senthil_cbe Here I didn't see any class name, I beleive even if I senthil_cbe modify the XLST unless there is an entry in the XML senthil_cbe document it wont display the class name. So I need to senthil_cbe introduce one more attribute class name while writing senthil_cbe XML am I right? Yes, you are right. You have to customize org.apache.cactus.internal.server.runner.XMLFormatter class and XSL stylesheet if you are using ServletTestRunner. org.apache.cactus.internal.server.runner.XMLFormatter#endTest(Test) method is the first point to modify, I think. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus 1.6.1 Tests from Two Different WARs Deployed in Same JVM
Hi Jeremy, In article [EMAIL PROTECTED], Thu, 2 Feb 2006 15:22:03 -0600, Fredrich, Jeremy D [EMAIL PROTECTED] wrote: Jeremy I have deployed two different EARs, each containing a WAR, Jeremy into a Websphere 5.1.1 application server which uses a shared JVM. Jeremy Both Cactus tests(one from each WAR) run successfully from the browser Jeremy if they are the first and only to run after the server is started. Jeremy If I attempt to run the second Cactus test after the first one Jeremy successfully runs, I receive the following error: Jeremy org.apache.cactus.util.ChainedRuntimeException: Failed to get the test results at http://localhost:9080/application1_web/ServletRedirectorSecure Jeremy The cactus.contextURL contains the URL of the first test that ran. This is the limitation of the ServletTestRunner. The context-url the ServletTestRedirector uses is stored as a system (i.e. jvm wide) property and is initialized once when the class is loaded for the first time. See also: http://www.mail-archive.com/cactus-user@jakarta.apache.org/msg06966.html Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: what url I should write?
Hi, Awaneesh In article [EMAIL PROTECTED], Fri, 3 Feb 2006 12:18:03 +0530, Awaneesh Shatmanyu [EMAIL PROTECTED] wrote: a.shatmanyu The package structure of my project Glossary Tool ...is a.shatmanyu com.NRI.TStar.servlets. a.shatmanyu a.shatmanyu Inside servlets(package) I have a SampleServlet.java and to test this a.shatmanyu using cactus I have TestSampleServlet.java.. [snip] a.shatmanyu I am trying a.shatmanyu http://localhost:8080/GlossaryTool/ServletTestRunner?suite=TestSampleServlet a.shatmanyu..this does not work. I'm not sure how does that not work ;-) The url might be http://localhost:8080/GlossaryTool/ServletTestRunner?suite=com.NRI.TStar.servlets.TestSampleServlet a.shatmanyu PROBLEM: a.shatmanyu a.shatmanyu I am not able to display the test result on the SampleServlet on my a.shatmanyu browser...(test result is shown in xml in cactus) If you are seeing a test result in XML format, http://jakarta.apache.org/cactus/integration/integration_browser.html might helps you. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: In html report how can I display Class names.
Hi Senthil, In article [EMAIL PROTECTED], Tue, 31 Jan 2006 18:04:01 -0800 (PST), senthil kumar [EMAIL PROTECTED] wrote: senthil_cbe How can I display the test class names in report. For senthil_cbe example I have three test classes senthil_cbe Atest.java (testAmethod()) senthil_cbe Btest.java (testBmethod()) senthil_cbe Ctest.java (testCmethod()) senthil_cbe senthil_cbe I created a suite with for these three classes. senthil_cbe AllTestsSuite (which has all three testClasses) senthil_cbe senthil_cbe If I call AllTestsSuite then in the report I am seeing senthil_cbe the suite name after the summary section testSuite senthil_cbe name displayed senthil_cbe TestCase AllTestSuite senthil_cbe and down below I am seeing all the method names but I senthil_cbe need a break down report for each test case meaning senthil_cbe (for each test class these are the methods). Right how senthil_cbe its showing all the methods from different test senthil_cbe classes its very hard to find out which test class has senthil_cbe which method. You might use batchtest to execute cactus for individual test class. By using build.xml fragment such as follws, you could obtain test reports each of which is for a test class: cactus ... ... batchtest fileset dir=${cactus.src.dir} includes=**/*test.java excludes=AllTestsSuite.java / /batchtest formatter type=xml / junitreport fileset dir=${report.cactus.dir} includes=TEST-*.xml / report todir=${report.cactus.dir}/html format=frames / /junitreport ... /cactus If you want to see all results in a single HTML report -- this may be a reason why you are using AllTestSuites --, you could use your own XSL style-sheet for junitreport Ant task. In a test report of XML format, which is created by cactus and formatter, there is information you might want to see in the HTML report, such as class-name. Follwing is an example of the report of XML format: ?xml version=1.0 encoding=UTF-8 ? testsuite errors=0 failures=0 name=AllTests tests=28 time=3.834 ... testcase classname=org.dummy.SampleTest name=testA time=0.291/testcase ... /testsuite Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: testing output stream of doGet failed
Hi, In article [EMAIL PROTECTED], Thu, 19 Jan 2006 09:51:37 +0530, 214060 - Shou Jiesong [EMAIL PROTECTED] wrote: 214060 public void doGet(HttpServletRequest request, [snip] 214060 response.setContentType(text/html); 214060 214060 PrintWriter out = response.getWriter(); 214060 214060 out.print(htmlheadtitleTesting Servlets/title + 214060 214060 /title/headbodyh1Count is + count + 214060 214060 /h1/body/html); 214060 214060 out.close(); In this context, PrintWriter#close() method commits the response body, and then, subsequent output (i.e. print method calls) will be ignored. 214060 I observed that the test failed. I called doGet() twice and it was 214060 suppose to increase count to 2. it does in testDoGet() since I could see 214060 the printed result; it was 2. 214060 214060 But in endDoGet(), the count was always 1 whatever how many times 214060 doGet() was called in testDoGet(). If you want test if the count is properlly incremented, you might set the session attribute before doGet() method get called. For example: Integer prevCount = new Integer(1); session.setAttribute(Count, prevCount); doGet(request, response); Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Failed to get the test results at [http://localhost:80/test/ServletRedirector]
Hi Senthil, In article [EMAIL PROTECTED], Sat, 7 Jan 2006 11:46:53 -0800 (PST), senthil kumar [EMAIL PROTECTED] wrote: senthil_cbe My problem was resolved. Thanks a lot for your Good news. senthil_cbe Once again thanks a lot for the tip. Could you please senthil_cbe tell me how can I have global begin method for all the senthil_cbe test methods. You could have begin(WebRequest) method for such purpose. See also: http://jakarta.apache.org/cactus/writing/howto_testcase.html Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Failed to get the test results at [http://localhost:80/test/ServletRedirector]
Hi Senthil, In article [EMAIL PROTECTED], Thu, 5 Jan 2006 16:07:15 -0800 (PST), senthil kumar [EMAIL PROTECTED] wrote: senthil_cbe 3. My test class [snip] senthil_cbe public void beginBasicAuthentication(WebRequest senthil_cbe theRequest) [snip] senthil_cbe public void testGetHVersionGID() throws Your test-case should have beginGetHVersionGID(WebRequest) method. The beginBasicAuthentication(WebRequest) method will be called for the corresponding testBasicAuthentication() method but not for the testGetHVersionGID(). You could find how Cactus runs at http://jakarta.apache.org/cactus/how_it_works.html Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot change initial context cactus uses, jboss 3.2.5
Hi Chris, In article [EMAIL PROTECTED], Tue, 20 Dec 2005 15:30:46 -0800, Chris Fellows [EMAIL PROTECTED] wrote: cfellows Having issues getting the initial connection test to hit the correct cfellows context. I define contextURL=http://localhost:18080/test2, but it will cfellows keep trying to connect to http://localhost:18080/test1. The name of the cfellows test war file is test1.war. I have not found anything similar to this cfellows from searches and archives. Any help would be appreciated. I've tried cfellows setting the contextURL all 3 ways (jvm arg, classpath, system property) cfellows and none of them works. It seems that no matter what settings and task I cfellows use, cactus will still use the name of the war file for the context. AFAIK, cactus ant-task doesn't use contextURL system property, but uses war archive filename instead. cfellows Relevant part of build.xml: cfellows cactus warfile=${test.war} fork=yes [snip] cfellows jboss3x According to the source code (CactusTest), a hook to override the context is provided for specific containers such as jboss3x. jboss3x's implementation seems trying to override the context by using context-root element of jboss-web.xml, however, I don't think it will work. If you are using war archive, I can send you a patch against src-distribution of Cactus-1.7.1. Will you try that? # It may have some side-effects because I cannot test the patch, though. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot change initial context cactus uses, jboss 3.2.5
Hi Chris, In article [EMAIL PROTECTED], Tue, 27 Dec 2005 10:40:49 -0800, Chris Fellows [EMAIL PROTECTED] wrote: cfellows Sure, I'll give that a test. Thanks for the tip on how cactus determines cfellows the context path. Appending is a patch against source distribution of Cactus-1.7.1. # A file to be modified is JBoss3xContainer.java: # @version $Id: JBoss3xContainer.java,v 1.19 2005/01/29 15:49:18 vmassol Exp $ In article [EMAIL PROTECTED], Tue, 20 Dec 2005 15:30:46 -0800, Chris Fellows [EMAIL PROTECTED] wrote: cfellows jboss-web cfellowscontext-root//context-root jboss-web.xml should have proper context-root element value when you use the patched version of cactus-ant.jar (context-root/test2/context-root for example). Hope this helps, Kazuhito SUGURI --- ./integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss/JBoss3xContainer.java.orig 2005-01-29 13:49:18.0 +0900 +++ ./integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss/JBoss3xContainer.java 2005-12-28 09:59:03.540257687 +0900 @@ -236,6 +236,7 @@ // Try to infer the test root context from the JBoss specific // codejboss-web.xml/code file. this.testContextRoot = getTestContextFromJBossWebXml(); +getDeployableFile().setTestContext(this.testContextRoot); // TODO: as long as we don't have a way to set the port on the JBoss // instance, we'll at least need to extract the port from a config file @@ -441,10 +442,7 @@ IOException, ParserConfigurationException, SAXException { Document doc = null; -File configDir = new File(this.dir, server); -File deployDir = new File(configDir, this.config + /deploy); -File warFile = new File(deployDir, -getDeployableFile().getFile().getName()); +File warFile = getDeployableFile().getFile(); JarFile war = new JarFile(warFile); ZipEntry entry = war.getEntry(WEB-INF/jboss-web.xml); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Failed to get the test results at [http://localhost:80/test/ServletRedirector]
Hi Senthil, Have you solved the problem? If the problem is still there, let us start from a working sample. In article [EMAIL PROTECTED], Tue, 20 Dec 2005 11:44:47 -0800 (PST), senthil kumar [EMAIL PROTECTED] wrote: senthil_cbe Thanks for your reply. I set the break point in my senthil_cbe beginXXX and Test Suite() methods it looks like senthil_cbe beginXXX is not at all called. It gets into suite() senthil_cbe method but not beginXX method. Here is my begin method After some tries, I cannot reproduce your problem. Appending are codes I tried: SampleJUnitTest.java - extends JUnit's TestCase SampleServletTest.java - extends Cactus's ServletTestCase AllTests.java - provide a suite() web.xml tomcat-users.xml A war-archive should have structure as follows: ./WEB-INF/lib ./WEB-INF/lib/cactus-1.7.1.jar ./WEB-INF/lib/commons-httpclient-2.0.2.jar ./WEB-INF/lib/aspectjrt-1.2.1.jar ./WEB-INF/lib/junit.jar ./WEB-INF/lib/commons-logging-1.0.4.jar ./WEB-INF/classes ./WEB-INF/classes/SampleServletTest.class ./WEB-INF/classes/SampleJUnitTest.class ./WEB-INF/classes/AllTests.class ./WEB-INF/web.xml I deployed the war-archive (sample.war) ant tomcat-users.xml to the Tomcat-5.5.9 on my localhost. All of following URLs work fine: http://localhost:8080/sample/ServletTestRunner?suite=AllTests http://localhost:8080/sample/ServletTestRunner?suite=SampleJUnitTest http://localhost:8080/sample/ServletTestRunner?suite=SampleServletTest Could you explain what I should do to reproduce your problem form the sample? Regards, Kazuhito SUGURI import junit.framework.Test; import junit.framework.TestCase; import org.apache.cactus.ServletTestSuite; import org.apache.cactus.WebRequest; import org.apache.cactus.client.authentication.BasicAuthentication; public class SampleJUnitTest extends TestCase { public SampleJUnitTest(String theName) { super(theName); } public void beginSample(WebRequest theRequest) { theRequest.setRedirectorName(ServletRedirectorSecure); theRequest.setAuthentication(new BasicAuthentication(testuser, testpassword)); } public void testSample() { assertTrue(true); } public static Test suite() { ServletTestSuite suite = new ServletTestSuite(); suite.addTestSuite(SampleJUnitTest.class); return suite; } } import junit.framework.Test; import org.apache.cactus.ServletTestCase; import org.apache.cactus.ServletTestSuite; import org.apache.cactus.WebRequest; import org.apache.cactus.client.authentication.BasicAuthentication; public class SampleServletTest extends ServletTestCase { public SampleServletTest(String theName) { super(theName); } public void beginSample(WebRequest theRequest) { theRequest.setRedirectorName(ServletRedirectorSecure); theRequest.setAuthentication(new BasicAuthentication(testuser, testpassword)); } public void testSample() { assertEquals(testuser, request.getUserPrincipal().getName()); } public static Test suite() { ServletTestSuite suite = new ServletTestSuite(); suite.addTestSuite(SampleServletTest.class); return suite; } } import junit.framework.Test; import org.apache.cactus.ServletTestSuite; public class AllTests { public static Test suite() { ServletTestSuite suite = new ServletTestSuite(); suite.addTestSuite(SampleJUnitTest.class); suite.addTestSuite(SampleServletTest.class); return suite; } } ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app display-nameSample/display-name descriptionSample Application/description servlet servlet-nameServletTestRunner/servlet-name servlet-classorg.apache.cactus.server.runner.ServletTestRunner/servlet-class /servlet servlet servlet-nameServletRedirector/servlet-name servlet-classorg.apache.cactus.server.ServletTestRedirector/servlet-class /servlet servlet servlet-nameServletRedirectorSecure/servlet-name servlet-classorg.apache.cactus.server.ServletTestRedirector/servlet-class /servlet servlet-mapping servlet-nameServletTestRunner/servlet-name url-pattern/ServletTestRunner/url-pattern /servlet-mapping servlet-mapping servlet-nameServletRedirector/servlet-name url-pattern/ServletRedirector/url-pattern /servlet-mapping servlet-mapping servlet-nameServletRedirectorSecure/servlet-name url-pattern/ServletRedirectorSecure/url
Re: Failed to get the test results at [http://localhost:80/test/ServletRedirector]
Hi Senthil, In article [EMAIL PROTECTED], Mon, 19 Dec 2005 13:17:14 -0800 (PST), senthil kumar [EMAIL PROTECTED] wrote: senthil_cbe I am trying to test a junit test case wrapped up with senthil_cbe servletTestSuite and that java class which I am senthil_cbe testing requires login (authentication). I went thru senthil_cbe the cactus documentation and set the web.xml like senthil_cbe adding [snip] senthil_cbe org.apache.cactus.util.ChainedRuntimeException: Failed senthil_cbe to get the test results at senthil_cbe [http://localhost:80/test/ServletRedirector] Why does the cactus-client access the ServletRedirector but not the ServletRedirectorSecure? I guess the beginXXX method doesn't call WebRequest#setRedirectorName(String) method. senthil_cbe org.apache.cactus.internal.client.ParsingException: senthil_cbe Not a valid response [401 Unauthorized] This says the cause. You might confirm followings: - security-constraint is configured properly in web.xml - XxxAuthentication instance (username/password pair) passed to WebRequest#setAuthentication() method is correct - the user has a role which is permitted to access the resource (i.e. ServletRedirectorSecure) Hope this helps. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with 2 apps on tomcat, both has cactus tests, one tries to use ServletRedirector of the second app
Hi Rostislav, In article [EMAIL PROTECTED], Sun, 18 Dec 2005 17:48:56 +0100, Rostislav Svoboda [EMAIL PROTECTED] wrote: rosta.svo I have two apps on tomcat 5.5, both has cactus test, [snip] rosta.svo I access test from web browser, first test goes well - it doesn't matter rosta.svo if first is test of app A or app B. rosta.svo Second test crashes: [snip] rosta.svo If I stop app on which I started first test - lets say A, the message is rosta.svo this: [snip] rosta.svo It seems that app B test tries to use ServletRedirector of app A. Can you rosta.svo please help me how to solve this problem. rosta.svo rosta.svo Is it problem of Cactus or Tomcat? I think, this is a limitation of the ServletTestRedirector. AFAIK, the context-url the ServletTestRedirector uses is stored as a system (i.e. jvm wide) property and is initialized once when the class is loaded for the first time. You might try cactus ant task instead of invoking test from browser. I'm not sure if there is a solution if the use of web browser is mandatory for your case. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Version of HttpClient used
Hi, In article [EMAIL PROTECTED], Mon, 12 Dec 2005 17:56:56 +0530, Jaya Christina B [EMAIL PROTECTED] wrote: bjaya I need to know which is the version of HttpClient being used by the bjaya latest version of cactus (will that be 1.8?). ATM, Cactus-1.7.1 uses commons-httpclient-2.0.2. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to setup request paramaters??
Hi Yassen, In article [EMAIL PROTECTED], Fri, 16 Dec 2005 11:29:07 +0200, Yassen Damyanov [EMAIL PROTECTED] wrote: yd I am trying to test a simple Servlet that gets a GET or POST yd request and bases its work on determining the value of an yd action parameter. So I was pretty sure that trying to type yd ydrequest.setParameter(name, value); yd yd for the Cactus HttpServletRequestWrapper will surely let me yd prepare the request the way I want it (this is in a textXxx() yd context within a ServletTestCase subclass). yd yd Alas, nothing like that! What do I miss? I cannot imagine that yd there is no way to prepare the request before testing the yd servlet. You can do it by using one of WebRequest#addParameter() methods. Following is an example: public void beginXXX(WebRequest theRequest) { theRequest.addParameter(name, value, WebRequest.POST_METHOD); } public void testXXX() { // some tests } You can find working examples archived in the Cactus distribution. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log not clear - 'ChainedRuntimeException: Failed to get the test results'
Hi Eric, In article [EMAIL PROTECTED], Wed, 16 Nov 2005 17:15:31 -0800, Eric Wulff [EMAIL PROTECTED] wrote: ewulff Hi, I'm getting a 'ChainedRuntimeException: Failed to get the test ewulff results'. Can someone tell me the most common causes of that error? There are some possible causes. For your case, the log shows that. ewulff 1) testDoGet(MapperServletTest)org.apache.cactus.util.ChainedRuntimeException: ewulff Failed to get the test results at ewulff [http://localhost:8080/cactusTest/ServletRedirector] [snip] ewulff org.apache.cactus.internal.client.ParsingException: Not a valid ewulff response [404 /cactusTest/ServletRedirector] [snip] ewulff 2) testUseAllCaps(MapperServletTest)org.apache.cactus.util.ChainedRuntimeException: ewulff Failed to get the test results at ewulff [http://localhost:8080/cactusTest/ServletRedirector] [snip] ewulff org.apache.cactus.internal.client.ParsingException: Not a valid ewulff response [404 /cactusTest/ServletRedirector] It seems that /cactusTest/ServletRedirector does not exist. You might examine web.xml to see if ServletRedirector has been properly mapped. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running cactus from Ant
HI, In article [EMAIL PROTECTED], Thu, 13 Oct 2005 09:05:12 -0700, Kevin Murdoff [EMAIL PROTECTED] wrote: KMURDOFF However, I did finally get the thing to work. Problem is, KMURDOFF I'm not sure how! All I did (i.e. remember doing) was enter KMURDOFF the 'serverxml' attribute and then take it out ... (???) KMURDOFF Anyway, using port 5 and 'C:/Temp' as the 'tmpdir', it works. Good news, anyway ;-) The useage of the tmpdir attribute might have been a point for your case. KMURDOFF Why does one of my tests work correctly in the browser using KMURDOFF 'ServletTestRunner', but not in the cactus Ant task? kMURDOFF KMURDOFF The assert method that fails reports an assertion failure KMURDOFF when I try to assert that a value stored in a 'session'-scoped KMURDOFF JavaBean is, in fact, what I expected. The JavaBean does exist, KMURDOFF and through logs I can verify that it's values are being set KMURDOFF properly, but when the cactus task runs the test, KMURDOFF the assertion fails. KMURDOFF KMURDOFF Is there a difference in handling session-scoped beans KMURDOFF between the two runners? A possible cause I can imagine is in a relationship between session and tests. When you run tests by using Ant task, a session each test uses is created per test method. On the other hand, when you run tests by using ServletTestRunner, a session each test uses might be a session created for a browser that had called the ServletTestRunner. This means that all tests may share the same session, and thus, the session-scoped JavaBean might have been created during tests executed prior to the test in problem. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot run samples from 1.7.1
Hi, In article [EMAIL PROTECTED], Thu, 06 Oct 2005 11:04:42 -0500, Shay [EMAIL PROTECTED] wrote: sthompso BUILD FAILED sthompso E:\jakarta-cactus-13-1.7.1\samples\ejb\build.xml:134: taskdef A class sthompso needed by class org.apache.cactus.integration.ant.CactifyWarTask cannot be sthompso found: org/codehaus/cargo/module/webapp/WarArchive sthompso sthompso I've checked everything I can think of and nothing seems to be out of sthompso sorts. I have cargo-0.5.jar and it's in the class path defined by the sthompso taskdef. I've tried hard coding the paths with the same result. I've sthompso tried different ways to do a taskdef with the same result. I cannot reproduce your problem. Fortunately, I had a Windows-XP box to set up, so, I tried as follows: (already done in past: download and install j2sdk-1.4.2_08.) step-1: set JAVA_HOME env. step-2: download apache-ant-1.6.5-bin.zip and unzip it. set ANT_HOME and PATH env. step-3: download junit-3.8.1 and copy junit.jar to ANT_HOME\lib step-4: download jboss-3.2.7.zip and unzip it to c:\tmp\jboss-3.2.7 step-5: download jakarta-cactus-13-1.7.1.zip and unzip it to c:\tmp\cactus-1.7.1 step-6: edit c:\tmp\cactus-1.7.1\samples\ejb\build.properties to use the JBoss-3.2.7 as a container: cactus.home.jboss3x = c:/tmp/jboss-3.2.7 step-7: run ant at c:\tmp\cactus-1.7.1\samples\ejb. It works fine for me. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strage problem with Cactus on Weblogic 8.1 with Cactus being deployed on multiple Ears on the same JVM (Windows NT)
Hi, In article [EMAIL PROTECTED], Mon, 10 Oct 2005 22:43:43 +0200, Nader - Sanabel [EMAIL PROTECTED] wrote: nader I have two Ears each one has a War module that contains Cactus tests, each nader war has a distinct war context nader When only one of the EARs, any one, is deployed tests are found and can be nader executed, whenever I deploy both of the ears Junit tests becomes accessible nader only on one of them (the first invoked one after a restart of the server) nader where as test included in the other war becomes invisble and Cactus reports nader class not found exception. Strange !!! The contextURL is a JVM wide system property which is set once at the beginning of the first Cactus test. After the contextURL set, subsequent Cactus tests under the JVM use the same contextURL. If your WAR modules are mapped to differnt contextURLs, your test-run should be separated for each context. hope this helps. I may be misunderstanding your problem, though. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running cactus from Ant
Hi, In article [EMAIL PROTECTED], Tue, 11 Oct 2005 08:02:27 -0700, Kevin Murdoff [EMAIL PROTECTED] wrote: KMURDOFF I read in the docs that the containerset won't start and stop KMURDOFF Tomcat if it is already running, but when I use it with a port of KMURDOFF 8080, it complains (obviously) that port 8080 is already bound. KMURDOFF No doubt by my existing Tomcat instance. AFAIK, to know whether a container is already running, cactus task accesses to ServletRedirector of the target contextURL and checks its response status. In other words, cactus task checks whether the target cactified application is available. So, you need to deploy the cactified application prior to the cactus task call. KMURDOFF However, when I change the port to say 5, none of my tests succeed. KMURDOFF The test classes could not be loaded by the Context and web apps class loaders. If you only changed the port attribute of the tomcat5x element in your build.xml, that may be not enough. You need to provide a server configuration file (server.xml) for the new server instance. In your use case, I think, the server.xml, which has been configured for the existing server instance, has conflicting conditions that cause the start up of the new server to be failed. tomcat5x task uses ${directory specified by dir attr}/conf/server.xml to start up the new server by default, but you can change it by using serverxml attribute. Be sure that all ports the new server will listen to are not in use by the existing server, 8005 and 8080 for examples. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ant Task Descriptions
Hi Rod, In article [EMAIL PROTECTED], Mon, 19 Sep 2005 23:16:00 -0700, Rod Macpherson [EMAIL PROTECTED] wrote: rmacpherson Is there a definitive document for the Ant tasks? The examples are fine rmacpherson but where, for example, are the attributes for test listed? There are rmacpherson examples but I'm looking for the full documentation and can't seem to rmacpherson find any. http://jakarta.apache.org/cactus/integration/ant/index.html Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ant integration w/o junit.jar
Hi Mark, In article [EMAIL PROTECTED], Mon, 19 Sep 2005 10:26:48 -0400, Mark Lybarger [EMAIL PROTECTED] wrote: mlybarger i'm just wondering if there's a way to run cactus's ant integration w/o mlybarger putting junit.jar into the ant lib folder? i'd like to keep all cactus mlybarger specific stuff packaged up outside of the target environment.. You don't need junit.jar placed in Ant's lib directory if it's available on the system (or user) CLASSPATH environment variable. See also: http://ant.apache.org/manual/install.html#optionalTasks http://ant.apache.org/manual/install.html#librarydependencies Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ChainedRuntimeException: Failed to get the test results at http:...//ServletRedirector
Hi Phlip, In article [EMAIL PROTECTED], Fri, 16 Sep 2005 12:07:50 -0700, Phlip [EMAIL PROTECTED] wrote: phlip2005 compile-test: phlip2005 log4j:ERROR setFile(null,false) call failed. phlip2005 java.io.FileNotFoundException: @[EMAIL PROTECTED] (The phlip2005 system cannot find the path specified) You (your build system) should rewrite @target.dir@ properly. phlip2005 phlip2005 Then it doesn't say where to put the files. I use the Tomcat bundled phlip2005 phlip2005 with NetBeans, and there is another Tomcat available. phlip2005 phlip2005 phlip2005 phlip2005 Please don't just say on the class path. Where do those files go? phlip2005 phlip2005 How about WEB-INF/classes? phlip2005 phlip2005 build/web/WEB-INF/classes or ? ;-) It's depending on your build system. Finally siginificant is a cactified application deployed to your server even if the source is where. The files should exist on your server-side classpath and WEB-INF/classes of your cactified application is one of them. I've never userd NetBeans. So, please don't ask me how ;-) Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection Refused Error.
Hi, In article [EMAIL PROTECTED], Wed, 14 Sep 2005 08:57:36 +0530, Aruna Ponnusamy [EMAIL PROTECTED] wrote: aruna.ponnusamy My contextURL is http://localhost:8080/detailapp aruna.ponnusamy I'm using my localhost. OK. Then... In article [EMAIL PROTECTED], Mon, 12 Sep 2005 14:18:03 +0530, Aruna Ponnusamy [EMAIL PROTECTED] wrote: aruna My Tomcat is up and the application works perfectly, but cactus throws aruna errors when run. One cause I know is that the AP server is not running (or is not listening a port that is spedified by contextURL) when Cactus runs. If this isn't the cause, we need more information about your case. aruna testControlStatus(test.TestLogonPage)java.net.ConnectException: aruna Connection refused aruna at java.net.PlainSocketImpl.socketConnect(Native Method) [snip] aruna at aruna org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactusTestCase.java:133) aruna at test.TestLogonPage.main(TestLogonPage.java:60) How did you run the test? `java test.TestLogonPage`? Could you try `java junit.textui.TestRunner test.TestLogonPage`? Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ChainedRuntimeException: Failed to get the test results at http:...//ServletRedirector
Hi Phlip, In article [EMAIL PROTECTED], Wed, 14 Sep 2005 14:24:12 -0700, Phlip [EMAIL PROTECTED] wrote: phlip2005 testSuccessfulLogin(TestLoginAction)org.apache.cactus.util.ChainedRuntimeException: phlip2005 Failed to get the test results at phlip2005 [http://localhost:8084/StrutsTest//ServletRedirector] '//' in the URL may be the cause. Could you verify that your contextURL is not ends with '/'? phlip2005 Then it doesn't say where to put the files. I use the Tomcat bundled phlip2005 with NetBeans, and there is another Tomcat available. phlip2005 phlip2005 Please don't just say on the class path. Where do those files go? How about WEB-INF/classes? Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cookies ???????
Hi, In article [EMAIL PROTECTED], Wed, 14 Sep 2005 10:47:22 +0530, Sharma, Harsh [EMAIL PROTECTED] wrote: harshs Situation : I have a Custom Tag which based on previously set Cookie harshs Value generates some tables Dynamically. I need to come up with a Unit harshs test for this Custom Tag. harshs harshs Problem : Since I don't have a actual session going Cookie are not set harshs to Values which are required to generate these tables, so how do I set harshs values for cookies to generate these tables. You can add cookies at beginXXX method: public void beginXXX(WebRequest theRequest) { theRequest.addCookie(name1, value1); ... } Then, you can refer cookie(s) at the corresponding testXXX method: public void testXXX() { Cookie[] cookies = request.getCookies(); ... } If you have to set-up an object as a session attribute for your custom tag, you can do so: public void testXXX() { ... String cookieValue = getCookieValueByName(name1); session.setAttribute(cookieValue, someObjectAssociatedWithCookieName1); ... // instantiate and test the target class. } private String getCookieValueByName(String theName) { ... } Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection Refused Error.
Hi Aruna, In article [EMAIL PROTECTED], Mon, 12 Sep 2005 14:18:03 +0530, Aruna Ponnusamy [EMAIL PROTECTED] wrote: aruna When I try running my cactus testcase it is throwing the following aruna error: aruna aruna testControlStatus(test.TestLogonPage)java.net.ConnectException: aruna Connection refused As the error message informs... aruna I've put my cactus.properties file also in src and classes folder. [snip] aruna My Tomcat is up and the application works perfectly, but cactus throws aruna errors when run. What's your cactus.contextURL? Can you access to the host:port by using telnet? Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem Testing TagLibrary....
Hi, In article [EMAIL PROTECTED], Thu, 8 Sep 2005 18:06:32 +0530, Sharma, Harsh [EMAIL PROTECTED] wrote: harshs I am a newbie to Cactus.I am trying to run SampleTag harshs TestSampleTag Sample which comes with cactus 1.7.1 harshs harshs My Web.xml look like [snip] harshs servlet harshs servlet-nameJSPRedirector/servlet-name harshs harshs servlet-classorg.apache.cactus.server.JSPTestRedirector/servlet-class harshs harshs /servlet JspRedirector is distributed as a JSP file. So, your web.xml should have entry like as follows: servlet servlet-nameJspRedirector/servlet-name jsp-file/jspRedirector.jsp/jsp-file /servlet servlet-mapping servlet-nameJspRedirector/servlet-name url-pattern/JspRedirector/url-pattern /servlet-mapping See also: http://jakarta.apache.org/cactus/integration/manual/howto_config.html#serverside Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to assert forwards?
Hi Niklas, In article [EMAIL PROTECTED], Sat, 13 Aug 2005 12:24:54 +0200 (CEST), Niklas Lindholm [EMAIL PROTECTED] wrote: cactuslist response.getWebRequest().getURL(); cactuslist cactuslist I have done a simple test and in that test the getURL() method returns cactuslist null. So I get this failure: cactuslist cactuslist junit.framework.AssertionFailedError: expected:unit.jsp but was:null cactuslist cactuslist I have a servlet that ends with this line: cactuslist cactuslist req.getRequestDispatcher(unit.jsp).forward(req, res); cactuslist cactuslist And in my endXXX() method I have this assertion: cactuslist cactuslist assertEquals(unit.jsp, response.getWebRequest().getURL()); cactuslist cactuslist The endXXX() method is run on the client side. Will the client side really cactuslist have information about what forward that has been done since this typs of cactuslist forward is done entirely on the server side? I would imagine that this cactuslist kind of assertion would have to go into the testXXX() method. AFAIK, the getURL() method returns a simulated URL which is specified by WebRequest#setURL method. So, you cannot know a forwarded URL by using the method. cactuslist Why ?? It seems a great solution : you can check more ie that there is cactuslist no error message in the page code... cactuslist cactuslist Well.. in this case I don't want to verify the content of the resulting cactuslist page. Only the logic of the servlet. And it could be pretty difficult to cactuslist figure out from the resulting HTML which jsp page that actually has been cactuslist invoked. (Unless I code some comment into it telling which jsp page it cactuslist is.. hmm.. that might be a solution..) If you are interested in the servlet logic, you might separate the logic into some methods to make your test easier. For your case: - a method returns String as a resource name to be forwarded - a method forward the request to the selected resource For example, the code will be like as follows: public String getForwardTo() { // resource selection logic return resourceName; } ... req.getRequestDispatcher(getForwardTo()).forward(req, res); You can write tests for the getForwardTo() method to verify the selection has been done properly. If you want the forward is been done properly, you have to verify the resulting HTML in endXXX(). To make it easier, you might insert ID string as a HTML comment in every JSPs. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: URLencode
Hi Romain, In article [EMAIL PROTECTED], Fri, 05 Aug 2005 16:20:26 +0200, Romain Thouvenin [EMAIL PROTECTED] wrote: rthouvenin What can be the cause of a NullPointerException thrown by rthouvenin java.net.URLEncoder.encode ? rthouvenin rthouvenin Here is the whole stack trace : rthouvenin testAdd(com.aguila.tests.client.MyClientTest)java.lang.NullPointerException rthouvenin at java.net.URLEncoder.encode(Unknown Source) rthouvenin at java.net.URLEncoder.encode(Unknown Source) rthouvenin at rthouvenin org.apache.cactus.internal.client.connector.http.HttpUtil.addHttpGetParameters_aroundBody0(HttpUtil.java:86) Don't you have a code like as follows? public void beginXXX(WebRequest theRequest) { request.addParameter(paramName, null, WebRequest.GET_METHOD); } The null value for the parameter may the cause. If so, could you please entry the issue to JIRA? Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bug with double instance ?
Hi Romain, In article [EMAIL PROTECTED], Wed, 03 Aug 2005 14:56:57 +0200, Romain Thouvenin [EMAIL PROTECTED] wrote: rthouvenin I tried this morning, but it still have the same NullPointerException. rthouvenin It seems that the begin method is called after the setUp method rthouvenin (messages printed in the begin method never appear in the console). I rthouvenin believed it is the contrary, isn't it ? At server-side, begin method will never be called. The execution sequence of a test method is roughly as follows: client-side JVM server-side JVM -- begin(WebRequest) beginXXX(WebRequest) -- send HTTP request -- XXXTestCase(String) :construct setUp() testXXX() tearDown() -- return HTTP response -- endXXX(WebResponse) end(WebResponse) # Though it's not accurate... Is this helps you? Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bug with double instance ?
Hi Romain, In article [EMAIL PROTECTED], Tue, 02 Aug 2005 15:44:57 +0200, Romain Thouvenin [EMAIL PROTECTED] wrote: rthouvenin I'm creating a tool to launch tests based on cactus. rthouvenin It uses my own test cases which extend ServletTestCase, and these rthouvenin testCases have a field used in test methods. rthouvenin But when i launch the test and try to access this field in the setUp rthouvenin method, i get a NullPointerException. rthouvenin I've checked with prints and with a debugger, the field is correctly rthouvenin initialized. (snip) rthouvenin To build the TestSuite, i use my own constructor with a code like this : rthouvenin # suite.addTest(new MyTestCase(testName, MyClass param)); rthouvenin and a field of MyTestCase is directly set with param. Server side test-case construction of Cacuts uses constructor with one String argument ... or use the default (i.e. no argument) constructor and setName method to specify test method name to be executed. So, your custom constructor is ignored in server-side. If the parameter is determined at client-side in run-time, you might use request parameter to pass it to server. For example: private Param param; public ExampleTestCase(String name) { super(name); } public ExampleTestCase(String name, Param param) { this(name); this.param = param; } public void begin(WebRequest request) { request.addParameter(PARAM_NAME_FOR_TESTCASE, param.toString(), WebRequest.POST_METHOD); } public void setUp() { String paramStr = request.getParameter(PARAM_NAME_FOR_TESTCASE); this.param = new Param(paramStr); } public void testXXX() { } Just an idea. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: End handler happened before every page I am checking does not com e
Hi Meir, In article [EMAIL PROTECTED], Thu, 28 Jul 2005 14:21:31 +0200, Meir Kalter [EMAIL PROTECTED] wrote: meirka I will start with part of my code: meirka meirka public void beginMainData(WebRequest theRequest) meirka { meirka // Set up HTTP related parameters meirka theRequest.setURL(myserver, /app, /index2.html, meirka null, null); meirka } meirka meirka public void endMainData(com.meterware.httpunit.WebResponse meirka theResponse) meirka { meirka WebTable table = null; meirka String title = null; meirka try { meirka assertNull(null); meirka title = theResponse.getTitle(); meirka assertEquals(test,title); meirka {} meirka What need to be happen is that the index2.html will be received , then the meirka function endMainData will be happened. Could you show us testMainData method? The testMainData() method should call appropriate methods to write the page content to the output-stream of the response object. Use of WebRequest#setURL method does not mean that we can get the specified resource as a WebResponse instance. The method is provided to control value returned by some methods of javax.servlet.http.HttpServletRequest, getPathInfo() for example, so that we can easily test behavior of server-side methods depending on value of requested URL. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus tests failing - unable to lookup Data sources
Hi Madhan, In article [EMAIL PROTECTED], Mon, 25 Jul 2005 11:52:07 -0700 (PDT), Madhan Thirukonda [EMAIL PROTECTED] wrote: madhanmt2-list Thanks for your time. I traced the problem. I actually madhanmt2-list had some junit tests and did not change the calls to madhanmt2-list the cactus way so it was running it on the client madhanmt2-list side. When I added ServletTestSuite().addTestSuite(), madhanmt2-list it ran okay (like below) Ah. I couldn't imagine that. Thanks for the information. Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus tests failing - unable to lookup Data sources
Hi Madhan, In article [EMAIL PROTECTED], Sun, 24 Jul 2005 17:04:22 -0700 (PDT), Madhan Thirukonda [EMAIL PROTECTED] wrote: madhanmt2-list I am running the appserver (OC4J) in a seperate JVM madhanmt2-list (I couldn't get it to working using containerset madhanmt2-list so I run it outside my ant script). Is that a problem? I don't think that is the problem. I think the problem is in configuration of the server and/or ear archiving. You might extract the cactified ear (and war(s) included in it) to know how the cactified application is configured. Could you find what may be wrong? Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Class org.apache.commons.logging.impl.SimpleLog does not implement Log
Hi Delacour, You may solved the problem already. In article [EMAIL PROTECTED], Fri, 15 Jul 2005 14:14:35 +0200, DELACOUR D ROSI/SICOR [EMAIL PROTECTED] wrote: ddelacour Hi, ddelacour I use cactus 1.6.1. ddelacour I have two WAS servers. I use lg4j log logging ddelacour The first use only servlet, cactus test works. ddelacour The second use Struts, and cactus test doesn't work The servlet doen't start(ServletRedirector]: Servlet.service() pour la servlet ServletRedirector a gレnレrレ une exception) ddelacour Can you help me ? I miss somethings? ddelacour ddelacour the error ddelacour Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.SimpleLog does not implement Log As a possible case, your server-side classpath contains multiple jar (and/or class) files of commons-logging package. Could you please check your server-side jar files to make sure that you have only one commons-logging jar file on your server-side classpath. Hope this helps, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus tests failing - unable to lookup Data sources
Hi Madhan, In article [EMAIL PROTECTED], Fri, 22 Jul 2005 19:55:51 -0700 (PDT), [EMAIL PROTECTED] wrote: madhanmt2-list Hi, I just got cactus up and running. I have everything setup ok and it seems to be running some tests well. Some tests are failing because of database connectivity. Here is what I do. madhanmt2-list madhanmt2-list InitialContext ctx = new InitialContext(); madhanmt2-list DataSource ds = (DataSource) ctx.lookup(_connectionPoolname); Where the code is located? If the code is in beginXXX method, it should fail because it's executed in client-side. If the code is in testXXX or setUp method, the problem may be depending on how the DataSource is configured. For example, if the DataSource is available only for /target context, the resource cannot be used from /target-cactified context. We may need more information to help you. Thanks, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with referer header.
Hi Willie, In article [EMAIL PROTECTED], Fri, 13 May 2005 17:22:13 -0500, Willie H Armstrong [EMAIL PROTECTED] wrote: warmstr2 I have examined the source code for both the addHeader() and the warmstr2 getHeader() methods. I am at a loss for an explanation. Have you seen org.apache.cactus.server.HttpServletRequestWrapper and its super-classes? HttpServletRequestWrapper#getHeader(String), which is called on server-side, calls that method of a HttpServletRequest instance passed from the container. Could you add following code to your testRefere() method to see header names received: Enumeration headerNames = request.getHeaderNames(); while(headerNames.hasMoreElements()) { String name = (String)headerNames.nextElement(); System.out.println(name + : + request.getHeader(name)); } If the request header name is appeard as lower-case string, you might try request.getHeader(referer). Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with referer header.
Hi Willie, I have tried to re-produce your problem, but my test-case does not fail. I'm trying with tomcat-5.0.28. My test codes are appending: SampleServlet.java SampleServletTest.java The SampleServlet is mapped to /refersample in my case. In article [EMAIL PROTECTED], Wed, 11 May 2005 09:34:53 -0500, Willie H Armstrong [EMAIL PROTECTED] wrote: warmstr2 I am having a problem with the Referer header being distorted by the warmstr2 WebRequest.addHeader() method. The header name and the header value warmstr2 gets changed into: ~~~ and :~~~ warmstr2 which I see when examining the Enumeration en in the debugger. warmstr2 warmstr2 I am attempting to set two headers in a WebRequest. warmstr2 warmstr2 code pieces as follows: warmstr2 warmstr2 warmstr2 // the imports warmstr2 import org.apache.cactus.ServletTestCase; warmstr2 import org.apache.cactus.WebResponse; warmstr2 import org.apache.cactus.WebRequest; warmstr2 warmstr2 // setting up the request warmstr2 public void beginProcessRequestNotReseeding(WebRequest request) { warmstr2 System.out.print(beginProcessRequestNotReseeding); warmstr2 request.addHeader(HTTP_SM_USER, strHttpUser); warmstr2 request.addHeader(Referer, strRefUrl); warmstr2 System.out.println(.Completed client side begin.); warmstr2 } In my code, corresponds to SampleServletTest#beginReferer(). warmstr2 // sending the request warmstr2 warmstr2public void testProcessRequestNotReseeding() { warmstr2 System.out.println(testProcessRequestNotReseeding); warmstr2 assertFalse(Credential was set to true, warmstr2 Credentialer.isReseeding()); warmstr2 Enumeration en = request.getHeaderNames(); warmstr2 try { warmstr2 servlet.processRequest(request, response); warmstr2 } catch (javax.servlet.ServletException jsse) { warmstr2 // do nothing warmstr2 } catch (IOException jioe) { warmstr2 // do nothing warmstr2 } warmstr2 Credentialer.setReseeding(false); warmstr2 System.out.println(.Completed.); warmstr2 } In my code, corresponds to SampleServletTest#testReferer(). warmstr2 // adding a Basic Authentication to header then dispatching it to warmstr2 Sender servlet warmstr2 warmstr2 called by testProcessRequestNotReseeding() warmstr2 warmstr2 protected void processRequest(HttpServletRequest request, warmstr2 HttpServletResponse response) warmstr2 throws ServletException, IOException { warmstr2 ... warmstr2 String strUser = request.getHeader(HTTP_SM_USER); warmstr2 String strPW = Credentialer.getPassword(strUser); warmstr2 // put BasicAuthurization data in request header warmstr2 try { warmstr2 response.setHeader(Authorization, Basic + warmstr2 makeAuthedString(strUser, strPW)); warmstr2 } catch (EncoderException acnee){ warmstr2 acnee.printStackTrace(); warmstr2 // TODO make an HTML Message of failure); warmstr2 } warmstr2 // send request to Refer url warmstr2 request.getRequestDispatcher(/Sender).forward(request, warmstr2 response); warmstr2 } In my code, corresponds to SampleServlet#processRequest(). At this method, the request is dispatched to /refersample, i.e. I'm expecting SampleServlet#doGet() will be called. warmstr2 // the Sender servlet does redirect to back to the referer. warmstr2 ... the final servlet method called warmstr2 warmstr2 protected void processRequest(HttpServletRequest request, warmstr2 HttpServletResponse response) warmstr2 throws ServletException, IOException { warmstr2 String strRefURL = request.getHeader(Referer); warmstr2 response.sendRedirect(strRefURL); warmstr2 } In my code, corresponds to SampleServlet#doGet(). At this point, request.getHeader(Referer) of my code has non-null value, /test.jsp, and of cource, 302 response code is received at SampleServletTest#endReferer(). warmstr2 The String strRefUrl is set to null so the sendRedirect of course fails. How could we re-produce the problem? Regards, Kazuhito SUGURI import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class SampleServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println(Referer: + request.getHeader(Referer)); response.sendRedirect(request.getHeader(Referer)); } protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
Re: HttpServletRequestWrapper and getLocalName()
Hi Darren, In article [EMAIL PROTECTED], Tue, 10 May 2005 16:30:39 -0400, Darren Hartford [EMAIL PROTECTED] wrote: dhartford My problem is the 'request.getLocalName()' uses HttpServletRequest, and dhartford when trying to run cactus tests on this particular servlet I get an dhartford error like this: dhartford dhartford === dhartford [cactus]Caused an ERROR dhartford dhartford [cactus] dhartford org.apache.cactus.server.HttpServletRequestWrapper.getLocalName()Ljava/l dhartford ang/String; dhartford dhartford [cactus] java.lang.AbstractMethodError: dhartford org.apache.cactus.server.HttpServletRequestWrapper.getLocalName()Ljava/l dhartford ang/String; dhartford == As Sun's Servlet API document shows, getLocalName() is not method of javax.servlet.ServletRequest or of javax.servert.http.HttpServletRequest. Some of servlet containers, such as Tomcat and Jetty, provide their own Servlet class library which has javax.servlet.ServletRequest#getLocalName(), though... I believe the java code of the servlet cannot be compiled by using j2ee.jar provided by Sun. # From API doc of java.lang.AbstractMethodError: # Thrown when an application tries to call an abstract method. # Normally, this error is caught by the compiler; this error can only occur # at run time if the definition of some class has incompatibly changed # since the currently executing method was last compiled. Regards, Kazuhito SUGURI - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multi part upload
Hi Sushil, In article [EMAIL PROTECTED], Thu, 31 Mar 2005 14:46:29 -0600, Sushil Sureka [EMAIL PROTECTED] wrote: sushil Before I ask my question, I just wanted to let you know that I have sushil been through FAQs and other places but I can't seem to get it right. I sushil have this piece of code to upload the file sushil sushilFile file = new File(c:\\temp.txt); sushil FilePart filePart = new FilePart(theFile, file); sushil try { sushil ByteArrayOutputStream os = new ByteArrayOutputStream(); sushil filePart.send(os); sushil InputStream i = convert(os); sushil request.setUserData(i); sushil //request.setContentType(multipart/form-data); sushil i.close(); sushil } catch (IOException e) { sushil System.out.println(Error Building Multipart); sushil } sushil sushil public static InputStream convert( ByteArrayOutputStream os ) sushil throws IOException sushil { sushil return new ByteArrayInputStream(os.toByteArray()); sushil } sushil sushil But when the app tried to parse the data on server side, it gets this exception sushil Failed to parse multipart request sushil org.apache.commons.fileupload.FileUploadException: the request was rejected beca sushil use no multipart boundary was found You might refer RFC1867 'Form-based File Upload in HTML' to know how file-upload works. http://www.ietf.org/rfc/rfc1867.txt The RFC shows an example of data sent back from client as follows: Content-type: multipart/form-data, boundary=AaB03x --AaB03x content-disposition: form-data; name=field1 Joe Blow --AaB03x content-disposition: form-data; name=pics; filename=file1.txt Content-Type: text/plain ... contents of file1.txt ... --AaB03x-- As this example shows, you need to specify a boundary string in the Content-Type field for the HTTP request, 'Content-type: multipart/form-data, boundary=YOUR-OWN-BOUNDARY' for example. Then, use the boundary string to separate and terminate each part of the multi-part content. Hope this helps, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 403 Forbidden
Hi Frederic, In article [EMAIL PROTECTED], Fri, 25 Feb 2005 09:51:09 -0700, Frederic Jean [EMAIL PROTECTED] wrote: Frederic I'm trying to test an authorization type filter. Under some Frederic circumstances, the filter has to return an HTTP response code of 403 Frederic (Forbidden). Frederic Frederic When I try to test the filter under conditions where it should return a Frederic 403, I get the following exception instead: Frederic Frederic [cactus] Testcase: testNoAssetId took 0.087 sec Frederic [cactus]Caused an ERROR Frederic [cactus] Failed to get the test results at Frederic [http://localhost:8880/delivery-cactus/test/filterRedirector.jsp] Frederic [cactus] org.apache.cactus.util.ChainedRuntimeException: Failed to Frederic get the test results at As a possible case, your web.xml may contains filter-mapping entry which applies the filter to requests to the FilterRedirector, http://localhost:8880/delivery-cactus/test/filterRedirector.jsp. for this case. (I'm not sure why it has jsp suffix). For example, if your web.xml have a filter-mapping entry like filter-mapping filter-nametheFilter/filter-name url-pattern/*/url-pattern /filter-mapping and theFilter can fail for the request from Cactus-client, Cactus-client cannot get test results. Codes are appending for an example. You should not add filter and filter-mapping entries for the SampleFilter to your web.xml to run this example successfully. If you add entries like follows to web.xml, the test will be failed as you encountered: filter filter-namesampleFilter/filter-name filter-classSampleFilter/filter-class /filter filter-mapping filter-namesampleFilter/filter-name url-pattern/FilterRedirector/url-pattern /filter-mapping I hope this helps you. Kazuhito SUGURI mailto:[EMAIL PROTECTED] import java.io.IOException; import java.io.PrintWriter; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; public class SampleFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { HttpServletResponse httpResponse = (HttpServletResponse)response; httpResponse.setStatus(HttpServletResponse.SC_FORBIDDEN); httpResponse.setContentType(text/html); PrintWriter out = httpResponse.getWriter(); out.print(htmlbodyForbidden/body/html\r\n); out.flush(); out.close(); } public void init(FilterConfig config){} public void destroy(){} } import org.apache.cactus.FilterTestCase; import org.apache.cactus.WebRequest; import org.apache.cactus.WebResponse; public class SampleFilterTest extends FilterTestCase { public SampleFilterTest(String name){ super(name); } public void testSample(){ SampleFilter target = new SampleFilter(); target.init(config); try{ target.doFilter(request, response, null); }catch(Exception e){ fail(e.getClass().getName() + : + e.getMessage()); } } public void endSample(WebResponse response){ assertEquals(403, response.getStatusCode()); assertEquals(htmlbodyForbidden/body/html\r\n, response.getText()); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormAuthentication and Error Code 500
Hi Setanta, Could you post server log? We need more detail to understand what's going on. In article [EMAIL PROTECTED], Thu, 18 Nov 2004 13:25:02 -, Setanta Mathews [EMAIL PROTECTED] wrote: smathews The authentication must be working. Part of the test in question calls an smathews EJB that does the following check: smathews smathews principal = sessionContext.getCallerPrincipal(); smathews name = principal.getName(); smathews System.out.println(User Id: + name); smathews if (name.equals(anonymous) || name.equals(guest)) smathews throw new PrincipalException(Principal must be authenticated); smathews smathews Without the begin method in my test the principal name is guest and a smathews PrincipalException will be thrown. With the begin method the principal name smathews is 0 (so authentication must have happened) and no exception is thrown. If the purpose of the authentication is to get a principal name, and you think the FormAuthentication goes worng, you might try to use the BasicAuthentication for your unit-testing of EJBs. smathews I agree that setting the expected response code to 500 is dangerous smathews but I can't spend too much more time trying to get my tests running. I don't think that is a good idea. It may take long time to solve your problem with FormAuthentication, but it cannot be a reason to bypassing the problem by such unusual approach. I suggest you to use more simple authentication for your tests. Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormAuthentication and Error Code 500
Hi Setanta, In article [EMAIL PROTECTED], Thu, 18 Nov 2004 11:03:53 -, Setanta Mathews [EMAIL PROTECTED] wrote: smathews public void beginA(WebRequest theRequest) smathews { smathews theRequest.setRedirectorName(ServletRedirectorSecure); smathews FormAuthentication fa = new FormAuthentication(0, smathews qUqP5cyxm6YcTAhz05Hph5gvu9M=); smathews theRequest.setAuthentication(fa); smathews } Is the password qUqP5cyxm6YcTAhz05Hph5gvu9M= base-64 encoded? Your system may stores passwords with encrypted and base-64 encoded form, however, you should give a password with plain text form to the system. So, you should pass a plain password to the constructor, I guess. smathews The HTTP traffic is smathews smathews 1 - Cactus Request smathews smathews GET /ServletRedirectorSecure? HTTP/1.1 smathews Content-type: application/x-www-form-urlencoded smathews User-Agent: Jakarta Commons-HttpClient/2.0rc1 smathews Host: localhost:8889 smathews smathews 2 - OC4J Response smathews smathews HTTP/1.1 200 OK smathews Date: Thu, 18 Nov 2004 10:43:46 GMT smathews Server: Oracle9iAS (9.0.3.0.0) Containers for J2EE smathews Content-Location: smathews http://localhost:8889/jsp/html/portlet/my_account/j_login.jsp smathews Set-Cookie: JSESSIONID=b3eabbf09d734b998c79d15602741b8c; Path=/ smathews Connection: Close smathews Content-Type: text/html;charset=ISO-8859-1 smathews Cache-Control: no-cache smathews Transfer-Encoding: chunked smathews smathews 3 - Cactus Request smathews smathews POST /j_security_check? HTTP/1.1 smathews Content-type: application/x-www-form-urlencoded smathews User-Agent: Jakarta Commons-HttpClient/2.0rc1 smathews Host: localhost:8889 smathews Cookie: $Version=0; JSESSIONID=b3eabbf09d734b998c79d15602741b8c smathews Content-Length: 54 smathews smathews j_username=0j_password=qUqP5cyxm6YcTAhz05Hph5gvu9M%3D smathews smathews 4 - OC4J Response smathews smathews HTTP/1.1 100 Continue smathews Server: Oracle9iAS (9.0.3.0.0) Containers for J2EE smathews Date: Thu, 18 Nov 2004 10:43:47 GMT The last response means that the authentication is not completed. I'm not sure why your container responses with status 100, however, this may make your case, i.e. unable to find line starting with HTTP. Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormAuthentication and Error Code 500
Hi Setanta, In article [EMAIL PROTECTED], Thu, 18 Nov 2004 11:56:27 -, Setanta Mathews [EMAIL PROTECTED] wrote: smathews I think the password is okay. If I change it to something else I get a 403 smathews (forbidden) error response code: Can you access to a secured resource from your browser as a user account you are coded in beginA method? First of all, we need to know an account (id and password) which is available in the system. smathews Now, if I change by begin method to expect a response code of 500 ... smathews smathews public void beginA(WebRequest theRequest) smathews { smathews theRequest.setRedirectorName(ServletRedirectorSecure); smathews FormAuthentication fa = new FormAuthentication(0, smathews qUqP5cyxm6YcTAhz05Hph5gvu9M=); smathews fa.setExpectedAuthResponse(500); smathews theRequest.setAuthentication(fa); smathews } I strongly suggest, don't try this approach. # need some protection logic in setExpectedAuthResponse()? Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FilterRedirector does not initialize sessions. - IS THIS A BUG ??
Hi Vincent, In article [EMAIL PROTECTED], Thu, 11 Nov 2004 11:02:13 +0100, Vincent Massol [EMAIL PROTECTED] wrote: vmassol Kazuhito, do you agree we should have the same behavior for Filters than we vmassol have for Servlets? At this moment, I cannot agree with that because I think it may have impact to existing FilterTestCases as it changes the precondition of testXXX methods. If someone have testIfSessionNotExists(), for example, they have to have beginIfSessionNotExists() which has setAutomaticSession(false). I think it is enough with change of the document. Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FilterRedirector does not initialize sessions. - IS THIS A BUG ??
Hi Vincent, In article [EMAIL PROTECTED], Thu, 11 Nov 2004 12:44:36 +0100, Vincent Massol [EMAIL PROTECTED] wrote: vmassol I'd still suggest we implement the feature to support the vmassol setAutomaticSession() for FilterTestCase but I'm ok to have it of by vmassol default. OK. That's fine. I agree to support setAutomaticSession() for FilterTestCase if it does not breaks existing TestCases. vmassol BTW, after looking at the code again, I think this is the default vmassol for Servlets too, so that's ok. We need check this. org.apache.cactus.internal.WebRequestImpl has isAutomaticSession field and its default value is true, at least Cactus-1.6.1. I think this value is sent to the server as a parameter to control the session creation, and then, session is created by default. vmassol Don't you agree with Pedro that the following test case should pass and that vmassol it is a Cactus bug? I think it is a bug of the document rather than of the implementation. So it can be an enhancement of Cactus. But, the difference between 'enahncement' and 'bug' is not so important for me :-). Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FilterRedirector does not initialize sessions. - IS THIS A BUG ??
Hi Vincent, In article [EMAIL PROTECTED], Thu, 11 Nov 2004 14:03:04 +0100, Vincent Massol [EMAIL PROTECTED] wrote: vmassol What strategy would you like us to follow to align the behaviors of vmassol FilterTestCase and ServletTestCase? To align... Is this means that FilterTestCase and ServletTestCase should have same behavior of its default setAutomateSession()? If so, I think it's impossible without breaking existing TestCases. Of cource, it might be more trifling problem than I think. Why don't we wait for reactions from other users of this list? # How do you think, Pedro? vmassol BTW, do you have any idea why I decided to enable session creation by vmassol default for ServletTestCase? I can't recall... ;-) I'm not sure since it had already been so when I used Cactus for the first time. But I can guess some: 1. Servlet uses a session object in many cases, then, it's user friendly if the session object is prepared by default. 2. if method under test uses a session object, a TestCase 'there is no session object available' is needed only once, however, there are other many 'when the session object has XYZ' TestCases. 3. if method under test does not use any session object, the default behavior of the session creation can not be a problem. Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FilterRedirector does not initialize sessions. - IS THIS A BUG ??
Hi Pedro, In article [EMAIL PROTECTED], Thu, 11 Nov 2004 18:39:16 +0100, Pedro Nevado [EMAIL PROTECTED] wrote: pnevado As far as I remember, the problem is not only with the default mecanism to pnevado associate a session to the request in the client side. Even if you pnevado explicitly set automatic session to true in the client side, this statement pnevado is ineffective in the server side. Yes. I agree with support setAutomaticSession() for FilterTestCase. Only thing I cannot decide is its default behavior. pnevado A midway would be just to patch the code to allow instatiating a session if pnevado explicitly said in the webrequest. That way, there would not be, I think, pnevado any effect on existing tests wich counts on the present default mecanism. Fine. I agree with this. Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FilterRedirector does not initialize sessions. - IS THIS A BUG ??
Hi Lobello, In article [EMAIL PROTECTED], Thu, 11 Nov 2004 14:28:58 -0500, Lobello Jeffrey [EMAIL PROTECTED] wrote: jeffrey Do the right thing, even if it means breaking existing tests. Ultimately, jeffrey that will be better in the long run. Just my $0.02. I'm not sure what is the right thing, so I would like to wait for comments. Do you think session should be created by default or not? Why do you think so? Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FilterRedirector does not initialize sessions. - IS THIS A BUG ??
Hi, In article [EMAIL PROTECTED], Wed, 10 Nov 2004 10:24:49 +0100, Vincent Massol [EMAIL PROTECTED] wrote: vmassol Are you sure your SessionFilter is a real Filter? It looks like you're not vmassol extending the Filter interface. The second problem I can see is that you're vmassol completely bypassing the filter initialization in your init() method (I vmassol think it is safer to call super.init(filterConfig)). vmassol vmassol Have you registered the filter as a filter in the web.xml file? I believe, Pedro is expecting that following two tests should be passed: public class SessionServletTest extends ServletTestCase { public void beginSession(WebRequest request) { request.setAutomaticSession(true); } public void testSession() { assertNotNull(There should be a session, session); } } public class SessionFilterTest extends FilterTestCase { public void beginSession(WebRequest request) { request.setAutomaticSession(true); } public void testSession() { HttpSession session = request.getSession(false); assertNotNull(There should be a session, session); } } Am I misunderstanding, Pedro? I cannot try it now, but, SessionFilterTest#testSession() may fails. An HTTP Session is created to fill the session implicit object of ServletTestCase (and of JspTestCase) prior to testXXX. However, for FilterTestCase, which doesn't have the session implicit object, such session creation is not needed and is not implemented, AFAIK. Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: commons logging problem with JUnit/Cactus
Hi, In article [EMAIL PROTECTED], Mon, 25 Oct 2004 11:55:29 -0400, Dimitar Georgievski [EMAIL PROTECTED] wrote: dgeorgievski I have a folder called c:\junit\runner that contains execluded.properties dgeorgievski with the following content 'c:\junit\runner' or 'c:\ejb\junit\runner' ? dgeorgievski java -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog dgeorgievski -cp .;C:\ejb\junit\runner; I guess 'C:\ejb\junit\runner ' should be 'C:\ejb'. # execlude.properties should be found in the junit.runner package. Is it helps you? Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cactus test dont run with LTPA authentication websphere
Hi Pandu, In article [EMAIL PROTECTED], Mon, 25 Oct 2004 16:39:44 -0500, [EMAIL PROTECTED] wrote: Pandu I am runing my unit tests with cactus on websphere 5.1. When I changed the Pandu authentication mechanism to LTPA(Light weight third party authentication), Pandu tests are not able to run. I'm not sure how the LTPA works, however, I can guess two possibilities: 1. the cookie name which is used by LTPA may be different from JSESSIONID. If so, please try FormAuthentication#setSessionCookieName(String). 2. the authentication sequence of LTPA is different from that of expected by the current FormAuthentication implementation.of Cactus If so, following ML archives may help you: http://www.mail-archive.com/[EMAIL PROTECTED]/msg05446.html http://www.mail-archive.com/[EMAIL PROTECTED]/msg05452.html # Please search form cactus-user ML archive by subject # Security (using FormAuthentication) not working against WebSphere 5.1 Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: commons logging problem with JUnit/Cactus
Hi, In article [EMAIL PROTECTED], Fri, 22 Oct 2004 16:41:10 -0400, Dimitar Georgievski [EMAIL PROTECTED] wrote: dgeorgievski - renaming the file to junit.runner.execluded.properties It should not work. dgeorgievski - putting it into junit\runner folder Do you mean you have junit\runner\execluded.properties? If so, please confirm the thing that the directory where the junit directory exists in your classpath is proceeding to junit.jar. Regards, Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: commons logging problem with JUnit/Cactus
Hi Dimitar, In article [EMAIL PROTECTED], Wed, 20 Oct 2004 14:11:32 -0400, Dimitar Georgievski [EMAIL PROTECTED] wrote: dgeorgievski First I have stored this file in a location that comes before junit.jar in dgeorgievski the class path. According to JUnit documentation properties set in this file dgeorgievski would override the settings in the excluded.properties in the JAR archive. dgeorgievski It didn't work. Did you put execluded.properties file to be accessible as junit.runner.execluded.properties, i.e junit\runner\execluded.properties? Hope this helps. Kazuhito SUGURI mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]