001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /*
043: * EXT.java
044: *
045: * Tests registered extensions of specified DataLoader.
046: *
047: * Created on May 30, 2001, 4:57 PM
048: */
049:
050: package DataLoaderTests.LoaderPoolTest;
051:
052: import org.openide.loaders.UniFileLoader;
053:
054: public class EXT {
055:
056: /** Creates new EXT */
057: public EXT() {
058: }
059:
060: private static java.io.PrintWriter log = null;
061: private static java.io.PrintWriter ref = null;
062: static boolean successful = true;
063: LoaderPoolTest LPT = null;
064:
065: /**This methods write an output to log stream*/
066: public static void writeLog(String text) {
067: log.println(text);
068: System.out.println(text);
069: if (text.equals(FAILED))
070: successful = false;
071: }
072:
073: /**This methods write an output to reference stream*/
074: public static void writeRef(String text) {
075: ref.println(text);
076: System.out.println(text);
077: if (text.equals(FAILED))
078: successful = false;
079: }
080:
081: /**If enabled, prints exception to the output and to the ref stream*/
082: static void printException(Exception e) {
083: if (PRINT_EXCEPTIONS) {
084: e.printStackTrace();
085: e.printStackTrace(ref);
086: }
087: }
088:
089: /**
090: *Performs initializing before own tests starts
091: */
092: void prepare() {
093: LPT = new LoaderPoolTest("x");
094: LPT.prepare();
095: }
096:
097: /**
098: *Performs clean up
099: */
100: void clean() {
101: LPT.clean();
102: }
103:
104: /**
105: *Performs waiting of current thread for time in millis
106: *@param millist integer number - time in millis to wait
107: */
108: static void dummyWait(int millis) {
109: try {
110: Thread.sleep(millis);
111: } catch (Exception ex) {
112: printException(ex);
113: }
114: }
115:
116: public static void main(String args[]) {
117: log = new java.io.PrintWriter(System.err);
118: ref = new java.io.PrintWriter(System.out);
119:
120: EXT ext = new EXT();
121:
122: ext.prepare();
123:
124: //LoaderPoolTest.printExtensions( (UniFileLoader) LoaderPoolTest.getDataLoader(LOADER));
125: ext.successful = ext.LPT.refPrintExtensions(ext.LPT
126: .getDataLoader(LOADER));
127:
128: ext.clean();
129:
130: //test if all test passed, if yes, then return passed, if any of all test failed, return failed.
131: //if(successful) return Status.passed(""); else return Status.failed("");
132: }
133:
134: //if you want print exceptions into log file, put here true.
135: public static final boolean PRINT_EXCEPTIONS = true;
136:
137: public static final String PASSED = "passed.\n";
138: public static final String FAILED = "failed.\n";
139:
140: protected static String LOADER = null;
141: }
|