org.apache.qpid.test.framework.qpid
Class CauseFailureDecorator

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.extensions.TestDecorator
          extended by org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator
              extended by org.apache.qpid.test.framework.qpid.CauseFailureDecorator
All Implemented Interfaces:
junit.framework.Test

public class CauseFailureDecorator
extends org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator

CauseFailureDecorator applies decorations to BrokerLifecycleAware tests, so that they may use different failure mechanisms. It is capable of detecting when a test case uses in-vm brokers, and setting up an automatic failure for those tests, so that the current live broker can be shut-down by test cases. For external brokers, automatic failure could be implemented, for example by having a kill script. At the moment this sets up the failure to prompt a user interactively to cause a failure, using CauseFailureUserPrompt.

CRC Card
Responsibilities Collaborations
Setup automatic failures for in-vm brokers. CauseFailureInVM
Setup user generated failures for external brokers. CauseFailureUserPrompt.

Todo:
Slight problem in that CauseFailureInVM is Qpid specific, whereas CauseFailureUserPrompt is not. Would like the failure decorator to be non-qpid specific so that it can test failure of any JMS implementation too. Either pass in class name of failure mechanism, set it up in the in-vm decorator instead of here but with prompt user as the default for when the in-vm decorator is not used?

Field Summary
 
Fields inherited from class org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator
suite
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
CauseFailureDecorator(org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator test)
          Creates a wrapped test test decorator from another one.
 
Method Summary
 void run(junit.framework.TestResult testResult)
          Runs the tests with a LocalAMQPCircuitFactory.
 String toString()
          Prints the name of the test for debugging purposes.
 
Methods inherited from class org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator
countTestCases, getAllUnderlyingTests, testAt
 
Methods inherited from class junit.extensions.TestDecorator
basicRun, getTest
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CauseFailureDecorator

public CauseFailureDecorator(org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator test)
Creates a wrapped test test decorator from another one.

Parameters:
test - The test test.
Method Detail

run

public void run(junit.framework.TestResult testResult)
Runs the tests with a LocalAMQPCircuitFactory. Only tests that extend FrameworkBaseCase are decorated.

Specified by:
run in interface junit.framework.Test
Overrides:
run in class junit.extensions.TestDecorator
Parameters:
testResult - The the results object to monitor the test results with.

toString

public String toString()
Prints the name of the test for debugging purposes.

Overrides:
toString in class junit.extensions.TestDecorator
Returns:
The name of the test.


Licensed to the Apache Software Foundation