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-2006 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 gui;
043:
044: import java.io.File;
045: import java.io.IOException;
046:
047: import junit.textui.TestRunner;
048: import org.netbeans.jellytools.Bundle;
049: import org.netbeans.jellytools.EditorOperator;
050: import org.netbeans.jellytools.JellyTestCase;
051: import org.netbeans.jellytools.NbDialogOperator;
052: import org.netbeans.jellytools.OptionsOperator;
053: import org.netbeans.jellytools.RepositoryTabOperator;
054: import org.netbeans.jellytools.actions.PropertiesAction;
055: import org.netbeans.jellytools.nodes.JavaNode;
056: import org.netbeans.jellytools.nodes.Node;
057: import org.netbeans.jellytools.properties.Property;
058: import org.netbeans.jellytools.properties.PropertySheetOperator;
059: import org.netbeans.jemmy.EventTool;
060: import org.netbeans.jemmy.operators.JCheckBoxOperator;
061: import org.netbeans.jemmy.operators.JComboBoxOperator;
062: import org.netbeans.jemmy.operators.JTextFieldOperator;
063: import org.netbeans.junit.NbTestSuite;
064:
065: import org.openide.actions.SaveAllAction;
066: import org.openide.filesystems.FileObject;
067:
068: import org.openide.filesystems.Repository;
069: import org.openide.loaders.DataFolder;
070: import org.openide.loaders.DataObject;
071:
072: public class CreateNewIndexedProperty extends JellyTestCase {
073:
074: private static final String NAME_TEST_FILE = "TestFile";
075: private static final String NAME_INDEX_PROPERTY = "indexProperty";
076: private static final String NAME_WRONG = "123";
077: private static final String TYPE_WRONG = "+++";
078:
079: private static final String sampleDir = Utilities.findFileSystem(
080: "src").getDisplayName();
081:
082: /** Need to be defined because of JUnit */
083: public CreateNewIndexedProperty(String name) {
084: super (name);
085: }
086:
087: public static NbTestSuite suite() {
088: NbTestSuite suite = new NbTestSuite();
089: suite.addTest(new CreateNewIndexedProperty("testName"));
090: suite.addTest(new CreateNewIndexedProperty("testType"));
091: suite.addTest(new CreateNewIndexedProperty("testMode"));
092: suite.addTest(new CreateNewIndexedProperty("testBound"));
093: suite.addTest(new CreateNewIndexedProperty("testConstrained"));
094: suite
095: .addTest(new CreateNewIndexedProperty(
096: "testGenerateField"));
097: suite.addTest(new CreateNewIndexedProperty(
098: "testGenerateReturnStatement"));
099: suite.addTest(new CreateNewIndexedProperty(
100: "testGenerateSetStatement"));
101: suite.addTest(new CreateNewIndexedProperty(
102: "testGenerateNonIndexedGetterWithReturnStatement"));
103: suite.addTest(new CreateNewIndexedProperty(
104: "testGenerateIndexedSetter"));
105: suite.addTest(new CreateNewIndexedProperty(
106: "testGeneratePropertyChangeSupport"));
107: return suite;
108: }
109:
110: /** Use for execution inside IDE */
111: public static void main(java.lang.String[] args) {
112: // run whole suite
113: TestRunner.run(suite());
114: // run only selected test case
115: //junit.textui.TestRunner.run(new BeansTemplates("testJavaBean"));
116: }
117:
118: /** setUp method */
119: public void setUp() {
120: // redirect jemmy trace and error output to a log
121: System.out.println("######## " + getName() + " #######");
122:
123: OptionsOperator optionsOperator = OptionsOperator.invoke();
124: optionsOperator.selectOption(Bundle.getString(
125: "org.netbeans.core.Bundle", "UI/Services/Editing")
126: + "|"
127: + Bundle.getString("org.netbeans.modules.beans.Bundle",
128: "PROP_Option_Menu"));
129: PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator(
130: optionsOperator);
131: new Property(propertySheetTabOperator, Bundle.getString(
132: "org.netbeans.modules.beans.Bundle",
133: "PROP_Option_Prop_Style")).setValue(Bundle.getString(
134: "org.netbeans.modules.beans.Bundle",
135: "MSG_Option_Gen_This"));
136:
137: FileObject testFile = Repository.getDefault().findResource(
138: "gui/data/" + NAME_TEST_FILE + ".java");
139: FileObject destination = Repository.getDefault()
140: .findFileSystem(sampleDir.replace('\\', '/')).getRoot();
141: optionsOperator.close();
142: try {
143: DataObject.find(testFile).copy(
144: DataFolder.findFolder(destination));
145: } catch (IOException e) {
146: fail(e);
147: }
148: new PropertiesAction().perform();
149: }
150:
151: /** tearDown method */
152: public void tearDown() {
153: ((SaveAllAction) SaveAllAction.findObject(SaveAllAction.class,
154: true)).performAction();
155:
156: Utilities.delete(NAME_TEST_FILE + ".java");
157: }
158:
159: /** testName method */
160: public void testName() {
161: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
162:
163: Node repositoryRootNode = explorerOperator.getRootNode();
164: Node patternsNode = new Node(repositoryRootNode, sampleDir
165: + "|"
166: + NAME_TEST_FILE
167: + "|"
168: + "class "
169: + NAME_TEST_FILE
170: + "|"
171: + Bundle.getString("org.netbeans.modules.beans.Bundle",
172: "Patterns"));
173: patternsNode.select();
174: patternsNode.performPopupActionNoBlock(Bundle.getString(
175: "org.openide.src.nodes.Bundle", "LAB_Add")
176: + "|"
177: + Bundle.getString("org.netbeans.modules.beans.Bundle",
178: "MENU_CREATE_IDXPROPERTY"));
179: String dialogTitle = Bundle.getString(
180: "org.netbeans.modules.beans.Bundle",
181: "CTL_TITLE_NewIdxProperty");
182: NbDialogOperator nbDialogOperator = new NbDialogOperator(
183: dialogTitle);
184: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
185: nbDialogOperator, 0);
186:
187: jTextFieldOperator.typeText(NAME_WRONG);
188:
189: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
190: nbDialogOperator, 0);
191: jComboBoxOperator.setSelectedItem("String");
192:
193: nbDialogOperator.ok();
194:
195: new EventTool().waitNoEvent(3000);
196:
197: new NbDialogOperator("Error").ok();
198:
199: jTextFieldOperator.clearText();
200: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
201:
202: jComboBoxOperator.setSelectedItem("String");
203:
204: nbDialogOperator.ok();
205:
206: new JavaNode(repositoryRootNode, sampleDir + "|"
207: + NAME_TEST_FILE).open();
208:
209: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
210: ref(eo.getText());
211: compareReferenceFiles();
212: }
213:
214: /** testType method */
215: public void testType() {
216: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
217:
218: Node repositoryRootNode = explorerOperator.getRootNode();
219: Node patternsNode = new Node(repositoryRootNode, sampleDir
220: + "|"
221: + NAME_TEST_FILE
222: + "|"
223: + "class "
224: + NAME_TEST_FILE
225: + "|"
226: + Bundle.getString("org.netbeans.modules.beans.Bundle",
227: "Patterns"));
228: patternsNode.select();
229: patternsNode.performPopupActionNoBlock(Bundle.getString(
230: "org.openide.src.nodes.Bundle", "LAB_Add")
231: + "|"
232: + Bundle.getString("org.netbeans.modules.beans.Bundle",
233: "MENU_CREATE_IDXPROPERTY"));
234: String dialogTitle = Bundle.getString(
235: "org.netbeans.modules.beans.Bundle",
236: "CTL_TITLE_NewIdxProperty");
237: NbDialogOperator nbDialogOperator = new NbDialogOperator(
238: dialogTitle);
239:
240: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
241: nbDialogOperator, 0);
242: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
243:
244: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
245: nbDialogOperator, 0);
246: jComboBoxOperator.typeText(TYPE_WRONG);
247:
248: nbDialogOperator.ok();
249:
250: new EventTool().waitNoEvent(3000);
251:
252: new NbDialogOperator("Error").ok();
253:
254: jTextFieldOperator.clearText();
255: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
256: jComboBoxOperator.clearText();
257: jComboBoxOperator.setSelectedItem("Double");
258:
259: nbDialogOperator.ok();
260:
261: new JavaNode(repositoryRootNode, sampleDir + "|"
262: + NAME_TEST_FILE).open();
263:
264: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
265: ref(eo.getText());
266: compareReferenceFiles();
267: }
268:
269: /** testMode method */
270: public void testMode() {
271: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
272:
273: Node repositoryRootNode = explorerOperator.getRootNode();
274: Node patternsNode = new Node(repositoryRootNode, sampleDir
275: + "|"
276: + NAME_TEST_FILE
277: + "|"
278: + "class "
279: + NAME_TEST_FILE
280: + "|"
281: + Bundle.getString("org.netbeans.modules.beans.Bundle",
282: "Patterns"));
283: patternsNode.select();
284: patternsNode.performPopupActionNoBlock(Bundle.getString(
285: "org.openide.src.nodes.Bundle", "LAB_Add")
286: + "|"
287: + Bundle.getString("org.netbeans.modules.beans.Bundle",
288: "MENU_CREATE_IDXPROPERTY"));
289: String dialogTitle = Bundle.getString(
290: "org.netbeans.modules.beans.Bundle",
291: "CTL_TITLE_NewIdxProperty");
292: NbDialogOperator nbDialogOperator = new NbDialogOperator(
293: dialogTitle);
294:
295: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
296: nbDialogOperator, 0);
297: jTextFieldOperator.typeText("first");
298:
299: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
300: nbDialogOperator, 0);
301: jComboBoxOperator.setSelectedItem("int");
302: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
303: jComboBoxOperator.setSelectedItem("Read Only");
304: nbDialogOperator.ok();
305:
306: patternsNode.performPopupActionNoBlock(Bundle.getString(
307: "org.openide.src.nodes.Bundle", "LAB_Add")
308: + "|"
309: + Bundle.getString("org.netbeans.modules.beans.Bundle",
310: "MENU_CREATE_IDXPROPERTY"));
311: nbDialogOperator = new NbDialogOperator(dialogTitle);
312: jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);
313: jTextFieldOperator.typeText("second");
314:
315: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
316: jComboBoxOperator.setSelectedItem("double");
317: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
318: jComboBoxOperator.setSelectedItem("Write Only");
319: nbDialogOperator.ok();
320:
321: patternsNode.performPopupActionNoBlock(Bundle.getString(
322: "org.openide.src.nodes.Bundle", "LAB_Add")
323: + "|"
324: + Bundle.getString("org.netbeans.modules.beans.Bundle",
325: "MENU_CREATE_IDXPROPERTY"));
326: nbDialogOperator = new NbDialogOperator(dialogTitle);
327: jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);
328: jTextFieldOperator.typeText("third");
329:
330: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
331: jComboBoxOperator.setSelectedItem("long");
332: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
333: jComboBoxOperator.setSelectedItem(Bundle.getString(
334: "org.openide.src.nodes.Bundle", "LAB_Add"));
335: nbDialogOperator.ok();
336: new JavaNode(repositoryRootNode, sampleDir + "|"
337: + NAME_TEST_FILE).open();
338:
339: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
340: ref(eo.getText());
341: compareReferenceFiles();
342: }
343:
344: /** testBound method */
345: public void testBound() {
346: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
347:
348: Node repositoryRootNode = explorerOperator.getRootNode();
349: Node patternsNode = new Node(repositoryRootNode, sampleDir
350: + "|"
351: + NAME_TEST_FILE
352: + "|"
353: + "class "
354: + NAME_TEST_FILE
355: + "|"
356: + Bundle.getString("org.netbeans.modules.beans.Bundle",
357: "Patterns"));
358: patternsNode.select();
359: patternsNode.performPopupActionNoBlock(Bundle.getString(
360: "org.openide.src.nodes.Bundle", "LAB_Add")
361: + "|"
362: + Bundle.getString("org.netbeans.modules.beans.Bundle",
363: "MENU_CREATE_IDXPROPERTY"));
364: String dialogTitle = Bundle.getString(
365: "org.netbeans.modules.beans.Bundle",
366: "CTL_TITLE_NewIdxProperty");
367: NbDialogOperator nbDialogOperator = new NbDialogOperator(
368: dialogTitle);
369:
370: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
371: nbDialogOperator, 0);
372: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
373:
374: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
375: nbDialogOperator, 0);
376: jComboBoxOperator.setSelectedItem("MyType");
377: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
378: jComboBoxOperator.setSelectedItem(Bundle.getString(
379: "org.openide.src.nodes.Bundle", "LAB_Add"));
380: JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
381: nbDialogOperator, 0);
382: jCheckBoxOperator.push();
383: new EventTool().waitNoEvent(3000);
384: nbDialogOperator.ok();
385:
386: new JavaNode(repositoryRootNode, sampleDir + "|"
387: + NAME_TEST_FILE).open();
388:
389: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
390: ref(eo.getText());
391: compareReferenceFiles();
392: }
393:
394: /** testConstrained method */
395: public void testConstrained() {
396: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
397:
398: Node repositoryRootNode = explorerOperator.getRootNode();
399: Node patternsNode = new Node(repositoryRootNode, sampleDir
400: + "|"
401: + NAME_TEST_FILE
402: + "|"
403: + "class "
404: + NAME_TEST_FILE
405: + "|"
406: + Bundle.getString("org.netbeans.modules.beans.Bundle",
407: "Patterns"));
408: patternsNode.select();
409: patternsNode.performPopupActionNoBlock(Bundle.getString(
410: "org.openide.src.nodes.Bundle", "LAB_Add")
411: + "|"
412: + Bundle.getString("org.netbeans.modules.beans.Bundle",
413: "MENU_CREATE_IDXPROPERTY"));
414: String dialogTitle = Bundle.getString(
415: "org.netbeans.modules.beans.Bundle",
416: "CTL_TITLE_NewIdxProperty");
417: NbDialogOperator nbDialogOperator = new NbDialogOperator(
418: dialogTitle);
419:
420: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
421: nbDialogOperator, 0);
422: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
423:
424: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
425: nbDialogOperator, 0);
426: jComboBoxOperator.setSelectedItem("MyType");
427: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
428: jComboBoxOperator.setSelectedItem(Bundle.getString(
429: "org.openide.src.nodes.Bundle", "LAB_Add"));
430: JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
431: nbDialogOperator, Bundle.getString(
432: "org.netbeans.modules.beans.Bundle",
433: "CTL_IdxPropertyPanel_constrainedCheckBox"));
434: jCheckBoxOperator.push();
435: new EventTool().waitNoEvent(3000);
436: nbDialogOperator.ok();
437:
438: new JavaNode(repositoryRootNode, sampleDir + "|"
439: + NAME_TEST_FILE).open();
440:
441: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
442: ref(eo.getText());
443: compareReferenceFiles();
444: }
445:
446: /** testGenerateField method */
447: public void testGenerateField() {
448: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
449:
450: Node repositoryRootNode = explorerOperator.getRootNode();
451: Node patternsNode = new Node(repositoryRootNode, sampleDir
452: + "|"
453: + NAME_TEST_FILE
454: + "|"
455: + "class "
456: + NAME_TEST_FILE
457: + "|"
458: + Bundle.getString("org.netbeans.modules.beans.Bundle",
459: "Patterns"));
460: patternsNode.select();
461: patternsNode.performPopupActionNoBlock(Bundle.getString(
462: "org.openide.src.nodes.Bundle", "LAB_Add")
463: + "|"
464: + Bundle.getString("org.netbeans.modules.beans.Bundle",
465: "MENU_CREATE_IDXPROPERTY"));
466: String dialogTitle = Bundle.getString(
467: "org.netbeans.modules.beans.Bundle",
468: "CTL_TITLE_NewIdxProperty");
469: NbDialogOperator nbDialogOperator = new NbDialogOperator(
470: dialogTitle);
471:
472: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
473: nbDialogOperator, 0);
474: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
475:
476: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
477: nbDialogOperator, 0);
478: jComboBoxOperator.setSelectedItem("MyType");
479: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
480: jComboBoxOperator.setSelectedItem(Bundle.getString(
481: "org.openide.src.nodes.Bundle", "LAB_Add"));
482: JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
483: nbDialogOperator, Bundle.getString(
484: "org.netbeans.modules.beans.Bundle",
485: "CTL_IdxPropertyPanel_fieldCheckBox"));
486: jCheckBoxOperator.push();
487: new EventTool().waitNoEvent(3000);
488: nbDialogOperator.ok();
489:
490: new JavaNode(repositoryRootNode, sampleDir + "|"
491: + NAME_TEST_FILE).open();
492:
493: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
494: ref(eo.getText());
495: compareReferenceFiles();
496: }
497:
498: /** testGenerateReturnStatement method */
499: public void testGenerateReturnStatement() {
500: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
501:
502: Node repositoryRootNode = explorerOperator.getRootNode();
503: Node patternsNode = new Node(repositoryRootNode, sampleDir
504: + "|"
505: + NAME_TEST_FILE
506: + "|"
507: + "class "
508: + NAME_TEST_FILE
509: + "|"
510: + Bundle.getString("org.netbeans.modules.beans.Bundle",
511: "Patterns"));
512: patternsNode.select();
513: patternsNode.performPopupActionNoBlock(Bundle.getString(
514: "org.openide.src.nodes.Bundle", "LAB_Add")
515: + "|"
516: + Bundle.getString("org.netbeans.modules.beans.Bundle",
517: "MENU_CREATE_IDXPROPERTY"));
518: String dialogTitle = Bundle.getString(
519: "org.netbeans.modules.beans.Bundle",
520: "CTL_TITLE_NewIdxProperty");
521: NbDialogOperator nbDialogOperator = new NbDialogOperator(
522: dialogTitle);
523:
524: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
525: nbDialogOperator, 0);
526: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
527:
528: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
529: nbDialogOperator, 0);
530: jComboBoxOperator.setSelectedItem("MyType");
531: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
532: jComboBoxOperator.setSelectedItem(Bundle.getString(
533: "org.openide.src.nodes.Bundle", "LAB_Add"));
534: JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
535: nbDialogOperator, Bundle.getString(
536: "org.netbeans.modules.beans.Bundle",
537: "CTL_IdxPropertyPanel_fieldCheckBox"));
538: jCheckBoxOperator.push();
539: new EventTool().waitNoEvent(3000);
540: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
541: Bundle.getString("org.netbeans.modules.beans.Bundle",
542: "CTL_IdxPropertyPanel_returnCheckBox"));
543: jCheckBoxOperator.push();
544: new EventTool().waitNoEvent(3000);
545: nbDialogOperator.ok();
546:
547: new JavaNode(repositoryRootNode, sampleDir + "|"
548: + NAME_TEST_FILE).open();
549:
550: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
551: ref(eo.getText());
552: compareReferenceFiles();
553: }
554:
555: /** testGenerateSetStatement method */
556: public void testGenerateSetStatement() {
557: //
558: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
559:
560: Node repositoryRootNode = explorerOperator.getRootNode();
561: Node patternsNode = new Node(repositoryRootNode, sampleDir
562: + "|"
563: + NAME_TEST_FILE
564: + "|"
565: + "class "
566: + NAME_TEST_FILE
567: + "|"
568: + Bundle.getString("org.netbeans.modules.beans.Bundle",
569: "Patterns"));
570: patternsNode.select();
571: patternsNode.performPopupActionNoBlock(Bundle.getString(
572: "org.openide.src.nodes.Bundle", "LAB_Add")
573: + "|"
574: + Bundle.getString("org.netbeans.modules.beans.Bundle",
575: "MENU_CREATE_IDXPROPERTY"));
576: String dialogTitle = Bundle.getString(
577: "org.netbeans.modules.beans.Bundle",
578: "CTL_TITLE_NewIdxProperty");
579: NbDialogOperator nbDialogOperator = new NbDialogOperator(
580: dialogTitle);
581:
582: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
583: nbDialogOperator, 0);
584: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
585:
586: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
587: nbDialogOperator, 0);
588: jComboBoxOperator.setSelectedItem("MyType");
589: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
590: jComboBoxOperator.setSelectedItem(Bundle.getString(
591: "org.openide.src.nodes.Bundle", "LAB_Add"));
592: JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
593: nbDialogOperator, Bundle.getString(
594: "org.netbeans.modules.beans.Bundle",
595: "CTL_IdxPropertyPanel_fieldCheckBox"));
596: jCheckBoxOperator.push();
597: new EventTool().waitNoEvent(3000);
598: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
599: Bundle.getString("org.netbeans.modules.beans.Bundle",
600: "CTL_IdxPropertyPanel_setCheckBox"));
601: jCheckBoxOperator.push();
602: new EventTool().waitNoEvent(3000);
603: nbDialogOperator.ok();
604:
605: new JavaNode(repositoryRootNode, sampleDir + "|"
606: + NAME_TEST_FILE).open();
607:
608: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
609: ref(eo.getText());
610: compareReferenceFiles();
611: //
612: }
613:
614: /** testGenerateNonIndexedGetterWithReturnStatement method */
615: public void testGenerateNonIndexedGetterWithReturnStatement() {
616: //
617: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
618:
619: Node repositoryRootNode = explorerOperator.getRootNode();
620: Node patternsNode = new Node(repositoryRootNode, sampleDir
621: + "|"
622: + NAME_TEST_FILE
623: + "|"
624: + "class "
625: + NAME_TEST_FILE
626: + "|"
627: + Bundle.getString("org.netbeans.modules.beans.Bundle",
628: "Patterns"));
629: patternsNode.select();
630: patternsNode.performPopupActionNoBlock(Bundle.getString(
631: "org.openide.src.nodes.Bundle", "LAB_Add")
632: + "|"
633: + Bundle.getString("org.netbeans.modules.beans.Bundle",
634: "MENU_CREATE_IDXPROPERTY"));
635: String dialogTitle = Bundle.getString(
636: "org.netbeans.modules.beans.Bundle",
637: "CTL_TITLE_NewIdxProperty");
638: NbDialogOperator nbDialogOperator = new NbDialogOperator(
639: dialogTitle);
640:
641: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
642: nbDialogOperator, 0);
643: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
644:
645: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
646: nbDialogOperator, 0);
647: jComboBoxOperator.setSelectedItem("MyType");
648: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
649: jComboBoxOperator.setSelectedItem(Bundle.getString(
650: "org.openide.src.nodes.Bundle", "LAB_Add"));
651: JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
652: nbDialogOperator, Bundle.getString(
653: "org.netbeans.modules.beans.Bundle",
654: "CTL_IdxPropertyPanel_fieldCheckBox"));
655: jCheckBoxOperator.push();
656: new EventTool().waitNoEvent(3000);
657: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
658: Bundle.getString("org.netbeans.modules.beans.Bundle",
659: "CTL_IdxPropertyPanel_niGetterCheckBox"));
660: jCheckBoxOperator.push();
661: new EventTool().waitNoEvent(3000);
662: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
663: Bundle.getString("org.netbeans.modules.beans.Bundle",
664: "CTL_IdxPropertyPanel_niReturnCheckBox"));
665: jCheckBoxOperator.push();
666: new EventTool().waitNoEvent(3000);
667: nbDialogOperator.ok();
668:
669: new JavaNode(repositoryRootNode, sampleDir + "|"
670: + NAME_TEST_FILE).open();
671:
672: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
673: ref(eo.getText());
674: compareReferenceFiles();
675: //
676: }
677:
678: /** testGenerateIndexedSetter method */
679: public void testGenerateIndexedSetter() {
680: //
681: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
682:
683: Node repositoryRootNode = explorerOperator.getRootNode();
684: Node patternsNode = new Node(repositoryRootNode, sampleDir
685: + "|"
686: + NAME_TEST_FILE
687: + "|"
688: + "class "
689: + NAME_TEST_FILE
690: + "|"
691: + Bundle.getString("org.netbeans.modules.beans.Bundle",
692: "Patterns"));
693: patternsNode.select();
694: patternsNode.performPopupActionNoBlock(Bundle.getString(
695: "org.openide.src.nodes.Bundle", "LAB_Add")
696: + "|"
697: + Bundle.getString("org.netbeans.modules.beans.Bundle",
698: "MENU_CREATE_IDXPROPERTY"));
699: String dialogTitle = Bundle.getString(
700: "org.netbeans.modules.beans.Bundle",
701: "CTL_TITLE_NewIdxProperty");
702: NbDialogOperator nbDialogOperator = new NbDialogOperator(
703: dialogTitle);
704:
705: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
706: nbDialogOperator, 0);
707: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
708:
709: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
710: nbDialogOperator, 0);
711: jComboBoxOperator.setSelectedItem("MyType");
712: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
713: jComboBoxOperator.setSelectedItem(Bundle.getString(
714: "org.openide.src.nodes.Bundle", "LAB_Add"));
715: JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
716: nbDialogOperator, Bundle.getString(
717: "org.netbeans.modules.beans.Bundle",
718: "CTL_IdxPropertyPanel_fieldCheckBox"));
719: jCheckBoxOperator.push();
720: new EventTool().waitNoEvent(3000);
721: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
722: Bundle.getString("org.netbeans.modules.beans.Bundle",
723: "CTL_IdxPropertyPanel_niSetterCheckBox"));
724: jCheckBoxOperator.push();
725: new EventTool().waitNoEvent(3000);
726: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
727: Bundle.getString("org.netbeans.modules.beans.Bundle",
728: "CTL_IdxPropertyPanel_niSetCheckBox"));
729: jCheckBoxOperator.push();
730: new EventTool().waitNoEvent(3000);
731: nbDialogOperator.ok();
732:
733: new JavaNode(repositoryRootNode, sampleDir + "|"
734: + NAME_TEST_FILE).open();
735:
736: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
737: ref(eo.getText());
738: compareReferenceFiles();
739: //
740: }
741:
742: /** testGeneratePropertyChangeSupport method */
743: public void testGeneratePropertyChangeSupport() {
744: //
745: RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
746:
747: Node repositoryRootNode = explorerOperator.getRootNode();
748: Node patternsNode = new Node(repositoryRootNode, sampleDir
749: + "|"
750: + NAME_TEST_FILE
751: + "|"
752: + "class "
753: + NAME_TEST_FILE
754: + "|"
755: + Bundle.getString("org.netbeans.modules.beans.Bundle",
756: "Patterns"));
757: patternsNode.select();
758: patternsNode.performPopupActionNoBlock(Bundle.getString(
759: "org.openide.src.nodes.Bundle", "LAB_Add")
760: + "|"
761: + Bundle.getString("org.netbeans.modules.beans.Bundle",
762: "MENU_CREATE_IDXPROPERTY"));
763: String dialogTitle = Bundle.getString(
764: "org.netbeans.modules.beans.Bundle",
765: "CTL_TITLE_NewIdxProperty");
766: NbDialogOperator nbDialogOperator = new NbDialogOperator(
767: dialogTitle);
768:
769: JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(
770: nbDialogOperator, 0);
771: jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
772:
773: JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(
774: nbDialogOperator, 0);
775: jComboBoxOperator.setSelectedItem("MyType");
776: jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 1);
777: jComboBoxOperator.setSelectedItem(Bundle.getString(
778: "org.openide.src.nodes.Bundle", "LAB_Add"));
779:
780: JCheckBoxOperator jCheckBoxOperator = new JCheckBoxOperator(
781: nbDialogOperator, Bundle.getString(
782: "org.netbeans.modules.beans.Bundle",
783: "CTL_IdxPropertyPanel_fieldCheckBox"));
784: jCheckBoxOperator.push();
785: new EventTool().waitNoEvent(1000);
786: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
787: Bundle.getString("org.netbeans.modules.beans.Bundle",
788: "CTL_IdxPropertyPanel_setCheckBox"));
789: jCheckBoxOperator.push();
790: new EventTool().waitNoEvent(1000);
791: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
792: Bundle.getString("org.netbeans.modules.beans.Bundle",
793: "CTL_IdxPropertyPanel_constrainedCheckBox"));
794: jCheckBoxOperator.push();
795: new EventTool().waitNoEvent(1000);
796: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
797: Bundle.getString("org.netbeans.modules.beans.Bundle",
798: "CTL_IdxPropertyPanel_boundCheckBox"));
799: jCheckBoxOperator.push();
800: new EventTool().waitNoEvent(1000);
801: jCheckBoxOperator = new JCheckBoxOperator(nbDialogOperator,
802: Bundle.getString("org.netbeans.modules.beans.Bundle",
803: "CTL_IdxPropertyPanel_supportCheckBox"));
804: jCheckBoxOperator.push();
805: new EventTool().waitNoEvent(3000);
806: nbDialogOperator.ok();
807:
808: new JavaNode(repositoryRootNode, sampleDir + "|"
809: + NAME_TEST_FILE).open();
810:
811: EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
812: ref(eo.getText());
813: compareReferenceFiles();
814: //
815: }
816:
817: }
|