Source Code Cross Referenced for DeploymentTest.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » test » deployment » generic » 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 » visualweb.api.designer » org.netbeans.test.deployment.generic 
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:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.test.deployment.generic;
043:
044:        import org.netbeans.jemmy.operators.*;
045:        import org.netbeans.jellytools.TopComponentOperator;
046:        import org.netbeans.junit.NbTestSuite;
047:        import junit.framework.Test;
048:
049:        import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
050:        import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerExplorerOperator;
051:        import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
052:        import org.netbeans.modules.visualweb.gravy.websvc.AddWebServiceOperator;
053:        import org.netbeans.modules.visualweb.gravy.actions.FindAction;
054:        import org.netbeans.modules.visualweb.gravy.model.components.*;
055:        import org.netbeans.modules.visualweb.gravy.model.deployment.*;
056:        import org.netbeans.modules.visualweb.gravy.model.project.*;
057:        import org.netbeans.modules.visualweb.gravy.model.project.components.*;
058:        import org.netbeans.modules.visualweb.gravy.model.*;
059:        import org.netbeans.modules.visualweb.gravy.*;
060:
061:        import javax.swing.tree.TreePath;
062:        import com.meterware.httpunit.*;
063:        import java.awt.event.KeyEvent;
064:        import java.awt.Point;
065:
066:        /**
067:         *
068:         * @author Roman Mostyka
069:         */
070:
071:        public class DeploymentTest extends RaveTestCase {
072:
073:            private ServerNavigatorOperator server;
074:            private JTreeOperator sntree;
075:            private DeploymentAcceptanceTest dat;
076:            private static DeploymentTargetDescriptor dtd;
077:            private static DeploymentTarget dt;
078:            private static ApplicationServer as;
079:            public static String serverType = null;
080:            static String AS_PREF;
081:
082:            /** constructor required by JUnit
083:             * @param testName method name to be used as testcase
084:             */
085:            public DeploymentTest(String testName) {
086:                super (testName);
087:            }
088:
089:            public static Test suite() {
090:                NbTestSuite suite = new NbTestSuite("Deployment Tests");
091:                suite.addTest(new DeploymentTest("testStress"));
092:                suite.addTest(new DeploymentAcceptanceTest(
093:                        "testOpenServerContextMenu"));
094:                suite.addTest(new DeploymentTest("testCloseServerContextMenu"));
095:                suite.addTest(new DeploymentTest(
096:                        "testCorrectnessServerContextMenu"));
097:                suite
098:                        .addTest(new DeploymentTest(
099:                                "testCorrectnessServerContextMenuAfterChangeServerState"));
100:                suite.addTest(new DeploymentTest("testServerLog"));
101:                suite.addTest(new DeploymentTest("testServerProperties"));
102:                suite.addTest(new DeploymentTest(
103:                        "testOpenDeployedComponentsContextMenu"));
104:                suite.addTest(new DeploymentTest(
105:                        "testCloseDeployedComponentsContextMenu"));
106:                suite.addTest(new DeploymentTest(
107:                        "testRefreshDeployedComponents"));
108:                suite
109:                        .addTest(new DeploymentTest(
110:                                "testOpenResourcesContextMenu"));
111:                suite.addTest(new DeploymentTest(
112:                        "testCloseResourcesContextMenu"));
113:                suite.addTest(new DeploymentTest("testResourcesProperties"));
114:                suite.addTest(new DeploymentTest("testDeleteResources"));
115:                suite
116:                        .addTest(new DeploymentTest(
117:                                "testDeleteMultipleResources"));
118:                suite.addTest(new DeploymentAcceptanceTest(
119:                        "testDeploySimpleProject"));
120:                suite.addTest(new DeploymentAcceptanceTest(
121:                        "testRedeploySimpleProject"));
122:                suite.addTest(new DeploymentAcceptanceTest(
123:                        "testOpenApplicationContextMenu"));
124:                suite.addTest(new DeploymentTest(
125:                        "testCloseApplicationContextMenu"));
126:                suite.addTest(new DeploymentTest("testApplicationProperties"));
127:                suite.addTest(new DeploymentTest("testDisableApplication"));
128:                suite.addTest(new DeploymentTest("testEnableApplication"));
129:                suite.addTest(new DeploymentAcceptanceTest(
130:                        "testUndeployApplication"));
131:                suite.addTest(new DeploymentAcceptanceTest(
132:                        "testDeployDBProject"));
133:                suite.addTest(new DeploymentAcceptanceTest(
134:                        "testRedeployDBProject"));
135:                suite.addTest(new DeploymentTest("testDeployWSProject"));
136:                return suite;
137:            }
138:
139:            /** method called before each testcase
140:             */
141:            protected void setUp() {
142:            }
143:
144:            public void testStress() {
145:                dtd = new DeploymentTargetDescriptor();
146:                dtd.load();
147:                if (serverType != null)
148:                    dtd.setProperty(dtd.SERVER_TYPE_KEY, serverType);
149:                dt = IDE.getIDE().addDeploymentTarget(dtd);
150:                as = (ApplicationServer) dt;
151:                AS_PREF = as.getName().replace(' ', '_').replace('.', '_');
152:                for (int i = 0; i < 1; i++) {
153:                    try {
154:                        as.start();
155:                    } catch (Exception e) {
156:                        System.out.println("Exception occured: ");
157:                        e.printStackTrace();
158:                    }
159:                    TestUtils.wait(5000);
160:                    try {
161:                        as.stop();
162:                    } catch (Exception e) {
163:                        System.out.println("Exception occured: ");
164:                        e.printStackTrace();
165:                    }
166:                    TestUtils.wait(5000);
167:                }
168:            }
169:
170:            public void testCloseServerContextMenu() {
171:                server = ServerNavigatorOperator.showNavigatorOperator();
172:                TestUtils.wait(4000);
173:                sntree = server.getTree();
174:                sntree.callPopupOnPath(sntree.findPath(dat.serverFullPath));
175:                TestUtils.wait(1000);
176:                JPopupMenuOperator snpm = new JPopupMenuOperator();
177:                TestUtils.wait(1000);
178:                snpm.pressKey(KeyEvent.VK_ESCAPE);
179:                TestUtils.wait(1000);
180:                try {
181:                    snpm = new JPopupMenuOperator();
182:                    fail("Popup Menu doesn't disappear!");
183:                } catch (Exception e) {
184:                    System.out.println("Exception occured: ");
185:                    e.printStackTrace();
186:                }
187:            }
188:
189:            public void testCorrectnessServerContextMenu() {
190:                server = ServerNavigatorOperator.showNavigatorOperator();
191:                TestUtils.wait(4000);
192:                sntree = server.getTree();
193:                sntree.callPopupOnPath(sntree.findPath(dat.serverFullPath));
194:                TestUtils.wait(3000);
195:                JPopupMenuOperator snpm = new JPopupMenuOperator();
196:                TestUtils.wait(1000);
197:                for (int i = 0; i < as.server_popup.length; i++) {
198:                    try {
199:                        JMenuItemOperator mio = new JMenuItemOperator(snpm,
200:                                as.server_popup[i][0]);
201:                        String state = ((new Boolean(as.server_popup[i][1]))
202:                                .booleanValue()) ? "enabled" : "disabled";
203:                        if (!(new Boolean(mio.isEnabled()).toString()
204:                                .equalsIgnoreCase(as.server_popup[i][1])))
205:                            fail("\"" + as.server_popup[i][0]
206:                                    + "\" item is not " + state + "!");
207:                    } catch (Exception e) {
208:                        fail("\"" + as.server_popup[i][0] + "\" is not exist!");
209:                    }
210:                }
211:                server = ServerNavigatorOperator.showNavigatorOperator();
212:                TestUtils.wait(1000);
213:                sntree = server.getTree();
214:                sntree.selectPath(sntree.findPath(dat.serverFullPath));
215:            }
216:
217:            public void testCorrectnessServerContextMenuAfterChangeServerState() {
218:                as.stop();
219:                TestUtils.wait(15000);
220:                server = ServerNavigatorOperator.showNavigatorOperator();
221:                TestUtils.wait(4000);
222:                sntree = server.getTree();
223:                sntree.callPopupOnPath(sntree.findPath(dat.serverFullPath));
224:                TestUtils.wait(3000);
225:                JPopupMenuOperator snpm = new JPopupMenuOperator();
226:                TestUtils.wait(1000);
227:                for (int i = 0; i < as.server_popup.length; i++) {
228:                    try {
229:                        JMenuItemOperator mio = new JMenuItemOperator(snpm,
230:                                as.server_popup[i][0]);
231:                        String state = ((new Boolean(as.server_popup[i][2]))
232:                                .booleanValue()) ? "enabled" : "disabled";
233:                        if (!(new Boolean(mio.isEnabled()).toString()
234:                                .equalsIgnoreCase(as.server_popup[i][2])))
235:                            fail("\"" + as.server_popup[i][0]
236:                                    + "\" item is not " + state + "!");
237:                    } catch (Exception e) {
238:                        fail("\"" + as.server_popup[i][0] + "\" is not exist!");
239:                    }
240:                }
241:                server = ServerNavigatorOperator.showNavigatorOperator();
242:                TestUtils.wait(1000);
243:                sntree = server.getTree();
244:                sntree.selectPath(sntree.findPath(dat.serverFullPath));
245:            }
246:
247:            public void testServerLog() {
248:                server = ServerNavigatorOperator.showNavigatorOperator();
249:                TestUtils.wait(4000);
250:                sntree = server.getTree();
251:                TestUtils.wait(1000);
252:                try {
253:                    as.start();
254:                } catch (Exception e) {
255:                    System.out.println("Exception occured: ");
256:                    e.printStackTrace();
257:                }
258:                TestUtils.wait(15000);
259:                sntree.callPopupOnPath(sntree.findPath(dat.serverFullPath));
260:                TestUtils.wait(3000);
261:                JPopupMenuOperator snpm = new JPopupMenuOperator();
262:                TestUtils.wait(1000);
263:                new JMenuItemOperator(snpm, as.SERVER_VIEW_LOG).pushNoBlock();
264:                TestUtils.wait(1000);
265:                String serverType = dt.getDescriptor().getProperty(
266:                        dt.getDescriptor().SERVER_TYPE_KEY);
267:                String forMatch = "";
268:                if (serverType.equals(server.STR_NAME_WEBLOGIC))
269:                    forMatch = "WebLogic";
270:                if (serverType.equals(server.STR_NAME_JBOSS))
271:                    forMatch = "JBoss";
272:                if (serverType.equals(server.STR_NAME_APPSERVER))
273:                    forMatch = "Sun Java System Application Server";
274:                if (serverType.equals(server.STR_NAME_TOMCAT50))
275:                    forMatch = "Apache Tomcat/5.0";
276:                if (serverType.equals(server.STR_NAME_TOMCAT55))
277:                    forMatch = "Apache Tomcat/5.5";
278:                if (serverType.equals(server.STR_NAME_TOMCAT60))
279:                    forMatch = "Apache Tomcat/6.0";
280:                TopComponentOperator tcoOutput = new TopComponentOperator(
281:                        "Output");
282:                System.out.println("Output text: "
283:                        + new JEditorPaneOperator(tcoOutput).getText());
284:                if (new JEditorPaneOperator(tcoOutput).getText().indexOf(
285:                        forMatch) == -1)
286:                    fail("Wrong information in Output window! String \""
287:                            + forMatch + "\" is not detected!");
288:                TestUtils.wait(1000);
289:                tcoOutput.close();
290:            }
291:
292:            public void testServerProperties() {
293:                server = ServerNavigatorOperator.showNavigatorOperator();
294:                TestUtils.wait(4000);
295:                sntree = server.getTree();
296:                sntree.callPopupOnPath(sntree.findPath(dat.serverFullPath));
297:                TestUtils.wait(3000);
298:                JPopupMenuOperator snpm = new JPopupMenuOperator();
299:                TestUtils.wait(1000);
300:                new JMenuItemOperator(snpm, as.PROPERTIES, 0).pushNoBlock();
301:                TestUtils.wait(1000);
302:                new JDialogOperator(server.STR_DIALOG_TITLE_SERVER_MANAGER)
303:                        .close();
304:                TestUtils.wait(1000);
305:            }
306:
307:            public void testOpenDeployedComponentsContextMenu() {
308:                server = ServerNavigatorOperator.showNavigatorOperator();
309:                TestUtils.wait(4000);
310:                sntree = server.getTree();
311:                sntree.expandPath(sntree.findPath(dat.serverFullPath));
312:                TestUtils.wait(1000);
313:                sntree.callPopupOnPath(sntree
314:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
315:                                + as.web_applications_path));
316:                TestUtils.wait(1000);
317:                JPopupMenuOperator snpm = new JPopupMenuOperator();
318:                TestUtils.wait(1000);
319:                try {
320:                    new JMenuItemOperator(snpm, as.REFRESH);
321:                } catch (Exception e) {
322:                    fail("Refresh not exist!");
323:                }
324:                server = ServerNavigatorOperator.showNavigatorOperator();
325:                TestUtils.wait(1000);
326:                sntree = server.getTree();
327:                sntree.selectPath(sntree.findPath(dat.serverFullPath));
328:                TestUtils.wait(1000);
329:            }
330:
331:            public void testCloseDeployedComponentsContextMenu() {
332:                server = ServerNavigatorOperator.showNavigatorOperator();
333:                TestUtils.wait(4000);
334:                sntree = server.getTree();
335:                TestUtils.wait(1000);
336:                sntree.callPopupOnPath(sntree
337:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
338:                                + as.web_applications_path));
339:                TestUtils.wait(1000);
340:                JPopupMenuOperator snpm = new JPopupMenuOperator();
341:                TestUtils.wait(1000);
342:                snpm.pressKey(KeyEvent.VK_ESCAPE);
343:                TestUtils.wait(1000);
344:                try {
345:                    snpm = new JPopupMenuOperator();
346:                    fail("Popup Menu doesn't disappear!");
347:                } catch (Exception e) {
348:                }
349:                server = ServerNavigatorOperator.showNavigatorOperator();
350:                TestUtils.wait(1000);
351:                sntree = server.getTree();
352:                sntree.selectPath(sntree.findPath(dat.serverFullPath));
353:                TestUtils.wait(1000);
354:            }
355:
356:            public void testRefreshDeployedComponents() {
357:                server = ServerNavigatorOperator.showNavigatorOperator();
358:                TestUtils.wait(4000);
359:                sntree = server.getTree();
360:                sntree.callPopupOnPath(sntree
361:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
362:                                + as.web_applications_path));
363:                TestUtils.wait(1000);
364:                ProjectDescriptor pd = new ProjectDescriptor(AS_PREF + "_"
365:                        + dat._firstProjectName, dat._projectPath,
366:                        ProjectDescriptor.J2EE14, as.getName());
367:                Project prj = IDE.getIDE().createProject(pd);
368:                prj.run();
369:                server = ServerNavigatorOperator.showNavigatorOperator();
370:                TestUtils.wait(4000);
371:                sntree = server.getTree();
372:                if (as.getName().indexOf("WebLogic") == -1) {
373:                    try {
374:                        sntree.findPath(ServerExplorerOperator.STR_SERVERS_PATH
375:                                + as.web_applications_path + "|" + AS_PREF
376:                                + "_" + dat._firstProjectName);
377:                    } catch (Exception e) {
378:                        fail("Excetion in HTTP check : " + e);
379:                    } finally {
380:                        dat.finishProject(prj, true, true);
381:                    }
382:                } else {
383:                    dat.finishProject(prj, false, true);
384:                }
385:            }
386:
387:            public void testOpenResourcesContextMenu() {
388:                server = ServerNavigatorOperator.showNavigatorOperator();
389:                TestUtils.wait(4000);
390:                sntree = server.getTree();
391:                sntree.expandPath(sntree.findPath(dat.serverFullPath));
392:                TestUtils.wait(1000);
393:                sntree.callPopupOnPath(sntree
394:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
395:                                + as.jdbc_resources_path));
396:                TestUtils.wait(1000);
397:                JPopupMenuOperator snpm = new JPopupMenuOperator();
398:                TestUtils.wait(1000);
399:                try {
400:                    new JMenuItemOperator(snpm, as.REFRESH);
401:                } catch (Exception e) {
402:                    fail("Refresh not exist!");
403:                }
404:                server = ServerNavigatorOperator.showNavigatorOperator();
405:                TestUtils.wait(1000);
406:                sntree = server.getTree();
407:                sntree.selectPath(sntree.findPath(dat.serverFullPath));
408:                TestUtils.wait(1000);
409:            }
410:
411:            public void testCloseResourcesContextMenu() {
412:                server = ServerNavigatorOperator.showNavigatorOperator();
413:                TestUtils.wait(4000);
414:                sntree = server.getTree();
415:                TestUtils.wait(1000);
416:                sntree.callPopupOnPath(sntree
417:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
418:                                + as.jdbc_resources_path));
419:                TestUtils.wait(1000);
420:                JPopupMenuOperator snpm = new JPopupMenuOperator();
421:                TestUtils.wait(1000);
422:                snpm.pressKey(KeyEvent.VK_ESCAPE);
423:                TestUtils.wait(1000);
424:                try {
425:                    snpm = new JPopupMenuOperator();
426:                    fail("Popup Menu doesn't disappear!");
427:                } catch (Exception e) {
428:                }
429:                server = ServerNavigatorOperator.showNavigatorOperator();
430:                TestUtils.wait(1000);
431:                sntree = server.getTree();
432:                sntree.selectPath(sntree.findPath(dat.serverFullPath));
433:                TestUtils.wait(1000);
434:            }
435:
436:            public void testResourcesProperties() {
437:                server = ServerNavigatorOperator.showNavigatorOperator();
438:                TestUtils.wait(4000);
439:                sntree = server.getTree();
440:                sntree.callPopupOnPath(sntree
441:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
442:                                + as.jdbc_resources_path));
443:                TestUtils.wait(1000);
444:                server
445:                        .pushPopup(ServerExplorerOperator.STR_SERVERS_PATH
446:                                + as.jdbc_resources_path + "|jdbc/Test1",
447:                                as.PROPERTIES);
448:                TestUtils.wait(1000);
449:                new JDialogOperator(as.PROPERTIES).close();
450:                TestUtils.wait(1000);
451:            }
452:
453:            public void testDeleteResources() {
454:                server = ServerNavigatorOperator.showNavigatorOperator();
455:                TestUtils.wait(4000);
456:                sntree = server.getTree();
457:                sntree.expandPath(sntree
458:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
459:                                + as.jdbc_resources_path));
460:                TestUtils.wait(1000);
461:                server.pushPopup(ServerExplorerOperator.STR_SERVERS_PATH
462:                        + as.jdbc_resources_path + "|jdbc/Test1",
463:                        dat.deleteResPopup);
464:                TestUtils.wait(1000);
465:                try {
466:                    sntree.findPath(ServerExplorerOperator.STR_SERVERS_PATH
467:                            + as.jdbc_resources_path + "jdbc/Test1");
468:                    fail("Resource is not deleted!");
469:                } catch (Exception e) {
470:                }
471:                TestUtils.wait(1000);
472:            }
473:
474:            public void testDeleteMultipleResources() {
475:                server = ServerNavigatorOperator.showNavigatorOperator();
476:                TestUtils.wait(4000);
477:                sntree = server.getTree();
478:                sntree.expandPath(sntree
479:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
480:                                + as.jdbc_resources_path));
481:                TestUtils.wait(1000);
482:                TreePath[] deleteResource = {
483:                        sntree.findPath(ServerExplorerOperator.STR_SERVERS_PATH
484:                                + as.jdbc_resources_path + "|jdbc/Test2"),
485:                        sntree.findPath(ServerExplorerOperator.STR_SERVERS_PATH
486:                                + as.jdbc_resources_path + "|jdbc/Test3") };
487:                sntree.callPopupOnPaths(deleteResource);
488:                TestUtils.wait(1000);
489:                JPopupMenuOperator snpm = new JPopupMenuOperator();
490:                TestUtils.wait(1000);
491:                new JMenuItemOperator(snpm, dat.deleteResPopup).pushNoBlock();
492:                TestUtils.wait(1000);
493:                try {
494:                    sntree.findPath(ServerExplorerOperator.STR_SERVERS_PATH
495:                            + as.jdbc_resources_path + "jdbc/Test2");
496:                    fail("Resource is not deleted!");
497:                } catch (Exception e) {
498:                }
499:                try {
500:                    sntree.findPath(ServerExplorerOperator.STR_SERVERS_PATH
501:                            + as.jdbc_resources_path + "jdbc/Test3");
502:                    fail("Resource is not deleted!");
503:                } catch (Exception e) {
504:                }
505:                TestUtils.wait(1000);
506:            }
507:
508:            public void testCloseApplicationContextMenu() {
509:                server = ServerNavigatorOperator.showNavigatorOperator();
510:                TestUtils.wait(4000);
511:                sntree = server.getTree();
512:                sntree.callPopupOnPath(sntree
513:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
514:                                + as.web_applications_path + "|" + as.app_pref
515:                                + AS_PREF + "_" + dat._simpleProjectName));
516:                ;
517:                TestUtils.wait(1000);
518:                JPopupMenuOperator snpm = new JPopupMenuOperator();
519:                TestUtils.wait(1000);
520:                snpm.pressKey(KeyEvent.VK_ESCAPE);
521:                TestUtils.wait(1000);
522:                try {
523:                    snpm = new JPopupMenuOperator();
524:                    fail("Popup Menu doesn't disappear!");
525:                } catch (Exception e) {
526:                }
527:                server = ServerNavigatorOperator.showNavigatorOperator();
528:                TestUtils.wait(1000);
529:                sntree = server.getTree();
530:                sntree.selectPath(sntree.findPath(dat.serverFullPath));
531:                TestUtils.wait(1000);
532:            }
533:
534:            public void testApplicationProperties() {
535:                server = ServerNavigatorOperator.showNavigatorOperator();
536:                TestUtils.wait(4000);
537:                sntree = server.getTree();
538:                sntree.expandPath(sntree
539:                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
540:                                + as.web_applications_path));
541:                TestUtils.wait(1000);
542:                server
543:                        .pushPopup(ServerExplorerOperator.STR_SERVERS_PATH
544:                                + as.web_applications_path + "|" + as.app_pref
545:                                + AS_PREF + "_" + dat._simpleProjectName,
546:                                as.PROPERTIES);
547:                TestUtils.wait(1000);
548:                new JDialogOperator(as.PROPERTIES).close();
549:                TestUtils.wait(1000);
550:            }
551:
552:            public void testDisableApplication() {
553:                server = ServerNavigatorOperator.showNavigatorOperator();
554:                TestUtils.wait(4000);
555:                server.pushPopup(ServerExplorerOperator.STR_SERVERS_PATH
556:                        + as.web_applications_path + "|" + as.app_pref
557:                        + AS_PREF + "_" + dat._simpleProjectName,
558:                        as.APPLICATION_DISABLE);
559:                TestUtils.wait(5000);
560:                try {
561:                    WebConversation conversation = new WebConversation();
562:                    WebResponse response = null;
563:                    System.out.println("requestPrefix=" + as.requestPrefix);
564:                    response = conversation.getResponse(as.requestPrefix
565:                            + AS_PREF + "_" + dat._simpleProjectName);
566:                    if (response
567:                            .getText()
568:                            .indexOf(
569:                                    "HTTP Status 503 - This application is not currently available") == -1)
570:                        fail("Application might be not disabled! Exception is not thrown!");
571:                } catch (Exception e) {
572:                    if (e.getClass().getName().equals(
573:                            "com.meterware.httpunit.HttpException")) {
574:                        if (e.toString().indexOf("Error on HTTP request: 503") == -1)
575:                            fail("Wrong response! Application might be not disabled!");
576:                    } else {
577:                        System.out.println("Exception occured: ");
578:                        e.printStackTrace();
579:                        fail("Excetion in HTTP check : " + e);
580:                    }
581:                }
582:                TestUtils.wait(5000);
583:            }
584:
585:            public void testEnableApplication() {
586:                server = ServerNavigatorOperator.showNavigatorOperator();
587:                TestUtils.wait(4000);
588:                server.pushPopup(ServerExplorerOperator.STR_SERVERS_PATH
589:                        + as.web_applications_path + "|" + as.app_pref
590:                        + AS_PREF + "_" + dat._simpleProjectName,
591:                        as.APPLICATION_ENABLE);
592:                TestUtils.wait(5000);
593:                try {
594:                    WebConversation conversation = new WebConversation();
595:                    WebResponse response = null;
596:                    System.out.println("requestPrefix=" + as.requestPrefix);
597:                    response = conversation.getResponse(as.requestPrefix
598:                            + AS_PREF + "_" + dat._simpleProjectName);
599:                } catch (Exception e) {
600:                    if (e.toString().indexOf("Error on HTTP request: 503") != -1)
601:                        fail("Wrong response! Application might be not enabled!");
602:                    System.out.println("Exception occured: ");
603:                    e.printStackTrace();
604:                    fail("Excetion in HTTP check : " + e);
605:                }
606:                TestUtils.wait(5000);
607:            }
608:
609:            public void testDeployWSProject() {
610:                addWebService(dat.wsURL);
611:                as.start();
612:                ProjectDescriptor pd = new ProjectDescriptor(AS_PREF + "_"
613:                        + dat._wsProjectName, dat._projectPath,
614:                        ProjectDescriptor.J2EE14, as.getName());
615:                Project prj = IDE.getIDE().createProject(pd);
616:                TestUtils.disableBrowser(AS_PREF + "_" + dat._wsProjectName,
617:                        true);
618:                TestUtils.wait(1000);
619:                WebPageFolder wpf = prj.getRoot().getWebPageRootFolder();
620:                WebPage wp = wpf.getWebPage("Page1");
621:                VisualComponent vcmp = (VisualComponent) wp.add(
622:                        (WebComponent) IDE.getIDE().getDefaultComponentSet()
623:                                .getComponent(
624:                                        StaticTextComponent.STATIC_TEXT_ID),
625:                        new Point(48, 48));
626:                server = ServerNavigatorOperator.showNavigatorOperator();
627:                TestUtils.wait(4000);
628:                sntree = server.getTree();
629:                server.pushPopup(dat.wsPath + dat.wsName, dat.addToPagePopup);
630:                TestUtils.wait(30000);
631:                DesignerPaneOperator designer = new DesignerPaneOperator(
632:                        RaveWindowOperator.getDefaultRave());
633:                designer.switchToJavaSource();
634:                TestUtils.wait(1000);
635:                EditorOperator editor = new EditorOperator(RaveWindowOperator
636:                        .getDefaultRave(), "Page1.java");
637:                TestUtils.wait(2000);
638:                new FindAction().performShortcut();
639:                TestUtils.wait(500);
640:                JComboBoxOperator jcbo = new JComboBoxOperator(editor);
641:                TestUtils.wait(500);
642:                jcbo.clearText();
643:                TestUtils.wait(500);
644:                jcbo.enterText("prerender() {");
645:                TestUtils.wait(500);
646:                jcbo.pressKey(KeyEvent.VK_ESCAPE);
647:                TestUtils.wait(500);
648:                jcbo.pressKey(KeyEvent.VK_RIGHT);
649:                TestUtils.wait(500);
650:                editor.setCaretPositionToEndOfLine(editor.getLineNumber());
651:                TestUtils.wait(500);
652:                editor.pressKey(KeyEvent.VK_ENTER);
653:                TestUtils.wait(2000);
654:                editor.txtEditorPane().typeText("try {\n");
655:                editor
656:                        .txtEditorPane()
657:                        .typeText(
658:                                "staticText1.setText(USWeatherSoapClient1.getWeatherReport(\"94025\"));\n");
659:                editor.txtEditorPane().typeText("}\n");
660:                editor.txtEditorPane().typeText("catch(Exception e) {");
661:                editor.txtEditorPane().clickForPopup();
662:                JPopupMenuOperator epm = new JPopupMenuOperator();
663:                TestUtils.wait(1000);
664:                new JMenuItemOperator(epm, dat.reformatePopup).push();
665:                TestUtils.wait(2000);
666:                prj.run();
667:                server = ServerNavigatorOperator.showNavigatorOperator();
668:                TestUtils.wait(4000);
669:                sntree = server.getTree();
670:                if (as.getName().indexOf("WebLogic") == -1) {
671:                    server.pushPopup(ServerExplorerOperator.STR_SERVERS_PATH
672:                            + as.web_applications_path, as.REFRESH);
673:                    TestUtils.wait(1000);
674:                    try {
675:                        sntree
676:                                .selectPath(sntree
677:                                        .findPath(ServerExplorerOperator.STR_SERVERS_PATH
678:                                                + as.web_applications_path
679:                                                + "|"
680:                                                + as.app_pref
681:                                                + AS_PREF
682:                                                + "_" + dat._wsProjectName));
683:                    } catch (Exception e) {
684:                        fail("There is no WSProject application in Deployed Components node!");
685:                    }
686:                    TestUtils.wait(1000);
687:                }
688:                try {
689:                    WebConversation conversation = new WebConversation();
690:                    WebResponse response = null;
691:                    System.out.println("requestPrefix=" + as.requestPrefix);
692:                    response = conversation.getResponse(as.requestPrefix
693:                            + AS_PREF + "_" + dat._wsProjectName);
694:                    String verificationString = "Weather";
695:                    if (response.getText().indexOf(verificationString) == -1)
696:                        fail("There is no needed string in response!");
697:                } catch (Exception e) {
698:                    System.out.println("Exception occured: ");
699:                    e.printStackTrace();
700:                    fail("Excetion in HTTP check : " + e);
701:                } finally {
702:                    dat.finishProject(prj, true, true);
703:                    as.stop();
704:                }
705:            }
706:
707:            private void addWebService(String URL) {
708:                server = ServerNavigatorOperator.showNavigatorOperator();
709:                TestUtils.wait(4000);
710:                server.pushPopup(dat.wsPath.substring(0,
711:                        dat.wsPath.length() - 1), dat.popup_addWS);
712:                TestUtils.wait(1000);
713:                AddWebServiceOperator wsOp = new AddWebServiceOperator();
714:                wsOp.addWebService(URL);
715:                TestUtils.wait(2000);
716:            }
717:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.