Source Code Cross Referenced for ChangingOfBeanPropertyProperties.java in  » IDE-Netbeans » beans » gui » 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 » beans » gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:
0042:        package gui;
0043:
0044:        import java.io.*;
0045:        import junit.textui.TestRunner;
0046:        import org.netbeans.jellytools.Bundle;
0047:        import org.netbeans.jellytools.ChooseTemplateStepOperator;
0048:        import org.netbeans.jellytools.EditorOperator;
0049:        import org.netbeans.jellytools.JellyTestCase;
0050:        import org.netbeans.jellytools.MainWindowOperator;
0051:        import org.netbeans.jellytools.NbDialogOperator;
0052:        import org.netbeans.jellytools.NewWizardOperator;
0053:        import org.netbeans.jellytools.OptionsOperator;
0054:        import org.netbeans.jellytools.RepositoryTabOperator;
0055:        import org.netbeans.jellytools.TargetLocationStepOperator;
0056:        import org.netbeans.jellytools.actions.DeleteAction;
0057:        import org.netbeans.jellytools.actions.NewTemplateAction;
0058:        import org.netbeans.jellytools.actions.PropertiesAction;
0059:        import org.netbeans.jellytools.nodes.FolderNode;
0060:        import org.netbeans.jellytools.nodes.JavaNode;
0061:        import org.netbeans.jellytools.nodes.Node;
0062:        import org.netbeans.jellytools.properties.Property;
0063:        import org.netbeans.jellytools.properties.PropertySheetOperator;
0064:        import org.netbeans.jemmy.EventTool;
0065:        import org.netbeans.jemmy.operators.JCheckBoxOperator;
0066:        import org.netbeans.jemmy.operators.JComboBoxOperator;
0067:        import org.netbeans.jemmy.operators.JRadioButtonOperator;
0068:        import org.netbeans.jemmy.operators.JTextFieldOperator;
0069:        import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
0070:        import org.netbeans.junit.NbTestSuite;
0071:
0072:        import org.openide.actions.SaveAllAction;
0073:        import org.openide.filesystems.FileObject;
0074:
0075:        import org.openide.filesystems.Repository;
0076:        import org.openide.loaders.DataFolder;
0077:        import org.openide.loaders.DataObject;
0078:
0079:        public class ChangingOfBeanPropertyProperties extends JellyTestCase {
0080:
0081:            private static final String NAME_TEST_FILE = "TestFile";
0082:            private static final String NAME_INDEX_PROPERTY = "indexProperty";
0083:            private static final String NAME_NON_INDEX_PROPERTY = "nonIndexProperty";
0084:
0085:            private static final String sampleDir = Utilities.findFileSystem(
0086:                    "src").getDisplayName();
0087:
0088:            /** Need to be defined because of JUnit */
0089:            public ChangingOfBeanPropertyProperties(String name) {
0090:                super (name);
0091:            }
0092:
0093:            public static NbTestSuite suite() {
0094:                NbTestSuite suite = new NbTestSuite();
0095:                suite.addTest(new ChangingOfBeanPropertyProperties(
0096:                        "testChangePropertyNameAndType"));
0097:                suite.addTest(new ChangingOfBeanPropertyProperties(
0098:                        "testChangeMode"));
0099:                suite.addTest(new ChangingOfBeanPropertyProperties(
0100:                        "testDeleteAnyPropertiesAndEvents"));
0101:                suite.addTest(new ChangingOfBeanPropertyProperties(
0102:                        "testChangeSourceCode"));
0103:                suite.addTest(new ChangingOfBeanPropertyProperties(
0104:                        "testChangeOfStyleOfDeclaredVariable"));
0105:                return suite;
0106:            }
0107:
0108:            /** Use for execution inside IDE */
0109:            public static void main(java.lang.String[] args) {
0110:                // run whole suite
0111:                TestRunner.run(suite());
0112:                // run only selected test case
0113:                //junit.textui.TestRunner.run(new ChangingOfBeanPropertyProperties("testChangeMode"));
0114:            }
0115:
0116:            /** setUp method  */
0117:            public void setUp() {
0118:                System.out.println("########  " + getName() + "  #######");
0119:                if (!getName().equals("testChangeSourceCode")
0120:                        && !getName()
0121:                                .equals("testDeleteAnyPropertiesAndEvents")) {
0122:
0123:                    FileObject testFile = Repository.getDefault().findResource(
0124:                            "gui/data/" + NAME_TEST_FILE + ".java");
0125:                    FileObject destination = Repository.getDefault()
0126:                            .findFileSystem(sampleDir.replace('\\', '/'))
0127:                            .getRoot();
0128:
0129:                    try {
0130:                        DataObject.find(testFile).copy(
0131:                                DataFolder.findFolder(destination));
0132:                    } catch (IOException e) {
0133:                        fail(e);
0134:                    }
0135:                }
0136:                new PropertiesAction().perform();
0137:            }
0138:
0139:            /** tearDown method */
0140:            public void tearDown() {
0141:                ((SaveAllAction) SaveAllAction.findObject(SaveAllAction.class,
0142:                        true)).performAction();
0143:
0144:                Utilities.delete(NAME_TEST_FILE + ".java");
0145:            }
0146:
0147:            /** - Create an empty class
0148:             *  - Set Tools|Options|Editing|Beans Property|Style of Declared Variable = this.property_Value
0149:             *  - add a new property
0150:             *  - Set Tools|Options|Editing|Beans Property|Style of Declared Variable = _property_Value
0151:             *  - add a new property
0152:             */
0153:            public void testChangeOfStyleOfDeclaredVariable() {
0154:                MainWindowOperator mainWindowOper = MainWindowOperator
0155:                        .getDefault();
0156:
0157:                OptionsOperator optionsOperator = OptionsOperator.invoke();
0158:                optionsOperator.selectOption(Bundle.getString(
0159:                        "org.netbeans.core.Bundle", "UI/Services/Editing")
0160:                        + "|"
0161:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0162:                                "PROP_Option_Menu"));
0163:                PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator(
0164:                        optionsOperator);
0165:                new Property(propertySheetTabOperator, Bundle.getString(
0166:                        "org.netbeans.modules.beans.Bundle",
0167:                        "PROP_Option_Prop_Style")).setValue(Bundle.getString(
0168:                        "org.netbeans.modules.beans.Bundle",
0169:                        "MSG_Option_Gen_This"));
0170:
0171:                new EventTool().waitNoEvent(3000);
0172:
0173:                RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
0174:                Node repositoryRootNode = explorerOperator.getRootNode();
0175:                Node patternsNode = new Node(repositoryRootNode, sampleDir
0176:                        + "|"
0177:                        + NAME_TEST_FILE
0178:                        + "|"
0179:                        + "class "
0180:                        + NAME_TEST_FILE
0181:                        + "|"
0182:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0183:                                "Patterns"));
0184:
0185:                patternsNode.select();
0186:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0187:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0188:                        + "|"
0189:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0190:                                "MENU_CREATE_PROPERTY"));
0191:                String dialogTitle = Bundle.getString(
0192:                        "org.netbeans.modules.beans.Bundle",
0193:                        "CTL_TITLE_NewProperty");
0194:                NbDialogOperator nbDialogOperator = new NbDialogOperator(
0195:                        dialogTitle);
0196:
0197:                JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
0198:                        nbDialogOperator, 0);
0199:                jTextFieldOperator.typeText("firstName");
0200:                JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
0201:                        nbDialogOperator, 0);
0202:                jComboBoxOperator.typeText("int");
0203:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
0204:                jComboBoxOperator.setSelectedItem(Bundle.getString(
0205:                        "org.netbeans.modules.beans.Bundle",
0206:                        "LAB_ReadWriteMODE"));
0207:                JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
0208:                        nbDialogOperator, Bundle.getString(
0209:                                "org.netbeans.modules.beans.Bundle",
0210:                                "CTL_PropertyPanel_fieldCheckBox"));
0211:                jCheckBoxOperator.push();
0212:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0213:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0214:                                "CTL_PropertyPanel_setCheckBox"));
0215:                jCheckBoxOperator.push();
0216:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0217:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0218:                                "CTL_PropertyPanel_returnCheckBox"));
0219:                jCheckBoxOperator.push();
0220:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0221:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0222:                                "CTL_PropertyPanel_constrainedCheckBox"));
0223:                jCheckBoxOperator.push();
0224:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0225:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0226:                                "CTL_PropertyPanel_boundCheckBox"));
0227:                jCheckBoxOperator.push();
0228:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0229:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0230:                                "CTL_PropertyPanel_supportCheckBox"));
0231:                jCheckBoxOperator.push();
0232:                new EventTool().waitNoEvent(2000);
0233:                nbDialogOperator.ok();
0234:
0235:                new Property(propertySheetTabOperator, Bundle.getString(
0236:                        "org.netbeans.modules.beans.Bundle",
0237:                        "PROP_Option_Prop_Style")).setValue(Bundle.getString(
0238:                        "org.netbeans.modules.beans.Bundle",
0239:                        "MSG_Option_Gen_Undescored"));
0240:                new EventTool().waitNoEvent(3000);
0241:                //////////////////
0242:                explorerOperator = new RepositoryTabOperator();
0243:                repositoryRootNode = explorerOperator.getRootNode();
0244:                patternsNode = new Node(repositoryRootNode, sampleDir
0245:                        + "|"
0246:                        + NAME_TEST_FILE
0247:                        + "|"
0248:                        + "class "
0249:                        + NAME_TEST_FILE
0250:                        + "|"
0251:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0252:                                "Patterns"));
0253:
0254:                patternsNode.select();
0255:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0256:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0257:                        + "|"
0258:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0259:                                "MENU_CREATE_PROPERTY"));
0260:                dialogTitle = Bundle.getString(
0261:                        "org.netbeans.modules.beans.Bundle",
0262:                        "CTL_TITLE_NewProperty");
0263:                nbDialogOperator = new NbDialogOperator(dialogTitle);
0264:
0265:                jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);
0266:                jTextFieldOperator.typeText("secondName");
0267:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
0268:                jComboBoxOperator.typeText("String");
0269:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
0270:                jComboBoxOperator.setSelectedItem(Bundle.getString(
0271:                        "org.netbeans.modules.beans.Bundle",
0272:                        "LAB_ReadWriteMODE"));
0273:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0274:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0275:                                "CTL_PropertyPanel_fieldCheckBox"));
0276:                jCheckBoxOperator.push();
0277:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0278:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0279:                                "CTL_PropertyPanel_setCheckBox"));
0280:                jCheckBoxOperator.push();
0281:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0282:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0283:                                "CTL_PropertyPanel_returnCheckBox"));
0284:                jCheckBoxOperator.push();
0285:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0286:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0287:                                "CTL_PropertyPanel_constrainedCheckBox"));
0288:                jCheckBoxOperator.push();
0289:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0290:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0291:                                "CTL_PropertyPanel_boundCheckBox"));
0292:                jCheckBoxOperator.push();
0293:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0294:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0295:                                "CTL_PropertyPanel_supportCheckBox"));
0296:                jCheckBoxOperator.push();
0297:                new EventTool().waitNoEvent(2000);
0298:                nbDialogOperator.ok();
0299:                optionsOperator.close();
0300:
0301:                new JavaNode(repositoryRootNode, sampleDir + "|"
0302:                        + NAME_TEST_FILE).open();
0303:
0304:                EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
0305:                new EventTool().waitNoEvent(500);
0306:                ref(eo.getText());
0307:                compareReferenceFiles();
0308:
0309:            }
0310:
0311:            /** - Create an empty class
0312:             *  - Set Tools|Options|Editing|Beans Property|Style of Declared Variable = 0
0313:             *  - add a new property with an initial value
0314:             *  - change of property type a name
0315:             */
0316:            public void testChangePropertyNameAndType() {
0317:                MainWindowOperator mainWindowOper = MainWindowOperator
0318:                        .getDefault();
0319:
0320:                OptionsOperator optionsOperator = OptionsOperator.invoke();
0321:                optionsOperator.selectOption(Bundle.getString(
0322:                        "org.netbeans.core.Bundle", "UI/Services/Editing")
0323:                        + "|"
0324:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0325:                                "PROP_Option_Menu"));
0326:                PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator(
0327:                        optionsOperator);
0328:                new Property(propertySheetTabOperator, Bundle.getString(
0329:                        "org.netbeans.modules.beans.Bundle",
0330:                        "PROP_Option_Prop_Style"))
0331:                        .setValue("this.property_Value");
0332:
0333:                new EventTool().waitNoEvent(3000);
0334:
0335:                RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
0336:                Node repositoryRootNode = explorerOperator.getRootNode();
0337:                Node patternsNode = new Node(repositoryRootNode, sampleDir
0338:                        + "|"
0339:                        + NAME_TEST_FILE
0340:                        + "|"
0341:                        + "class "
0342:                        + NAME_TEST_FILE
0343:                        + "|"
0344:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0345:                                "Patterns"));
0346:
0347:                patternsNode.select();
0348:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0349:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0350:                        + "|"
0351:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0352:                                "MENU_CREATE_PROPERTY"));
0353:                String dialogTitle = Bundle.getString(
0354:                        "org.netbeans.modules.beans.Bundle",
0355:                        "CTL_TITLE_NewProperty");
0356:                NbDialogOperator nbDialogOperator = new NbDialogOperator(
0357:                        dialogTitle);
0358:
0359:                JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
0360:                        nbDialogOperator, 0);
0361:                jTextFieldOperator.typeText("initialName");
0362:                JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
0363:                        nbDialogOperator, 0);
0364:                jComboBoxOperator.typeText("initialType");
0365:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
0366:                jComboBoxOperator.setSelectedItem(Bundle.getString(
0367:                        "org.netbeans.modules.beans.Bundle",
0368:                        "LAB_ReadWriteMODE"));
0369:                JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
0370:                        nbDialogOperator, Bundle.getString(
0371:                                "org.netbeans.modules.beans.Bundle",
0372:                                "CTL_PropertyPanel_fieldCheckBox"));
0373:                jCheckBoxOperator.push();
0374:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0375:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0376:                                "CTL_PropertyPanel_setCheckBox"));
0377:                jCheckBoxOperator.push();
0378:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0379:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0380:                                "CTL_PropertyPanel_returnCheckBox"));
0381:                jCheckBoxOperator.push();
0382:                new EventTool().waitNoEvent(2000);
0383:                nbDialogOperator.ok();
0384:
0385:                new Property(propertySheetTabOperator, Bundle.getString(
0386:                        "org.netbeans.modules.beans.Bundle",
0387:                        "PROP_Option_Prop_Style")).setValue("_property_Value");
0388:                new EventTool().waitNoEvent(3000);
0389:                optionsOperator.close();
0390:                /////////////////
0391:                explorerOperator = new RepositoryTabOperator();
0392:                patternsNode = new Node(repositoryRootNode, sampleDir
0393:                        + "|"
0394:                        + NAME_TEST_FILE
0395:                        + "|"
0396:                        + "class "
0397:                        + NAME_TEST_FILE
0398:                        + "|"
0399:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0400:                                "Patterns") + "|" + "initialName");
0401:                patternsNode.select();
0402:
0403:                propertySheetTabOperator = new PropertySheetOperator();
0404:                answerYes();
0405:                new Property(propertySheetTabOperator, Bundle.getString(
0406:                        "org.netbeans.modules.beans.beaninfo.Bundle",
0407:                        "PROP_Bi_name")).setValue("requiredName");
0408:                new EventTool().waitNoEvent(1500);
0409:
0410:                new JavaNode(repositoryRootNode, sampleDir + "|"
0411:                        + NAME_TEST_FILE).open();
0412:
0413:                EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
0414:                ref(eo.getText());
0415:                compareReferenceFiles();
0416:
0417:            }
0418:
0419:            private void answerYes() {
0420:                new Thread() {
0421:                    public void run() {
0422:                        String questionTitle = Bundle.getString(
0423:                                "org.openide.Bundle", "NTF_QuestionTitle");
0424:                        NbDialogOperator nbDialogOperator = new NbDialogOperator(
0425:                                questionTitle);
0426:                        nbDialogOperator.yes();
0427:                    }
0428:                }.start();
0429:            }
0430:
0431:            /** - Create an empty class
0432:             *  - Set Tools|Options|Editing|Beans Property|Style of Declared Variable = this.property_Value
0433:             *  - add a new property
0434:             *  - Set Tools|Options|Editing|Beans Property|Style of Declared Variable = _property_Value
0435:             *  - Add a new property
0436:             *  - Change of the first property mode to Read Only
0437:             *  - Change of the second property mode to Write Only
0438:             */
0439:            public void testChangeMode() {
0440:                //
0441:                MainWindowOperator mainWindowOper = MainWindowOperator
0442:                        .getDefault();
0443:
0444:                OptionsOperator optionsOperator = OptionsOperator.invoke();
0445:                optionsOperator.selectOption(Bundle.getString(
0446:                        "org.netbeans.core.Bundle", "UI/Services/Editing")
0447:                        + "|"
0448:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0449:                                "PROP_Option_Menu"));
0450:                PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator(
0451:                        optionsOperator);
0452:                new Property(propertySheetTabOperator, Bundle.getString(
0453:                        "org.netbeans.modules.beans.Bundle",
0454:                        "PROP_Option_Prop_Style"))
0455:                        .setValue("this.property_Value");
0456:
0457:                new EventTool().waitNoEvent(3000);
0458:
0459:                RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
0460:                Node repositoryRootNode = explorerOperator.getRootNode();
0461:                Node patternsNode = new Node(repositoryRootNode, sampleDir
0462:                        + "|"
0463:                        + NAME_TEST_FILE
0464:                        + "|"
0465:                        + "class "
0466:                        + NAME_TEST_FILE
0467:                        + "|"
0468:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0469:                                "Patterns"));
0470:
0471:                patternsNode.select();
0472:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0473:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0474:                        + "|"
0475:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0476:                                "MENU_CREATE_PROPERTY"));
0477:                String dialogTitle = Bundle.getString(
0478:                        "org.netbeans.modules.beans.Bundle",
0479:                        "CTL_TITLE_NewProperty");
0480:                NbDialogOperator nbDialogOperator = new NbDialogOperator(
0481:                        dialogTitle);
0482:
0483:                JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
0484:                        nbDialogOperator, 0);
0485:                jTextFieldOperator.typeText("firstName");
0486:                JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
0487:                        nbDialogOperator, 0);
0488:                jComboBoxOperator.typeText("int");
0489:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
0490:                jComboBoxOperator.setSelectedItem(Bundle.getString(
0491:                        "org.netbeans.modules.beans.Bundle",
0492:                        "LAB_ReadWriteMODE"));
0493:                JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
0494:                        nbDialogOperator, Bundle.getString(
0495:                                "org.netbeans.modules.beans.Bundle",
0496:                                "CTL_PropertyPanel_fieldCheckBox"));
0497:                jCheckBoxOperator.push();
0498:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0499:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0500:                                "CTL_PropertyPanel_setCheckBox"));
0501:                jCheckBoxOperator.push();
0502:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0503:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0504:                                "CTL_PropertyPanel_returnCheckBox"));
0505:                jCheckBoxOperator.push();
0506:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0507:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0508:                                "CTL_PropertyPanel_constrainedCheckBox"));
0509:                jCheckBoxOperator.push();
0510:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0511:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0512:                                "CTL_PropertyPanel_boundCheckBox"));
0513:                jCheckBoxOperator.push();
0514:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0515:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0516:                                "CTL_PropertyPanel_supportCheckBox"));
0517:                jCheckBoxOperator.push();
0518:                new EventTool().waitNoEvent(1000);
0519:                nbDialogOperator.ok();
0520:
0521:                new Property(propertySheetTabOperator, Bundle.getString(
0522:                        "org.netbeans.modules.beans.Bundle",
0523:                        "PROP_Option_Prop_Style")).setValue("_property_Value");
0524:                new EventTool().waitNoEvent(1000);
0525:                optionsOperator.close();
0526:                //////////////////
0527:                explorerOperator = new RepositoryTabOperator();
0528:                repositoryRootNode = explorerOperator.getRootNode();
0529:                patternsNode = new Node(repositoryRootNode, sampleDir
0530:                        + "|"
0531:                        + NAME_TEST_FILE
0532:                        + "|"
0533:                        + "class "
0534:                        + NAME_TEST_FILE
0535:                        + "|"
0536:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0537:                                "Patterns"));
0538:
0539:                patternsNode.select();
0540:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0541:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0542:                        + "|"
0543:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0544:                                "MENU_CREATE_PROPERTY"));
0545:                dialogTitle = Bundle.getString(
0546:                        "org.netbeans.modules.beans.Bundle",
0547:                        "CTL_TITLE_NewProperty");
0548:                nbDialogOperator = new NbDialogOperator(dialogTitle);
0549:
0550:                jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);
0551:                jTextFieldOperator.typeText("secondName");
0552:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
0553:                jComboBoxOperator.typeText("String");
0554:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
0555:                jComboBoxOperator.setSelectedItem(Bundle.getString(
0556:                        "org.netbeans.modules.beans.Bundle",
0557:                        "LAB_ReadWriteMODE"));
0558:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0559:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0560:                                "CTL_PropertyPanel_fieldCheckBox"));
0561:                jCheckBoxOperator.push();
0562:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0563:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0564:                                "CTL_PropertyPanel_setCheckBox"));
0565:                jCheckBoxOperator.push();
0566:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0567:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0568:                                "CTL_PropertyPanel_returnCheckBox"));
0569:                jCheckBoxOperator.push();
0570:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0571:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0572:                                "CTL_PropertyPanel_constrainedCheckBox"));
0573:                jCheckBoxOperator.push();
0574:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0575:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0576:                                "CTL_PropertyPanel_boundCheckBox"));
0577:                jCheckBoxOperator.push();
0578:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0579:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0580:                                "CTL_PropertyPanel_supportCheckBox"));
0581:                jCheckBoxOperator.push();
0582:                new EventTool().waitNoEvent(1000);
0583:                nbDialogOperator.ok();
0584:                ////
0585:                explorerOperator = new RepositoryTabOperator();
0586:
0587:                patternsNode = new Node(repositoryRootNode, sampleDir
0588:                        + "|"
0589:                        + NAME_TEST_FILE
0590:                        + "|"
0591:                        + "class "
0592:                        + NAME_TEST_FILE
0593:                        + "|"
0594:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0595:                                "Patterns") + "|" + "firstName");
0596:                patternsNode.select();
0597:                new EventTool().waitNoEvent(1000);
0598:                answerYes();
0599:                propertySheetTabOperator = new PropertySheetOperator();
0600:                //new ComboBoxProperty(propertySheetTabOperator, Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_mode")).setValue(Bundle.getString("org.netbeans.modules.beans.Bundle", "LAB_ReadOnlyMODE"));
0601:                new Property(propertySheetTabOperator, Bundle.getString(
0602:                        "org.netbeans.modules.beans.Bundle", "PROP_mode"))
0603:                        .setValue(1);
0604:                new EventTool().waitNoEvent(1000);
0605:
0606:                patternsNode = new Node(repositoryRootNode, sampleDir
0607:                        + "|"
0608:                        + NAME_TEST_FILE
0609:                        + "|"
0610:                        + "class "
0611:                        + NAME_TEST_FILE
0612:                        + "|"
0613:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0614:                                "Patterns") + "|" + "secondName");
0615:                patternsNode.select();
0616:                new EventTool().waitNoEvent(1000);
0617:                answerYes();
0618:                propertySheetTabOperator = new PropertySheetOperator();
0619:                //new ComboBoxProperty(propertySheetTabOperator, Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_mode")).setValue(Bundle.getString("org.netbeans.modules.beans.Bundle", "LAB_WriteOnlyMODE"));
0620:                new Property(propertySheetTabOperator, Bundle.getString(
0621:                        "org.netbeans.modules.beans.Bundle", "PROP_mode"))
0622:                        .setValue(2);
0623:                new EventTool().waitNoEvent(1000);
0624:
0625:                new JavaNode(repositoryRootNode, sampleDir + "|"
0626:                        + NAME_TEST_FILE).open();
0627:
0628:                EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
0629:                ref(eo.getText());
0630:                compareReferenceFiles();
0631:
0632:                ////
0633:
0634:            }
0635:
0636:            public void testChangeSourceCode() {
0637:
0638:                Node repositoryRootNode = RepositoryTabOperator.invoke()
0639:                        .getRootNode();
0640:
0641:                FolderNode examplesFolderNode = new FolderNode(
0642:                        repositoryRootNode, sampleDir); // NOI18N
0643:                examplesFolderNode.select();
0644:                DefaultStringComparator comparator = new DefaultStringComparator(
0645:                        true, true);
0646:                new NewTemplateAction().perform();
0647:                NewWizardOperator newWizardOper = new NewWizardOperator();
0648:                ChooseTemplateStepOperator ctso = new ChooseTemplateStepOperator();
0649:                String bean = Bundle.getString(
0650:                        "org.netbeans.modules.beans.Bundle", "Templates/Beans")
0651:                        + "|"
0652:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0653:                                "Templates/Beans/Bean.java");
0654:                ctso.selectTemplate(bean);
0655:                ctso.next();
0656:                TargetLocationStepOperator tlso = new TargetLocationStepOperator();
0657:                tlso.setName(NAME_TEST_FILE);
0658:                tlso.tree().setComparator(comparator);
0659:                tlso.selectLocation(sampleDir);
0660:                tlso.finish();
0661:
0662:                EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
0663:                eo.setCaretPosition(1, 1);
0664:                eo
0665:                        .insert(
0666:                                "    private static final String PROP_MY_PROPERTY = \"MyProperty\";\n",
0667:                                16, 1);
0668:                new EventTool().waitNoEvent(500);
0669:
0670:                eo.insert("    private String myProperty;\n", 19, 1);
0671:                new EventTool().waitNoEvent(500);
0672:
0673:                eo.insert("    public String getMyProperty() {\n", 38, 1);
0674:                new EventTool().waitNoEvent(500);
0675:                eo.insert("        return myProperty;\n", 39, 1);
0676:                new EventTool().waitNoEvent(500);
0677:                eo.insert("    }\n", 40, 1);
0678:                new EventTool().waitNoEvent(500);
0679:                eo.insert("\n", 41, 1);
0680:                new EventTool().waitNoEvent(500);
0681:
0682:                eo.insert("    public void setMyProperty(String value) {\n",
0683:                        42, 1);
0684:                new EventTool().waitNoEvent(500);
0685:                eo.insert("        String oldValue = myProperty;\n", 43, 1);
0686:                new EventTool().waitNoEvent(500);
0687:                eo.insert("        myProperty = value;\n", 44, 1);
0688:                new EventTool().waitNoEvent(500);
0689:                eo
0690:                        .insert(
0691:                                "        propertySupport.firePropertyChange(PROP_MY_PROPERTY, oldValue, myProperty);\n",
0692:                                45, 1);
0693:                new EventTool().waitNoEvent(500);
0694:                eo.insert("    }\n", 46, 1);
0695:                new EventTool().waitNoEvent(500);
0696:                eo.insert("\n", 47, 1);
0697:                new EventTool().waitNoEvent(500);
0698:
0699:                RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
0700:                Node patternsNode = new Node(repositoryRootNode, sampleDir
0701:                        + "|"
0702:                        + NAME_TEST_FILE
0703:                        + "|"
0704:                        + "class "
0705:                        + NAME_TEST_FILE
0706:                        + "|"
0707:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0708:                                "Patterns") + "|" + "myProperty");
0709:                patternsNode.select();
0710:                new EventTool().waitNoEvent(1000);
0711:                PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator();
0712:
0713:                assertEquals("Estimated Field", "String myProperty",
0714:                        new Property(propertySheetTabOperator, Bundle
0715:                                .getString("org.netbeans.modules.beans.Bundle",
0716:                                        "PROP_estimatedField")).getValue());
0717:                assertEquals("Getter", "getMyProperty ()", new Property(
0718:                        propertySheetTabOperator, Bundle.getString(
0719:                                "org.netbeans.modules.beans.Bundle",
0720:                                "PROP_getter")).getValue());
0721:                assertEquals("Mode", Bundle.getString(
0722:                        "org.netbeans.modules.beans.Bundle",
0723:                        "LAB_ReadWriteMODE"), new Property(
0724:                        propertySheetTabOperator, Bundle.getString(
0725:                                "org.netbeans.modules.beans.Bundle",
0726:                                "PROP_mode")).getValue());
0727:                assertEquals("Name of Property", "myProperty", new Property(
0728:                        propertySheetTabOperator, Bundle.getString(
0729:                                "org.netbeans.modules.beans.Bundle",
0730:                                "PROP_name")).getValue());
0731:                assertEquals("Setter", "setMyProperty (String)", new Property(
0732:                        propertySheetTabOperator, Bundle.getString(
0733:                                "org.netbeans.modules.beans.Bundle",
0734:                                "PROP_setter")).getValue());
0735:                assertEquals("Type", "String", new Property(
0736:                        propertySheetTabOperator, Bundle.getString(
0737:                                "org.netbeans.modules.beans.Bundle",
0738:                                "PROP_type")).getValue());
0739:            }
0740:
0741:            private void createContent() {
0742:                // Start - NonIndexProperty
0743:                RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
0744:
0745:                Node repositoryRootNode = explorerOperator.getRootNode();
0746:                Node patternsNode = new Node(repositoryRootNode, sampleDir
0747:                        + "|"
0748:                        + NAME_TEST_FILE
0749:                        + "|"
0750:                        + "class "
0751:                        + NAME_TEST_FILE
0752:                        + "|"
0753:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0754:                                "Patterns"));
0755:                patternsNode.select();
0756:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0757:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0758:                        + "|"
0759:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0760:                                "MENU_CREATE_PROPERTY"));
0761:                String dialogTitle = Bundle.getString(
0762:                        "org.netbeans.modules.beans.Bundle",
0763:                        "CTL_TITLE_NewProperty");
0764:                NbDialogOperator nbDialogOperator = new NbDialogOperator(
0765:                        dialogTitle);
0766:
0767:                JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
0768:                        nbDialogOperator, 0);
0769:                jTextFieldOperator.typeText(NAME_NON_INDEX_PROPERTY);
0770:                JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
0771:                        nbDialogOperator, 0);
0772:                jComboBoxOperator.typeText("String");
0773:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
0774:                jComboBoxOperator.setSelectedItem(Bundle.getString(
0775:                        "org.netbeans.modules.beans.Bundle",
0776:                        "LAB_ReadWriteMODE"));
0777:                JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
0778:                        nbDialogOperator, Bundle.getString(
0779:                                "org.netbeans.modules.beans.Bundle",
0780:                                "CTL_PropertyPanel_fieldCheckBox"));
0781:                jCheckBoxOperator.push();
0782:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0783:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0784:                                "CTL_PropertyPanel_setCheckBox"));
0785:                jCheckBoxOperator.push();
0786:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0787:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0788:                                "CTL_PropertyPanel_returnCheckBox"));
0789:                jCheckBoxOperator.push();
0790:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0791:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0792:                                "CTL_PropertyPanel_constrainedCheckBox"));
0793:                jCheckBoxOperator.push();
0794:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0795:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0796:                                "CTL_PropertyPanel_boundCheckBox"));
0797:                jCheckBoxOperator.push();
0798:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0799:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0800:                                "CTL_PropertyPanel_supportCheckBox"));
0801:                jCheckBoxOperator.push();
0802:                new EventTool().waitNoEvent(1500);
0803:                nbDialogOperator.ok();
0804:                // End - NonIndexProperty
0805:                // Start - IndexProperty
0806:                explorerOperator = new RepositoryTabOperator();
0807:
0808:                repositoryRootNode = explorerOperator.getRootNode();
0809:                patternsNode = new Node(repositoryRootNode, sampleDir
0810:                        + "|"
0811:                        + NAME_TEST_FILE
0812:                        + "|"
0813:                        + "class "
0814:                        + NAME_TEST_FILE
0815:                        + "|"
0816:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0817:                                "Patterns"));
0818:                patternsNode.select();
0819:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0820:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0821:                        + "|"
0822:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0823:                                "MENU_CREATE_IDXPROPERTY"));
0824:                dialogTitle = Bundle.getString(
0825:                        "org.netbeans.modules.beans.Bundle",
0826:                        "CTL_TITLE_NewIdxProperty");
0827:                nbDialogOperator = new NbDialogOperator(dialogTitle);
0828:
0829:                jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);
0830:                jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
0831:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
0832:                jComboBoxOperator.setSelectedItem("String");
0833:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
0834:                jComboBoxOperator.setSelectedItem(Bundle.getString(
0835:                        "org.netbeans.modules.beans.Bundle",
0836:                        "LAB_ReadWriteMODE"));
0837:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0838:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0839:                                "CTL_IdxPropertyPanel_fieldCheckBox"));
0840:                jCheckBoxOperator.push();
0841:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0842:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0843:                                "CTL_IdxPropertyPanel_setCheckBox"));
0844:                jCheckBoxOperator.push();
0845:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0846:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0847:                                "CTL_IdxPropertyPanel_returnCheckBox"));
0848:                jCheckBoxOperator.push();
0849:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0850:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0851:                                "CTL_IdxPropertyPanel_niSetterCheckBox"));
0852:                jCheckBoxOperator.push();
0853:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0854:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0855:                                "CTL_IdxPropertyPanel_niGetterCheckBox"));
0856:                jCheckBoxOperator.push();
0857:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0858:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0859:                                "CTL_IdxPropertyPanel_niSetCheckBox"));
0860:                jCheckBoxOperator.push();
0861:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0862:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0863:                                "CTL_IdxPropertyPanel_niReturnCheckBox"));
0864:                jCheckBoxOperator.push();
0865:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0866:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0867:                                "CTL_IdxPropertyPanel_constrainedCheckBox"));
0868:                jCheckBoxOperator.push();
0869:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0870:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0871:                                "CTL_IdxPropertyPanel_boundCheckBox"));
0872:                jCheckBoxOperator.push();
0873:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0874:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0875:                                "CTL_IdxPropertyPanel_supportCheckBox"));
0876:                jCheckBoxOperator.push();
0877:                new EventTool().waitNoEvent(1500);
0878:                nbDialogOperator.ok();
0879:                // End - IndexProperty
0880:                // Start - UnicastEventSource
0881:                explorerOperator = new RepositoryTabOperator();
0882:
0883:                repositoryRootNode = explorerOperator.getRootNode();
0884:                patternsNode = new Node(repositoryRootNode, sampleDir
0885:                        + "|"
0886:                        + NAME_TEST_FILE
0887:                        + "|"
0888:                        + "class "
0889:                        + NAME_TEST_FILE
0890:                        + "|"
0891:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0892:                                "Patterns"));
0893:                patternsNode.select();
0894:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0895:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0896:                        + "|"
0897:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0898:                                "MENU_CREATE_UNICASTSE"));
0899:                dialogTitle = Bundle.getString(
0900:                        "org.netbeans.modules.beans.Bundle",
0901:                        "CTL_TITLE_NewUniCastES");
0902:                nbDialogOperator = new NbDialogOperator(dialogTitle);
0903:
0904:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
0905:                jComboBoxOperator
0906:                        .setSelectedItem("java.awt.event.ActionListener");
0907:                JRadioButtonOperator jRadioButtonOperator = new JRadioButtonOperator(
0908:                        nbDialogOperator, Bundle.getString(
0909:                                "org.netbeans.modules.beans.Bundle",
0910:                                "CTL_UEventSetPanel_implRadioButton"));
0911:                jRadioButtonOperator.push();
0912:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0913:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0914:                                "CTL_UEventSetPanel_fireCheckBox"));
0915:                jCheckBoxOperator.push();
0916:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0917:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0918:                                "CTL_UEventSetPanel_passEventCheckBox"));
0919:                jCheckBoxOperator.push();
0920:
0921:                new EventTool().waitNoEvent(1500);
0922:
0923:                nbDialogOperator.ok();
0924:                // End - UnicastEventSource
0925:                // Start - MulticastEventSourceArrayListImpl
0926:                explorerOperator = new RepositoryTabOperator();
0927:
0928:                repositoryRootNode = explorerOperator.getRootNode();
0929:                patternsNode = new Node(repositoryRootNode, sampleDir
0930:                        + "|"
0931:                        + NAME_TEST_FILE
0932:                        + "|"
0933:                        + "class "
0934:                        + NAME_TEST_FILE
0935:                        + "|"
0936:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0937:                                "Patterns"));
0938:                patternsNode.select();
0939:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0940:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0941:                        + "|"
0942:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0943:                                "MENU_CREATE_MULTICASTSE"));
0944:                dialogTitle = Bundle.getString(
0945:                        "org.netbeans.modules.beans.Bundle",
0946:                        "CTL_TITLE_NewMultiCastES");
0947:                nbDialogOperator = new NbDialogOperator(dialogTitle);
0948:
0949:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
0950:                jComboBoxOperator
0951:                        .setSelectedItem("java.awt.event.ItemListener");
0952:
0953:                jRadioButtonOperator = new JRadioButtonOperator(
0954:                        nbDialogOperator, Bundle.getString(
0955:                                "org.netbeans.modules.beans.Bundle",
0956:                                "CTL_EventSetPanel_alRadioButton"));
0957:                jRadioButtonOperator.push();
0958:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0959:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0960:                                "CTL_EventSetPanel_fireCheckBox"));
0961:                jCheckBoxOperator.push();
0962:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
0963:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
0964:                                "CTL_EventSetPanel_passEventCheckBox"));
0965:                jCheckBoxOperator.push();
0966:
0967:                new EventTool().waitNoEvent(1500);
0968:
0969:                nbDialogOperator.ok();
0970:                // End - MulticastEventSourceArrayListImpl
0971:                // Start - MulticastEventSourceEventListenerListImpl
0972:                explorerOperator = new RepositoryTabOperator();
0973:
0974:                repositoryRootNode = explorerOperator.getRootNode();
0975:                patternsNode = new Node(repositoryRootNode, sampleDir
0976:                        + "|"
0977:                        + NAME_TEST_FILE
0978:                        + "|"
0979:                        + "class "
0980:                        + NAME_TEST_FILE
0981:                        + "|"
0982:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0983:                                "Patterns"));
0984:                patternsNode.select();
0985:                patternsNode.performPopupActionNoBlock(Bundle.getString(
0986:                        "org.openide.src.nodes.Bundle", "LAB_Add")
0987:                        + "|"
0988:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
0989:                                "MENU_CREATE_MULTICASTSE"));
0990:                dialogTitle = Bundle.getString(
0991:                        "org.netbeans.modules.beans.Bundle",
0992:                        "CTL_TITLE_NewMultiCastES");
0993:                nbDialogOperator = new NbDialogOperator(dialogTitle);
0994:
0995:                jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
0996:                jComboBoxOperator
0997:                        .setSelectedItem("java.awt.event.FocusListener");
0998:
0999:                jRadioButtonOperator = new JRadioButtonOperator(
1000:                        nbDialogOperator, Bundle.getString(
1001:                                "org.netbeans.modules.beans.Bundle",
1002:                                "CTL_EventSetPanel_ellRadioButton"));
1003:                jRadioButtonOperator.push();
1004:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
1005:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
1006:                                "CTL_EventSetPanel_fireCheckBox"));
1007:                jCheckBoxOperator.push();
1008:                jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
1009:                        Bundle.getString("org.netbeans.modules.beans.Bundle",
1010:                                "CTL_EventSetPanel_passEventCheckBox"));
1011:                jCheckBoxOperator.push();
1012:                new EventTool().waitNoEvent(1500);
1013:                nbDialogOperator.ok();
1014:
1015:            }
1016:
1017:            public void testDeleteAnyPropertiesAndEvents() {
1018:                Node repositoryRootNode = RepositoryTabOperator.invoke()
1019:                        .getRootNode();
1020:
1021:                FolderNode examplesFolderNode = new FolderNode(
1022:                        repositoryRootNode, sampleDir); // NOI18N
1023:                examplesFolderNode.select();
1024:                DefaultStringComparator comparator = new DefaultStringComparator(
1025:                        true, true);
1026:                new NewTemplateAction().perform();
1027:                NewWizardOperator newWizardOper = new NewWizardOperator();
1028:                ChooseTemplateStepOperator ctso = new ChooseTemplateStepOperator();
1029:                String bean = Bundle.getString(
1030:                        "org.netbeans.modules.beans.Bundle", "Templates/Beans")
1031:                        + "|"
1032:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
1033:                                "Templates/Beans/Bean.java");
1034:                ctso.selectTemplate(bean);
1035:                ctso.next();
1036:                TargetLocationStepOperator tlso = new TargetLocationStepOperator();
1037:                tlso.setName(NAME_TEST_FILE);
1038:                tlso.tree().setComparator(comparator);
1039:                tlso.selectLocation(sampleDir);
1040:                tlso.finish();
1041:
1042:                EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
1043:                eo.select(1, 6);
1044:                new DeleteAction().performAPI(eo);
1045:                new EventTool().waitNoEvent(1500);
1046:                eo.select(3, 6);
1047:
1048:                new DeleteAction().performAPI(eo);
1049:                new EventTool().waitNoEvent(1500);
1050:
1051:                try {
1052:                    File workDir = getWorkDir();
1053:                    (new File(workDir,
1054:                            "testDeleteAnyPropertiesAndEventsInitial.ref"))
1055:                            .createNewFile();
1056:                    PrintWriter out = new PrintWriter(
1057:                            new BufferedWriter(
1058:                                    new FileWriter(
1059:                                            workDir
1060:                                                    + File.separator
1061:                                                    + "testDeleteAnyPropertiesAndEventsInitial.ref")));
1062:                    out.print(eo.getText());
1063:                    out.close();
1064:                } catch (IOException exc) {
1065:                    exc.printStackTrace();
1066:                }
1067:                compareReferenceFiles(
1068:                        "testDeleteAnyPropertiesAndEventsInitial.ref",
1069:                        "testDeleteAnyPropertiesAndEventsInitial.pass",
1070:                        "testDeleteAnyPropertiesAndEventsInitial.diff");
1071:
1072:                createContent();
1073:
1074:                // Delete nonIndexProperty
1075:
1076:                JavaNode patternsNode = new JavaNode(sampleDir
1077:                        + "|"
1078:                        + NAME_TEST_FILE
1079:                        + "|"
1080:                        + "class "
1081:                        + NAME_TEST_FILE
1082:                        + "|"
1083:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
1084:                                "Patterns") + "|" + NAME_NON_INDEX_PROPERTY);
1085:                patternsNode.select();
1086:                patternsNode.delete();
1087:
1088:                String confirmTitle = Bundle.getString(
1089:                        "org.openide.explorer.Bundle",
1090:                        "MSG_ConfirmDeleteObjectTitle");
1091:                new NbDialogOperator(confirmTitle).yes();
1092:                String questionTitle = Bundle.getString("org.openide.Bundle",
1093:                        "NTF_QuestionTitle");
1094:                NbDialogOperator nbDialogOperator = new NbDialogOperator(
1095:                        questionTitle);
1096:                nbDialogOperator.yes();
1097:
1098:                patternsNode.waitNotPresent();
1099:                // Delete indexProperty
1100:                JavaNode patternsNode2 = new JavaNode(sampleDir
1101:                        + "|"
1102:                        + NAME_TEST_FILE
1103:                        + "|"
1104:                        + "class "
1105:                        + NAME_TEST_FILE
1106:                        + "|"
1107:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
1108:                                "Patterns") + "|" + NAME_INDEX_PROPERTY);
1109:                patternsNode2.select();
1110:                patternsNode2.delete();
1111:
1112:                confirmTitle = Bundle.getString("org.openide.explorer.Bundle",
1113:                        "MSG_ConfirmDeleteObjectTitle");
1114:                new NbDialogOperator(confirmTitle).yes();
1115:                questionTitle = Bundle.getString("org.openide.Bundle",
1116:                        "NTF_QuestionTitle");
1117:                nbDialogOperator = new NbDialogOperator(questionTitle);
1118:                nbDialogOperator.yes();
1119:
1120:                patternsNode2.waitNotPresent();
1121:
1122:                // Delete action listener
1123:                JavaNode patternsNode3 = new JavaNode(sampleDir
1124:                        + "|"
1125:                        + NAME_TEST_FILE
1126:                        + "|"
1127:                        + "class "
1128:                        + NAME_TEST_FILE
1129:                        + "|"
1130:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
1131:                                "Patterns") + "|" + "actionListener");
1132:                patternsNode3.select();
1133:                patternsNode3.delete();
1134:
1135:                confirmTitle = Bundle.getString("org.openide.explorer.Bundle",
1136:                        "MSG_ConfirmDeleteObjectTitle");
1137:                new NbDialogOperator(confirmTitle).yes();
1138:                questionTitle = Bundle.getString("org.openide.Bundle",
1139:                        "NTF_QuestionTitle");
1140:                nbDialogOperator = new NbDialogOperator(questionTitle);
1141:                nbDialogOperator.yes();
1142:
1143:                patternsNode3.waitNotPresent();
1144:
1145:                // Delete focus listener
1146:                JavaNode patternsNode4 = new JavaNode(sampleDir
1147:                        + "|"
1148:                        + NAME_TEST_FILE
1149:                        + "|"
1150:                        + "class "
1151:                        + NAME_TEST_FILE
1152:                        + "|"
1153:                        + Bundle.getString("org.netbeans.modules.beans.Bundle",
1154:                                "Patterns") + "|" + "focusListener");
1155:                patternsNode4.select();
1156:                patternsNode4.delete();
1157:
1158:                confirmTitle = Bundle.getString("org.openide.explorer.Bundle",
1159:                        "MSG_ConfirmDeleteObjectTitle");
1160:                new NbDialogOperator(confirmTitle).yes();
1161:                questionTitle = Bundle.getString("org.openide.Bundle",
1162:                        "NTF_QuestionTitle");
1163:                nbDialogOperator = new NbDialogOperator(questionTitle);
1164:                nbDialogOperator.yes();
1165:
1166:                patternsNode4.waitNotPresent();
1167:                new EventTool().waitNoEvent(1500);
1168:                try {
1169:                    File workDir = getWorkDir();
1170:                    (new File(workDir,
1171:                            "testDeleteAnyPropertiesAndEventsModified.ref"))
1172:                            .createNewFile();
1173:                    PrintWriter out = new PrintWriter(
1174:                            new BufferedWriter(
1175:                                    new FileWriter(
1176:                                            workDir
1177:                                                    + File.separator
1178:                                                    + "testDeleteAnyPropertiesAndEventsModified.ref")));
1179:                    out.print(eo.getText());
1180:                    out.close();
1181:                } catch (IOException exc) {
1182:                    exc.printStackTrace();
1183:                }
1184:                compareReferenceFiles(
1185:                        "testDeleteAnyPropertiesAndEventsModified.ref",
1186:                        "testDeleteAnyPropertiesAndEventsModified.pass",
1187:                        "testDeleteAnyPropertiesAndEventsModified.diff");
1188:
1189:            }
1190:
1191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.