KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

68     public boolean go(Object JavaDoc o, java.io.PrintWriter JavaDoc log) throws Exception JavaDoc {
69         
70 // org.openide.src.ClassElement clazz = ((org.openide.src.SourceElement) o).getClasses()[0];
71
// System.setProperty(MyListener.RESULT_KEY,"");
72
boolean passed = true;
73 //
74
// JavaDataObject DO = (JavaDataObject) clazz.getSource().getCookie(JavaDataObject.class);
75
// ConnectionCookie cc = (ConnectionCookie) DO.getCookie(ConnectionCookie.class);
76
// MyListener l = new MyListener();
77
// //Type t = new Type(org.netbeans.modules.java.JavaConnections.TYPE_ALL);
78
//
79
// Thread.currentThread().sleep(DELAY*3);
80
// //cc.register(t, l);
81
//
82
// org.openide.src.ConstructorElement ce = Common.createConstructor(null,Common.PARS1);
83
//
84
// clazz.addConstructor(ce);
85
// ce = clazz.getConstructor(Common.TPARS1);
86
//
87
// Thread.currentThread().sleep(DELAY*3);
88
// ce.addPropertyChangeListener(new PropertyChangeListener() {
89
// public void propertyChange(java.beans.PropertyChangeEvent ev) {
90
// if (!ev.getPropertyName().equals("cookie")) { //hack to slow event firing
91
// ref("PropertyChanged: "+ev.getPropertyName());
92
// }
93
// }
94
// });
95
//
96
// Thread.currentThread().sleep(DELAY);
97
//
98
// ce.setBody("//blah\n");
99
// log.println("set body");
100
// Thread.currentThread().sleep(DELAY);
101
//
102
// ce.setExceptions(new Identifier[]{Identifier.create("java.lang.Exception","java.io.IOException")});
103
// log.println("set exceptions");
104
// Thread.currentThread().sleep(DELAY);
105
//
106
// ce.setModifiers(java.lang.reflect.Modifier.PROTECTED);
107
// log.println("set modifiers");
108
// Thread.currentThread().sleep(DELAY);
109
//
110
// ce.setParameters(Common.PARS2);
111
// log.println("set parameters");
112
// Thread.currentThread().sleep(DELAY);
113
//
114
// //cc.unregister(t, l);
115
//
116
// ref(System.getProperty(MyListener.RESULT_KEY));
117

118         return passed;
119     }
120     
121     protected boolean writeResult(DataObject DO) {
122         return true;
123     }
124     
125     /**
126      */

127     protected void setUp() {
128         super.setUp();
129         name = "JavaTestSourceEventFiringConstructorsChanged";
130         packageName = "org.netbeans.test.java.testsources";
131     }
132     
133     protected void tearDown() {
134         try {
135             Thread.sleep(2*DELAY);
136         } catch (InterruptedException JavaDoc e) {
137         }
138         super.tearDown();
139     }
140     
141 }
142
Popular Tags