| org.apache.hivemind.test.HiveMindTestCase
All known Subclasses: org.apache.hivemind.conditional.TestLexer, org.apache.hivemind.lib.groovy.TestHiveMindBuilder, hivemind.test.rules.TestServicePointTranslator, org.apache.hivemind.lib.pipeline.TestPipelineAssembler, org.apache.hivemind.TestApplicationRuntimeException, org.apache.hivemind.impl.TestRegistryInfrastructureConstructor, hivemind.test.rules.TestSetPropertyRule, org.apache.hivemind.schema.rules.TestCreateObjectRule, hivemind.test.services.TestEventLinker, org.apache.hivemind.management.TestMBeanRegistry, hivemind.test.lib.TestSpringLookupFactory, org.apache.hivemind.servlet.TestHiveMindFilter, org.apache.hivemind.TestBeanService, org.apache.hivemind.lib.groovy.TestGroovyModuleDescriptorProvider, hivemind.test.services.TestMethodSignature, org.apache.hivemind.util.TestInstanceCreationUtils, org.apache.hivemind.conditional.TestEvaluators, org.apache.hivemind.impl.TestServicePoint, org.apache.hivemind.lib.pipeline.TestFilterMethodAnalyzer, org.apache.hivemind.conditional.TestToken, org.apache.hivemind.management.log4j.TestLogManagementMBean, org.apache.hivemind.test.TestArrayMatcher, org.apache.hivemind.service.impl.TestInterfaceSynthesizer, org.apache.hivemind.impl.TestModule, org.apache.examples.panorama.startup.impl.TestTaskExecutor, hivemind.test.rules.TestPushContentRule, org.apache.hivemind.impl.TestServiceImplementationFactoryParametersImpl, hivemind.test.rules.TestPushAttributeRule, org.apache.hivemind.impl.TestSchemaProcessor, org.apache.hivemind.methodmatch.AbstractMethodTestCase, org.apache.hivemind.impl.TestDefaultClassResolver, org.apache.hivemind.impl.TestTranslatorManager, hivemind.test.services.TestBuilderFactory, org.apache.hivemind.impl.TestMessageFinder, org.apache.hivemind.impl.TestRegistryImpl, org.apache.hivemind.impl.TestMethodIterator, org.apache.hivemind.impl.servicemodel.TestRegistryShutdownListenerServices, org.apache.hivemind.TestThreadLocale, org.apache.hivemind.service.impl.TestBuilderFactory, hivemind.test.lib.TestRemoteExceptionCoordinator, org.apache.hivemind.lib.pipeline.TestBridgeBuilder, org.apache.hivemind.service.impl.TestBuilderPropertyFacet, org.apache.hivemind.test.TestMockClass, org.apache.hivemind.service.impl.TestObjectTranslator, hivemind.test.lib.TestSpringObjectProvider, org.apache.hivemind.service.impl.TestLoggingInterceptorFactory, org.apache.hivemind.impl.TestMessageFormatter, org.apache.hivemind.lib.chain.TestChainBuilder, org.apache.hivemind.lib.impl.TestServicePropertyFactory, org.apache.hivemind.impl.TestSymbolExpander, org.apache.hivemind.schema.rules.TestIdTranslators, org.apache.hivemind.management.TestPerformanceMonitorFactory, org.apache.hivemind.test.TestRegexpMatcher, org.apache.hivemind.util.TestConstructorUtils, org.apache.hivemind.management.TestConnectors, org.apache.hivemind.lib.impl.TestMethodInterceptorFactory, org.apache.hivemind.util.TestPropertyUtils, org.apache.hivemind.util.TestIdUtils, org.apache.hivemind.lib.factory.TestBeanFactoryImpl, org.apache.hivemind.util.TestStringUtils, org.apache.hivemind.util.TestContextResource, org.apache.hivemind.util.TestToStringBuilder, org.apache.hivemind.impl.TestVisibility, org.apache.hivemind.lib.factory.TestBeanFactoryObjectProvider, org.apache.hivemind.conditional.TestParser, org.apache.hivemind.impl.TestServiceModelThreading, hivemind.test.lib.TestEJBProxyFactory, hivemind.test.rules.TestSmartTranslator, hivemind.test.FrameworkTestCase, org.apache.hivemind.impl.TestRegistryInfrastructure, org.apache.hivemind.test.TestAggregateArgumentsMatcher, hivemind.test.impl.TestRegistryAssemblyImpl, org.apache.hivemind.TestDefense, org.apache.hivemind.impl.TestInvokeFactoryServiceConstructor, org.apache.hivemind.util.TestLocalizedContextResourceFinder, org.apache.hivemind.conditional.TestEvaluationContext, hivemind.test.parse.TestModuleDescriptor, org.apache.hivemind.service.impl.TestClassFabUtils, org.apache.hivemind.impl.TestServiceInterceptorContributionImpl, hivemind.test.lib.TestDefaultImplementationBuilder, org.apache.hivemind.service.impl.TestClassFab, org.apache.hivemind.lib.strategy.TestStrategyFactory, org.apache.hivemind.service.impl.TestObjectProviders, org.apache.hivemind.service.impl.TestInterfaceFab, org.apache.hivemind.lib.util.TestStrategyRegistry, org.apache.hivemind.conditional.TestNode,
HiveMindTestCase | abstract public class HiveMindTestCase extends TestCase (Code) | | Contains some support for creating HiveMind tests; this is useful enough that has been moved into
the main framework, to simplify creation of tests in the dependent libraries.
author: Howard Lewis Ship |
Inner Class :interface MockControlFactory | |
Inner Class :static class PlaceholderClassMockControlFactory implements MockControlFactory | |
Method Summary | |
protected void | addControl(MockControl control) Adds the control to the list of managed controls used by
HiveMindTestCase.replayControls() and
HiveMindTestCase.verifyControls() . | protected void | assertExceptionRegexp(Throwable ex, String pattern) Checks that the message for an exception matches a regular expression. | protected void | assertExceptionSubstring(Throwable ex, String substring) Checks that the provided substring exists in the exceptions message. | protected static void | assertListsEqual(Object[] expected, List actual) Converts the actual list to an array and invokes
HiveMindTestCase.assertListsEqual(Object[],Object[]) . | protected static void | assertListsEqual(Object[] expected, Object[] actual) Asserts that the two arrays are equal; same length and all elements equal. | protected void | assertLoggedMessage(String message) Asserts that some capture log event matches the given message exactly. | protected void | assertLoggedMessage(String message, List events) Asserts that some capture log event matches the given message exactly. | protected void | assertLoggedMessagePattern(String pattern) | protected void | assertLoggedMessagePattern(String pattern, List events) | protected void | assertLoggedMessages(String[] messages) Checks the messages for all logged events for exact match against the supplied list. | protected void | assertRegexp(String pattern, String actual) | protected Registry | buildFrameworkRegistry(String file) Convienience method for invoking
HiveMindTestCase.buildFrameworkRegistry(String[]) with only a single
file. | protected Registry | buildFrameworkRegistry(String[] files) Builds a minimal registry, containing only the specified files, plus the master module
descriptor (i.e., those visible on the classpath). | protected Registry | buildFrameworkRegistry(ModuleDescriptorProvider customProvider) Builds a registry, containing only the modules delivered by the specified
org.apache.hivemind.ModuleDescriptorProvider , plus the master module descriptor
(i.e., those visible on the classpath). | protected Registry | buildMinimalRegistry(Resource l) Builds a registry from exactly the provided resource; this registry will not include the
hivemind module. | protected Location | fabricateLocation(int line) | protected Throwable | findNestedException(ApplicationRuntimeException ex) Digs down through (potentially) a stack of ApplicationRuntimeExceptions until it reaches the
originating exception, which is returned. | protected ClassResolver | getClassResolver() Returns a
DefaultClassResolver . | protected MockControl | getControl(Object mock) Accesses the control for a previously created mock object. | protected List | getInterceptedLogEvents() Gets the list of events most recently intercepted. | protected Resource | getResource(String file) Returns the given file as a
Resource from the classpath. | protected void | interceptLogging(String loggerName) Sets up an appender to intercept logging for the specified logger. | protected boolean | matches(String input, String pattern) | protected MockControl | newControl(Class mockClass) Creates a managed control via
MockControl.createStrictControl(java.lang.Class) . | protected Location | newLocation() Returns a new
Location instance. | protected Object | newMock(Class mockClass) Convienience for invoking
HiveMindTestCase.newControl(Class) and then invoking
MockControl.getMock on the result. | protected void | replayControls() Invokes
MockControl.replay on all controls created by
HiveMindTestCase.newControl(Class) . | protected void | resetControls() Invokes
org.easymock.MockControl.reset on all controls. | protected void | setReturnValue(Object mock, Object returnValue) Invoked when training a mock object to set the return value for the most recently invoked
method. | protected void | setReturnValue(Object mock, long returnValue) Invoked when training a mock object to set the return value for the most recently invoked
method. | protected void | setReturnValue(Object mock, float returnValue) Invoked when training a mock object to set the return value for the most recently invoked
method. | protected void | setReturnValue(Object mock, double returnValue) Invoked when training a mock object to set the return value for the most recently invoked
method. | protected void | setReturnValue(Object mock, boolean returnValue) Invoked when training a mock object to set the return value for the most recently invoked
method. | protected void | setThrowable(Object mock, Throwable t) Invoked when training a mock object to set the Throwable for the most recently invoked
method. | protected void | tearDown() Removes the appender that may have been setup by
HiveMindTestCase.interceptLogging(String) . | protected static void | unreachable() Called when code should not be reachable (because a test is expected to throw an exception);
throws AssertionFailedError always. | protected void | verifyControls() Invokes
org.easymock.MockControl.verify and
MockControl.reset on all
controls created by
HiveMindTestCase.newControl(Class) . |
_interceptedLoggerName | protected String _interceptedLoggerName(Code) | | |
assertExceptionRegexp | protected void assertExceptionRegexp(Throwable ex, String pattern) throws Exception(Code) | | Checks that the message for an exception matches a regular expression.
|
assertExceptionSubstring | protected void assertExceptionSubstring(Throwable ex, String substring)(Code) | | Checks that the provided substring exists in the exceptions message.
|
assertListsEqual | protected static void assertListsEqual(Object[] expected, Object[] actual)(Code) | | Asserts that the two arrays are equal; same length and all elements equal. Checks the
elements first, then the length.
|
assertLoggedMessage | protected void assertLoggedMessage(String message)(Code) | | Asserts that some capture log event matches the given message exactly.
|
assertLoggedMessage | protected void assertLoggedMessage(String message, List events)(Code) | | Asserts that some capture log event matches the given message exactly.
Parameters: message - to search for; success is finding a logged message contain the parameter as asubstring Parameters: events - from HiveMindTestCase.getInterceptedLogEvents() |
assertLoggedMessagePattern | protected void assertLoggedMessagePattern(String pattern) throws Exception(Code) | | |
assertLoggedMessages | protected void assertLoggedMessages(String[] messages)(Code) | | Checks the messages for all logged events for exact match against the supplied list.
|
buildMinimalRegistry | protected Registry buildMinimalRegistry(Resource l) throws Exception(Code) | | Builds a registry from exactly the provided resource; this registry will not include the
hivemind module.
|
findNestedException | protected Throwable findNestedException(ApplicationRuntimeException ex)(Code) | | Digs down through (potentially) a stack of ApplicationRuntimeExceptions until it reaches the
originating exception, which is returned.
|
getControl | protected MockControl getControl(Object mock)(Code) | | Accesses the control for a previously created mock object. Iterates over the list of managed
controls until one is found whose mock object identity equals the mock object provided.
Parameters: Mock - object whose control is needed the corresponding MockControl if found throws: IllegalArgumentException - if not found since: 1.1 |
getResource | protected Resource getResource(String file)(Code) | | Returns the given file as a
Resource from the classpath. Typically, this is to find
files in the same folder as the invoking class.
|
newLocation | protected Location newLocation()(Code) | | Returns a new
Location instance. The resource is the test class, and the line number
increments by one from one for each invocation (thus each call will get a unique instance not
equal to any previously obtained instance).
since: 1.1 |
resetControls | protected void resetControls()(Code) | | Invokes
org.easymock.MockControl.reset on all controls.
|
setReturnValue | protected void setReturnValue(Object mock, Object returnValue)(Code) | | Invoked when training a mock object to set the return value for the most recently invoked
method. Overrides of this method exist to support a number of primitive types.
Parameters: mock - the mock object being trained Parameters: returnValue - the value to return from the most recently invoked methods since: 1.1 |
setReturnValue | protected void setReturnValue(Object mock, long returnValue)(Code) | | Invoked when training a mock object to set the return value for the most recently invoked
method. Overrides of this method exist to support a number of primitive types.
Parameters: mock - the mock object being trained Parameters: returnValue - the value to return from the most recently invoked methods since: 1.1 |
setReturnValue | protected void setReturnValue(Object mock, float returnValue)(Code) | | Invoked when training a mock object to set the return value for the most recently invoked
method. Overrides of this method exist to support a number of primitive types.
Parameters: mock - the mock object being trained Parameters: returnValue - the value to return from the most recently invoked methods since: 1.1 |
setReturnValue | protected void setReturnValue(Object mock, double returnValue)(Code) | | Invoked when training a mock object to set the return value for the most recently invoked
method. Overrides of this method exist to support a number of primitive types.
Parameters: mock - the mock object being trained Parameters: returnValue - the value to return from the most recently invoked methods since: 1.1 |
setReturnValue | protected void setReturnValue(Object mock, boolean returnValue)(Code) | | Invoked when training a mock object to set the return value for the most recently invoked
method. Overrides of this method exist to support a number of primitive types.
Parameters: mock - the mock object being trained Parameters: returnValue - the value to return from the most recently invoked methods since: 1.1 |
setThrowable | protected void setThrowable(Object mock, Throwable t)(Code) | | Invoked when training a mock object to set the Throwable for the most recently invoked
method.
Parameters: mock - the mock object being trained Parameters: t - the exception the object should throw when it replays since: 1.1 |
unreachable | protected static void unreachable()(Code) | | Called when code should not be reachable (because a test is expected to throw an exception);
throws AssertionFailedError always.
|
|
|