Source Code Cross Referenced for AcceptanceTest.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » test » components » input » stdsecretfield » 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.modules.visualweb.test.components.input.stdsecretfield 
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.modules.visualweb.test.components.input.stdsecretfield;
043:
044:        import junit.framework.Test;
045:        import junit.framework.TestSuite;
046:        import org.netbeans.junit.NbTestSuite;
047:        import org.netbeans.jellytools.OutputOperator;
048:        import org.netbeans.jemmy.Waiter;
049:        import org.netbeans.jemmy.Waitable;
050:        import org.netbeans.jemmy.QueueTool;
051:        import org.netbeans.jemmy.operators.JTreeOperator;
052:
053:        import org.netbeans.modules.visualweb.gravy.*;
054:        import org.netbeans.modules.visualweb.gravy.designer.DesignerPaneOperator;
055:        import org.netbeans.modules.visualweb.gravy.properties.SheetTableOperator;
056:        import org.netbeans.modules.visualweb.gravy.toolbox.PaletteContainerOperator;
057:        import org.netbeans.modules.visualweb.test.components.util.ComponentUtils;
058:        import org.netbeans.modules.visualweb.gravy.dataconnectivity.ServerNavigatorOperator;
059:
060:        import java.io.File;
061:        import java.awt.Point;
062:        import java.io.IOException;
063:
064:        /**
065:         * @author Lark Fitzgerald (lark.fitzgerald@sun.com)
066:         */
067:        public class AcceptanceTest extends RaveTestCase {
068:
069:            //Project variables
070:            public String _sharedBundle = "org.netbeans.modules.visualweb.test.components.Component";
071:            public String _privateBundle = "org.netbeans.modules.visualweb.test.components.input.stdsecretfield.Acceptance";
072:            public String _projectName = Bundle.getStringTrimmed(
073:                    _privateBundle, "projectName");
074:            public String _projectServer = Bundle.getStringTrimmed(
075:                    _sharedBundle, "projectServer");
076:            public String _logFileLocation = Bundle.getStringTrimmed(
077:                    _sharedBundle, "logFile");
078:            public String _logFile = System.getProperty("xtest.workdir")
079:                    + File.separator + _logFileLocation;
080:            public String _exception = Bundle.getStringTrimmed(_sharedBundle,
081:                    "Exception");
082:            public String _close = Bundle.getStringTrimmed(_sharedBundle,
083:                    "close");
084:            public String _run = Bundle.getStringTrimmed(_sharedBundle, "Run");
085:            public String _buildSuccess = Bundle.getStringTrimmed(
086:                    _sharedBundle, "buildSuccess");
087:            public String _true = Bundle
088:                    .getStringTrimmed(_sharedBundle, "true");
089:
090:            //Palette variables
091:            public String _standardPalette = Bundle.getStringTrimmed(
092:                    _sharedBundle, "standardPalette");
093:            public String _standardButton = Bundle.getStringTrimmed(
094:                    _sharedBundle, "standardButton");
095:            public String _standardSecretField = Bundle.getStringTrimmed(
096:                    _sharedBundle, "standardSecretField");
097:
098:            //drop points
099:            public int _x = Integer.parseInt(Bundle.getStringTrimmed(
100:                    _privateBundle, "x"));
101:            public int _secret1y = Integer.parseInt(Bundle.getStringTrimmed(
102:                    _privateBundle, "secret1y"));
103:            public int _button1y = Integer.parseInt(Bundle.getStringTrimmed(
104:                    _privateBundle, "button1y"));
105:
106:            //undeployment
107:            public String _undeploy = Bundle.getStringTrimmed(_sharedBundle,
108:                    "undeploy");
109:            public String _refresh = Bundle.getStringTrimmed(_sharedBundle,
110:                    "refresh");
111:            public String _serverPath = Bundle.getStringTrimmed(_sharedBundle,
112:                    "serverPath");
113:            public String _deploymentPath = Bundle.getStringTrimmed(
114:                    _sharedBundle, "deploymentPathGlassfish");
115:            public String _separator = Bundle.getStringTrimmed(_sharedBundle,
116:                    "separator");
117:
118:            Point clickPoint, dropPoint;
119:            public static DesignerPaneOperator designer;
120:            public static PaletteContainerOperator palette;
121:            public static DocumentOutlineOperator outline;
122:            public static SheetTableOperator sheet;
123:            public static DeploymentDialogOperator deploy;
124:            public static ServerNavigatorOperator explorer;
125:            public int row;
126:
127:            public AcceptanceTest(String testName) {
128:                super (testName);
129:            }
130:
131:            public static Test suite() {
132:                TestSuite suite = new NbTestSuite();
133:                suite.addTest(new AcceptanceTest("testCreateWebProject"));
134:                suite.addTest(new AcceptanceTest("testAddSecretField"));
135:                suite.addTest(new AcceptanceTest("testAddButton"));
136:                suite.addTest(new AcceptanceTest("testDeploy"));
137:                suite.addTest(new AcceptanceTest("testCloseWebProject"));
138:                suite.addTest(new AcceptanceTest("testUndeploy"));
139:                suite.addTest(new AcceptanceTest("testCheckIDELog"));
140:
141:                return suite;
142:            }
143:
144:            /** method called before each testcase
145:             */
146:            protected void setUp() {
147:                System.out.println("########  " + getName() + "  #######");
148:            }
149:
150:            /** method called after each testcase
151:             */
152:            protected void tearDown() {
153:                System.out.println("########  " + getName()
154:                        + " Finished #######");
155:            }
156:
157:            /*
158:             *    Create Web Project
159:             *
160:             */
161:            public void testCreateWebProject() {
162:                startTest();
163:                log("**Creating Project");
164:                //Create Project
165:                try {
166:                    ComponentUtils.createNewProject(_projectName);
167:                } catch (Exception e) {
168:                    log(">> Project Creation Failed");
169:                    e.printStackTrace();
170:                    log(e.toString());
171:                    fail();
172:                }
173:                log("**Done");
174:                endTest();
175:            }
176:
177:            /*
178:             *    Add a password to designer
179:             */
180:            public void testAddSecretField() {
181:                startTest();
182:                log("**Initialize");
183:                Util.saveAllAPICall();
184:                designer = new DesignerPaneOperator(RaveWindowOperator
185:                        .getDefaultRave());
186:                palette = new PaletteContainerOperator(_standardPalette);
187:                try {
188:                    Thread.sleep(5000);
189:                } catch (Exception e) {
190:                }
191:
192:                log("**Add Secret field to designer");
193:                clickPoint = palette.getClickPoint(_standardSecretField);
194:                dropPoint = new Point(_x, _secret1y);
195:                //below dnd drag's datatable onto designer instead of secret field.        
196:                //        palette.dndPaletteComponent(_standardSecretField, designer, dropPoint);
197:                palette.addComponent(_standardSecretField, designer, dropPoint);
198:                try {
199:                    Thread.sleep(2000);
200:                } catch (Exception e) {
201:                }
202:
203:                log("**Done.");
204:                endTest();
205:
206:            }
207:
208:            /*
209:             *    Add a button to designer
210:             */
211:            public void testAddButton() {
212:                startTest();
213:                log("**Initialize");
214:                designer = new DesignerPaneOperator(RaveWindowOperator
215:                        .getDefaultRave());
216:                palette = new PaletteContainerOperator(_standardPalette);
217:                try {
218:                    Thread.sleep(5000);
219:                } catch (Exception e) {
220:                }
221:
222:                log("**Add Button to designer");
223:                clickPoint = palette.getClickPoint(_standardButton);
224:                dropPoint = new Point(_x, _button1y);
225:                palette.dndPaletteComponent(_standardButton, designer,
226:                        dropPoint);
227:                try {
228:                    Thread.sleep(2000);
229:                } catch (Exception e) {
230:                }
231:
232:                log("**Done.");
233:                endTest();
234:            }
235:
236:            /*
237:             * Deploy application
238:             */
239:            public void testDeploy() {
240:                startTest();
241:                //need to wait responce
242:                Waiter deploymentWaiter = new Waiter(new Waitable() {
243:                    public Object actionProduced(Object output) {
244:                        String text = ((OutputOperator) output).getText();
245:                        if (text.indexOf(_buildSuccess) != -1)
246:                            return _true;
247:                        return null;
248:
249:                    }
250:
251:                    public String getDescription() {
252:                        return ("Waiting Project Deployed");
253:                    }
254:                });
255:                log("Deploy from menu");
256:                ProjectNavigatorOperator.pressPopupItemOnNode(_projectName,
257:                        _run);
258:                TestUtils.wait(2000);
259:                OutputOperator outputWindow = new OutputOperator();
260:                deploymentWaiter.getTimeouts().setTimeout("Waiter.WaitingTime",
261:                        240000);
262:                log("wait until " + _buildSuccess);
263:                try {
264:                    deploymentWaiter.waitAction(outputWindow);
265:                } catch (InterruptedException e) {
266:                    log(outputWindow.getText());
267:                    e.printStackTrace();
268:                    fail("Deployment error: " + e);
269:                }
270:                log("Deployment complete");
271:                endTest();
272:            }
273:
274:            /*
275:             * Close Project
276:             *
277:             */
278:            public void testCloseWebProject() {
279:                startTest();
280:                Util.saveAllAPICall();
281:                new ProjectNavigatorOperator().pressPopupItemOnNode(
282:                        _projectName, _close);
283:                //TestUtils.closeCurrentProject();
284:                TestUtils.wait(5000);
285:                endTest();
286:            }
287:
288:            /* Need to undeploy project to finish tests correctly */
289:            public void testUndeploy() {
290:                startTest();
291:                log("Initialize");
292:                explorer = ServerNavigatorOperator.showNavigatorOperator();
293:                String serverPath = _serverPath + _projectServer; //Current deployment server
294:                String deploymentPath = serverPath + _deploymentPath; //glassfish specific
295:                String applicationPath = deploymentPath + _separator
296:                        + _projectName; //project name
297:
298:                // Select the Server Navigator and set the JTreeOperator
299:                log("get explorer");
300:                new QueueTool().waitEmpty(100); //??
301:                explorer.requestFocus();
302:                JTreeOperator tree = explorer.getTree();
303:                try {
304:                    Thread.sleep(4000);
305:                } catch (Exception e) {
306:                } // Sleep 4 secs to make sure Server Navigator is in focus
307:
308:                // Need to refresh J2EE AppServer node
309:                log("refresh");
310:                explorer.pushPopup(tree, serverPath, _refresh);
311:                TestUtils.wait(1000);
312:
313:                log("refresh deployment path: " + deploymentPath);
314:                TestUtils.wait(1000);
315:                explorer.selectPath(deploymentPath);
316:                explorer.getTree().expandPath(
317:                        explorer.getTree().findPath(deploymentPath));
318:                explorer.pushPopup(tree, deploymentPath, _refresh);
319:                TestUtils.wait(1000);
320:
321:                log("undeploy Path: " + applicationPath);
322:                explorer.selectPath(applicationPath);
323:                TestUtils.wait(1000);
324:
325:                log("Push Menu Undeploy...");
326:                explorer.pushPopup(explorer.getTree(), applicationPath,
327:                        _undeploy);
328:                TestUtils.wait(5000);
329:                endTest();
330:            }
331:
332:            public void testCheckIDELog() {
333:                startTest();
334:                try {
335:                    String err = ComponentUtils.hasUnexpectedException();
336:                    String str = "";
337:                    if (!(err.equals(""))) {
338:                        assertTrue(
339:                                "Unexpected  exceptions found in message.log: "
340:                                        + err, str.equals(""));
341:                    }
342:                } catch (IOException ioe) {
343:                    ioe.printStackTrace();
344:                    fail("Failed to open message.log : " + ioe);
345:                }
346:                endTest();
347:            }
348:        }
w__w___w__.___j___a_v__a___2_s_.__c_o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.