EzDevInfo.com

Cactus

Static site generator for designers. Uses Python and Django templates.

Error : "javax.servlet.ServletException: Failed to load test suite [SampleTest], Reason is [Class not found "SampleTest"] "

Hi i am new to cactus and when i am using tomcat5.1 and have included all the necessary jars. But when i am trying to execute it, it is showing the error,

Error : "javax.servlet.ServletException: Failed to load test suite [SampleTest], Reason is [Class not found "SampleTest"] "

Please let me know what the problem is??


Source: (StackOverflow)

How do I download source code of Jakarta cactus? [closed]

I went to http://jakarta.apache.org/cactus/downloads.html and clicked on Cactus source releases. However, I get a

Forbidden

You don't have permission to access /site/downloads/downloads_cactus.cgi on this server.

Can I use maven to get the source code for Jakarta cactus?


Source: (StackOverflow)

Advertisements

sass files are not working in Cactus 1.0.1

I am using Cactus 1.0.1. In my html I am using .scss file. As per the Cactus documentation, the .scss file will be support in cactus without installing any additional things. But it is not working and the page was rendered without stylesheet. Please help me to solve this issue.


Source: (StackOverflow)

Cactus versus mock objects (jMock, Easy mock)

I'm little confused with Cactus and mock objects (jMock, Easy mock).

Could anyone please answer the following questions?

  1. When to use Cactus for testing?
  2. When not to use Cactus for testing?
  3. When to use mock objects for testing?
  4. When not to use mock objects for testing?

Source: (StackOverflow)

Jakarta Cactus alternate?

Greetings, we have a project with loads of beans, JSP and etc. There is a desperate need for performing automated tests in our environment (we use Maven). Now, we can easily write tests for database project layer, for various security utilities we implemented. But the JSP pages remain untested.

I searched for utilities for server-side testing and Cactus seems the best option. However, according to their changelist, their last release is 1.8 and it was released more than two years ago!

So the question is - what happened to Cactus, is it still developing or what? And what are the recent alternates for Jakarta Cactus (if any exists)?


Source: (StackOverflow)

Cactus still viable for Integration Testing?

I'm working on a project and we want to perform integration testing for our servlets and JSP. I was reading about the Cactus project. I was wondering if Cactus is still a viable solution for integration testing of servlets and JSPs? I know it has been around for a while and curious if there are other recent open-source projects that do a similar thing?


Source: (StackOverflow)

OutOfMemoryError trying to run Cactus unit tests

We have a Hudson/Ant build setup. I have just added a series of Apache Cactus (version 1.8.1) unit tests to the project and am trying to run them after the project builds. I get the following error when it tries to execute the cactus task: "java.lang.OutOfMemoryError: Java heap space."

We have already bumped up the Java heap space as much as we can. Is there a way to make the Cactus task use less memory? Or something else I can do within the test cases themselves to reduce the memory footprint?


Source: (StackOverflow)

Doing integration testing on Oracle ADF application

I have an ADF application which running on my server. I was trying to run some integration test cases on it. I used to use apache cactus framework to run testing on normal web applications. My test cases would extend CactusStrutsTestCase and will be run. I tried to approach, ADF application with same concept. But I am getting connection refused error

java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

So my question is that , is it possible to do testing in ADF application with a ServletTestcase which is part of Cactus framework ?

Thanks Jijoy


Source: (StackOverflow)

Run JUnit test case in tomcat container

I am writing a JUnit test case which tests a findBy method of a HibernateEnity. Entity gets it's database connection from tomcat managed datasources.
JUnit test case:

MyHibernateEntity entity = new MyHibernateEntity();

expectedResult = entity.findByFK(dummyFK);

How can I run testcase inside tomcat container? We don't have any other Java EE in-container component other then datasources. That's why I need a framework with least footprints. Till now I have tried following:

  1. Arquillian - Too complex to implement. A lot of configuration.
  2. Cactus - It has 3 class to extend. ServletTestCase, JspTestCase and FilterTestCase. Not sure which one is applicable in my case.
  3. DBUnit - Read about it in JUnit in Action. I don't know if it is applicable for in container datasources.

    Note: I understand this test case is not a pure unit testing. I am introducing JUnit in a legacy system and do not have time to resolve integration issues.


Source: (StackOverflow)

Error "syntax error near unexpected token '&' - trying to run a file from command line within an application

I am a newbie to Linux and I am only really using it to use a program for my final year thesis. I have got to grips with the language for the program but am having issues with actually running it in Linux. The program is called "CACTUS" and all documentation can be found here.

I have extracted the application file and I have made the executable as instructed in the install.txt file:

"Installation of CACTUS for Linux or Mac machines.

  1. Unzip the directory and put in desired location. On terminal cd into the correct directory (you should be able to see the makefiles).

  2. Create the executable by typing:

    $make

    or

    $make -f Makefile.gfortran

    on the terminal. The executable will be called cactus and be located in the directory one level above.You can add the executable's location to your path so that you can call it by simple typing cactus on the terminal instead of the complete path.

  3. cd into the Test/RegTest directory

    $cd ./Test/RegTest

    and run the RegTest by executing runreg.py with the path to the CACTUS executable as an argument (or just the name of the executable if you added it to your path).

    $./runreg.py ../../../cactus

    or

    $./runreg.py cactus

    The output should say 'No differences' for all three tests. Note: if you have Python 3 installed used runreg_p3.py instead.

    CONGRATULATIONS! You have successfully installed CACTUS.

I have run this and I didn't get the "No Differences" returned on the runreg.py. I continued anyway as I did not know why or how I could fix this. (This may be a root cause of my overally problem here)

As I progressed I have been trying to open an input file "TestVAWT.in" from TestCase2 with the following command:

./TestVAWT.in ../../../cactus

From this I get the error in the title returned. Am I correct in assuming that it has tried to run the TestVAWT.in file on the command line without referring to the Cactus application which I presume would be able to read the '&' prefix of the code along with the rest of the input file. Or is it something else I am missing here.

I would appreciate any help as I have been banging my head against a wall for some time now.

Note: I am using Ubuntu 14.04 LTS.

Best Regards

Richard


Source: (StackOverflow)

How to Speed up cactifywar ant task

Is there a way to speed-up the cactifywar Ant task? It takes several minutes to run this task.


Source: (StackOverflow)

AssertionFailedError

I am facing the following problem while running it using junit: All the methods are working fine except testValidatePanelistIDHwid. This is the new method that i have added in this class all other methods are working fine.

junit.framework.AssertionFailedError: Method "testValidatePanelistIDHwid" not found
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.TestCase.runTest(TestCase.java:147)
at junit.framework.TestCase.runBare(TestCase.java:127)

import junit.framework.TestCase;  

import org.apache.cactus.ServletTestCase;  
import org.apache.cactus.WebRequest;  
import xys.model.common.BusinessObjectException;  
import xys.class.model.common.util.ValidationUtility;  

public class ValidationUtilityTest extends ServletTestCase  
{  
    ValidationUtility validationUtil = new ValidationUtility();   

    public void begin(WebRequest request){}  

    public void setUp() throws Exception  
    {  
        super.setUp();  
    }//end of SetUp  

    protected void tearDown() throws Exception  
    {  
        super.tearDown();  
    }  

    public void testIsMessageOfCorrectLength()  
    {  
        boolean isCorrectLen = ValidationUtility.isMessageOfCorrectLength("Test",4);  
        assertTrue("Message is not correct.",isCorrectLen == true);  

        isCorrectLen = ValidationUtility.isMessageOfCorrectLength("Test",3);  
        assertFalse("Message is longer than the limit.",isCorrectLen == true);  

        isCorrectLen = ValidationUtility.isMessageOfCorrectLength("Test",8);  
        assertTrue("Message is not longer.",isCorrectLen == true);  

        try  
        {  
            isCorrectLen = ValidationUtility.isMessageOfCorrectLength(null,8);  
        //  fail("InputString is null.");  
        }  
        catch(Exception e)  
        {  
            System.out.println("ValidationUtilityTest:testIsMessageOfCorrectLength");
        }  
    }  

    public void testValidateCommandInstanceId()throws BusinessObjectException  
    {  
        boolean isValidCmdInstID = false;  

            isValidCmdInstID = ValidationUtility.validateCommandInstanceId(341);  
            assertTrue("Command Instance ID 341 is not valid.", isValidCmdInstID == true);  

            isValidCmdInstID = ValidationUtility.validateCommandInstanceId(400);  
            assertTrue("Command Instance ID 400 is not valid.", isValidCmdInstID == true);  

            isValidCmdInstID = ValidationUtility.validateCommandInstanceId(56);  
            assertTrue("Command Instance ID 56 is not valid.", isValidCmdInstID == true);  

            isValidCmdInstID = ValidationUtility.validateCommandInstanceId(320);  
            assertTrue("Command Instance ID 320 is not valid.", isValidCmdInstID == true);  

            try  
            {  
                isValidCmdInstID = ValidationUtility.validateCommandInstanceId(0);  
            }  
            catch(BusinessObjectException b)  
            {  
                System.out.println("ValidationUtilityTest:testValidateCommandInstanceId"); 
            }  

            try  
            {  
                isValidCmdInstID = ValidationUtility.validateCommandInstanceId(21);  
                fail("Instance ID not present.");  
            }  
            catch(BusinessObjectException b)  
            {  
                System.out.println("ValidationUtilityTest:testValidateCommandInstanceId:");
            }  

        try  
        {  
            isValidCmdInstID = ValidationUtility.validateCommandInstanceId(-500);  
            fail("Invalid Instance ID.");  
        }  
        catch(BusinessObjectException b)  
        {  
            System.out.println("ValidationUtilityTest:testValidateCommandInstanceId");
        }  
    }  

    public void testValidateHardwareId()throws BusinessObjectException  
    {  
        boolean isValidHardwareID = false;  

            isValidHardwareID = ValidationUtility.validateHardwareId("35279401003038707");  
         assertTrue("Hardware ID 35279401003038707 is not valid.", isValidHardwareID ==  true);  

            isValidHardwareID = ValidationUtility.validateHardwareId("357246016572305");  
            assertTrue("Hardware ID is not valid.", isValidHardwareID == true);  

            try  
            {  
                isValidHardwareID = ValidationUtility.validateHardwareId("352794010030387076546456546357567567686742324");  
                fail("Very Long Instance ID.");  
            }  
            catch(Exception b)  
            {  
                System.out.println("ValidationUtilityTest:testValidateHardwareId: Exception: Very Long Hardware ID.");  
            }  

            try  
            {                                                                                                                         
                isValidHardwareID = ValidationUtility.validateHardwareId("3527dsds$$$$38707");  
                fail("Invalid Hardware ID.");  
            }  
            catch(Exception b)  
            {  
                System.out.println("ValidationUtilityTest:testValidateHardwareId: Exception: Invalid Hardware ID. ");  
            }  
    }  

    public void testValidatePanelistIDHwid()throws BusinessObjectException  
    {     

        boolean PanelistIDHwid = false;  

        PanelistIDHwid = ValidationUtility.validatePanelistIDHwid(19560,"A0000024B885E2");  
            assertTrue("Panelist ID 19560 and Hardware ID A0000024B885E2  is  valid.", PanelistIDHwid == true);  
            //assertTrue("Hardware ID A0000024B885E2 is  valid.", isValidHardwareID == true);  

            PanelistIDHwid = ValidationUtility.validatePanelistIDHwid(123,"357246016572305");  
            assertTrue("Hardware ID is not valid.", PanelistIDHwid == true);  

            try  
            {  
                PanelistIDHwid = ValidationUtility.validatePanelistIDHwid(19560,"352794010030387076546456546357567567686742324");  
                fail("Very Long Instance ID.");  
            }  
            catch(Exception b)  
            {  
                System.out.println("ValidationUtilityTest:testValidateHardwareId: Exception: Very Long Hardware ID.");  
            }  

            try  
            {                                                                                                                         
                PanelistIDHwid = ValidationUtility.validatePanelistIDHwid(19560,"3527dsds$$$$38707");  
                fail("Invalid Hardware ID.");  
            }  
            catch(Exception b)  
            {  
                System.out.println("ValidationUtilityTest:testValidateHardwareId: Exception: Invalid Hardware ID. ");  
            }  
    }  

}

    junit.framework.AssertionFailedError: Method "testValidatePanelistIDHwid" not found
    at junit.framework.Assert.fail(Assert.java:47)
    at junit.framework.TestCase.runTest(TestCase.java:147)
    at junit.framework.TestCase.runBare(TestCase.java:127)
   at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
    at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:619)

Source: (StackOverflow)

What is best way to test smartServer servlets?

I have the following Servlet method which I want to create test for it using junit or Cactus.I've tried Junit but in testing implementation classes but I'm a newbie in testing WebServices so I will really appreciate any help.

public DSResponse executeFetch(DSRequest req) throws Exception { 
DSResponse resp = new DSResponse(); 

String maID = (String) req.getCriteria().get("memberActivityID"); 
MemberActivityImpl memberImpl = new MemberActivityImpl(); 

MemberActivity memberAct = new MemberActivity(); 

if (req.getDataSourceName().equals("memberActivity")) { 
if (maID != null) { 
// Fetch the MemberActivity based on the memberActivityID criteria 
memberAct = memberImpl.getMemberActivity(maID); 

List<Map> resultList = new LinkedList<Map>(); 

if( memberAct != null && memberAct.getMemberID() != null ) 
    // Pass the memberAct to the client 
    Map<String, Object> result = new HashMap<String, Object>(); 
    result.put("name", memberAct.getName()); 
    result.put("type", memberAct.getType()); 
    result.put("memberID", memberAct.getMemberID()); 
    if (memberAct.getGoal() != null) { 
        result.put("goal", memberAct.getGoal());} 
        resultList.add(result); 
    } 
    resp.setData(resultList); 
} else { 
    resp.setFailure(); 
} 

`


Source: (StackOverflow)

Create junitTest or cactus test for servlet

I have the following Servlet method which I want to create test for it using junit or Cactus. I'm a newbie so I will really appreciate any tips.

public DSResponse executeFetch(DSRequest req) throws Exception {
    DSResponse resp = new DSResponse();

    String maID = (String) req.getCriteria().get("memberActivityID");
    MemberActivityImpl memberImpl = new MemberActivityImpl();

    MemberActivity memberAct = new MemberActivity();

    if (req.getDataSourceName().equals("memberActivity")) {
    if (maID != null) {
    // Fetch the MemberActivity based on the memberActivityID criteria
    memberAct = memberImpl.getMemberActivity(maID);

    List<Map> resultList = new LinkedList<Map>();

    if( memberAct != null && memberAct.getMemberID() != null )
        // Pass the memberAct to the client
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("name", memberAct.getName());
        result.put("type", memberAct.getType());
        result.put("memberID", memberAct.getMemberID());
        if (memberAct.getGoal() != null) {
            result.put("goal", memberAct.getGoal());}
            resultList.add(result);
        }
        resp.setData(resultList);
    } else {
        resp.setFailure();
    }

Source: (StackOverflow)

Connection Pool "Leak" in development. Could it be due to JUnit test setup?

I am trying to track down a database connection pool "leak" in development and I am wondering if it is resulting from how the unit tests are set up. Something is grabbing database connections from the Glassfish pool and not closing them when done. Eventually the pool max connections are used up and the application is unable to get any new db connections.

Our JUnit tests get a connection from the pool in the setUp() method and then close that connection in the tearDown() method. Can we be sure that the tearDown() method will ALWAYS run? If an unhandled exception occurs, could the tearDown() method be bypassed?

Any other ideas on what we should look for?

I should note that we are using Jakarta Cactus to run these unit tests on the Glassfish application server.


Source: (StackOverflow)