You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by Christopher Lenz <cm...@gmx.de> on 2003/05/14 22:03:39 UTC
Client server synchronization
Hi all,
the class comment in the TestClientServerSynchronizatation has been
making me nervous ever since I saw it the first time:
"This JUnit test need to be the first one to be run.
Otherwise, the test result might be that of the
previous test and not the current test one, thus
proving nothing !!"
Okay, so my first question is: how can this happen? In "typical" Cactus
test runs, there should be only one instance of the test runner running
tests against one instance of a container. The request-response cycle
should be strictly sequential. Am I missing something?
The next question: why don't we guarantee that responses don't get mixed
up? Instead of storing the test-results as a "singleton" attribute in
the application context, we could assign a unique ID for each test. The
test-results would then be stored in a Map in the application scope,
with the unique test ID being the key into the map. That would also
enable many test-runners running against a single container, potentially
calling the same test case simultaneously.
What do you think?
--
Christopher Lenz
/=/ cmlenz at gmx.de
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
Re: Client server synchronization
Posted by Christopher Lenz <cm...@gmx.de>.
Nicholas Lesiecki wrote:
> +10 :P This issue has actually caused bugs in a number of my tests. I'd
> probably do it, but I won't have time for at least a few weeks.
>
>>>Okay, so my first question is: how can this happen? In "typical"
>>>Cactus
>>>test runs, there should be only one instance of the test runner
>>>running
>>>tests against one instance of a container. The request-response cycle
>>>should be strictly sequential. Am I missing something?
>
> Unfortunately, this isn't the case. The junit task for ant needs to be run
> with fork="true" under Java 1.4. (At least, I haven't found a workaround.)
> Forking seems to involve a separate JVM for each test. Thus multiple
> instances of the test runner running against the same container. It makes
Hmm, this doesn't explain why the CALL_TEST/GET_RESULT responses could
be returned out of order, does it? There should still be only one
instance of the test runner, just in a different JVM.
> getting a unique ID somewhat problematic. Also, proving it works with
> functional test would also be difficult. That's part of the reason I haven't
> done it.
But using some GUID/UUID algorithm should do the trick. I can see two
options for the ID generation:
1/ The client generates the ID and sends it as a query string parameter
to the redirector. Later, when it retrieves the test results, it'd
need to pass the same ID to the GET_RESULTS service, of course
(which would have the side effect that the test results can be
garbage collected on the server side)
2/ The server creates a ID on a CALL_TEST request, and returns it as
an HTTP header (say, X-Cactus-Token) to the test runner. The test
runner would then use the ID for the GET_RESULTS request as in
option 1/
This is assuming that the underlying problem is uniquely associating the
CALL_TEST request/response with the corresponding GET_RESULT
request/response. Option 1/ seems far more straightforward, and doesn't
mess with the response that is visible to the test cases.
I'd consider not having to impose a specific order on the Cactus tests a
"good enough" test. Testing UID generation is pretty much impossible AFAIK.
> Cheers,
> Nick
>
>
>>-----Original Message-----
>>From: Vincent Massol [mailto:vmassol@pivolis.com]
>>Sent: Wednesday, May 14, 2003 1:40 PM
>>To: 'Cactus Developers List'
>>Subject: RE: Client server synchronization
>>
>>
>>
>>
>>
>>>-----Original Message-----
>>>From: Christopher Lenz [mailto:cmlenz@gmx.de]
>>>Sent: 14 May 2003 22:04
>>>To: Cactus Developers List
>>>Subject: Client server synchronization
>>>
>>>Hi all,
>>>
>>>the class comment in the TestClientServerSynchronizatation has been
>>>making me nervous ever since I saw it the first time:
>>>
>>> "This JUnit test need to be the first one to be run.
>>> Otherwise, the test result might be that of the
>>> previous test and not the current test one, thus
>>> proving nothing !!"
>>>
>>>Okay, so my first question is: how can this happen? In "typical"
>>
>>Cactus
>>
>>>test runs, there should be only one instance of the test runner
>>
>>running
>>
>>>tests against one instance of a container. The request-response cycle
>>>should be strictly sequential. Am I missing something?
>>>
>>
>>hum... I've looked at the TestClientServerSynchronization class and I
>>don't understand why it has to be the first one... Maybe this comment
>>was left during a refactoring. I do remember that one test had to be the
>>first to run (because it was supposing there were no tests before) but I
>>don't understand why this one ... Let's try running it out of
>>sequence... :-)
>>
>>
>>>The next question: why don't we guarantee that responses don't get
>>
>>mixed
>>
>>>up? Instead of storing the test-results as a "singleton" attribute in
>>>the application context, we could assign a unique ID for each test.
>>
>>The
>>
>>>test-results would then be stored in a Map in the application scope,
>>>with the unique test ID being the key into the map. That would also
>>>enable many test-runners running against a single container,
>>
>>potentially
>>
>>>calling the same test case simultaneously.
>>
>>Yes, definitely. This has been on the todo list for a long time and I've
>>never taken the time to implement it... :
>>
>> <action>
>> Add support for multi-concurrent Cactus tests. This involves
>>storing
>> each test result under a unique key in the application scope.
>> </action>
>>
>>>What do you think?
>>
>>+1!
>>
>>Thanks
>>-Vincent
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>
>>
--
Christopher Lenz
/=/ cmlenz at gmx.de
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
RE: Client server synchronization
Posted by Nicholas Lesiecki <ni...@eblox.com>.
+10 :P This issue has actually caused bugs in a number of my tests. I'd
probably do it, but I won't have time for at least a few weeks.
> > Okay, so my first question is: how can this happen? In "typical"
> Cactus
> > test runs, there should be only one instance of the test runner
> running
> > tests against one instance of a container. The request-response cycle
> > should be strictly sequential. Am I missing something?
Unfortunately, this isn't the case. The junit task for ant needs to be run
with fork="true" under Java 1.4. (At least, I haven't found a workaround.)
Forking seems to involve a separate JVM for each test. Thus multiple
instances of the test runner running against the same container. It makes
getting a unique ID somewhat problematic. Also, proving it works with
functional test would also be difficult. That's part of the reason I haven't
done it.
Cheers,
Nick
> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@pivolis.com]
> Sent: Wednesday, May 14, 2003 1:40 PM
> To: 'Cactus Developers List'
> Subject: RE: Client server synchronization
>
>
>
>
> > -----Original Message-----
> > From: Christopher Lenz [mailto:cmlenz@gmx.de]
> > Sent: 14 May 2003 22:04
> > To: Cactus Developers List
> > Subject: Client server synchronization
> >
> > Hi all,
> >
> > the class comment in the TestClientServerSynchronizatation has been
> > making me nervous ever since I saw it the first time:
> >
> > "This JUnit test need to be the first one to be run.
> > Otherwise, the test result might be that of the
> > previous test and not the current test one, thus
> > proving nothing !!"
> >
> > Okay, so my first question is: how can this happen? In "typical"
> Cactus
> > test runs, there should be only one instance of the test runner
> running
> > tests against one instance of a container. The request-response cycle
> > should be strictly sequential. Am I missing something?
> >
>
> hum... I've looked at the TestClientServerSynchronization class and I
> don't understand why it has to be the first one... Maybe this comment
> was left during a refactoring. I do remember that one test had to be the
> first to run (because it was supposing there were no tests before) but I
> don't understand why this one ... Let's try running it out of
> sequence... :-)
>
> > The next question: why don't we guarantee that responses don't get
> mixed
> > up? Instead of storing the test-results as a "singleton" attribute in
> > the application context, we could assign a unique ID for each test.
> The
> > test-results would then be stored in a Map in the application scope,
> > with the unique test ID being the key into the map. That would also
> > enable many test-runners running against a single container,
> potentially
> > calling the same test case simultaneously.
>
> Yes, definitely. This has been on the todo list for a long time and I've
> never taken the time to implement it... :
>
> <action>
> Add support for multi-concurrent Cactus tests. This involves
> storing
> each test result under a unique key in the application scope.
> </action>
>
> >
> > What do you think?
>
> +1!
>
> Thanks
> -Vincent
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
RE: Client server synchronization
Posted by Vincent Massol <vm...@pivolis.com>.
> -----Original Message-----
> From: Christopher Lenz [mailto:cmlenz@gmx.de]
> Sent: 14 May 2003 22:04
> To: Cactus Developers List
> Subject: Client server synchronization
>
> Hi all,
>
> the class comment in the TestClientServerSynchronizatation has been
> making me nervous ever since I saw it the first time:
>
> "This JUnit test need to be the first one to be run.
> Otherwise, the test result might be that of the
> previous test and not the current test one, thus
> proving nothing !!"
>
> Okay, so my first question is: how can this happen? In "typical"
Cactus
> test runs, there should be only one instance of the test runner
running
> tests against one instance of a container. The request-response cycle
> should be strictly sequential. Am I missing something?
>
hum... I've looked at the TestClientServerSynchronization class and I
don't understand why it has to be the first one... Maybe this comment
was left during a refactoring. I do remember that one test had to be the
first to run (because it was supposing there were no tests before) but I
don't understand why this one ... Let's try running it out of
sequence... :-)
> The next question: why don't we guarantee that responses don't get
mixed
> up? Instead of storing the test-results as a "singleton" attribute in
> the application context, we could assign a unique ID for each test.
The
> test-results would then be stored in a Map in the application scope,
> with the unique test ID being the key into the map. That would also
> enable many test-runners running against a single container,
potentially
> calling the same test case simultaneously.
Yes, definitely. This has been on the todo list for a long time and I've
never taken the time to implement it... :
<action>
Add support for multi-concurrent Cactus tests. This involves
storing
each test result under a unique key in the application scope.
</action>
>
> What do you think?
+1!
Thanks
-Vincent
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org