[jboss-cvs] JBossAS SVN: r67282 - projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 20 04:39:28 EST 2007
Author: alesj
Date: 2007-11-20 04:39:28 -0500 (Tue, 20 Nov 2007)
New Revision: 67282
Modified:
projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/TerminateStructureTestCase.java
Log:
Terminate with RuntimeException test.
Modified: projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/TerminateStructureTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/TerminateStructureTestCase.java 2007-11-20 09:29:16 UTC (rev 67281)
+++ projects/microcontainer/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/TerminateStructureTestCase.java 2007-11-20 09:39:28 UTC (rev 67282)
@@ -48,25 +48,37 @@
return suite(TerminateStructureTestCase.class);
}
- protected StructureDeployer[] getStructureDeployers(int failNumber, int size)
+ protected StructureDeployer[] getStructureDeployers(int failNumber, int size, boolean checkCause)
{
StructureDeployer[] deployers = new StructureDeployer[size];
for(int i = 0; i < size; i++)
- deployers[i] = (i == failNumber) ? new FailStructureDeployer(i) : new PassStructureDeployer(i);
+ {
+ if (i == failNumber)
+ {
+ if (checkCause)
+ deployers[i] = new REStructureDeployer(i);
+ else
+ deployers[i] = new FailStructureDeployer(i);
+ }
+ else
+ deployers[i] = new PassStructureDeployer(i);
+ }
return deployers;
}
- protected void checkFailedNumber(VFSDeployment deployment, int failNumber, int size)
+ protected void checkFailedNumber(VFSDeployment deployment, int failNumber, int size, boolean checkCause)
throws Exception
{
try
{
- determineStructureWithStructureDeployers(deployment, getStructureDeployers(failNumber, size));
+ determineStructureWithStructureDeployers(deployment, getStructureDeployers(failNumber, size, checkCause));
fail("Should not be here.");
}
- catch (DeploymentException e)
+ catch (Throwable t)
{
- String msg = e.getMessage();
+ if (checkCause)
+ t = t.getCause();
+ String msg = t.getMessage();
int number = Integer.parseInt(msg);
assertEquals(failNumber, number);
}
@@ -76,11 +88,20 @@
{
// some deployment
VFSDeployment deployment = createDeployment("/structure/file", "simple");
- checkFailedNumber(deployment, 0, 3);
- checkFailedNumber(deployment, 1, 3);
- checkFailedNumber(deployment, 2, 3);
+ checkFailedNumber(deployment, 0, 3, false);
+ checkFailedNumber(deployment, 1, 3, false);
+ checkFailedNumber(deployment, 2, 3, false);
}
+ public void testRuntimeTerminate() throws Exception
+ {
+ // some deployment
+ VFSDeployment deployment = createDeployment("/structure/file", "simple");
+ checkFailedNumber(deployment, 0, 3, true);
+ checkFailedNumber(deployment, 1, 3, true);
+ checkFailedNumber(deployment, 2, 3, true);
+ }
+
protected VFSDeploymentContext determineStructure(VFSDeployment deployment) throws Exception
{
throw new UnsupportedOperationException("No use case.");
@@ -111,4 +132,17 @@
throw new DeploymentException(String.valueOf(getRelativeOrder()));
}
}
+
+ private class REStructureDeployer extends AbstractStructureDeployer
+ {
+ public REStructureDeployer(int order)
+ {
+ setRelativeOrder(order);
+ }
+
+ public boolean determineStructure(VirtualFile root, VirtualFile parent, VirtualFile file, StructureMetaData metaData, VFSStructuralDeployers deployers) throws DeploymentException
+ {
+ throw new RuntimeException(String.valueOf(getRelativeOrder()));
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list