KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > java > eventfiring > InitializerChanged


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 /*
21  * InitializerChanged.java
22  *
23  * Created on June 26, 2000, 9:29 AM
24  */

25
26 package org.netbeans.test.java.eventfiring.InitializerChanged;
27
28 import org.netbeans.test.java.eventfiring.MyListener;
29 //import org.netbeans.modules.java.JavaConnections.Type;
30
import org.openide.cookies.ConnectionCookie;
31 import java.beans.PropertyChangeListener JavaDoc;
32 //import org.netbeans.modules.java.JavaDataObject;
33
import org.openide.loaders.DataObject;
34
35 /**
36  * @author Jan Becicka <Jan.Becicka@sun.com>
37  */

38
39 public class InitializerChanged extends org.netbeans.test.java.XRunner {
40     
41     final static int DELAY = 2000;
42     
43     public static void main(java.lang.String JavaDoc[] args) {
44         junit.textui.TestRunner.run(suite());
45     }
46     
47     public InitializerChanged() {
48         super("");
49     }
50     
51     public InitializerChanged(java.lang.String JavaDoc testName) {
52         super(testName);
53     }
54     
55     public static org.netbeans.junit.NbTest suite() {
56         return new org.netbeans.junit.NbTestSuite(InitializerChanged.class);
57     }
58     
59     /** "body" of this TestCase
60      * @param o SourceElement - target for generating
61      * @param log log is used for logging StackTraces
62      * @throws Exception
63      * @return true if test passed
64      * false if failed
65      */

66     public boolean go(Object JavaDoc o, java.io.PrintWriter JavaDoc log) throws Exception JavaDoc {
67         
68 // org.openide.src.ClassElement clazz = ((org.openide.src.SourceElement) o).getClasses()[0];
69
// System.setProperty(MyListener.RESULT_KEY,"");
70
boolean passed = true;
71 //
72
// JavaDataObject DO = (JavaDataObject) clazz.getSource().getCookie(JavaDataObject.class);
73
// ConnectionCookie cc = (ConnectionCookie) DO.getCookie(ConnectionCookie.class);
74
// MyListener l = new MyListener();
75
// //Type t = new Type(org.netbeans.modules.java.JavaConnections.TYPE_ALL);
76
//
77
// Thread.currentThread().sleep(DELAY*3);
78
// //cc.register(t, l);
79
//
80
// org.openide.src.InitializerElement ie = org.netbeans.test.java.Common.createInitializer();
81
//
82
// clazz.addInitializer(ie);
83
// ie = clazz.getInitializers()[0];
84
//
85
// Thread.currentThread().sleep(DELAY*5);
86
// ie.addPropertyChangeListener(new PropertyChangeListener() {
87
// public void propertyChange(java.beans.PropertyChangeEvent ev) {
88
// if (!ev.getPropertyName().equals("cookie")) { //hack to slow event firing
89
// ref("PropertyChanged: "+ev.getPropertyName());
90
// }
91
// }
92
// });
93
//
94
// Thread.currentThread().sleep(DELAY);
95
//
96
// ie.setBody("//blah\n");
97
// Thread.currentThread().sleep(DELAY);
98
//
99
// ie.setStatic(false);
100
// Thread.currentThread().sleep(DELAY);
101
//
102
// //cc.unregister(t, l);
103
//
104
// ref(System.getProperty(MyListener.RESULT_KEY));
105

106         return passed;
107     }
108     
109     protected boolean writeResult(DataObject DO) {
110         return true;
111     }
112     
113     /**
114      */

115     protected void setUp() {
116         super.setUp();
117         name = "EventFiringInitializerChanged";
118         packageName = "org.netbeans.test.java.testsources";
119     }
120     
121     protected void tearDown() {
122         try {
123             Thread.sleep(2*DELAY);
124         } catch (InterruptedException JavaDoc e) {
125         }
126         super.tearDown();
127     }
128     
129 }
130
Popular Tags