Java Doc for HiveMindTestCase.java in  » Inversion-of-Control » hivemind » org » apache » hivemind » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Inversion of Control » hivemind » org.apache.hivemind.test 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

Field Summary
protected  StoreAppender_appender
    
protected  String_interceptedLoggerName
    


Method Summary
protected  voidaddControl(MockControl control)
     Adds the control to the list of managed controls used by HiveMindTestCase.replayControls() and HiveMindTestCase.verifyControls() .
protected  voidassertExceptionRegexp(Throwable ex, String pattern)
     Checks that the message for an exception matches a regular expression.
protected  voidassertExceptionSubstring(Throwable ex, String substring)
     Checks that the provided substring exists in the exceptions message.
protected static  voidassertListsEqual(Object[] expected, List actual)
     Converts the actual list to an array and invokes HiveMindTestCase.assertListsEqual(Object[],Object[]) .
protected static  voidassertListsEqual(Object[] expected, Object[] actual)
     Asserts that the two arrays are equal; same length and all elements equal.
protected  voidassertLoggedMessage(String message)
     Asserts that some capture log event matches the given message exactly.
protected  voidassertLoggedMessage(String message, List events)
     Asserts that some capture log event matches the given message exactly.
protected  voidassertLoggedMessagePattern(String pattern)
    
protected  voidassertLoggedMessagePattern(String pattern, List events)
    
protected  voidassertLoggedMessages(String[] messages)
     Checks the messages for all logged events for exact match against the supplied list.
protected  voidassertRegexp(String pattern, String actual)
    
protected  RegistrybuildFrameworkRegistry(String file)
     Convienience method for invoking HiveMindTestCase.buildFrameworkRegistry(String[]) with only a single file.
protected  RegistrybuildFrameworkRegistry(String[] files)
     Builds a minimal registry, containing only the specified files, plus the master module descriptor (i.e., those visible on the classpath).
protected  RegistrybuildFrameworkRegistry(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  RegistrybuildMinimalRegistry(Resource l)
     Builds a registry from exactly the provided resource; this registry will not include the hivemind module.
protected  LocationfabricateLocation(int line)
    
protected  ThrowablefindNestedException(ApplicationRuntimeException ex)
     Digs down through (potentially) a stack of ApplicationRuntimeExceptions until it reaches the originating exception, which is returned.
protected  ClassResolvergetClassResolver()
     Returns a DefaultClassResolver .
protected  MockControlgetControl(Object mock)
     Accesses the control for a previously created mock object.
protected  ListgetInterceptedLogEvents()
     Gets the list of events most recently intercepted.
protected  ResourcegetResource(String file)
     Returns the given file as a Resource from the classpath.
protected  voidinterceptLogging(String loggerName)
     Sets up an appender to intercept logging for the specified logger.
protected  booleanmatches(String input, String pattern)
    
protected  MockControlnewControl(Class mockClass)
     Creates a managed control via MockControl.createStrictControl(java.lang.Class) .
protected  LocationnewLocation()
     Returns a new Location instance.
protected  ObjectnewMock(Class mockClass)
     Convienience for invoking HiveMindTestCase.newControl(Class) and then invoking MockControl.getMock on the result.
protected  voidreplayControls()
     Invokes MockControl.replay on all controls created by HiveMindTestCase.newControl(Class) .
protected  voidresetControls()
     Invokes org.easymock.MockControl.reset on all controls.
protected  voidsetReturnValue(Object mock, Object returnValue)
     Invoked when training a mock object to set the return value for the most recently invoked method.
protected  voidsetReturnValue(Object mock, long returnValue)
     Invoked when training a mock object to set the return value for the most recently invoked method.
protected  voidsetReturnValue(Object mock, float returnValue)
     Invoked when training a mock object to set the return value for the most recently invoked method.
protected  voidsetReturnValue(Object mock, double returnValue)
     Invoked when training a mock object to set the return value for the most recently invoked method.
protected  voidsetReturnValue(Object mock, boolean returnValue)
     Invoked when training a mock object to set the return value for the most recently invoked method.
protected  voidsetThrowable(Object mock, Throwable t)
     Invoked when training a mock object to set the Throwable for the most recently invoked method.
protected  voidtearDown()
     Removes the appender that may have been setup by HiveMindTestCase.interceptLogging(String) .
protected static  voidunreachable()
     Called when code should not be reachable (because a test is expected to throw an exception); throws AssertionFailedError always.
protected  voidverifyControls()
     Invokes org.easymock.MockControl.verify and MockControl.reset on all controls created by HiveMindTestCase.newControl(Class) .

Field Detail
_appender
protected StoreAppender _appender(Code)



_interceptedLoggerName
protected String _interceptedLoggerName(Code)





Method Detail
addControl
protected void addControl(MockControl control)(Code)
Adds the control to the list of managed controls used by HiveMindTestCase.replayControls() and HiveMindTestCase.verifyControls() .



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, List actual)(Code)
Converts the actual list to an array and invokes HiveMindTestCase.assertListsEqual(Object[],Object[]) .



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)



assertLoggedMessagePattern
protected void assertLoggedMessagePattern(String pattern, List events) throws Exception(Code)



assertLoggedMessages
protected void assertLoggedMessages(String[] messages)(Code)
Checks the messages for all logged events for exact match against the supplied list.



assertRegexp
protected void assertRegexp(String pattern, String actual) throws Exception(Code)



buildFrameworkRegistry
protected Registry buildFrameworkRegistry(String file) throws Exception(Code)
Convienience method for invoking HiveMindTestCase.buildFrameworkRegistry(String[]) with only a single file.



buildFrameworkRegistry
protected Registry buildFrameworkRegistry(String[] files) throws Exception(Code)
Builds a minimal registry, containing only the specified files, plus the master module descriptor (i.e., those visible on the classpath). Files are resolved using HiveMindTestCase.getResource(String) .



buildFrameworkRegistry
protected Registry buildFrameworkRegistry(ModuleDescriptorProvider customProvider)(Code)
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).



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.



fabricateLocation
protected Location fabricateLocation(int line)(Code)
HiveMindTestCase.newLocation()



findNestedException
protected Throwable findNestedException(ApplicationRuntimeException ex)(Code)
Digs down through (potentially) a stack of ApplicationRuntimeExceptions until it reaches the originating exception, which is returned.



getClassResolver
protected ClassResolver getClassResolver()(Code)
Returns a DefaultClassResolver . Repeated calls in the same test return the same value.
since:
   1.1



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



getInterceptedLogEvents
protected List getInterceptedLogEvents()(Code)
Gets the list of events most recently intercepted. This resets the appender, clearing the list of stored events.
See Also:   HiveMindTestCase.interceptLogging(String)



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.



interceptLogging
protected void interceptLogging(String loggerName)(Code)
Sets up an appender to intercept logging for the specified logger. Captured log events can be recovered via HiveMindTestCase.getInterceptedLogEvents() .



matches
protected boolean matches(String input, String pattern) throws Exception(Code)



newControl
protected MockControl newControl(Class mockClass)(Code)
Creates a managed control via MockControl.createStrictControl(java.lang.Class) . The created control is remembered, and will be invoked by HiveMindTestCase.replayControls() , HiveMindTestCase.verifyControls() , etc.

The class to mock may be either an interface or a class. The EasyMock class extension (easymockclassextension-1.1.jar) and CGLIB (cglib-full-2.01.jar) must be present in the latter case (new since 1.1).

This method is not deprecated, but is rarely used; typically HiveMindTestCase.newMock(Class) is used to create the control and the mock, and HiveMindTestCase.setReturnValue(Object,Object) and HiveMindTestCase.setThrowable(Object,Throwable) are used to while training it. HiveMindTestCase.getControl(Object) is used for the rare cases where the MockControl itself is needed.




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



newMock
protected Object newMock(Class mockClass)(Code)
Convienience for invoking HiveMindTestCase.newControl(Class) and then invoking MockControl.getMock on the result.



replayControls
protected void replayControls()(Code)
Invokes MockControl.replay on all controls created by HiveMindTestCase.newControl(Class) .



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



tearDown
protected void tearDown() throws Exception(Code)
Removes the appender that may have been setup by HiveMindTestCase.interceptLogging(String) . Also, invokes org.apache.hivemind.util.PropertyUtils.clearCache .



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.



verifyControls
protected void verifyControls()(Code)
Invokes org.easymock.MockControl.verify and MockControl.reset on all controls created by HiveMindTestCase.newControl(Class) .



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.