On 19 Jun 2009, at 18:02, Dan Allen wrote:
On Fri, Jun 19, 2009 at 8:16 AM, Pete Muir <pmuir(a)redhat.com>
wrote:
Dan/David,
Not sure if you are planning on changing the isDefinitionError() on
Managers further, but currently it is not quite right - the spec
doesn't say that an exception will be thrown when there is a
definition error, just that container will detect it.
So, the signature needs to be isDefinitionError() and the
ManagersImpl return true or false (and detect/store the failure
internally).
I was going off these two statements in 12.4:
"If a definition error exists in a deployment, initialization will
be aborted by the container."
"If a deployment problem exists in a deployment, initialization will
be aborted by the container."
The way I have the test working is as follows. Deployment of the
artifact is attempted. If it fails with an exception, the
AbstractTest tries to determine if this was an expected exception
(as declared by @ExpectedDeploymentException on the @Artifact). I
override that method in AbstractJSR299TestCase to see if the
exception thrown can be claimed by the Managers implementation (such
that the exception falls into a category, either definition error or
deployment error).
AbstractTest#isThrowablePresent() ->
AbstractJSR299Test#isThrowablePresent() ->
Managers#isDefinitionError() or Managers#isDeploymentError()
If the exception thrown during deployment maps to the expected
exception (via this lookup) then the test case is considered passed.
So I get what you are saying, but it appears what I implemented
follows exactly that.
I'm assuming that the only way to abort initialization is by
throwning an exception.
Right, this isn't specified anywhere :-) I agree it's both the logical
way, and the way that JBoss AS does it, but I don't think we can
assume it. I would prefer the porting package impl to be responsible
for this.
I'll add a method with the right sig and impl it tonight and you can
switch to use it.
Maybe that is where my assumption is flawed. Feel free to revise if
you feel it necessary.
-Dan
--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan
NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than
a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters. Please don't hesitate to resend a
message if
you feel that it did not reach my attention.