KickJava   Java API By Example, From Geeks To Geeks.

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


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.ActionNoBlock;
26 import org.netbeans.jellytools.actions.OpenAction;
27 import org.netbeans.jellytools.nodes.Node;
28 import org.netbeans.jemmy.JemmyException;
29 import org.netbeans.jemmy.Waitable;
30 import org.netbeans.jemmy.Waiter;
31 import org.netbeans.jemmy.operators.*;
32 import org.netbeans.jemmy.util.PNGEncoder;
33 import org.netbeans.test.j2ee.*;
34
35 /**
36  *
37  * @author lm97939
38  */

39 public class SendMessageTest extends AddMethodBase {
40     
41     /** Creates a new instance of AddMethodTest */
42     public SendMessageTest(String JavaDoc name) {
43         super(name);
44     }
45     
46     /** Use for execution inside IDE */
47     public static void main(java.lang.String JavaDoc[] args) {
48         // run only selected test case
49
junit.textui.TestRunner.run(new SendMessageTest("testSendMessage1InSB"));
50     }
51
52     public void setUp() {
53         System.out.println("######## "+getName()+" #######");
54     }
55     
56     public void testSendMessage1InSB() throws IOException JavaDoc{
57         beanName = "TestingSession";
58         editorPopup = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.entres.Bundle", "LBL_EnterpriseActionGroup")
59                                +"|"+Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.entres.Bundle", "LBL_SendJMSMessageAction");
60         toSearchInEditor = "sendJMSMessageToTestingMessageDestination";
61         isDDModified = true;
62         saveFile = true;
63         addMethod();
64     }
65
66     protected void addMethod() throws IOException JavaDoc {
67         EditorOperator editor = new EditorWindowOperator().getEditor(beanName+"Bean.java");
68         editor.select(11);
69
70         // invoke Add Business Method dialog
71
new ActionNoBlock(null,editorPopup).perform(editor);
72         NbDialogOperator dialog = new NbDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.entres.Bundle", "LBL_SelectMessageDestination"));
73         JComboBoxOperator combo=new JComboBoxOperator(dialog, 0);
74         combo.selectItem("TestingEntApp-EJBModule");
75         dialog.ok();
76         
77         if (saveFile)
78             editor.save();
79         
80         waitForEditorText(editor, toSearchInEditor);
81         
82         compareFiles();
83     }
84     
85 }
86
Popular Tags