KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > j2ee > addmethod > AddMethodBase


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.test.j2ee.addmethod;
21
22 import java.io.File JavaDoc;
23 import java.io.IOException JavaDoc;
24 import org.netbeans.jellytools.*;
25 import org.netbeans.jellytools.actions.OpenAction;
26 import org.netbeans.jellytools.nodes.Node;
27 import org.netbeans.jemmy.JemmyException;
28 import org.netbeans.jemmy.Waitable;
29 import org.netbeans.jemmy.Waiter;
30 import org.netbeans.test.j2ee.*;
31 import org.netbeans.test.j2ee.lib.Utils;
32
33 /**
34  *
35  * @author lm97939
36  */

37 public abstract class AddMethodBase extends JellyTestCase {
38
39     protected String JavaDoc beanName;
40     protected String JavaDoc editorPopup;
41     protected String JavaDoc dialogTitle;
42     protected boolean isDDModified = false;
43     protected String JavaDoc toSearchInEditor;
44     protected boolean saveFile = false;
45     
46     /** Creates a new instance of AddMethodTest */
47     public AddMethodBase(String JavaDoc name) {
48         super(name);
49     }
50     
51     protected void waitForEditorText(final EditorOperator editor, final String JavaDoc toSearchInEditor) {
52         try {
53             new Waiter(new Waitable() {
54                     public Object JavaDoc actionProduced(Object JavaDoc obj) {
55                         return editor.contains(toSearchInEditor)?Boolean.TRUE:null;
56                     }
57                     public String JavaDoc getDescription() {
58                         return("Editor contains "+ toSearchInEditor); // NOI18N
59
}
60                 }).waitAction(null);
61         } catch (InterruptedException JavaDoc ie) {
62             throw new JemmyException("Interrupted.", ie);
63         }
64     }
65     
66     protected void compareFiles() throws IOException JavaDoc {
67         new org.netbeans.jemmy.EventTool().waitNoEvent(2000);
68         Utils utils = new Utils(this);
69         String JavaDoc beanNames[] = { beanName+"Bean.java",
70                                beanName+"Local.java",
71                                beanName+"LocalBusiness.java",
72                                beanName+"LocalHome.java",
73                                beanName+"Remote.java",
74                                beanName+"RemoteBusiness.java",
75                                beanName+"RemoteHome.java",
76         };
77         utils.assertFiles(new File JavaDoc(EJBValidation.EJB_PROJECT_PATH + File.separator + "src" + File.separator + "java" + File.separator + "test"), beanNames, getName()+"_");
78         String JavaDoc ddNames[] = { "ejb-jar.xml",
79                              "sun-ejb-jar.xml"
80         };
81         utils.assertFiles(new File JavaDoc(EJBValidation.EJB_PROJECT_PATH + File.separator + "src" + File.separator + "conf"), ddNames, isDDModified?getName()+"_":"");
82
83     }
84 }
85
Popular Tags