Source Code Cross Referenced for EjbWsValidation.java in  » IDE-Netbeans » web.core » org » netbeans » modules » ws » qaf » 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 » IDE Netbeans » web.core » org.netbeans.modules.ws.qaf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * If you wish your version of this file to be governed by only the CDDL
025:         * or only the GPL Version 2, indicate your decision by adding
026:         * "[Contributor] elects to include this software in this distribution
027:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
028:         * single choice of license, a recipient has the option to distribute
029:         * your version of this file under either the CDDL, the GPL Version 2 or
030:         * to extend the choice of license to its licensees as provided above.
031:         * However, if you add GPL Version 2 code and therefore, elected the GPL
032:         * Version 2 license, then the option applies only if the new code is
033:         * made subject to such option by the copyright holder.
034:         *
035:         * Contributor(s):
036:         *
037:         * Portions Copyrighted 2007 Sun Microsystems, Inc.
038:         */
039:        package org.netbeans.modules.ws.qaf;
040:
041:        import junit.framework.Test;
042:        import junit.framework.TestSuite;
043:        import junit.textui.TestRunner;
044:        import org.netbeans.jellytools.Bundle;
045:        import org.netbeans.jellytools.EditorOperator;
046:        import org.netbeans.jellytools.NbDialogOperator;
047:        import org.netbeans.jellytools.NewFileNameLocationStepOperator;
048:        import org.netbeans.jellytools.actions.ActionNoBlock;
049:        import org.netbeans.jellytools.nodes.Node;
050:        import org.netbeans.jemmy.JemmyProperties;
051:        import org.netbeans.jemmy.TimeoutExpiredException;
052:        import org.netbeans.jemmy.operators.JButtonOperator;
053:        import org.netbeans.jemmy.operators.JRadioButtonOperator;
054:        import org.netbeans.jemmy.operators.JTreeOperator;
055:        import org.netbeans.junit.NbTestSuite;
056:        import org.netbeans.modules.ws.qaf.WebServicesTestBase.ProjectType;
057:
058:        /**
059:         *
060:         * @author lukas
061:         */
062:        public class EjbWsValidation extends WsValidation {
063:
064:            /** Default constructor.
065:             * @param testName name of particular test case
066:             */
067:            public EjbWsValidation(String name) {
068:                super (name);
069:            }
070:
071:            @Override
072:            protected ProjectType getProjectType() {
073:                return ProjectType.EJB;
074:            }
075:
076:            @Override
077:            protected String getWsProjectName() {
078:                return "WsInEjb"; //NOI18N
079:            }
080:
081:            @Override
082:            protected String getWsClientProjectName() {
083:                return "WsClientInEjb"; //NOI18N
084:            }
085:
086:            @Override
087:            protected String getWsName() {
088:                return "MyEjbWs"; //NOI18N
089:            }
090:
091:            @Override
092:            protected String getWsPackage() {
093:                return "o.n.m.ws.qaf.ws.ejb"; //NOI18N
094:            }
095:
096:            @Override
097:            protected String getWsClientPackage() {
098:                return "o.n.m.ws.qaf.client.ejb"; //NOI18N
099:            }
100:
101:            /** Creates suite from particular test cases. You can define order of testcases here. */
102:            public static TestSuite suite() {
103:                TestSuite suite = new NbTestSuite();
104:                suite.addTest(new EjbWsValidation("testCreateNewWs")); //NOI18N
105:                suite.addTest(new EjbWsValidation("testAddOperation")); //NOI18N
106:                suite.addTest(new EjbWsValidation("testStartServer")); //NOI18N
107:                suite.addTest(new EjbWsValidation("testWsHandlers")); //NOI18N
108:                suite.addTest(new EjbWsValidation("testDeployWsProject")); //NOI18N
109:                suite.addTest(new EjbWsValidation("testCreateWsClient")); //NOI18N
110:                suite.addTest(new EjbWsValidation(
111:                        "testCallWsOperationInSessionEJB")); //NOI18N
112:                suite.addTest(new EjbWsValidation(
113:                        "testCallWsOperationInJavaClass")); //NOI18N
114:                suite.addTest(new EjbWsValidation(
115:                        "testWsFromEJBinClientProject")); //NOI18N
116:                suite.addTest(new EjbWsValidation("testWsClientHandlers")); //NOI18N
117:                suite.addTest(new EjbWsValidation("testDeployWsClientProject")); //NOI18N
118:                suite.addTest(new EjbWsValidation("testUndeployProjects")); //NOI18N
119:                suite.addTest(new EjbWsValidation("testStopServer")); //NOI18N
120:                return suite;
121:            }
122:
123:            /* Method allowing test execution directly from the IDE. */
124:            public static void main(java.lang.String[] args) {
125:                TestRunner.run(suite());
126:            }
127:
128:            public void testWsFromEJBinClientProject() {
129:                String wsName = "WsFromEJB"; //NOI18N
130:                // Web Service
131:                String webServiceLabel = Bundle.getStringTrimmed(
132:                        "org.netbeans.modules.websvc.core.dev.wizard.Bundle",
133:                        "Templates/WebServices/WebService.java");
134:                createNewWSFile(getProject(), webServiceLabel);
135:                NewFileNameLocationStepOperator op = new NewFileNameLocationStepOperator();
136:                op.setObjectName(wsName);
137:                op.setPackage(getWsPackage());
138:                JRadioButtonOperator jrbo = new JRadioButtonOperator(op, 1);
139:                jrbo.setSelected(true);
140:                new JButtonOperator(op, 0).pushNoBlock();
141:                //Browse Enterprise Bean
142:                String browseEjbDlgTitle = Bundle.getStringTrimmed(
143:                        "org.netbeans.modules.websvc.core.dev.wizard.Bundle",
144:                        "LBL_BrowseBean_Title");
145:                NbDialogOperator ndo = new NbDialogOperator(browseEjbDlgTitle);
146:                JTreeOperator jto = new JTreeOperator(ndo);
147:                //Enterprise Beans
148:                String ejbNodeLabel = Bundle.getStringTrimmed(
149:                        "org.netbeans.modules.j2ee.ejbjar.project.ui.Bundle",
150:                        "LBL_node");
151:                Node ejbsNode = new Node(jto, getProjectName() + "|"
152:                        + ejbNodeLabel);
153:                ejbsNode.expand();
154:                new Node(ejbsNode, "NewSession").select();
155:                ndo.ok();
156:                op.finish();
157:                JemmyProperties.setCurrentTimeout(
158:                        "JTreeOperator.WaitNextNodeTimeout", 60000); //NOI18N
159:                Node wsRootNode = new Node(getProjectRootNode(),
160:                        WEB_SERVICES_NODE_NAME);
161:                wsRootNode.expand();
162:                Node wsNode = new Node(wsRootNode, wsName); //NOI18N
163:                wsNode.expand();
164:                JemmyProperties.setCurrentTimeout(
165:                        "JTreeOperator.WaitNextNodeTimeout", 60000); //NOI18N
166:                new Node(wsNode, "myBm"); //NOI18N
167:                assertEquals("Only one operation should be there", 1, wsNode
168:                        .getChildren().length);
169:                EditorOperator eo = new EditorOperator(wsName);
170:                assertTrue(eo.contains("@Stateless"));
171:                assertTrue(eo.contains("@EJB"));
172:                assertTrue(eo.contains("ejbRef"));
173:                assertTrue(eo.contains("@WebMethod"));
174:                assertTrue(eo.contains("myBm"));
175:            }
176:
177:            /**
178:             * Tests Call Web Service Operation action in a servlet
179:             */
180:            public void testCallWsOperationInSessionEJB() {
181:                //create a session bean
182:                String ejbName = "NewSession";
183:                //Enterprise
184:                String enterpriseLabel = Bundle.getStringTrimmed(
185:                        "org.netbeans.modules.j2ee.ejbcore.resources.Bundle",
186:                        "Templates/J2EE");
187:                //Session Bean
188:                String sessionBeanLabel = Bundle
189:                        .getStringTrimmed(
190:                                "org.netbeans.modules.j2ee.ejbcore.ejb.wizard.session.Bundle",
191:                                "Templates/J2EE/Session");
192:                createNewFile(getWsClientProject(), enterpriseLabel,
193:                        sessionBeanLabel);
194:                NewFileNameLocationStepOperator op = new NewFileNameLocationStepOperator();
195:                op.txtObjectName().clearText();
196:                op.txtObjectName().typeText(ejbName);
197:                op.cboPackage().clearText();
198:                op.cboPackage().typeText("org.mycompany.ejbs"); //NOI18N
199:                op.finish();
200:                //Add business method
201:                final EditorOperator eo = new EditorOperator(ejbName); //NOI18N
202:                addBusinessMethod(eo, "myBm", "String"); //NOI18N
203:                //edit code in the EJB
204:                // add new line and select it
205:                eo.setCaretPosition("myBm() {", false); //NOI18N
206:                eo.insert("\n//xxx"); //NOI18N
207:                eo.select("//xxx"); //NOI18N
208:                callWsOperation(eo, "myIntMethod", 16); //NOI18N
209:                assertTrue("@WebServiceRef has not been found", eo
210:                        .contains("@WebServiceRef")); //NOI18N
211:                assertFalse("Lookup present", eo
212:                        .contains(getWsClientLookupCall()));
213:                eo.close(true);
214:            }
215:
216:            protected void addBusinessMethod(EditorOperator eo, String mName,
217:                    String mRetVal) {
218:                //EJB Methods
219:                String actionGroupName = Bundle
220:                        .getStringTrimmed(
221:                                "org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle",
222:                                "LBL_EJBActionGroup");
223:                //Add Business Method...
224:                String actionName = Bundle
225:                        .getStringTrimmed(
226:                                "org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action.Bundle",
227:                                "LBL_AddBusinessMethodAction");
228:                try {
229:                    Thread.sleep(1000);
230:                } catch (InterruptedException ie) {
231:                }
232:                try {
233:                    new ActionNoBlock(null, actionGroupName + "|" + actionName)
234:                            .performPopup(eo);
235:                } catch (TimeoutExpiredException tee) {
236:                    eo.select(16);
237:                    new ActionNoBlock(null, actionGroupName + "|" + actionName)
238:                            .performPopup(eo);
239:                }
240:                addMethod(eo, actionName, mName, mRetVal);
241:            }
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.