alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

/*
 * EXT.java
 *
 * Tests registered extensions of specified DataLoader.
 *
 * Created on May 30, 2001, 4:57 PM
 */

package DataLoaderTests.LoaderPoolTest;

import org.openide.loaders.UniFileLoader;

public class EXT{

    /** Creates new EXT */
    public EXT() {
    }

    private static java.io.PrintWriter log = null;
    private static java.io.PrintWriter ref = null;
    static boolean successful = true;
    LoaderPoolTest LPT = null;
    
    
    /**This methods write an output to log stream*/
    public static void writeLog(String text) {
        log.println(text);
        System.out.println(text);
        if (text.equals(FAILED)) successful = false;
    }
    
    /**This methods write an output to reference stream*/
    public static void writeRef(String text) {
        ref.println(text);
        System.out.println(text);
        if (text.equals(FAILED)) successful = false;
    }
    
    /**If enabled, prints exception to the output and to the ref stream*/
    static void printException(Exception e) {
        if(PRINT_EXCEPTIONS){
            e.printStackTrace();
            e.printStackTrace(ref);
        }
    }
    
    /**
     *Performs initializing before own tests starts
     */
    void prepare() {
        LPT = new LoaderPoolTest("x");
        LPT.prepare();
    }
    
    /**
     *Performs clean up
     */
    void clean() {
        LPT.clean();
    }
    
    /**
     *Performs waiting of current thread for time in millis
     *@param millist integer number - time in millis to wait
     */
    static void dummyWait(int millis) {
        try {
            Thread.sleep(millis);
        } catch (Exception ex) {
            printException(ex);
        }
    }

    public static void main (String args[]) {
        log = new java.io.PrintWriter(System.err);
        ref = new java.io.PrintWriter(System.out);

        EXT ext = new EXT();
        
        ext.prepare();
        
        //LoaderPoolTest.printExtensions( (UniFileLoader) LoaderPoolTest.getDataLoader(LOADER));
        ext.successful = ext.LPT.refPrintExtensions(ext.LPT.getDataLoader(LOADER));
        
        ext.clean();
        
        //test if all test passed, if yes, then return passed, if any of all test failed, return failed.
        //if(successful) return Status.passed(""); else return Status.failed("");
    }    

    //if you want print exceptions into log file, put here true.
    public static final boolean PRINT_EXCEPTIONS = true;
    
    public static final String PASSED = "passed.\n";
    public static final String FAILED = "failed.\n";     
    
    protected static String LOADER = null;
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.