Java Doc for ComponentKeeperTest.java in  » Inversion-of-Control » carbon » org » sape » carbon » core » component » 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 » carbon » org.sape.carbon.core.component.test 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.sape.carbon.core.component.test.ComponentKeeperTest

ComponentKeeperTest
public class ComponentKeeperTest extends TestCase (Code)
This test case tests all the methods of the ComponentKeeper. It tests to make sure that
  • returned components references remain consistent
  • returned components are in the correct state
  • components are destroyed when requested
  • fetch requests are blocked appropriately when a component is being created
  • the keeper behaves correctly in a multi-threaded environment
  • Copyright 2002 Sapient
    since:
       carbon 1.0
    author:
       Douglas Voet, Febuary 2002
    version:
       $Revision: 1.14 $($Author: ghinkl $ / $Date: 2003/10/16 13:22:00 $)


Field Summary
final public static  ObjectTEST_LOCK
    

Constructor Summary
public  ComponentKeeperTest(String name)
    

Method Summary
protected  voidsetUp()
    
public static  Testsuite()
    
public  voidtestCircularDependency()
     This method tests that components with circular dependancies do not cause deadlocks.
public  voidtestComponentConsistency()
     This method tests that repeated calls the the fetchComponent method returns the same reference.
public  voidtestComponentNotFound()
     This method tests to make sure that a ComponentNotFoundException is thrown when a non-existent component is requested.
public  voidtestComponentState()
     This method tests to make sure that the component returned from the keeper is in the LifecycleStateEnum.RUNNING state.
public  voidtestCreationBlocking()
     Tests to make sure that building a component will block all requests for that component until the component is in either the LifecycleStateEnum.STOPPED or .STARTING states. This test depends on the component being requested taking a long time to load.
public  voidtestCreationNonBlocking()
     Tests to make sure that creating a component does not block the retrieval of other components.
public  voidtestDestroyAllComponents()
     Same as testDestroyComponent, but repeats the test for 2 components to make sure that more than one component is destroyed.
public  voidtestDestroyComponent()
     This test checks 2 things, that fetching a destroyed component will return a new component and that the destroyed component is in the LifecycleStateEnum.DESTROYED state.
public  voidtestFetchComponentA()
     Fetches a component multiple times and makes sure the return references remain consistent.
public  voidtestFetchComponentB()
     Fetches a component multiple times and makes sure the return references remain consistent.
public  voidtestFetchComponentC()
     Fetches a component multiple times and makes sure the return references remain consistent.
public  voidtestFetchDestroyedComponent()
    
public  voidtestNullComponentName()
     This method tests to make sure that an IllegalArgumentException is thrown when null is passed as the requested component name.
public  voidtestReturnedComponentState()
    

Field Detail
TEST_LOCK
final public static Object TEST_LOCK(Code)
Lock object used by test components that need to wait for an extended period of time




Constructor Detail
ComponentKeeperTest
public ComponentKeeperTest(String name)(Code)




Method Detail
setUp
protected void setUp()(Code)
Gets a reference to the keeper for use in all tests



suite
public static Test suite()(Code)
Method called by jUnit to get all the tests in this test case



testCircularDependency
public void testCircularDependency()(Code)
This method tests that components with circular dependancies do not cause deadlocks. It does this by creating 3 components A, B, and C. A depends on B, B depends on C, and C depends on A. This request will be made on a separate thread. If the thread does not complete execution within a reasonable amount of time, the test fails.



testComponentConsistency
public void testComponentConsistency()(Code)
This method tests that repeated calls the the fetchComponent method returns the same reference.



testComponentNotFound
public void testComponentNotFound()(Code)
This method tests to make sure that a ComponentNotFoundException is thrown when a non-existent component is requested.



testComponentState
public void testComponentState()(Code)
This method tests to make sure that the component returned from the keeper is in the LifecycleStateEnum.RUNNING state. This test assumes no other thread is creating the component.



testCreationBlocking
public void testCreationBlocking()(Code)
Tests to make sure that building a component will block all requests for that component until the component is in either the LifecycleStateEnum.STOPPED or .STARTING states. This test depends on the component being requested taking a long time to load. This test makes 2 requests for a component, one on this thread, one on a new one. This thread contains the second request. The second request should complete while the new thread is still alive (i.e. the first request is still being processed). This test fails if the new thread has completed or if the component is not in the LifecycleStateEnum.STOPPED or .STARTING states.



testCreationNonBlocking
public void testCreationNonBlocking()(Code)
Tests to make sure that creating a component does not block the retrieval of other components. This is done by kicking off 2 threads. The first will try to fetch a component that takes a long time to create. The second will fetch a component that is already created. If the second thread completes first, the test is sucessful.



testDestroyAllComponents
public void testDestroyAllComponents()(Code)
Same as testDestroyComponent, but repeats the test for 2 components to make sure that more than one component is destroyed.



testDestroyComponent
public void testDestroyComponent()(Code)
This test checks 2 things, that fetching a destroyed component will return a new component and that the destroyed component is in the LifecycleStateEnum.DESTROYED state.



testFetchComponentA
public void testFetchComponentA()(Code)
Fetches a component multiple times and makes sure the return references remain consistent. This test method is used as part of a multi-threaded test, each thread repeatedly asking for a different component.



testFetchComponentB
public void testFetchComponentB()(Code)
Fetches a component multiple times and makes sure the return references remain consistent. This test method is used as part of a multi-threaded test, each thread repeatedly asking for a different component.



testFetchComponentC
public void testFetchComponentC()(Code)
Fetches a component multiple times and makes sure the return references remain consistent. This test method is used as part of a multi-threaded test, each thread repeatedly asking for a different component.



testFetchDestroyedComponent
public void testFetchDestroyedComponent()(Code)
This method tests to make sure that if a component is destroyed by calling the destroyComponent lifecycle method directly, the next call to fetchComponent will return a new component, not the destroyed one



testNullComponentName
public void testNullComponentName()(Code)
This method tests to make sure that an IllegalArgumentException is thrown when null is passed as the requested component name.



testReturnedComponentState
public void testReturnedComponentState()(Code)



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