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


001:        /*
002:         * The contents of this file are subject to the terms
003:         * of the Common Development and Distribution License
004:         * (the License).  You may not use this file except in
005:         * compliance with the License.
006:         *
007:         * You can obtain a copy of the license at
008:         * https://glassfish.dev.java.net/public/CDDLv1.0.html or
009:         * glassfish/bootstrap/legal/CDDLv1.0.txt.
010:         * See the License for the specific language governing
011:         * permissions and limitations under the License.
012:         *
013:         * When distributing Covered Code, include this CDDL
014:         * Header Notice in each file and include the License file
015:         * at glassfish/bootstrap/legal/CDDLv1.0.txt.
016:         * If applicable, add the following below the CDDL Header,
017:         * with the fields enclosed by brackets [] replaced by
018:         * you own identifying information:
019:         * "Portions Copyrighted [year] [name of copyright owner]"
020:         *
021:         * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
022:         */
023:
024:        package com.sun.jbi.jsf.test;
025:
026:        import com.thoughtworks.selenium.*;
027:
028:        import java.util.regex.Pattern;
029:        import junit.framework.TestCase;
030:        import org.testng.annotations.*;
031:
032:        /*  
033:         * Before running the test, please ensure that your Selenium Remote Server
034:         * is up and running. Server can be started using the java -jar selenium-server.jar
035:         */
036:
037:        public class JBITest extends SeleneseTestCase {
038:            private DefaultSelenium selenium;
039:
040:            private static final String ADMINGUI_URL = "http://localhost:4848";
041:            private static final String LOGIN_USERNAME_VALUE = "admin";
042:            private static final String LOGIN_PASSWD_VALUE = "adminadmin";
043:            private static final String JBI_LIB_VALID_SL_ONLY_TEST_ARCHIVE = "valid-sl-only.zip";
044:            private static final String JBI_COMP_BC1_TEST_ARCHIVE = "bc1.zip";
045:            private static final String JBI_COMP_BC2_TEST_ARCHIVE = "bc2.zip";
046:            private static final String JBI_SA_FOR_BC1_BC2_TEST_ARCHIVE = "sa-for-bc1-and-bc2.zip";
047:            private static final String JBI_CORRUPT_ARCHIVE = "corrupted-archive.zip";
048:            private static final String JBI_EMPTY_ARCHIVE = "empty.zip";
049:            private static final String JBI_MISSING_JBI_XML_ARCHIVE = "missing-jbi-xml.zip";
050:            private static final String JBI_NOT_WELL_FORMED_JBI_XML_ARCHIVE = "not-well-formed-jbi-xml.zip";
051:
052:            //For windows testing,	 path has to be in this format
053:            private static String TIMEOUT_PERIOD = "10000";
054:
055:            //Constant IDs of Login Page Components
056:            private final static String LOGIN_PASSWORD_INPUT_ID = "Login.password";
057:            private final static String LOGIN_USERNAME_INPUT_ID = "Login.username";
058:
059:            @BeforeSuite(alwaysRun=true)
060:            private void configure() {
061:                /*Uncomment the following line when chrome url does not work. It will not handle upload use cases well.
062:                Please modify the location of firefox binary on local hard drive before launching the test*/
063:                //selenium = new DefaultSelenium("localhost", 4444, "*firefox //space0/firefox/firefox/firefox-bin", ADMINGUI_URL);
064:                //selenium = new DefaultSelenium("localhost", 4444, "*firefox", ADMINGUI_URL);
065:                /*Uncomment the following line to use secure chrome url and test upload use cases. Please modify the location of firefox binary on your hard-disk*/
066:                //selenium = new DefaultSelenium("localhost", 4444, "*chrome", ADMINGUI_URL);
067:                //Spacify the path in the following way when the firefox binary is not located at default location
068:                selenium = new DefaultSelenium(
069:                        "localhost",
070:                        4444,
071:                        "*chrome /home/pt145033/Priti_data/firefox/firefox/firefox-bin",
072:                        ADMINGUI_URL);
073:
074:                /* Uncomment the line below if you want to run the test on Internet Explorer.*/
075:                //selenium = new DefaultSelenium("localhost", 4444, "*iexplore", ADMINGUI_URL);
076:                selenium.start();
077:                selenium.open(ADMINGUI_URL);
078:            }
079:
080:            // Cleanup the selenium environment
081:            @AfterSuite(alwaysRun=true)
082:            private void stopTest() {
083:                selenium.stop();
084:            }
085:
086:            /*Logs into the console using default username and password before starting all tests*/
087:            //@BeforeSuite(dependsOnMethods = { "configure" })
088:            @BeforeClass(alwaysRun=true)
089:            private void runLogin() {
090:                try {
091:
092:                    selenium
093:                            .type(LOGIN_USERNAME_INPUT_ID, LOGIN_USERNAME_VALUE);
094:                    selenium.type(LOGIN_PASSWORD_INPUT_ID, LOGIN_PASSWD_VALUE);
095:
096:                    //Click the LoginButton
097:                    selenium.click("loginButton");
098:                    selenium.waitForCondition(
099:                            "selenium.browserbot.isNewPageLoaded()",
100:                            TIMEOUT_PERIOD);
101:                } catch (Exception t) {
102:                    t.printStackTrace();
103:                    //ToDo Add Logging statements
104:                    System.out.println("Login failed: " + t.getMessage());
105:                }
106:            }
107:
108:            /*Install Shared Library using the FileCHooser radiobutton*/
109:            @Test(groups={"copySL"})
110:            private void runCopyShareLibraryTest() {
111:                navigateToListPage(JBIIdConstants.JBI_LIBRARY_NODE_ID);
112:                clickNewButton();
113:                copyArchive(
114:                        JBIIdConstants.JBI_LIBRARY_INSTALL_FILECHOOSER_RADIO_ID,
115:                        JBIIdConstants.JBI_LIBRARY_INSTALL_FILECHOOSER_FIELD_ID,
116:                        JBI_LIB_VALID_SL_ONLY_TEST_ARCHIVE,
117:                        JBIIdConstants.JBI_LIBRARY_INSTALL_NEXT_BUTTON_ID);
118:
119:                selenium
120:                        .click(JBIIdConstants.JBI_LIBRARY_INSTALL_FINISH_BUTTON_ID);
121:                selenium
122:                        .waitForCondition(
123:                                "selenium.browserbot.isNewPageLoaded()",
124:                                TIMEOUT_PERIOD);
125:                //Verify that the finish step brought back to the list Shared library page
126:                verifyTrue(selenium
127:                        .isTextPresent("Manage Java Business Integration Shared Libraries"));
128:                verifyTrue(selenium
129:                        .isElementPresent("sharedTableForm:sharedTable:_tableActionsTop:_deselectMultipleButton:_deselectMultipleButton_image"));
130:                verifyTrue(selenium
131:                        .isElementPresent(JBIIdConstants.JBI_NEW_INSTALL_BUTTON_ID));
132:            }
133:
134:            //Install Components/Service Assemblies using non-upload path meant to install local packages
135:            //    public void runCopyComponentServiceAssembly()
136:            //    {
137:            //        runCopyComponent(JBI_COMP_BC1_TEST_ARCHIVE);
138:            //        runCopyComponent(JBI_COMP_BC2_TEST_ARCHIVE);
139:            //        runCopyDeployment(JBI_SA_FOR_BC1_BC2_TEST_ARCHIVE);
140:            //    }
141:
142:            /*Install Component using FileChooser Path for local components*/
143:            @Test(groups={"copyComp"},dataProvider="compInstallationData",dependsOnGroups={"copySL"})
144:            public void runCopyComponentTest(String aCompName) {
145:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
146:                //Choose the second radio button for installing local components
147:                clickNewButton();
148:                copyArchive(
149:                        JBIIdConstants.JBI_COMPONENT_INSTALL_FILECHOOSER_RADIO_ID,
150:                        JBIIdConstants.JBI_COMPONENT_INSTALL_FILECHOOSER_FIELD_ID,
151:                        aCompName,
152:                        JBIIdConstants.JBI_COMPONENT_INSTALL_NEXT_BUTTON_ID);
153:
154:                //Verify that the second step of install wizard has the right heading text and two configuration table presence
155:                selenium
156:                        .click(JBIIdConstants.JBI_COMPONENT_INSTALL_FINISH_BUTTON_ID);
157:            }
158:
159:            /*Deploy Service Assembly using FileChooser path*/
160:            //@Parameters ({"saName"})
161:            //@Test(groups = {"copySA"}, dependsOnMethods = {"runCopyComponent"})
162:            public void runCopyDeploymentTest(String aDeploymentName) {
163:                navigateToListPage(JBIIdConstants.JBI_SERVICE_ASSEMBLY_NODE_ID);
164:                clickNewButton();
165:                copyArchive(
166:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FILECHOOSER_RADIO_ID,
167:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FILECHOOSER_FIELD_ID,
168:                        aDeploymentName,
169:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_NEXT_BUTTON_ID);
170:
171:                selenium
172:                        .click(JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FINISH_BUTTON_ID);
173:                selenium
174:                        .waitForCondition(
175:                                "selenium.browserbot.isNewPageLoaded()",
176:                                TIMEOUT_PERIOD);
177:            }
178:
179:            /********************************************************************/
180:            /*Test invalid archives for shared libary installation using copy path
181:             ********************************************************************/
182:            @Test(groups={"invalidCopySL"})
183:            private void runInvalidArchiveSLTest() {
184:                navigateToListPage(JBIIdConstants.JBI_LIBRARY_NODE_ID);
185:                clickNewButton();
186:                invalidArchiveTest(
187:                        JBIIdConstants.JBI_LIBRARY_INSTALL_FILECHOOSER_RADIO_ID,
188:                        JBIIdConstants.JBI_LIBRARY_INSTALL_FILECHOOSER_FIELD_ID,
189:                        JBIIdConstants.JBI_LIBRARY_INSTALL_NEXT_BUTTON_ID);
190:
191:                /*Testing  Wrong  Archive type and asserting the right alert message is displayed*/
192:                copyArchive(
193:                        JBIIdConstants.JBI_LIBRARY_INSTALL_FILECHOOSER_RADIO_ID,
194:                        JBIIdConstants.JBI_LIBRARY_INSTALL_FILECHOOSER_FIELD_ID,
195:                        JBI_COMP_BC1_TEST_ARCHIVE,
196:                        JBIIdConstants.JBI_LIBRARY_INSTALL_NEXT_BUTTON_ID);
197:
198:                assertTrue(selenium
199:                        .isTextPresent(JBIResourceConstants.JBI_MISMATCHING_ARCHIVE_MSG));
200:
201:                copyArchive(
202:                        JBIIdConstants.JBI_LIBRARY_INSTALL_FILECHOOSER_RADIO_ID,
203:                        JBIIdConstants.JBI_LIBRARY_INSTALL_FILECHOOSER_FIELD_ID,
204:                        JBI_SA_FOR_BC1_BC2_TEST_ARCHIVE,
205:                        JBIIdConstants.JBI_LIBRARY_INSTALL_NEXT_BUTTON_ID);
206:
207:                assertTrue(selenium
208:                        .isTextPresent(JBIResourceConstants.JBI_MISMATCHING_ARCHIVE_MSG));
209:
210:            }
211:
212:            /********************************************************************/
213:
214:            /*Test Installation of Shared Library works using the upload path*/
215:            @Test(groups={"uploadSL"},dependsOnGroups={"invalidCopySL"})
216:            private void runUploadShareLibraryTest() {
217:                navigateToListPage(JBIIdConstants.JBI_LIBRARY_NODE_ID);
218:
219:                //occassionaly the Shared Libraries link is not found and then we need to uncomment 
220:                //following statement
221:                clickNewButton();
222:                installArchiveFirstStep(
223:                        JBIIdConstants.JBI_LIBRARY_INSTALL_UPLOAD_FIELD_ID,
224:                        JBI_LIB_VALID_SL_ONLY_TEST_ARCHIVE,
225:                        JBIIdConstants.JBI_LIBRARY_INSTALL_NEXT_BUTTON_ID);
226:                selenium
227:                        .click(JBIIdConstants.JBI_LIBRARY_INSTALL_FINISH_BUTTON_ID);
228:                selenium
229:                        .waitForCondition(
230:                                "selenium.browserbot.isNewPageLoaded()",
231:                                TIMEOUT_PERIOD);
232:
233:                //Verify that the finish step brought back to the list Shared library page
234:                verifyTrue(selenium
235:                        .isElementPresent(JBIIdConstants.JBI_NEW_INSTALL_BUTTON_ID));
236:            }
237:
238:            /*Uninstall the component after changing its state to shutdown*/
239:            /*This Method installs two binding components manage-binding1, manage-binding2 and  one Deployable archive is  esbadmin00002sa-for-bc1-and-bc2.zip
240:            from admin-gui/test/data directory . respective archives are bc1.zip, bc2.zip and  sa-for-bc1-and-bc2.zip
241:            After component installation this test deploys a Service Assembly esbadmin00002 with two SU's whose target components
242:            are manage-binding1 and manage-binding2. */
243:
244:            //        public void runUploadCompSA() 
245:            //        {
246:            //            runUploadComponent(JBI_COMP_BC1_TEST_ARCHIVE);
247:            //            runUploadComponent(JBI_COMP_BC2_TEST_ARCHIVE);
248:            //            runUploadServiceAssembly(JBI_SA_FOR_BC1_BC2_TEST_ARCHIVE);
249:            //         }
250:
251:            /********************************************************************/
252:            /*Test invalid archives for Component installation using copy path
253:             ************************************Comp********************************/
254:            @Test(groups={"invalidCopyComp"},dependsOnGroups={"uploadSL"})
255:            private void runInvalidArchiveCompTest() {
256:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
257:                clickNewButton();
258:                invalidArchiveTest(
259:                        JBIIdConstants.JBI_COMPONENT_INSTALL_FILECHOOSER_RADIO_ID,
260:                        JBIIdConstants.JBI_COMPONENT_INSTALL_FILECHOOSER_FIELD_ID,
261:                        JBIIdConstants.JBI_COMPONENT_INSTALL_NEXT_BUTTON_ID);
262:
263:                /*Testing  Wrong  Archive type and asserting the right alert message is displayed*/
264:                copyArchive(
265:                        JBIIdConstants.JBI_COMPONENT_INSTALL_FILECHOOSER_RADIO_ID,
266:                        JBIIdConstants.JBI_COMPONENT_INSTALL_FILECHOOSER_FIELD_ID,
267:                        JBI_LIB_VALID_SL_ONLY_TEST_ARCHIVE,
268:                        JBIIdConstants.JBI_COMPONENT_INSTALL_NEXT_BUTTON_ID);
269:                assertTrue(selenium
270:                        .isTextPresent(JBIResourceConstants.JBI_MISMATCHING_ARCHIVE_MSG));
271:
272:                copyArchive(
273:                        JBIIdConstants.JBI_COMPONENT_INSTALL_FILECHOOSER_RADIO_ID,
274:                        JBIIdConstants.JBI_COMPONENT_INSTALL_FILECHOOSER_FIELD_ID,
275:                        JBI_SA_FOR_BC1_BC2_TEST_ARCHIVE,
276:                        JBIIdConstants.JBI_COMPONENT_INSTALL_NEXT_BUTTON_ID);
277:                assertTrue(selenium
278:                        .isTextPresent(JBIResourceConstants.JBI_MISMATCHING_ARCHIVE_MSG));
279:
280:            }
281:
282:            /********************************************************************/
283:
284:            @DataProvider
285:            public Object[][] compInstallationData() {
286:                return new Object[][] {
287:                        new Object[] { JBI_COMP_BC1_TEST_ARCHIVE },
288:                        new Object[] { JBI_COMP_BC2_TEST_ARCHIVE }, };
289:            }
290:
291:            /*Install Component Using Upload Path*/
292:            @Test(groups={"installComp"},dataProvider="compInstallationData",dependsOnGroups={"invalidCopyComp"})
293:            //@Test(groups = { "installComp" }, parameters = { "compName" } )
294:            //@Parameters( value = { "compName" } )
295:            //@Test(groups = { "installComp" } )
296:            public void runUploadComponentTest(String aCompName) {
297:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
298:                clickNewButton();
299:                installArchiveFirstStep(
300:                        JBIIdConstants.JBI_COMPONENT_INSTALL_UPLOAD_FIELD_ID,
301:                        aCompName,
302:                        JBIIdConstants.JBI_COMPONENT_INSTALL_NEXT_BUTTON_ID);
303:
304:                //Verify that the second step of install wizard has the right heading text and two configuration table presence
305:                verifyTrue(selenium
306:                        .isTextPresent(JBIResourceConstants.JBI_COMP_INSTALL_WIZ_STEP2_TITLE));
307:                verifyTrue(selenium
308:                        .isTextPresent(JBIResourceConstants.JBI_COMP_INSTALL_CONF_PROP_TBL_TITLE));
309:                verifyTrue(selenium
310:                        .isTextPresent(JBIResourceConstants.JBI_COMP_INSTALL_PROP_TBL_TITLE));
311:
312:                selenium
313:                        .click(JBIIdConstants.JBI_COMPONENT_INSTALL_FINISH_BUTTON_ID);
314:            }
315:
316:            /********************************************************************/
317:            /*Test invalid archives for Component installation using copy path
318:             ************************************Comp********************************/
319:            @Test(groups={"invalidCopySA"},dependsOnGroups={"installComp"})
320:            private void runInvalidArchiveSATest() {
321:                navigateToListPage(JBIIdConstants.JBI_SERVICE_ASSEMBLY_NODE_ID);
322:                clickNewButton();
323:                invalidArchiveTest(
324:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FILECHOOSER_RADIO_ID,
325:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FILECHOOSER_FIELD_ID,
326:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_NEXT_BUTTON_ID);
327:
328:                /*Testing  Wrong  Archive (Library/Binding Component )type and asserting the right alert
329:                 message is displayed*/
330:                copyArchive(
331:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FILECHOOSER_RADIO_ID,
332:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FILECHOOSER_FIELD_ID,
333:                        JBI_LIB_VALID_SL_ONLY_TEST_ARCHIVE,
334:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_NEXT_BUTTON_ID);
335:                assertTrue(selenium
336:                        .isTextPresent(JBIResourceConstants.JBI_MISMATCHING_ARCHIVE_MSG));
337:
338:                copyArchive(
339:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FILECHOOSER_RADIO_ID,
340:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FILECHOOSER_FIELD_ID,
341:                        JBI_COMP_BC1_TEST_ARCHIVE,
342:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_NEXT_BUTTON_ID);
343:                assertTrue(selenium
344:                        .isTextPresent(JBIResourceConstants.JBI_MISMATCHING_ARCHIVE_MSG));
345:
346:            }
347:
348:            /********************************************************************/
349:
350:            /*Deploy Service Assembly using Upload Path*/
351:            @Parameters({"saName"})
352:            @Test(groups={"deploySA"},dependsOnGroups={"invalidCopySA"})
353:            public void runUploadServiceAssemblyTest(String aDeploymentName) {
354:                navigateToListPage(JBIIdConstants.JBI_SERVICE_ASSEMBLY_NODE_ID);
355:                //Deploy Service Assembly whose SU targets the previously installed two components
356:                //selenium.waitForCondition("selenium.browserbot.isNewPageLoaded()", TIMEOUT_PERIOD);
357:                //selenium.waitForPageToLoad("9000");
358:                clickNewButton();
359:                installArchiveFirstStep(
360:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_UPLOAD_FIELD_ID,
361:                        aDeploymentName,
362:                        JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_NEXT_BUTTON_ID);
363:
364:                verifyTrue(selenium
365:                        .isTextPresent("Deploy JBI Service Assembly (Step 2 of 2)"));
366:                selenium
367:                        .click(JBIIdConstants.JBI_SERVICE_ASSEMBLY_DEPLOY_FINISH_BUTTON_ID);
368:                selenium
369:                        .waitForCondition(
370:                                "selenium.browserbot.isNewPageLoaded()",
371:                                TIMEOUT_PERIOD);
372:                verifyTrue(selenium.isTextPresent("JBI Service Assemblies"));
373:            }
374:
375:            /*Test the Table of the Library page shows up fine and has major components*/
376:            @Test(groups={"listSL"},dependsOnGroups={"deploySA"})
377:            private void runListLibraryTest() {
378:                navigateToListPage(JBIIdConstants.JBI_LIBRARY_NODE_ID);
379:                selenium
380:                        .waitForCondition(
381:                                "selenium.browserbot.isNewPageLoaded()",
382:                                TIMEOUT_PERIOD);
383:
384:                //Verify the presence of Heading, Inline Help Text, Tables Header, Column header and table Select/Deselect All
385:                //Components . Also check Install, Uninstall buttons, Operations DropDown, Filter by State/Type DropDown presence.
386:
387:                //To do: Make Library specific tests
388:                verifyTrue(selenium
389:                        .isTextPresent(JBIResourceConstants.JBI_LIST_LIB_PAGE_TITLE));
390:                verifyTrue(selenium
391:                        .isTextPresent(JBIResourceConstants.JBI_LIST_LIB_PAGE_INLINE_HELP));
392:                verifyTrue(selenium
393:                        .isTextPresent(JBIResourceConstants.JBI_LIST_LIB_TABLE_TITLE_TEXT));
394:                verifyTrue(selenium
395:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_DESC_HEADER));
396:                verifyTrue(selenium
397:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_NAME_HEADER));
398:
399:                verifyTrue(selenium
400:                        .isElementPresent("sharedTableForm:sharedTable:_tableActionsTop:_selectMultipleButton:_selectMultipleButton_image"));
401:                verifyTrue(selenium
402:                        .isElementPresent("sharedTableForm:sharedTable:_tableActionsTop:_deselectMultipleButton:_deselectMultipleButton_image"));
403:                verifyTrue(selenium
404:                        .isElementPresent(JBIIdConstants.JBI_NEW_INSTALL_BUTTON_ID));
405:                verifyTrue(selenium
406:                        .isElementPresent(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID));
407:
408:                selenium.click(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID);
409:
410:                verifyTrue(selenium
411:                        .isElementPresent(JBIIdConstants.JBI_UNINSTALL_BUTTON_ID));
412:            }
413:
414:            /*Test the Table of the Components page shows up fine and has major components*/
415:            @Test(groups={"listComp"},dependsOnGroups={"listSL"})
416:            private void runListComponentTest() {
417:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
418:                selenium
419:                        .waitForCondition(
420:                                "selenium.browserbot.isNewPageLoaded()",
421:                                TIMEOUT_PERIOD);
422:
423:                //Verify the presence of Heading, Inline Help Text, Tables Header, Column header and table Select/Deselect All
424:                //Components . Also check Install, Uninstall buttons, Operations DropDown, Filter by State/Type DropDown presence.
425:
426:                verifyTrue(selenium
427:                        .isTextPresent(JBIResourceConstants.JBI_LIST_COMP_PAGE_TITLE));
428:                verifyTrue(selenium
429:                        .isTextPresent(JBIResourceConstants.JBI_LIST_COMP_PAGE_INLINE_HELP));
430:                verifyTrue(selenium
431:                        .isTextPresent(JBIResourceConstants.JBI_LIST_COMP_TABLE_TITLE_TEXT));
432:                verifyTrue(selenium
433:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_DESC_HEADER));
434:                verifyTrue(selenium
435:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_STATE_HEADER));
436:                verifyTrue(selenium
437:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_TYPE_HEADER));
438:                verifyTrue(selenium
439:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_NAME_HEADER));
440:                verifyTrue(selenium
441:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_ACTION_HEADER));
442:
443:                verifyTrue(selenium
444:                        .isElementPresent("sharedTableForm:sharedTable:_tableActionsTop:_selectMultipleButton:_selectMultipleButton_image"));
445:                verifyTrue(selenium
446:                        .isElementPresent("sharedTableForm:sharedTable:_tableActionsTop:_deselectMultipleButton:_deselectMultipleButton_image"));
447:                verifyTrue(selenium
448:                        .isElementPresent(JBIIdConstants.JBI_NEW_INSTALL_BUTTON_ID));
449:                verifyTrue(selenium
450:                        .isElementPresent("sharedTableForm:sharedTable:topActionsGroup1:filterByComponentStateDropDown_list"));
451:                verifyTrue(selenium
452:                        .isElementPresent("sharedTableForm:sharedTable:topActionsGroup1:filterTypeDropDown_list"));
453:                verifyTrue(selenium
454:                        .isElementPresent(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID));
455:
456:                selenium.click(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID);
457:
458:                verifyTrue(selenium
459:                        .isElementPresent(JBIIdConstants.JBI_UNINSTALL_BUTTON_ID));
460:                verifyTrue(selenium
461:                        .isElementPresent(JBIIdConstants.JBI_OPERATION_DROPDOWN_ID));
462:                selenium
463:                        .click("sharedTableForm:sharedTable:sharedTableRowGroup:sharedNamesTableColumn:_columnHeader:_primarySortButton:_primarySortButton_image");
464:                selenium
465:                        .waitForCondition(
466:                                "selenium.browserbot.isNewPageLoaded()",
467:                                TIMEOUT_PERIOD);
468:            }
469:
470:            /*Test the Table of the Components page shows up fine and has major components*/
471:            @Test(groups={"listServiceAssembly"},dependsOnGroups={"listComp"})
472:            private void runListServiceAssemblyTest() {
473:                navigateToListPage(JBIIdConstants.JBI_SERVICE_ASSEMBLY_NODE_ID);
474:                selenium
475:                        .waitForCondition(
476:                                "selenium.browserbot.isNewPageLoaded()",
477:                                TIMEOUT_PERIOD);
478:
479:                //Verify the presence of Heading, Inline Help Text, Tables Header, Column header and table Select/Deselect All
480:                //Components .
481:
482:                verifyTrue(selenium
483:                        .isTextPresent(JBIResourceConstants.JBI_LIST_SA_PAGE_TITLE));
484:                verifyTrue(selenium
485:                        .isTextPresent(JBIResourceConstants.JBI_LIST_SA_PAGE_INLINE_HELP));
486:                verifyTrue(selenium
487:                        .isTextPresent(JBIResourceConstants.JBI_LIST_SA_TABLE_TITLE_TEXT));
488:                verifyTrue(selenium
489:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_DESC_HEADER));
490:                verifyTrue(selenium
491:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_STATE_HEADER));
492:                verifyTrue(selenium
493:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_NAME_HEADER));
494:
495:                // Also check Install, Uninstall buttons, Operations DropDown, Filter by State/Type DropDown presence.
496:
497:                verifyTrue(selenium
498:                        .isElementPresent("sharedTableForm:sharedTable:_tableActionsTop:_selectMultipleButton:_selectMultipleButton_image"));
499:                verifyTrue(selenium
500:                        .isElementPresent("sharedTableForm:sharedTable:_tableActionsTop:_deselectMultipleButton:_deselectMultipleButton_image"));
501:                verifyTrue(selenium
502:                        .isElementPresent(JBIIdConstants.JBI_NEW_INSTALL_BUTTON_ID));
503:                verifyTrue(selenium
504:                        .isElementPresent("sharedTableForm:sharedTable:topActionsGroup1:filterByAssemblyStateDropDown_list"));
505:                verifyTrue(selenium
506:                        .isElementPresent(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID));
507:
508:                selenium.click(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID);
509:
510:                verifyTrue(selenium
511:                        .isElementPresent(JBIIdConstants.JBI_UNINSTALL_BUTTON_ID));
512:                verifyTrue(selenium
513:                        .isElementPresent(JBIIdConstants.JBI_OPERATION_DROPDOWN_ID));
514:                //selenium.waitForCondition("selenium.browserbot.isNewPageLoaded()", TIMEOUT_PERIOD);
515:            }
516:
517:            /*Test Show pages of Shared Library works and has two tabs (General, Descriptor)*/
518:            @Test(groups={"showSL"},dependsOnGroups={"listServiceAssembly"})
519:            private void runShowShareLibraryTest() {
520:                navigateToListPage(JBIIdConstants.JBI_LIBRARY_NODE_ID);
521:                //occassionaly the Shared Libraries link is not found and then we need to uncomment 
522:                //following statement
523:                clickNameHyperLink();
524:
525:                verifyTrue(selenium
526:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_GENERAL_TAB));
527:                verifyTrue(selenium
528:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_SL_INLINE_HELP));
529:                verifyTrue(selenium.isTextPresent("Description:"));
530:                verifyTrue(selenium
531:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_LIBRARIES_GEN_PAGE_TITLE));
532:
533:                selenium.click(JBIIdConstants.JBI_SHOW_DESCRIPTOR_TAB_ID);
534:                selenium
535:                        .waitForCondition(
536:                                "selenium.browserbot.isNewPageLoaded()",
537:                                TIMEOUT_PERIOD);
538:                verifyTrue(selenium
539:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_DESCRIPTOR_TAB));
540:                verifyTrue(selenium
541:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_DESCRIPTOR_INLINE_HELP));
542:
543:                selenium.click(JBIIdConstants.JBI_SHOW_SL_COMPONENTS_TAB_ID);
544:                selenium
545:                        .waitForCondition(
546:                                "selenium.browserbot.isNewPageLoaded()",
547:                                TIMEOUT_PERIOD);
548:                verifyTrue(selenium
549:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMPONENTS_TAB));
550:                verifyTrue(selenium
551:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_SL_COMP_PAGE_TITLE));
552:                verifyTrue(selenium
553:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_SL_COMP_TABLE_TITLE));
554:                verifyTrue(selenium
555:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_SL_COMP_PAGE_INLINE_HELP));
556:                verifyTrue(selenium
557:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_DESC_HEADER));
558:                verifyTrue(selenium
559:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_TYPE_HEADER));
560:                verifyTrue(selenium
561:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_NAME_HEADER));
562:
563:            }
564:
565:            /*Click Name link in List Components page to see the details of each component 
566:            Verify that Components have 5 tabs */
567:            @Test(groups={"showComp"},dependsOnGroups={"showSL"})
568:            private void runShowComponentTest() {
569:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
570:
571:                //Choose the first elements name which is a hyperlink in the list table.
572:                clickNameHyperLink();
573:
574:                //Verify that the General Tab is the tab open by default
575:                assertTrue(selenium
576:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_GENERAL_TAB));
577:
578:                //Click the Configuration Tab 
579:                selenium.click(JBIIdConstants.JBI_SHOW_CONFIGURATION_TAB_ID);
580:                selenium
581:                        .waitForCondition(
582:                                "selenium.browserbot.isNewPageLoaded()",
583:                                TIMEOUT_PERIOD);
584:                verifyTrue(selenium
585:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_CONFIGURATION_TAB));
586:
587:                //Click the Descriptor Tab
588:                selenium.click(JBIIdConstants.JBI_SHOW_DESCRIPTOR_TAB_ID);
589:                selenium
590:                        .waitForCondition(
591:                                "selenium.browserbot.isNewPageLoaded()",
592:                                TIMEOUT_PERIOD);
593:                assertTrue(selenium
594:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_DESCRIPTOR_TAB));
595:
596:                //Click the Loggers Tab and check for the presence of Load Deafults and Save Button
597:                selenium.click(JBIIdConstants.JBI_SHOW_LOGGERS_TAB_ID);
598:                selenium
599:                        .waitForCondition(
600:                                "selenium.browserbot.isNewPageLoaded()",
601:                                TIMEOUT_PERIOD);
602:                assertTrue(selenium
603:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_LOGGERS_TAB));
604:
605:                verifyTrue(selenium
606:                        .isElementPresent(JBIIdConstants.JBI_SHOW_LOAD_DEFAULTS_BUTTON_ID));
607:                verifyTrue(selenium
608:                        .isElementPresent(JBIIdConstants.JBI_SHOW_SAVE_BUTTON_ID));
609:
610:                //Click Monitoring Tab and check for presence of Tables n Columns
611:                selenium.click(JBIIdConstants.JBI_SHOW_MONITORING_TAB_ID);
612:                selenium
613:                        .waitForCondition(
614:                                "selenium.browserbot.isNewPageLoaded()",
615:                                TIMEOUT_PERIOD);
616:                assertTrue(selenium
617:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_MONITORING_TAB));
618:                verifyTrue(selenium
619:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_MONITORING_PAGE_TITLE));
620:                verifyTrue(selenium
621:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_MONITORING_PAGE_INLINE_HELP));
622:                verifyTrue(selenium
623:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_MONITORING_TABLE_TITLE));
624:                verifyTrue(selenium
625:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_MONITORING_TBL_ENDP));
626:                verifyTrue(selenium
627:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_MONITORING_TBL_PRO_ENDP));
628:                verifyTrue(selenium
629:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_MONITORING_TBL_CONS_ENDP));
630:                verifyTrue(selenium
631:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_MONITORING_TBL_TTL));
632:
633:                //Click Libraries Tab and check for presence of Tables n Columns
634:                selenium.click(JBIIdConstants.JBI_SHOW_COMP_LIBRARIES_TAB_ID);
635:                selenium
636:                        .waitForCondition(
637:                                "selenium.browserbot.isNewPageLoaded()",
638:                                TIMEOUT_PERIOD);
639:                assertTrue(selenium
640:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_LIBRARIES_TAB));
641:                verifyTrue(selenium
642:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_LIBRARIES_PAGE_TITLE));
643:                verifyTrue(selenium
644:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_LIBRARIES_INLINE_HELP));
645:                verifyTrue(selenium
646:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_COMP_LIBRARIES_TABLE_TITLE));
647:
648:            }
649:
650:            /*Tests the show detail pages of Service Assemblies in developer-profile */
651:            @Test(groups={"showSA"},dependsOnGroups={"showComp"})
652:            private void runShowDeploymentTest() {
653:                //Testing JBI Deployments Show pages which have 2 tabs General and Descriptor tab
654:                navigateToListPage(JBIIdConstants.JBI_SERVICE_ASSEMBLY_NODE_ID);
655:                //Check the presence of 2 tabs in the Show Deployments page
656:                //selenium.waitForCondition("selenium.browserbot.isNewPageLoaded()", "1000");
657:
658:                //Click the name of the first element in the Service assembly list table which is a hyperlink
659:                clickNameHyperLink();
660:
661:                //Check whether the first and default page is General tab
662:                assertTrue(selenium
663:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_GENERAL_TAB));
664:                assertTrue(selenium
665:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_SA_INLINE_HELP));
666:                //Check for the presence of the SErvice Units Table
667:                assertTrue(selenium
668:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_SA_GENERAL_SU_TABLE_TITLE));
669:                assertTrue(selenium
670:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_NAME_HEADER));
671:                assertTrue(selenium
672:                        .isTextPresent(JBIResourceConstants.JBI_LIST_TABLE_DESC_HEADER));
673:
674:                //Click the Descriptor tab and verify the inline Help's contents
675:                selenium.click(JBIIdConstants.JBI_SHOW_DESCRIPTOR_TAB_ID);
676:                selenium
677:                        .waitForCondition(
678:                                "selenium.browserbot.isNewPageLoaded()",
679:                                TIMEOUT_PERIOD);
680:                assertTrue(selenium
681:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_DESCRIPTOR_TAB));
682:                assertTrue(selenium
683:                        .isTextPresent(JBIResourceConstants.JBI_SHOW_DESCRIPTOR_INLINE_HELP));
684:                //checkForVerificationErrors();
685:            }
686:
687:            /****Filter Listed Components by Binding then Engine. 
688:             This test needs at least one Binding Component and one Service Engine to pass****/
689:            @Test(groups={"filterComp"},dependsOnGroups={"showSA"})
690:            private void runFilterComponents() {
691:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
692:                selenium
693:                        .waitForCondition(
694:                                "selenium.browserbot.isNewPageLoaded()",
695:                                TIMEOUT_PERIOD);
696:                selectDropDownNoCBAndVerifyResult(
697:                        JBIIdConstants.JBI_COMPONENT_FILTER_DROPDOWN_ID,
698:                        JBIResourceConstants.JBI_LIST_BC_TYPE_TEXT,
699:                        JBIResourceConstants.JBI_LIST_BC_TYPE_TEXT,
700:                        JBIIdConstants.JBI_COMPONENT_LIST_PAGE_FIRST_BC_TYPE_ID);
701:
702:                selectDropDownNoCBAndVerifyResult(
703:                        JBIIdConstants.JBI_COMPONENT_FILTER_DROPDOWN_ID,
704:                        JBIResourceConstants.JBI_LIST_SE_TYPE_TEXT,
705:                        JBIResourceConstants.JBI_LIST_SE_TYPE_TEXT,
706:                        JBIIdConstants.JBI_COMPONENT_LIST_PAGE_FIRST_SE_TYPE_ID);
707:            }
708:
709:            /******Operate on the component : Tested transitions
710:            a) Start->Stop->Shutdown->Start
711:            b) Start->Shutdown->Start
712:            c) Start->Stop->Start
713:            d) Start->Stop->Shutdown->Stop->Start*******/
714:
715:            @Test(groups={"operateComp"},dependsOnGroups={"filterComp"})
716:            private void runOperateComponentTest() {
717:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
718:                selenium
719:                        .waitForCondition(
720:                                "selenium.browserbot.isNewPageLoaded()",
721:                                TIMEOUT_PERIOD);
722:
723:                operate("Start",
724:                        JBIResourceConstants.JBI_OPERATION_STARTED_STATE);
725:                operate("Stop",
726:                        JBIResourceConstants.JBI_OPERATION_STOPPED_STATE);
727:                operate("Shut Down",
728:                        JBIResourceConstants.JBI_OPERATION_SHUTDOWN_STATE);
729:                operate("Start",
730:                        JBIResourceConstants.JBI_OPERATION_STARTED_STATE);
731:                operate("Shut Down",
732:                        JBIResourceConstants.JBI_OPERATION_SHUTDOWN_STATE);
733:                operate("Stop",
734:                        JBIResourceConstants.JBI_OPERATION_STOPPED_STATE);
735:                operate("Shut Down",
736:                        JBIResourceConstants.JBI_OPERATION_SHUTDOWN_STATE);
737:                operate("Stop",
738:                        JBIResourceConstants.JBI_OPERATION_STOPPED_STATE);
739:                operate("Start",
740:                        JBIResourceConstants.JBI_OPERATION_STARTED_STATE);
741:            }
742:
743:            /******Operate the service assembly : Tested transitions
744:             *a) Start->Stop->Shutdown->Start
745:             *b) Start->Stop->Start
746:             *c) Start->Shutdown->Start
747:             */
748:
749:            @Test(groups={"operateSA"},dependsOnGroups={"operateComp"})
750:            private void runOperateServiceAssemblyTest() {
751:                //Testing JBI Deployments lifecycle operations 
752:                navigateToListPage(JBIIdConstants.JBI_SERVICE_ASSEMBLY_NODE_ID);
753:                //Stop/Shutdown the Service Assembly 
754:                selenium
755:                        .waitForCondition(
756:                                "selenium.browserbot.isNewPageLoaded()",
757:                                TIMEOUT_PERIOD);
758:                operate("Start",
759:                        JBIResourceConstants.JBI_OPERATION_STARTED_STATE);
760:                operate("Stop",
761:                        JBIResourceConstants.JBI_OPERATION_STOPPED_STATE);
762:                operate("Shut Down",
763:                        JBIResourceConstants.JBI_OPERATION_SHUTDOWN_STATE);
764:                operate("Start",
765:                        JBIResourceConstants.JBI_OPERATION_STARTED_STATE);
766:                operate("Stop",
767:                        JBIResourceConstants.JBI_OPERATION_STOPPED_STATE);
768:                operate("Start",
769:                        JBIResourceConstants.JBI_OPERATION_STARTED_STATE);
770:                operate("Shut Down",
771:                        JBIResourceConstants.JBI_OPERATION_SHUTDOWN_STATE);
772:
773:                //            Expected to Fail            
774:                //            selectDropDownAndVerifyResult(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID,
775:                //                    JBIIdConstants.JBI_OPERATION_DROPDOWN_ID, 
776:                //                   "Stop",
777:                //                    JBIResourceConstants.JBI_OPERATION_STOPPED_STATE,
778:                //                    JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_STATE_ID);
779:                operate("Start",
780:                        JBIResourceConstants.JBI_OPERATION_STARTED_STATE);
781:            }
782:
783:            /*Tests Uninstallation of JBI Shared Library works */
784:            @Test(groups={"uninstallSL"},dependsOnGroups={"operateSA"})
785:            private void runUninstallShareLibrary() {
786:                navigateToListPage(JBIIdConstants.JBI_LIBRARY_NODE_ID);
787:                selenium
788:                        .waitForCondition(
789:                                "selenium.browserbot.isNewPageLoaded()",
790:                                TIMEOUT_PERIOD);
791:                //Assuming that first element is Sun Wsdl library and second is valid-sl-only 
792:                //selecting the second element in the table for uninstallation
793:                uninstallCheckedElement(JBIIdConstants.JBI_LIST_PAGE_SECOND_ELEM_CB_ID);
794:            }
795:
796:            /*Uninstall Component*/
797:            //This test cannot pass if the first component has a dependenet Service Assembly deployed to it
798:            //@Test(groups = {"uninstallComp"}, dependsOnGroups = {"uninstallSL"})
799:            private void runUninstallComponent() {
800:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
801:
802:                //Choose the components for uninstallation. 
803:                selenium
804:                        .waitForCondition(
805:                                "selenium.browserbot.isNewPageLoaded()",
806:                                TIMEOUT_PERIOD);
807:
808:                //Change the state of the components to shutdown, as components in started state cannot be uninstalled
809:                changeStateUninstall();
810:
811:                //Verify that after uninstallation the user is still on the list components page
812:                verifyTrue(selenium
813:                        .isElementPresent(JBIIdConstants.JBI_NEW_INSTALL_BUTTON_ID));
814:            }
815:
816:            /*Tests uninstallation of SA and components. Service Assembly and components  have to be in shutdown
817:            state before uninstalling. This tests change their states to shutdown before deleting them*/
818:            @Test(groups={"undeploySA"},dependsOnGroups={"uninstallSL"})
819:            private void runUndeploySATest() {
820:                navigateToListPage(JBIIdConstants.JBI_SERVICE_ASSEMBLY_NODE_ID);
821:
822:                //Select the first element in the Service Assembly table . Assuming that this is the only installed
823:                //SA and in shutdown state.
824:                selenium
825:                        .waitForCondition(
826:                                "selenium.browserbot.isNewPageLoaded()",
827:                                TIMEOUT_PERIOD);
828:                changeStateUninstall();
829:
830:                //Choose the components for uninstallation. 
831:                navigateToListPage(JBIIdConstants.JBI_COMPONENT_NODE_ID);
832:                selenium
833:                        .waitForCondition(
834:                                "selenium.browserbot.isNewPageLoaded()",
835:                                TIMEOUT_PERIOD);
836:
837:                //Change the state of the components to shutdown, as components in started state cannot be uninstalled
838:                changeStateUninstall();
839:                changeStateUninstall();
840:
841:                //Verify that after uninstallation the user is still on the list components page
842:                verifyTrue(selenium
843:                        .isElementPresent(JBIIdConstants.JBI_NEW_INSTALL_BUTTON_ID));
844:            }
845:
846:            /************************************************************************/
847:            /*****************Common Functions***************************************/
848:            /************************************************************************/
849:
850:            private void operate(String aOperateId, String aExpectedStateId) {
851:                selectDropDownAndVerifyResult(
852:                        JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID,
853:                        JBIIdConstants.JBI_OPERATION_DROPDOWN_ID, aOperateId,
854:                        aExpectedStateId,
855:                        JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_STATE_ID);
856:            }
857:
858:            private void invalidArchiveTest(String aRadioId, String aFieldId,
859:                    String aNextBtnId) {
860:
861:                /*Testing No Archive and asserting the right alert message shows up*/
862:                copyArchive(aRadioId, aFieldId, "", aNextBtnId);
863:                assertTrue(selenium
864:                        .isTextPresent(JBIResourceConstants.JBI_NO_ARCHIVE_MSG));
865:
866:                /*Testing Empty Archive and asserting the right alert message shows up*/
867:                copyArchive(aRadioId, aFieldId, JBI_EMPTY_ARCHIVE, aNextBtnId);
868:                assertTrue(selenium
869:                        .isTextPresent(JBIResourceConstants.JBI_EMPTY_ARCHIVE_MSG));
870:
871:                /*Testing Corrupted Archive and asserting the right alert message is displayed*/
872:                copyArchive(aRadioId, aFieldId, JBI_CORRUPT_ARCHIVE, aNextBtnId);
873:                assertTrue(selenium
874:                        .isTextPresent(JBIResourceConstants.JBI_CORRUPT_ARCHIVE_MSG));
875:
876:                /*Testing Not well formed JBI Xml Archive and asserting the right alert message is displayed*/
877:                copyArchive(aRadioId, aFieldId,
878:                        JBI_NOT_WELL_FORMED_JBI_XML_ARCHIVE, aNextBtnId);
879:                assertTrue(selenium
880:                        .isTextPresent(JBIResourceConstants.JBI_NOT_WELL_FORMED_JBI_XML_ARCHIVE_MSG));
881:
882:                /*Testing  Missing JBI XML Archive and asserting the right alert message is displayed*/
883:                copyArchive(aRadioId, aFieldId, JBI_MISSING_JBI_XML_ARCHIVE,
884:                        aNextBtnId);
885:                assertTrue(selenium
886:                        .isTextPresent(JBIResourceConstants.JBI_MISSING_JBI_XML_ARCHIVE_MSG));
887:            }
888:
889:            /*Method to get the test data archive path , tested on windows*/
890:            private String getTestFilePath(String aArchiveName) {
891:                java.io.File f = new java.io.File("data", aArchiveName);
892:                String result = f.getAbsolutePath();
893:                return result;
894:            }
895:
896:            /*Navigate to the page whose Id is passed*/
897:            private void navigateToListPage(String aPageId) {
898:                selenium.selectFrame("relative=up");
899:                selenium.selectFrame("index");
900:                selenium.click(aPageId);
901:                selenium.selectFrame("relative=up");
902:                selenium.selectFrame("main");
903:            }
904:
905:            /*Click the Install/Deply Button From List Page*/
906:            private void clickNewButton() {
907:                selenium
908:                        .waitForCondition(
909:                                "selenium.browserbot.isNewPageLoaded()",
910:                                TIMEOUT_PERIOD);
911:                selenium.click(JBIIdConstants.JBI_NEW_INSTALL_BUTTON_ID);
912:                selenium
913:                        .waitForCondition(
914:                                "selenium.browserbot.isNewPageLoaded()",
915:                                TIMEOUT_PERIOD);
916:            }
917:
918:            /*Try Installing passed Empty archive at the passed text field in installation wizard*/
919:            private void copyArchive(String aRadioId, String aTextFieldId,
920:                    String aArchiveId, String aButtonId) {
921:                selenium.click(aRadioId);
922:                installArchiveFirstStep(aTextFieldId, aArchiveId, aButtonId);
923:            }
924:
925:            private void installArchiveFirstStep(String aTextFieldId,
926:                    String aArchiveId, String aButtonId) {
927:                selenium.type(aTextFieldId, getTestFilePath(aArchiveId));
928:                selenium.click(aButtonId);
929:                selenium
930:                        .waitForCondition(
931:                                "selenium.browserbot.isNewPageLoaded()",
932:                                TIMEOUT_PERIOD);
933:            }
934:
935:            /*Click the Name hyperlink in first Row of List Tables */
936:            private void clickNameHyperLink() {
937:                selenium
938:                        .waitForCondition(
939:                                "selenium.browserbot.isNewPageLoaded()",
940:                                TIMEOUT_PERIOD);
941:                selenium
942:                        .click(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_NAME_LINK_ID);
943:                selenium
944:                        .waitForCondition(
945:                                "selenium.browserbot.isNewPageLoaded()",
946:                                TIMEOUT_PERIOD);
947:            }
948:
949:            /*Select a value from DropDown after checking one row and verify the Expected Result */
950:            private void selectDropDownAndVerifyResult(String aCheckBoxId, //Which row is to be targeted
951:                    String aDropDownComponentId, //Dropdown component's id
952:                    String aLabelVal, //Which label to chose
953:                    String aExpectedValue, //What is the final expected value
954:                    String aTargetCompId) //Which components value is expected to change
955:            {
956:                selenium.click(aCheckBoxId);
957:                selectDropDownNoCBAndVerifyResult(aDropDownComponentId,
958:                        aLabelVal, aExpectedValue, aTargetCompId);
959:            }
960:
961:            /*Select a value from DropDown without checking any row and verify the Expected Result */
962:            private void selectDropDownNoCBAndVerifyResult(
963:                    String aDropDownComponentId, //Dropdown component's id
964:                    String aLabelVal, //Which label to chose
965:                    String aExpectedValue, //What is the final expected value
966:                    String aTargetCompId) //Which components value is expected to change
967:            {
968:                String selectIndex = "label=" + aLabelVal;
969:                selenium.select(aDropDownComponentId, selectIndex);
970:                selenium
971:                        .waitForCondition(
972:                                "selenium.browserbot.isNewPageLoaded()",
973:                                TIMEOUT_PERIOD);
974:                verifyEquals(aExpectedValue, selenium.getText(aTargetCompId));
975:            }
976:
977:            private void changeStateUninstall() {
978:                operate("Shut Down",
979:                        JBIResourceConstants.JBI_OPERATION_SHUTDOWN_STATE);
980:                uninstallCheckedElement(JBIIdConstants.JBI_LIST_PAGE_FIRST_ELEM_CB_ID);
981:            }
982:
983:            /*Click the Uninstall button after selecting passed checbox in the list page*/
984:            private void uninstallCheckedElement(String aCheckBoxId)//Select which Row needs to be uninstalled
985:
986:            {
987:                selenium.click(aCheckBoxId);
988:                selenium.click(JBIIdConstants.JBI_UNINSTALL_BUTTON_ID);
989:                selenium
990:                        .waitForCondition(
991:                                "selenium.browserbot.isNewPageLoaded()",
992:                                TIMEOUT_PERIOD);
993:                selenium.getConfirmation().matches(
994:                        JBIResourceConstants.JBI_INSTALLABLE_DELETION_MSG);
995:            }
996:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.