Source Code Cross Referenced for TransmissionManagerWrapper.java in  » Testing » mockrunner-0.4 » com » mockrunner » jms » 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 » Testing » mockrunner 0.4 » com.mockrunner.jms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.mockrunner.jms;
002:
003:        import java.util.ArrayList;
004:        import java.util.List;
005:
006:        import com.mockrunner.mock.jms.MockMessageConsumer;
007:        import com.mockrunner.mock.jms.MockMessageProducer;
008:        import com.mockrunner.mock.jms.MockQueueSender;
009:        import com.mockrunner.mock.jms.MockTopicPublisher;
010:
011:        /**
012:         * A wrapper around {@link QueueTransmissionManager} and
013:         * {@link TopicTransmissionManager} and {@link GenericTransmissionManager}. 
014:         * Can be used to access all senders, publishers, receivers and subscribers
015:         * transparently.
016:         */
017:        public class TransmissionManagerWrapper {
018:            private QueueTransmissionManager queueManager;
019:            private TopicTransmissionManager topicManager;
020:            private GenericTransmissionManager genericManager;
021:
022:            public TransmissionManagerWrapper(
023:                    QueueTransmissionManager queueManager,
024:                    TopicTransmissionManager topicManager,
025:                    GenericTransmissionManager genericManager) {
026:                this .queueManager = queueManager;
027:                this .topicManager = topicManager;
028:                this .genericManager = genericManager;
029:            }
030:
031:            /**
032:             * Returns the underlying {@link QueueTransmissionManager}.
033:             * @return the {@link QueueTransmissionManager}
034:             */
035:            public QueueTransmissionManager getQueueTransmissionManager() {
036:                return queueManager;
037:            }
038:
039:            /**
040:             * Returns the underlying {@link TopicTransmissionManager}.
041:             * @return the {@link TopicTransmissionManager}
042:             */
043:            public TopicTransmissionManager getTopicTransmissionManager() {
044:                return topicManager;
045:            }
046:
047:            /**
048:             * Returns the underlying {@link GenericTransmissionManager}.
049:             * @return the {@link GenericTransmissionManager}
050:             */
051:            public GenericTransmissionManager getGenericTransmissionManager() {
052:                return genericManager;
053:            }
054:
055:            /**
056:             * Returns the {@link com.mockrunner.mock.jms.MockMessageProducer} object
057:             * with the specified index or <code>null</code>, if no such
058:             * {@link com.mockrunner.mock.jms.MockMessageProducer} exists.
059:             * @param index the index
060:             * @return the {@link com.mockrunner.mock.jms.MockMessageProducer} object
061:             */
062:            public MockMessageProducer getMessageProducer(int index) {
063:                List messageProducerList = getMessageProducerList();
064:                if (messageProducerList.size() <= index || index < 0)
065:                    return null;
066:                return (MockMessageProducer) messageProducerList.get(index);
067:            }
068:
069:            /**
070:             * Returns a list of all producer objects.
071:             * @return the list of {@link com.mockrunner.mock.jms.MockMessageProducer} objects
072:             */
073:            public List getMessageProducerList() {
074:                List resultList = new ArrayList();
075:                resultList.addAll(queueManager.getQueueSenderList());
076:                resultList.addAll(topicManager.getTopicPublisherList());
077:                resultList.addAll(genericManager.getMessageProducerList());
078:                return resultList;
079:            }
080:
081:            /**
082:             * Returns a list of all queue senders, i.e. all producer objects, 
083:             * that are an instance of <code>QueueSender</code>. In
084:             * contrast to {@link QueueTransmissionManager#getQueueSenderList},
085:             * this methods also includes the senders that were created without
086:             * specifying an explicit queue (these senders are collected using
087:             * {@link GenericTransmissionManager}).
088:             * @return the list of {@link com.mockrunner.mock.jms.MockQueueSender} objects
089:             */
090:            public List getQueueSenderList() {
091:                List resultList = new ArrayList();
092:                resultList.addAll(queueManager.getQueueSenderList());
093:                List genericList = genericManager.getMessageProducerList();
094:                for (int ii = 0; ii < genericList.size(); ii++) {
095:                    Object next = genericList.get(ii);
096:                    if (next instanceof  MockQueueSender) {
097:                        resultList.add(next);
098:                    }
099:                }
100:                return resultList;
101:            }
102:
103:            /**
104:             * Returns the {@link com.mockrunner.mock.jms.MockQueueSender} object
105:             * with the specified index or <code>null</code>, if no such 
106:             * {@link com.mockrunner.mock.jms.MockQueueSender} exists.
107:             * In contrast to {@link QueueTransmissionManager#getQueueSender},
108:             * this methods also recognizes the senders that were created without
109:             * specifying an explicit queue (these senders are collected using
110:             * {@link GenericTransmissionManager}).
111:             * @param index the index 
112:             * @return the {@link com.mockrunner.mock.jms.MockQueueSender} object 
113:             */
114:            public MockQueueSender getQueueSender(int index) {
115:                List queueSenderList = getQueueSenderList();
116:                if (queueSenderList.size() <= index || index < 0)
117:                    return null;
118:                return (MockQueueSender) queueSenderList.get(index);
119:            }
120:
121:            /**
122:             * Returns a list of all topic publishers, i.e. all producer objects,
123:             * that are an instance of <code>TopicPublisher</code>. In
124:             * contrast to {@link TopicTransmissionManager#getTopicPublisherList},
125:             * this methods also includes the publishers that were created without
126:             * specifying an explicit topic (these publishers are collected using
127:             * {@link GenericTransmissionManager}).
128:             * @return the list of {@link com.mockrunner.mock.jms.MockTopicPublisher} objects
129:             */
130:            public List getTopicPublisherList() {
131:                List resultList = new ArrayList();
132:                resultList.addAll(topicManager.getTopicPublisherList());
133:                List genericList = genericManager.getMessageProducerList();
134:                for (int ii = 0; ii < genericList.size(); ii++) {
135:                    Object next = genericList.get(ii);
136:                    if (next instanceof  MockTopicPublisher) {
137:                        resultList.add(next);
138:                    }
139:                }
140:                return resultList;
141:            }
142:
143:            /**
144:             * Returns the {@link com.mockrunner.mock.jms.MockTopicPublisher} object
145:             * with the specified index or <code>null</code>, if no such
146:             * {@link com.mockrunner.mock.jms.MockTopicPublisher} exists.
147:             * In contrast to {@link TopicTransmissionManager#getTopicPublisher},
148:             * this methods also recognizes the publishers that were created without
149:             * specifying an explicit queue (these publishers are collected using
150:             * {@link GenericTransmissionManager}).
151:             * @param index the index
152:             * @return the {@link com.mockrunner.mock.jms.MockTopicPublisher} object
153:             */
154:            public MockTopicPublisher getTopicPublisher(int index) {
155:                List topicPublisherList = getTopicPublisherList();
156:                if (topicPublisherList.size() <= index || index < 0)
157:                    return null;
158:                return (MockTopicPublisher) topicPublisherList.get(index);
159:            }
160:
161:            /**
162:             * Returns the {@link com.mockrunner.mock.jms.MockMessageConsumer} object
163:             * with the specified index or <code>null</code>, if no such
164:             * {@link com.mockrunner.mock.jms.MockMessageConsumer} exists.
165:             * @param index the index
166:             * @return the {@link com.mockrunner.mock.jms.MockMessageConsumer} object
167:             */
168:            public MockMessageConsumer getMessageConsumer(int index) {
169:                List messageConsumerList = getMessageConsumerList();
170:                if (messageConsumerList.size() <= index || index < 0)
171:                    return null;
172:                return (MockMessageConsumer) messageConsumerList.get(index);
173:            }
174:
175:            /**
176:             * Returns a list of all consumer objects. Includes durable subscribers.
177:             * @return the list of {@link com.mockrunner.mock.jms.MockMessageConsumer} objects
178:             */
179:            public List getMessageConsumerList() {
180:                List resultList = new ArrayList();
181:                resultList.addAll(queueManager.getQueueReceiverList());
182:                resultList.addAll(topicManager.getTopicSubscriberList());
183:                resultList.addAll(topicManager.getDurableTopicSubscriberMap()
184:                        .values());
185:                return resultList;
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.