Source Code Cross Referenced for JMSConfigGui.java in  » Testing » jakarta-jmeter » org » apache » jmeter » protocol » jms » control » gui » 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 » jakarta jmeter » org.apache.jmeter.protocol.jms.control.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *   http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         * 
017:         */
018:
019:        package org.apache.jmeter.protocol.jms.control.gui;
020:
021:        import java.awt.BorderLayout;
022:
023:        import javax.swing.BorderFactory;
024:        import javax.swing.Box;
025:        import javax.swing.JCheckBox;
026:        import javax.swing.JComboBox;
027:        import javax.swing.JPanel;
028:
029:        import org.apache.jmeter.config.Arguments;
030:        import org.apache.jmeter.config.gui.ArgumentsPanel;
031:        import org.apache.jmeter.gui.util.HorizontalPanel;
032:        import org.apache.jmeter.protocol.jms.sampler.JMSSampler;
033:        import org.apache.jmeter.testelement.TestElement;
034:        import org.apache.jmeter.util.JMeterUtils;
035:        import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
036:        import org.apache.jorphan.gui.JLabeledChoice;
037:        import org.apache.jorphan.gui.JLabeledTextArea;
038:        import org.apache.jorphan.gui.JLabeledTextField;
039:
040:        /**
041:         * Configuration screen for Java Messaging Point-to-Point requests. <br>
042:         * Created on: October 28, 2004
043:         * 
044:         */
045:        public class JMSConfigGui extends AbstractSamplerGui {
046:
047:            private JLabeledTextField queueuConnectionFactory = new JLabeledTextField(
048:                    JMeterUtils.getResString("jms_queue_connection_factory")); //$NON-NLS-1$
049:
050:            private JLabeledTextField sendQueue = new JLabeledTextField(
051:                    JMeterUtils.getResString("jms_send_queue")); //$NON-NLS-1$
052:
053:            private JLabeledTextField receiveQueue = new JLabeledTextField(
054:                    JMeterUtils.getResString("jms_receive_queue")); //$NON-NLS-1$
055:
056:            private JLabeledTextField timeout = new JLabeledTextField(
057:                    JMeterUtils.getResString("jms_timeout")); //$NON-NLS-1$
058:
059:            private JLabeledTextArea soapXml = new JLabeledTextArea(JMeterUtils
060:                    .getResString("jms_msg_content")); //$NON-NLS-1$
061:
062:            private JLabeledTextField initialContextFactory = new JLabeledTextField(
063:                    JMeterUtils.getResString("jms_initial_context_factory")); //$NON-NLS-1$
064:
065:            private JLabeledTextField providerUrl = new JLabeledTextField(
066:                    JMeterUtils.getResString("jms_provider_url")); //$NON-NLS-1$
067:
068:            private String[] labels = new String[] {
069:                    JMeterUtils.getResString("jms_request"), //$NON-NLS-1$
070:                    JMeterUtils.getResString("jms_requestreply") }; //$NON-NLS-1$
071:
072:            private JLabeledChoice oneWay = new JLabeledChoice(JMeterUtils
073:                    .getResString("jms_communication_style"), labels); //$NON-NLS-1$
074:
075:            private ArgumentsPanel jmsPropertiesPanel;
076:
077:            private ArgumentsPanel jndiPropertiesPanel;
078:
079:            private JCheckBox useNonPersistentDelivery;
080:
081:            public JMSConfigGui() {
082:                init();
083:            }
084:
085:            /**
086:             * Clears all fields.
087:             */
088:            public void clearGui() {// renamed from clear
089:                super .clearGui();
090:                queueuConnectionFactory.setText("");
091:                sendQueue.setText("");
092:                receiveQueue.setText("");
093:                ((JComboBox) oneWay.getComponentList().get(1))
094:                        .setSelectedItem(JMeterUtils
095:                                .getResString("jms_request")); //$NON-NLS-1$
096:                timeout.setText("");
097:                soapXml.setText("");
098:                initialContextFactory.setText("");
099:                providerUrl.setText("");
100:                jmsPropertiesPanel.clear();
101:                jndiPropertiesPanel.clear();
102:            }
103:
104:            public TestElement createTestElement() {
105:                // org.activemq.jndi.ActiveMQInitialContextFactory
106:                // ConfigTestElement element = new ConfigTestElement();
107:                JMSSampler sampler = new JMSSampler();
108:                this .configureTestElement(sampler);
109:                transfer(sampler);
110:                return sampler;
111:            }
112:
113:            private void transfer(JMSSampler element) {
114:                element.setQueueConnectionFactory(queueuConnectionFactory
115:                        .getText());
116:                element.setSendQueue(sendQueue.getText());
117:                element.setReceiveQueue(receiveQueue.getText());
118:
119:                boolean isOneway = oneWay.getText().equals(
120:                        JMeterUtils.getResString("jms_request")); //$NON-NLS-1$
121:                element.setIsOneway(isOneway);
122:
123:                element.setNonPersistent(useNonPersistentDelivery.isSelected());
124:                element.setTimeout(timeout.getText());
125:                element.setContent(soapXml.getText());
126:
127:                element.setInitialContextFactory(initialContextFactory
128:                        .getText());
129:                element.setContextProvider(providerUrl.getText());
130:                Arguments jndiArgs = (Arguments) jndiPropertiesPanel
131:                        .createTestElement();
132:                element.setJNDIProperties(jndiArgs);
133:
134:                Arguments args = (Arguments) jmsPropertiesPanel
135:                        .createTestElement();
136:                element.setJMSProperties(args);
137:
138:            }
139:
140:            /**
141:             * 
142:             * @param element
143:             */
144:            public void modifyTestElement(TestElement element) {
145:                JMSSampler sampler = (JMSSampler) element;
146:                this .configureTestElement(sampler);
147:                transfer(sampler);
148:
149:                /*
150:                 * element.setProperty( JMSSampler.QUEUE_CONNECTION_FACTORY_JNDI,
151:                 * queueuConnectionFactory.getText());
152:                 * element.setProperty(JMSSampler.SEND_QUEUE, sendQueue.getText());
153:                 * element.setProperty(JMSSampler.RECEIVE_QUEUE,
154:                 * receiveQueue.getText());
155:                 * 
156:                 * boolean isOneway =
157:                 * oneWay.getText().equals(JMeterUtils.getResString("jms_request"));
158:                 * element.setProperty(new BooleanProperty(JMSSampler.IS_ONE_WAY,
159:                 * isOneway));
160:                 * 
161:                 * element.setProperty(JMSSampler.TIMEOUT, timeout.getText());
162:                 * element.setProperty(JMSSampler.XML_DATA, soapXml.getText());
163:                 * 
164:                 * element.setProperty( JMSSampler.JNDI_INITIAL_CONTEXT_FACTORY,
165:                 * initialContextFactory.getText());
166:                 * element.setProperty(JMSSampler.JNDI_CONTEXT_PROVIDER_URL,
167:                 * providerUrl.getText()); Arguments jndiArgs = (Arguments)
168:                 * jndiPropertiesPanel.createTestElement(); element.setProperty(new
169:                 * TestElementProperty(JMSSampler.JNDI_PROPERTIES, jndiArgs));
170:                 * 
171:                 * Arguments args = (Arguments) jmsPropertiesPanel.createTestElement();
172:                 * element.setProperty(new
173:                 * TestElementProperty(JMSSampler.JMS_PROPERTIES, args));
174:                 */}
175:
176:            /**
177:             * @param el
178:             */
179:            public void configure(TestElement el) {
180:                super .configure(el);
181:                JMSSampler sampler = (JMSSampler) el;
182:                queueuConnectionFactory.setText(sampler
183:                        .getQueueConnectionFactory());
184:                sendQueue.setText(sampler.getSendQueue());
185:                receiveQueue.setText(sampler.getReceiveQueue());
186:
187:                JComboBox box = (JComboBox) oneWay.getComponentList().get(1);
188:                String selected = null;
189:                if (sampler.isOneway()) {
190:                    selected = JMeterUtils.getResString("jms_request"); //$NON-NLS-1$
191:                } else {
192:                    selected = JMeterUtils.getResString("jms_requestreply"); //$NON-NLS-1$
193:                }
194:                box.setSelectedItem(selected);
195:
196:                useNonPersistentDelivery.setSelected(sampler.isNonPersistent());
197:
198:                timeout.setText(String.valueOf(sampler.getTimeout()));
199:                soapXml.setText(sampler.getContent());
200:                initialContextFactory.setText(sampler
201:                        .getInitialContextFactory());
202:                providerUrl.setText(sampler.getContextProvider());
203:
204:                jmsPropertiesPanel.configure(sampler.getJMSProperties());
205:                // (TestElement)
206:                // el.getProperty(JMSSampler.JMS_PROPERTIES).getObjectValue());
207:
208:                jndiPropertiesPanel.configure(sampler.getJNDIProperties());
209:                // (TestElement)
210:                // el.getProperty(JMSSampler.JNDI_PROPERTIES).getObjectValue());
211:            }
212:
213:            /**
214:             * Initializes the configuration screen.
215:             * 
216:             */
217:            private void init() {
218:                setLayout(new BorderLayout());
219:                setBorder(makeBorder());
220:                add(makeTitlePanel(), BorderLayout.NORTH);
221:
222:                Box mainPanel = Box.createVerticalBox();
223:
224:                JPanel jmsQueueingPanel = new JPanel(new BorderLayout());
225:                jmsQueueingPanel.setBorder(BorderFactory.createTitledBorder(
226:                        BorderFactory.createEtchedBorder(), JMeterUtils
227:                                .getResString("jms_queueing"))); //$NON-NLS-1$
228:
229:                JPanel qcfPanel = new JPanel(new BorderLayout(5, 0));
230:                qcfPanel.add(queueuConnectionFactory, BorderLayout.CENTER);
231:                jmsQueueingPanel.add(qcfPanel, BorderLayout.NORTH);
232:
233:                JPanel sendQueuePanel = new JPanel(new BorderLayout(5, 0));
234:                sendQueuePanel.add(sendQueue);
235:                jmsQueueingPanel.add(sendQueuePanel, BorderLayout.CENTER);
236:
237:                JPanel receiveQueuePanel = new JPanel(new BorderLayout(5, 0));
238:                receiveQueuePanel.add(receiveQueue);
239:                jmsQueueingPanel.add(receiveQueuePanel, BorderLayout.SOUTH);
240:
241:                JPanel jndiPanel = createJNDIPanel();
242:
243:                JPanel messagePanel = new JPanel(new BorderLayout());
244:                messagePanel.setBorder(BorderFactory.createTitledBorder(
245:                        BorderFactory.createEtchedBorder(), JMeterUtils
246:                                .getResString("jms_message_title"))); //$NON-NLS-1$
247:
248:                JPanel messageNorthPanel = new JPanel(new BorderLayout());
249:                JPanel onewayPanel = new JPanel(new BorderLayout());
250:                onewayPanel.add(oneWay);
251:                messageNorthPanel.add(onewayPanel, BorderLayout.NORTH);
252:
253:                useNonPersistentDelivery = new JCheckBox(JMeterUtils
254:                        .getResString("jms_use_non_persistent_delivery"), false); //$NON-NLS-1$
255:
256:                JPanel timeoutPanel = new HorizontalPanel();
257:                timeoutPanel.add(timeout);
258:                timeoutPanel.add(useNonPersistentDelivery);
259:                messageNorthPanel.add(timeoutPanel, BorderLayout.SOUTH);
260:
261:                messagePanel.add(messageNorthPanel, BorderLayout.NORTH);
262:
263:                JPanel soapXmlPanel = new JPanel(new BorderLayout());
264:                soapXmlPanel.add(soapXml);
265:                messagePanel.add(soapXmlPanel, BorderLayout.CENTER);
266:
267:                jmsPropertiesPanel = new ArgumentsPanel(JMeterUtils
268:                        .getResString("jms_props")); //$NON-NLS-1$
269:                messagePanel.add(jmsPropertiesPanel, BorderLayout.SOUTH);
270:
271:                mainPanel.add(jmsQueueingPanel, BorderLayout.NORTH);
272:                mainPanel.add(messagePanel, BorderLayout.CENTER);
273:                mainPanel.add(jndiPanel, BorderLayout.SOUTH);
274:
275:                add(mainPanel, BorderLayout.CENTER);
276:            }
277:
278:            /**
279:             * Creates the panel for the JNDI configuration.
280:             * 
281:             * @return the JNDI Panel
282:             */
283:            private JPanel createJNDIPanel() {
284:                JPanel jndiPanel = new JPanel(new BorderLayout());
285:                jndiPanel.setBorder(BorderFactory.createTitledBorder(
286:                        BorderFactory.createEtchedBorder(), JMeterUtils
287:                                .getResString("jms_jndi_props"))); //$NON-NLS-1$
288:
289:                JPanel contextPanel = new JPanel(new BorderLayout(10, 0));
290:                contextPanel.add(initialContextFactory);
291:                jndiPanel.add(contextPanel, BorderLayout.NORTH);
292:
293:                JPanel providerPanel = new JPanel(new BorderLayout(10, 0));
294:                providerPanel.add(providerUrl);
295:                jndiPanel.add(providerPanel, BorderLayout.SOUTH);
296:
297:                jndiPropertiesPanel = new ArgumentsPanel(JMeterUtils
298:                        .getResString("jms_jndi_props")); //$NON-NLS-1$
299:                jndiPanel.add(jndiPropertiesPanel);
300:                return jndiPanel;
301:            }
302:
303:            public String getLabelResource() {
304:                return "jms_point_to_point"; //$NON-NLS-1$ // TODO - probably wrong
305:            }
306:
307:        }
w_w__w._ja___va2__s__.c___o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.