jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Mckenna <eric.mcke...@brainbench.com>
Subject Need Help using cactus to run server side DB Queries
Date Mon, 14 Oct 2002 17:11:13 GMT
Hello,
The place im contracting for has an api for running sql queries, but the api

assumes that the Resin Servlet container is available for pooling, etc.  
For my unit tests,some require DB access and running the queries outside the
servlet container creates long lag times.  Some simple queries take 
1-2 minutes.  So to fix this I was trying to use cactus run the classes that
required DB access since these cactus tests would have access to the
intended 
sql api.

I've included the cactus_client.log file.  One thing i did notice is that if
i take the url link from the log file and put it in a browser, the test runs
(I put some printlines in there and they showed up in the server stdout.log
file).  So i think my problem is probably with configuration.

any help appreciated.
eric.


using:
junit 3.7
ant 1.5
cactus 1.4.1

Im also running the cactus tests with ant, if that makes any difference.

======================================
cactus.properties:
======================================
cactus.contextURL=http://eric.in.foo.com:80
cactus.servletRedirectorName = ServletRedirector   



======================================
code sample:
======================================

...

public void beginCertConstructor(WebRequest theRequest)
    {
        // Set up HTTP related parameters
        theRequest.setURL("eric.in.foo.com", "", "", null, null);

    }
	
	//this is what i want run on the server.
    public void testCertConstructor() throws Exception
    {
        ResultSet results = runner.runSql(GET_CERTS_SQL);
        results.next();
        Row aRow = results.getRow();

        MyCertificate myCert = new MyCertificate();

        try
        {
            myCert = new MyCertificate(aRow);
        }
        catch(Exception e)
        {
            fail("There was an exception with the Constructor:
"+e.getMessage());
        }
    }

...

======================================
cactus_client.log:
======================================
12:11:01,356 [main] DEBUG test.ServerSideCert             - -------------
Test: testCertConstructor 
12:11:02,538 [main] DEBUG test.ServerSideCert             - Exception in
test 
org.apache.cactus.util.ChainedRuntimeException: Failed to get the test
results. This is probably due to an error that happened on the server side
when trying to execute the tests. Here is what was returned by the server :
 [<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>302 Found</TITLE>
</HEAD><BODY>
<H1>Found</H1>
The document has moved <A
HREF="http://www.eric.in.foo.com/ServletRedirector?Cactus_TestMethod=testCer
tConstructor&amp;Cactus_URL_ContextPath=&amp;Cactus_URL_Server=eric.in.foo.c
om&amp;Cactus_URL_ServletPath=&amp;Cactus_TestClass=com.brainbench.certmaile
r.test.ServerSideCert&amp;Cactus_AutomaticSession=true&amp;Cactus_URL_Protoc
ol=http&amp;Cactus_Service=CALL_TEST">here</A>.<P>
<HR>
<ADDRESS>Apache/1.3.23 Server at www.ericm02 Port 80</ADDRESS>
</BODY></HTML>
]
	at
org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(AbstractHttpCli
ent.java;org/apache/cactus/util/log/LogAspect.aj(1k):120)
	at
org.apache.cactus.client.AbstractHttpClient.around2_doTest(AbstractHttpClien
t.java;org/apache/cactus/util/log/LogAspect.aj(1k):1236)
	at
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java;o
rg/apache/cactus/util/log/LogAspect.aj(1k):104)
	at
org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestCase.jav
a:260)
	at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133)
	at
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:131)
	at junit.framework.TestSuite.runTest(TestSuite.java:173)
	at junit.framework.TestSuite.run(TestSuite.java:168)
	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:325)
	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:524)
org.apache.cactus.client.ParsingException: Not a valid response
	at
org.apache.cactus.client.WebTestResultParser.readRootElement(WebTestResultPa
rser.java;org/apache/cactus/util/log/LogAspect.aj(1k):140)
	at
org.apache.cactus.client.WebTestResultParser.dispatch29_parse(WebTestResultP
arser.java;org/apache/cactus/util/log/LogAspect.aj(1k):101)
	at
org.apache.cactus.client.WebTestResultParser.around29_parse(WebTestResultPar
ser.java;org/apache/cactus/util/log/LogAspect.aj(1k):1236)
	at
org.apache.cactus.client.WebTestResultParser.parse(WebTestResultParser.java;
org/apache/cactus/util/log/LogAspect.aj(1k):96)
	at
org.apache.cactus.client.AbstractHttpClient.callGetResult(AbstractHttpClient
.java;org/apache/cactus/util/log/LogAspect.aj(1k):230)
	at
org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(AbstractHttpCli
ent.java;org/apache/cactus/util/log/LogAspect.aj(1k):114)
	at
org.apache.cactus.client.AbstractHttpClient.around2_doTest(AbstractHttpClien
t.java;org/apache/cactus/util/log/LogAspect.aj(1k):1236)
	at
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java;o
rg/apache/cactus/util/log/LogAspect.aj(1k):104)
	at
org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestCase.jav
a:260)
	at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133)
	at
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:131)
	at junit.framework.TestSuite.runTest(TestSuite.java:173)
	at junit.framework.TestSuite.run(TestSuite.java:168)
	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:325)
	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:524)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message