001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.test.uml.findreplaceassociate;
043:
044: import java.io.*;
045: import java.util.LinkedList;
046: import org.netbeans.jemmy.*;
047: import org.netbeans.jemmy.operators.*;
048: import org.netbeans.junit.NbTestSuite;
049: import org.netbeans.test.uml.findreplaceassociate.utils.FRAUtils;
050: import org.netbeans.test.umllib.FindDialogOperator;
051: import org.netbeans.test.umllib.project.Project;
052: import org.netbeans.test.umllib.testcases.UMLTestCase;
053:
054: /**
055: *
056: * @author yaa
057: * @spec uml/FindReplaceAssociate.xml
058: */
059: public class Find extends UMLTestCase {
060: private static String prName1 = "UMLProject1";
061:
062: private static String OUT_LOG_FILE = "";
063: private static String ERR_LOG_FILE = "";
064: private static PrintStream myOut = null;
065: private static PrintStream myErr = null;
066: private static BufferedReader myIn = null;
067: public LinkedList testData = null;
068:
069: private static boolean isNotInitialized = true;
070: private EventTool eventTool = new EventTool();
071:
072: /** Need to be defined because of JUnit */
073: public Find(String name) {
074: super (name);
075: }
076:
077: public static NbTestSuite suite() {
078: NbTestSuite suite = new NbTestSuite(
079: org.netbeans.test.uml.findreplaceassociate.Find.class);
080: return suite;
081: }
082:
083: public void testFind_MC_CS_ElementName() {
084: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
085: dlg.doFindElements(prName1, "Class", true, false, false);
086: eventTool.waitNoEvent(1000);
087: if (!dlg.checkSearchResult(
088: FindDialogOperator.SearchTargetCriteria.NAME, testData,
089: "Class", true, false)) {
090: dlg.clickClose();
091: fail("Search results are incorrect");
092: } else {
093: dlg.clickClose();
094: }
095: }
096:
097: public void testFind_MC_CI_ElementName() {
098: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
099: dlg.doFindElements(prName1, "LaSsA", false, false, false);
100: eventTool.waitNoEvent(1000);
101: if (!dlg.checkSearchResult(
102: FindDialogOperator.SearchTargetCriteria.NAME, testData,
103: "LaSsA", false, false)) {
104: dlg.clickClose();
105: fail("Search results are incorrect");
106: } else {
107: dlg.clickClose();
108: }
109: }
110:
111: public void testFind_MC_CS_ElementDescription() {
112: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
113: dlg.doFindDescriptions(prName1, "ClasA", true, false);
114: eventTool.waitNoEvent(1000);
115: if (!dlg.checkSearchResult(
116: FindDialogOperator.SearchTargetCriteria.DESCRIPTION,
117: testData, "ClasA", true, false)) {
118: dlg.clickClose();
119: fail("Search results are incorrect");
120: } else {
121: dlg.clickClose();
122: }
123: }
124:
125: public void testFind_MC_CI_ElementDescription() {
126: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
127: dlg.doFindDescriptions(prName1, "cLasA", false, false);
128: eventTool.waitNoEvent(1000);
129: if (!dlg.checkSearchResult(
130: FindDialogOperator.SearchTargetCriteria.DESCRIPTION,
131: testData, "cLasA", false, false)) {
132: dlg.clickClose();
133: fail("Search results are incorrect");
134: } else {
135: dlg.clickClose();
136: }
137: }
138:
139: public void testFind_MC_CS_ElementNameAndAlias() {
140: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
141: dlg.doFindElements(prName1, "ClssA", true, false, true);
142: eventTool.waitNoEvent(1000);
143: if (!dlg.checkSearchResult(
144: FindDialogOperator.SearchTargetCriteria.NAME_AND_ALIAS,
145: testData, "ClssA", true, false)) {
146: dlg.clickClose();
147: fail("Search results are incorrect");
148: } else {
149: dlg.clickClose();
150: }
151: }
152:
153: public void testFind_MC_CI_ElementNameAndAlias() {
154: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
155: dlg.doFindElements(prName1, "caSsA", false, false, true);
156: eventTool.waitNoEvent(1000);
157: if (!dlg.checkSearchResult(
158: FindDialogOperator.SearchTargetCriteria.NAME_AND_ALIAS,
159: testData, "caSsA", false, false)) {
160: dlg.clickClose();
161: fail("Search results are incorrect");
162: } else {
163: dlg.clickClose();
164: }
165: }
166:
167: public void testFind_MC_CS_DiagramName() {
168: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
169: dlg.doFindElements(prName1, "DClass", true, false, false);
170: eventTool.waitNoEvent(1000);
171: if (!dlg.checkSearchResult(
172: FindDialogOperator.SearchTargetCriteria.NAME, testData,
173: "DClass", true, false)) {
174: dlg.clickClose();
175: fail("Search results are incorrect");
176: } else {
177: dlg.clickClose();
178: }
179: }
180:
181: public void testFind_MC_CI_DiagramName() {
182: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
183: dlg.doFindElements(prName1, "DcLaS", false, false, false);
184: eventTool.waitNoEvent(1000);
185: if (!dlg.checkSearchResult(
186: FindDialogOperator.SearchTargetCriteria.NAME, testData,
187: "DcLaS", false, false)) {
188: dlg.clickClose();
189: fail("Search results are incorrect");
190: } else {
191: dlg.clickClose();
192: }
193: }
194:
195: public void testFind_MC_CS_DiagramDescription() {
196: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
197: dlg.doFindDescriptions(prName1, "DClassA", true, false);
198: eventTool.waitNoEvent(1000);
199: if (!dlg.checkSearchResult(
200: FindDialogOperator.SearchTargetCriteria.DESCRIPTION,
201: testData, "DClassA", true, false)) {
202: dlg.clickClose();
203: fail("Search results are incorrect");
204: } else {
205: dlg.clickClose();
206: }
207: }
208:
209: public void testFind_MC_CI_DiagramDescription() {
210: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
211: dlg.doFindDescriptions(prName1, "DcLaSsA", false, false);
212: eventTool.waitNoEvent(1000);
213: if (!dlg.checkSearchResult(
214: FindDialogOperator.SearchTargetCriteria.DESCRIPTION,
215: testData, "DcLaSsA", false, false)) {
216: dlg.clickClose();
217: fail("Search results are incorrect");
218: } else {
219: dlg.clickClose();
220: }
221: }
222:
223: public void testFind_MC_CS_DiagramNameAndAlias() {
224: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
225: dlg.doFindElements(prName1, "sA", true, false, true);
226: eventTool.waitNoEvent(1000);
227: if (!dlg.checkSearchResult(
228: FindDialogOperator.SearchTargetCriteria.NAME_AND_ALIAS,
229: testData, "sA", true, false)) {
230: dlg.clickClose();
231: fail("Search results are incorrect");
232: } else {
233: dlg.clickClose();
234: }
235: }
236:
237: public void testFind_MC_CI_DiagramNameAndAlias() {
238: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
239: dlg.doFindElements(prName1, "DcLaSsA", false, false, true);
240: eventTool.waitNoEvent(1000);
241: if (!dlg.checkSearchResult(
242: FindDialogOperator.SearchTargetCriteria.NAME_AND_ALIAS,
243: testData, "DcLaSsA", false, false)) {
244: dlg.clickClose();
245: fail("Search results are incorrect");
246: } else {
247: dlg.clickClose();
248: }
249: }
250:
251: public void testFind_MC_CS_ProjectName() {
252: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
253: dlg.doFindElements(prName1, prName1, true, false, false);
254: eventTool.waitNoEvent(1000);
255: if (!dlg.checkSearchResult(
256: FindDialogOperator.SearchTargetCriteria.NAME, testData,
257: prName1, true, false)) {
258: dlg.clickClose();
259: fail("Search results are incorrect");
260: } else {
261: dlg.clickClose();
262: }
263: }
264:
265: public void testFind_MC_CI_ProjectName() {
266: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
267: dlg.doFindElements(prName1, prName1.toUpperCase(), false,
268: false, false);
269: eventTool.waitNoEvent(1000);
270: if (!dlg.checkSearchResult(
271: FindDialogOperator.SearchTargetCriteria.NAME, testData,
272: prName1.toLowerCase(), false, false)) {
273: dlg.clickClose();
274: fail("Search results are incorrect");
275: } else {
276: dlg.clickClose();
277: }
278: }
279:
280: public void testFind_MWWO_ElementName() {
281: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
282: dlg.doFindElements(prName1, "ClassA", true, true, false);
283: eventTool.waitNoEvent(1000);
284: if (!dlg.checkSearchResult(
285: FindDialogOperator.SearchTargetCriteria.NAME, testData,
286: "ClassA", true, true)) {
287: dlg.clickClose();
288: fail("Search results are incorrect");
289: } else {
290: dlg.clickClose();
291: }
292: }
293:
294: public void testFind_MWWO_ElementDescription() {
295: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
296: dlg.doFindDescriptions(prName1, "ClassA", true, true);
297: eventTool.waitNoEvent(1000);
298: if (!dlg.checkSearchResult(
299: FindDialogOperator.SearchTargetCriteria.DESCRIPTION,
300: testData, "ClassA", true, true)) {
301: dlg.clickClose();
302: fail("Search results are incorrect");
303: } else {
304: dlg.clickClose();
305: }
306: }
307:
308: public void testFind_MWWO_ElementNameAndAlias() {
309: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
310: dlg.doFindElements(prName1, "ClassA", true, true, true);
311: eventTool.waitNoEvent(1000);
312: if (!dlg.checkSearchResult(
313: FindDialogOperator.SearchTargetCriteria.NAME_AND_ALIAS,
314: testData, "ClassA", true, true)) {
315: dlg.clickClose();
316: fail("Search results are incorrect");
317: } else {
318: dlg.clickClose();
319: }
320: }
321:
322: public void testFind_MWWO_DiagramName() {
323: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
324: dlg.doFindElements(prName1, "DClassA", true, true, false);
325: eventTool.waitNoEvent(1000);
326: if (!dlg.checkSearchResult(
327: FindDialogOperator.SearchTargetCriteria.NAME, testData,
328: "DClassA", true, true)) {
329: dlg.clickClose();
330: fail("Search results are incorrect");
331: } else {
332: dlg.clickClose();
333: }
334: }
335:
336: public void testFind_MWWO_DiagramDescription() {
337: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
338: dlg.doFindDescriptions(prName1, "DClassA", true, true);
339: eventTool.waitNoEvent(1000);
340: if (!dlg.checkSearchResult(
341: FindDialogOperator.SearchTargetCriteria.DESCRIPTION,
342: testData, "DClassA", true, true)) {
343: dlg.clickClose();
344: fail("Search results are incorrect");
345: } else {
346: dlg.clickClose();
347: }
348: }
349:
350: public void testFind_MWWO_DiagramNameAndAlias() {
351: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
352: dlg.doFindElements(prName1, "DClassA", true, true, true);
353: eventTool.waitNoEvent(1000);
354: if (!dlg.checkSearchResult(
355: FindDialogOperator.SearchTargetCriteria.NAME_AND_ALIAS,
356: testData, "DClassA", true, true)) {
357: dlg.clickClose();
358: fail("Search results are incorrect");
359: } else {
360: dlg.clickClose();
361: }
362: }
363:
364: public void testFind_MWWO_ProjectName() {
365: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
366: dlg.doFindElements(prName1, prName1, true, true, false);
367: eventTool.waitNoEvent(1000);
368: if (!dlg.checkSearchResult(
369: FindDialogOperator.SearchTargetCriteria.NAME, testData,
370: prName1, true, true)) {
371: dlg.clickClose();
372: fail("Search results are incorrect");
373: } else {
374: dlg.clickClose();
375: }
376: }
377:
378: // ------ find XPath expressions --------
379:
380: public void testFind_XPath_ClassName() {
381: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
382: dlg.doFindXPath(prName1, "//UML:Class[@name=\"ClassA\"]");
383: eventTool.waitNoEvent(1000);
384: if (!dlg.checkXPathSearchResult(
385: FindDialogOperator.SearchTarget.CLASS,
386: FindDialogOperator.SearchTargetCriteria.NAME, testData,
387: "ClassA")) {
388: dlg.clickClose();
389: fail("Search results are incorrect");
390: } else {
391: dlg.clickClose();
392: }
393: }
394:
395: public void testFind_XPath_ProjectName() {
396: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
397: dlg.doFindXPath(prName1, "//UML:Project[@name=\"" + prName1
398: + "\"]");
399: eventTool.waitNoEvent(1000);
400: if (!dlg.checkXPathSearchResult(
401: FindDialogOperator.SearchTarget.PROJECT,
402: FindDialogOperator.SearchTargetCriteria.NAME, testData,
403: prName1)) {
404: dlg.clickClose();
405: fail("Search results are incorrect");
406: } else {
407: dlg.clickClose();
408: }
409: }
410:
411: public void testFind_XPath_InterfaceName() {
412: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
413: dlg.doFindXPath(prName1,
414: "//UML:Interface[@name=\"Interface1\"]");
415: eventTool.waitNoEvent(1000);
416: if (!dlg.checkXPathSearchResult(
417: FindDialogOperator.SearchTarget.INTERFACE,
418: FindDialogOperator.SearchTargetCriteria.NAME, testData,
419: "Interface1")) {
420: dlg.clickClose();
421: fail("Search results are incorrect");
422: } else {
423: dlg.clickClose();
424: }
425: }
426:
427: public void testFind_XPath_PackageName() {
428: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
429: dlg.doFindXPath(prName1, "//UML:Package[@name=\"pkg1\"]");
430: eventTool.waitNoEvent(1000);
431: if (!dlg.checkXPathSearchResult(
432: FindDialogOperator.SearchTarget.PACKAGE,
433: FindDialogOperator.SearchTargetCriteria.NAME, testData,
434: "pkg1")) {
435: dlg.clickClose();
436: fail("Search results are incorrect");
437: } else {
438: dlg.clickClose();
439: }
440: }
441:
442: public void testFind_XPath_AttributeName() {
443: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
444: dlg.doFindXPath(prName1, "//UML:Attribute[@name=\"data\"]");
445: eventTool.waitNoEvent(1000);
446: if (!dlg.checkXPathSearchResult(
447: FindDialogOperator.SearchTarget.ATTRIBUTE,
448: FindDialogOperator.SearchTargetCriteria.NAME, testData,
449: "data")) {
450: dlg.clickClose();
451: fail("Search results are incorrect");
452: } else {
453: dlg.clickClose();
454: }
455: }
456:
457: public void testFind_XPath_OperationName() {
458: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
459: dlg.doFindXPath(prName1, "//UML:Operation[@name=\"test\"]");
460: eventTool.waitNoEvent(1000);
461: if (!dlg.checkXPathSearchResult(
462: FindDialogOperator.SearchTarget.OPERATION,
463: FindDialogOperator.SearchTargetCriteria.NAME, testData,
464: "test")) {
465: dlg.clickClose();
466: fail("Search results are incorrect");
467: } else {
468: dlg.clickClose();
469: }
470: }
471:
472: public void testFind_XPath_ParameterName() {
473: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
474: dlg.doFindXPath(prName1, "//UML:Parameter[@name=\"val\"]");
475: eventTool.waitNoEvent(1000);
476: if (!dlg.checkXPathSearchResult(
477: FindDialogOperator.SearchTarget.PARAMETER,
478: FindDialogOperator.SearchTargetCriteria.NAME, testData,
479: "val")) {
480: dlg.clickClose();
481: fail("Search results are incorrect");
482: } else {
483: dlg.clickClose();
484: }
485: }
486:
487: public void testFind_XPath_GeneralizationName() {
488: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
489: dlg
490: .doFindXPath(prName1,
491: "//UML:Generalization[@name=\"Gen1\"]");
492: eventTool.waitNoEvent(1000);
493: if (!dlg.checkXPathSearchResult(
494: FindDialogOperator.SearchTarget.GENERALIZATION,
495: FindDialogOperator.SearchTargetCriteria.NAME, testData,
496: "Gen1")) {
497: dlg.clickClose();
498: fail("Search results are incorrect");
499: } else {
500: dlg.clickClose();
501: }
502: }
503:
504: public void testFind_XPath_ImplementationName() {
505: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
506: dlg.doFindXPath(prName1,
507: "//UML:Implementation[@name=\"Impl1\"]");
508: eventTool.waitNoEvent(1000);
509: if (!dlg.checkXPathSearchResult(
510: FindDialogOperator.SearchTarget.IMPLEMENTATION,
511: FindDialogOperator.SearchTargetCriteria.NAME, testData,
512: "Impl1")) {
513: dlg.clickClose();
514: fail("Search results are incorrect");
515: } else {
516: dlg.clickClose();
517: }
518: }
519:
520: public void testFind_XPath_ClassAlias() {
521: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
522: dlg.doFindXPath(prName1, "//UML:Class[@alias=\"class\"]");
523: eventTool.waitNoEvent(1000);
524: if (!dlg.checkXPathSearchResult(
525: FindDialogOperator.SearchTarget.CLASS,
526: FindDialogOperator.SearchTargetCriteria.ALIAS,
527: testData, "class")) {
528: dlg.clickClose();
529: fail("Search results are incorrect");
530: } else {
531: dlg.clickClose();
532: }
533: }
534:
535: public void testFind_XPath_InterfaceAlias() {
536: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
537: dlg.doFindXPath(prName1,
538: "//UML:Interface[@alias=\"interface\"]");
539: eventTool.waitNoEvent(1000);
540: if (!dlg.checkXPathSearchResult(
541: FindDialogOperator.SearchTarget.INTERFACE,
542: FindDialogOperator.SearchTargetCriteria.ALIAS,
543: testData, "interface")) {
544: dlg.clickClose();
545: fail("Search results are incorrect");
546: } else {
547: dlg.clickClose();
548: }
549: }
550:
551: public void testFind_XPath_PackageAlias() {
552: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
553: dlg.doFindXPath(prName1, "//UML:Package[@alias=\"package\"]");
554: eventTool.waitNoEvent(1000);
555: if (!dlg.checkXPathSearchResult(
556: FindDialogOperator.SearchTarget.PACKAGE,
557: FindDialogOperator.SearchTargetCriteria.ALIAS,
558: testData, "package")) {
559: dlg.clickClose();
560: fail("Search results are incorrect");
561: } else {
562: dlg.clickClose();
563: }
564: }
565:
566: public void testFind_XPath_AttributeAlias() {
567: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
568: dlg.doFindXPath(prName1,
569: "//UML:Attribute[@alias=\"attribute\"]");
570: eventTool.waitNoEvent(1000);
571: if (!dlg.checkXPathSearchResult(
572: FindDialogOperator.SearchTarget.ATTRIBUTE,
573: FindDialogOperator.SearchTargetCriteria.ALIAS,
574: testData, "attribute")) {
575: dlg.clickClose();
576: fail("Search results are incorrect");
577: } else {
578: dlg.clickClose();
579: }
580: }
581:
582: public void testFind_XPath_OperationAlias() {
583: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
584: dlg.doFindXPath(prName1,
585: "//UML:Operation[@alias=\"operation\"]");
586: eventTool.waitNoEvent(1000);
587: if (!dlg.checkXPathSearchResult(
588: FindDialogOperator.SearchTarget.OPERATION,
589: FindDialogOperator.SearchTargetCriteria.ALIAS,
590: testData, "operation")) {
591: dlg.clickClose();
592: fail("Search results are incorrect");
593: } else {
594: dlg.clickClose();
595: }
596: }
597:
598: public void testFind_XPath_ParameterAlias() {
599: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
600: dlg.doFindXPath(prName1,
601: "//UML:Parameter[@alias=\"parameter\"]");
602: eventTool.waitNoEvent(1000);
603: if (!dlg.checkXPathSearchResult(
604: FindDialogOperator.SearchTarget.PARAMETER,
605: FindDialogOperator.SearchTargetCriteria.ALIAS,
606: testData, "parameter")) {
607: dlg.clickClose();
608: fail("Search results are incorrect");
609: } else {
610: dlg.clickClose();
611: }
612: }
613:
614: public void testFind_XPath_GeneralizationAlias() {
615: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
616: dlg.doFindXPath(prName1,
617: "//UML:Generalization[@alias=\"generalization\"]");
618: eventTool.waitNoEvent(1000);
619: if (!dlg.checkXPathSearchResult(
620: FindDialogOperator.SearchTarget.GENERALIZATION,
621: FindDialogOperator.SearchTargetCriteria.ALIAS,
622: testData, "generalization")) {
623: dlg.clickClose();
624: fail("Search results are incorrect");
625: } else {
626: dlg.clickClose();
627: }
628: }
629:
630: public void testFind_XPath_ImplementationAlias() {
631: FindDialogOperator dlg = FindDialogOperator.invoke(getLog());
632: dlg.doFindXPath(prName1,
633: "//UML:Implementation[@alias=\"implementation\"]");
634: eventTool.waitNoEvent(1000);
635: if (!dlg.checkXPathSearchResult(
636: FindDialogOperator.SearchTarget.IMPLEMENTATION,
637: FindDialogOperator.SearchTargetCriteria.ALIAS,
638: testData, "implementation")) {
639: dlg.clickClose();
640: fail("Search results are incorrect");
641: } else {
642: dlg.clickClose();
643: }
644: }
645:
646: //------------------------------------------------------------------------------
647:
648: public void setUp() throws FileNotFoundException {
649: System.out.println("######## " + getName() + " #######");
650:
651: OUT_LOG_FILE = XTEST_WORK_DIR + File.separator + "jout_"
652: + getName() + ".log";
653: ERR_LOG_FILE = XTEST_WORK_DIR + File.separator + "jerr_"
654: + getName() + ".log";
655:
656: myOut = new PrintStream(new FileOutputStream(OUT_LOG_FILE),
657: true);
658: myErr = new PrintStream(new FileOutputStream(ERR_LOG_FILE),
659: true);
660: JemmyProperties.setCurrentOutput(new TestOut(System.in, myOut,
661: myErr));
662:
663: testData = FRAUtils.getTestData1();
664: if (isNotInitialized) {
665: Project.openProject(FRAUtils.FRA_XTEST_PROJECT_DIR + "/"
666: + prName1);
667: isNotInitialized = false;
668: }
669: }
670:
671: public void tearDown() throws FileNotFoundException, IOException,
672: InterruptedException {
673: org.netbeans.test.umllib.util.Utils.tearDown();
674: long timeout = JemmyProperties
675: .getCurrentTimeout("DialogWaiter.WaitDialogTimeout");
676: try {
677: JemmyProperties.setCurrentTimeout(
678: "DialogWaiter.WaitDialogTimeout", 2000);
679: JDialogOperator dlgError = new JDialogOperator(
680: "Unexpected Exception");
681: JTextAreaOperator textarea = new JTextAreaOperator(dlgError);
682: String str = textarea.getDisplayedText();
683: int pos = str.indexOf("\n");
684: if (pos != -1) {
685: str = str.substring(1, pos - 1);
686: }
687: dlgError.close();
688: fail(" " + str);
689: } catch (TimeoutExpiredException e) {
690: } finally {
691: JemmyProperties.setCurrentTimeout(
692: "DiagramOperator.WaitDiagramOperator", timeout);
693: }
694:
695: myIn = new BufferedReader(new FileReader(ERR_LOG_FILE));
696: String line;
697: do {
698: line = myIn.readLine();
699: if (line != null && line.indexOf("Exception") != -1) {
700: if ((line.indexOf("Unexpected Exception") == -1)
701: && (line.indexOf("TimeoutExpiredException") == -1)) {
702: //fail(line);
703: }
704: }
705: } while (line != null);
706: }
707:
708: }
|