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-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.jellytools.modules.db;

import org.netbeans.jellytools.JellyTestCase;
import org.netbeans.jellytools.RuntimeTabOperator;
import org.netbeans.jellytools.properties.PropertySheetOperator;
import org.netbeans.jemmy.operators.JTreeOperator;

/**
 *
 * @author Martin Schovanek
 * @version 1.0
 */
public class DBJellyTestCase extends JellyTestCase {
    protected static String DB_URL = null;
    protected static String DB_USER = null;
    protected static String DB_PASSWD = null;
    protected static String DB_SCHEMA = null;
    protected static String DB_URL_PREFIX = null;
    protected static String DB_DRIVER_NAME = null;
    protected static String DB_DRIVER_CLASS = null;
    protected static long WAIT_ERROR_TIMEOUT = -1;
    protected static boolean DEBUG = true; //enable debug messages set it to 'true'
    
    /*
     * This static initializer is used for initialization of the necessary DB specific strings.
     */
    static {
        DB_URL = System.getProperty("db.url"); //NOI18N
        DB_USER = System.getProperty("db.user"); //NOI18N
        DB_PASSWD = System.getProperty("db.password"); //NOI18N
        DB_SCHEMA = System.getProperty("db.schema"); //NOI18N
        DB_URL_PREFIX = System.getProperty("db.url.prefix"); //NOI18N
        DB_DRIVER_NAME = System.getProperty("db.drivername"); //NOI18N
        DB_DRIVER_CLASS = System.getProperty("db.driverclass"); //NOI18N
        WAIT_ERROR_TIMEOUT = Long.parseLong(System.getProperty("db.errortimeout", "10000"));
    }
    
    /**
     * Necessary constructor.
     */
    public DBJellyTestCase(String name) {
        super(name);
    }
    
    /**
     * Set up the test suite.
     */
    public void setUp() throws Exception {
        debug("*** Call 'setUp' method ... start for: " + getName()); //NOI18N
        debug("db URL ... " + DB_URL); //NOI18N
        debug("db user ... " + DB_USER); //NOI18N
        debug("db passwd ... " + DB_PASSWD); //NOI18N
        debug("db schema ... " + DB_SCHEMA); //NOI18N
        debug("db URL prefix... " + DB_URL_PREFIX); //NOI18N
        debug("db driver name ... " + DB_DRIVER_NAME); //NOI18N
        debug("db driver class ... " + DB_DRIVER_CLASS); //NOI18N
        debug("*** Call 'setUp' method ... end\n"); //NOI18N
    }
    
    protected JTreeOperator getRuntimeTree() {
        return RuntimeTabOperator.invoke().tree();
    }
    
    /**
     * Debug method.
     */
    protected void debug(String message) {
        if (DEBUG) {
            log(message);
            System.out.println("> " + message);
        }
    }
    
    protected void sleep() {
        debug("Waiting 10 sec ... ");
        try {
            Thread.currentThread().sleep(10000);
        } catch (Exception ex) {}
        debug("DONE");
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.