KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > localhistory > LocalHistoryViewTest


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  * LocalHistoryViewTest.java
21  *
22  * Created on February 2, 2007, 1:22 PM
23  *
24  * To change this template, choose Tools | Template Manager
25  * and open the template in the editor.
26  */

27
28 /**
29  *
30  * @author peter
31  */

32 package org.netbeans.test.localhistory;
33
34 import java.io.File JavaDoc;
35 import java.io.PrintStream JavaDoc;
36 import junit.textui.TestRunner;
37 import org.netbeans.jellytools.JellyTestCase;
38 import org.netbeans.jellytools.nodes.Node;
39 import org.netbeans.jellytools.nodes.SourcePackagesNode;
40 import org.netbeans.jemmy.JemmyProperties;
41 import org.netbeans.jemmy.operators.Operator;
42 import org.netbeans.junit.NbTestSuite;
43 import org.netbeans.test.localhistory.operators.ShowLocalHistoryOperator;
44 import org.netbeans.test.localhistory.utils.TestKit;
45
46
47
48 /**
49  *
50  * @author pvcs
51  */

52 public class LocalHistoryViewTest extends JellyTestCase {
53     
54     public static final String JavaDoc TMP_PATH = "/tmp";
55     public static final String JavaDoc WORK_PATH = "work";
56     public static final String JavaDoc PROJECT_NAME = "JavaApp";
57     public File JavaDoc projectPath;
58     public PrintStream JavaDoc stream;
59     String JavaDoc os_name;
60     Operator.DefaultStringComparator comOperator;
61     Operator.DefaultStringComparator oldOperator;
62     
63     /** Creates a new instance of LocalHistoryViewTest */
64     public LocalHistoryViewTest(String JavaDoc name) {
65         super(name);
66     }
67     
68     protected void setUp() throws Exception JavaDoc {
69         os_name = System.getProperty("os.name");
70         //System.out.println(os_name);
71
System.out.println("### "+getName()+" ###");
72         
73     }
74     
75     protected boolean isUnix() {
76         boolean unix = false;
77         if (os_name.indexOf("Windows") == -1) {
78             unix = true;
79         }
80         return unix;
81     }
82     
83     public static void main(String JavaDoc[] args) {
84         // TODO code application logic here
85
TestRunner.run(suite());
86     }
87     
88     public static NbTestSuite suite() {
89         NbTestSuite suite = new NbTestSuite();
90         suite.addTest(new LocalHistoryViewTest("testLocalHistoryInvoke"));
91         return suite;
92     }
93     
94     public void testLocalHistoryInvoke() throws Exception JavaDoc {
95         JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 30000);
96         JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 30000);
97         TestKit.closeProject(PROJECT_NAME);
98         
99         new File JavaDoc(TMP_PATH).mkdirs();
100         projectPath = TestKit.prepareProject("General", "Java Application", PROJECT_NAME);
101         Node node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|Main.java");
102         ShowLocalHistoryOperator slho = ShowLocalHistoryOperator.invoke(node);
103         slho.verify();
104         slho.performPopupAction(1, "Rollback from History");
105     }
106 }
107
Popular Tags