On Fri, Jun 19, 2009 at 8:16 AM, Pete Muir <pmuir@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. 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.