Source Code Cross Referenced for TestJBIManagementMessage.java in  » ESB » open-esb » com » sun » jbi » ui » common » 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 » ESB » open esb » com.sun.jbi.ui.common 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)TestJBIManagementMessage.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.ui.common;
030:
031:        import junit.framework.TestCase;
032:        import java.util.Map;
033:        import java.util.HashMap;
034:
035:        /**
036:         * test class
037:         * @author Sun Microsystems, Inc.
038:         */
039:        public class TestJBIManagementMessage extends TestCase {
040:            private static String CANNED_SUCCESS_RESPONSE = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
041:                    + "<jbi-task version=\"1.0\" xmlns=\"http://java.sun.com/xml/ns/jbi/management-message\">"
042:                    + "<jbi-task-result><frmwk-task-result>"
043:                    + "<frmwk-task-result-details>"
044:                    + "<task-result-details>"
045:                    + "<task-id>OPERATION</task-id>"
046:                    + "<task-result>SUCCESS</task-result>"
047:                    + "<message-type>INFO</message-type>"
048:                    + "<task-status-msg>"
049:                    + "<msg-loc-info>"
050:                    + "<loc-token>JBIADMIN011</loc-token>"
051:                    + "<loc-message>Success message.</loc-message>"
052:                    + "<loc-param>Service Assembly</loc-param>"
053:                    + "</msg-loc-info>"
054:                    + "</task-status-msg>"
055:                    + "</task-result-details>"
056:                    + "<locale>en</locale>"
057:                    + "</frmwk-task-result-details>"
058:                    + "</frmwk-task-result></jbi-task-result>" + "</jbi-task>";
059:
060:            private static String CANNED_FAILURE_RESPONSE = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
061:                    + "<jbi-task version=\"1.0\" xmlns=\"http://java.sun.com/xml/ns/jbi/management-message\">"
062:                    + "<jbi-task-result><frmwk-task-result>"
063:                    + "<frmwk-task-result-details>"
064:                    + "<task-result-details>"
065:                    + "<task-id>OPERATION</task-id>"
066:                    + "<task-result>FAILED</task-result>"
067:                    + "<message-type>ERROR</message-type>"
068:                    + "<task-status-msg>"
069:                    + "<msg-loc-info>"
070:                    + "<loc-token>JBIADMIN012</loc-token>"
071:                    + "<loc-message>Failure message.</loc-message>"
072:                    + "<loc-param>Service Assembly</loc-param>"
073:                    + "</msg-loc-info>"
074:                    + "</task-status-msg>"
075:                    + "</task-result-details>"
076:                    + "<locale>en</locale>"
077:                    + "</frmwk-task-result-details>"
078:                    + "</frmwk-task-result></jbi-task-result>" + "</jbi-task>";
079:
080:            private static String CANNED_EXCEPTION_RESPONSE = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
081:                    + "<jbi-task version=\"1.0\" xmlns=\"http://java.sun.com/xml/ns/jbi/management-message\">"
082:                    + "<jbi-task-result><frmwk-task-result>"
083:                    + "<frmwk-task-result-details>"
084:                    + "<task-result-details>"
085:                    + "<task-id>OPERATION</task-id>"
086:                    + "<task-result>FAILED</task-result>"
087:                    + "<message-type>ERROR</message-type>"
088:                    + "<task-status-msg>"
089:                    + "<msg-loc-info>"
090:                    + "<loc-token>JBIADMIN013</loc-token>"
091:                    + "<loc-message>Failure message.</loc-message>"
092:                    + "<loc-param>Service Assembly</loc-param>"
093:                    + "</msg-loc-info>"
094:                    + "</task-status-msg>"
095:                    + "<exception-info>"
096:                    + "<nesting-level>1</nesting-level>"
097:                    + "<msg-loc-info>"
098:                    + "<loc-token>JBIADMIN014</loc-token>"
099:                    + "<loc-message>First Instance Level Exception Message</loc-message>"
100:                    + "</msg-loc-info>"
101:                    + "<stack-trace>First Level Exception Stack Trace</stack-trace>"
102:                    + "</exception-info>"
103:                    + "</task-result-details>"
104:                    + "<locale>en</locale>"
105:                    + "</frmwk-task-result-details>"
106:                    + "</frmwk-task-result></jbi-task-result>" + "</jbi-task>";
107:
108:            /**
109:             * Creates a new instance of TestMgmtMessage
110:             * @param aTestName name
111:             */
112:            public TestJBIManagementMessage(String aTestName) {
113:                super (aTestName);
114:            }
115:
116:            /**
117:             * Test creating a composite management message
118:             * @throws Exception on error
119:             */
120:            public void testCreateJBIManagementMessage() throws Exception {
121:                // Create a response map for two app vars
122:                Map<String, String> responseMap = new HashMap();
123:                responseMap.put("applicationVar1", CANNED_SUCCESS_RESPONSE);
124:                responseMap.put("applicationVar2", CANNED_SUCCESS_RESPONSE);
125:
126:                // Create a management message
127:                JBIManagementMessage msg = JBIManagementMessage
128:                        .createJBIManagementMessage("addApplicationVariables",
129:                                responseMap, false);
130:
131:                assertTrue(msg.isSuccessMsg());
132:                assertTrue(msg.isInfoMsgType());
133:                assertEquals(4, msg.getFrameworkTaskResult()
134:                        .getTaskResultInfo().getStatusMessageInfoList().size());
135:            }
136:
137:            /**
138:             * Test creating a composite management message
139:             * @throws Exception on error
140:             */
141:            public void testCreateJBIManagementMessageWithError()
142:                    throws Exception {
143:                // Create a response map for two app vars
144:                Map<String, String> responseMap = new HashMap();
145:                responseMap.put("applicationVar1", CANNED_SUCCESS_RESPONSE);
146:                responseMap.put("applicationVar2", CANNED_FAILURE_RESPONSE);
147:
148:                // Create a management message
149:                JBIManagementMessage msg = JBIManagementMessage
150:                        .createJBIManagementMessage("addApplicationVariables",
151:                                responseMap, false);
152:
153:                assertTrue(msg.isWarningMsg());
154:                assertEquals(4, msg.getFrameworkTaskResult()
155:                        .getTaskResultInfo().getStatusMessageInfoList().size());
156:            }
157:
158:            /**
159:             * Test creating a composite management message which has a exception info
160:             * @throws Exception on error
161:             */
162:            public void testCreateJBIManagementMessageWithExceptionInfo()
163:                    throws Exception {
164:                // Create a response map for two app vars
165:                Map<String, String> responseMap = new HashMap();
166:                responseMap.put("applicationVar1", CANNED_SUCCESS_RESPONSE);
167:                responseMap.put("applicationVar2", CANNED_FAILURE_RESPONSE);
168:                responseMap.put("applicationVar3", CANNED_EXCEPTION_RESPONSE);
169:
170:                // Create a management message
171:                JBIManagementMessage msg = JBIManagementMessage
172:                        .createJBIManagementMessage("addApplicationVariables",
173:                                responseMap, false);
174:
175:                assertTrue(msg.isWarningMsg());
176:
177:                assertEquals(6, msg.getFrameworkTaskResult()
178:                        .getTaskResultInfo().getStatusMessageInfoList().size());
179:                assertEquals(2, msg.getFrameworkTaskResult()
180:                        .getTaskResultInfo().getExceptionInfoList().size());
181:            }
182:
183:            /**
184:             * Test creating a composite management message with requireAllSuccess=true
185:             * @throws Exception on error
186:             */
187:            public void testCreateJBIManagementMessageWithRequireAllSuccess()
188:                    throws Exception {
189:                // Create a response map for two app vars
190:                Map<String, String> responseMap = new HashMap();
191:                responseMap.put("applicationVar1", CANNED_SUCCESS_RESPONSE);
192:                responseMap.put("applicationVar2", CANNED_FAILURE_RESPONSE);
193:
194:                // Create a management message
195:                JBIManagementMessage msg = JBIManagementMessage
196:                        .createJBIManagementMessage("addApplicationVariables",
197:                                responseMap, true);
198:
199:                assertTrue(msg.isFailedMsg());
200:                assertEquals(4, msg.getFrameworkTaskResult()
201:                        .getTaskResultInfo().getStatusMessageInfoList().size());
202:            }
203:
204:            /**
205:             * Test creating a composite management message with a plain text exception message 
206:             * in the response for one application variable
207:             * @throws Exception on error
208:             */
209:            public void testCreateJBIManagementMessageWithExceptionMessage()
210:                    throws Exception {
211:                // Create a response map for two app vars
212:                Map<String, String> responseMap = new HashMap();
213:                responseMap.put("applicationVar1", CANNED_SUCCESS_RESPONSE);
214:                responseMap.put("applicationVar2",
215:                        "Variable already exists in component");
216:
217:                // Create a management message
218:                JBIManagementMessage msg = JBIManagementMessage
219:                        .createJBIManagementMessage("addApplicationVariables",
220:                                responseMap, false);
221:
222:                assertTrue(msg.isWarningMsg());
223:                assertEquals(4, msg.getFrameworkTaskResult()
224:                        .getTaskResultInfo().getStatusMessageInfoList().size());
225:            }
226:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.