Search in sources :

Example 1 with StdoutSessionLog

use of cbit.vcell.resource.StdoutSessionLog in project vcell by virtualcell.

the class Log4JSessionTest method compare.

// @Test
public void compare() {
    System.setProperty(PropertyLoader.mongodbHostInternal, "mongo.cam.uchc.edu");
    System.setProperty(PropertyLoader.mongodbPortInternal, "27017");
    StdoutSessionLog ssl = new StdoutSessionLog("JUnitTest");
    walkThrough(ssl);
    Logger.getRootLogger().setLevel(Level.ALL);
    Log4jSessionLog l4jl = new Log4jSessionLog("JUnitTest");
    walkThrough(l4jl);
}
Also used : StdoutSessionLog(cbit.vcell.resource.StdoutSessionLog)

Example 2 with StdoutSessionLog

use of cbit.vcell.resource.StdoutSessionLog in project vcell by virtualcell.

the class ClientRobotDispatcher method test.

/**
 * Insert the method's description here.
 * Creation date: (3/8/01 5:50:53 PM)
 * @param numRobots int
 * @param host java.lang.String
 * @param userid java.lang.String
 * @param password java.lang.String
 */
private void test(int numRobots, String host, String userid, String password, File biomodelfile) {
    StdoutSessionLog globalLog = new StdoutSessionLog("globalLog");
    Thread[] threads = new Thread[numRobots];
    for (int i = 0; i < numRobots; i++) {
        String robotName = "robot" + i;
        MixedSessionLog robotLog = new MixedSessionLog(new StringSessionLog(robotName), globalLog);
        this.clientRobotList.addElement(new ClientRobot(robotName, host, userid, password, biomodelfile, robotLog));
    }
    for (int i = 0; i < clientRobotList.size(); i++) {
        ClientRobot clientRobot = (ClientRobot) clientRobotList.elementAt(i);
        threads[i] = new Thread(clientRobot);
        threads[i].run();
    }
    // 
    for (int i = 0; i < numRobots; i++) {
        try {
            threads[i].wait();
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
    }
    System.out.println("printing Robot Summaries by robot");
    for (int i = 0; i < clientRobotList.size(); i++) {
        ClientRobot clientRobot = (ClientRobot) clientRobotList.elementAt(i);
        System.out.println(clientRobot.getActivityLog());
    }
}
Also used : StdoutSessionLog(cbit.vcell.resource.StdoutSessionLog)

Example 3 with StdoutSessionLog

use of cbit.vcell.resource.StdoutSessionLog in project vcell by virtualcell.

the class CompareDatabaseSchema method main.

/**
 * Starts the application.
 * @param args an array of command-line arguments
 */
public static void main(java.lang.String[] args) {
    // 
    try {
        final String oracle = "oracle";
        final String postgres = "postgres";
        final String usage = "Usage: (" + oracle + "|" + postgres + ") connectURL schemaUser schemaUserPassword";
        if (args.length != 4 || (!args[0].equalsIgnoreCase(oracle) && !args[0].equalsIgnoreCase(postgres))) {
            System.out.println(usage);
            System.exit(0);
        }
        String connectURL = args[1];
        String dbSchemaUser = args[2];
        String dbPassword = args[3];
        // 
        int ok = javax.swing.JOptionPane.showConfirmDialog(new JFrame(), "Will compare VCell Software 'Tables' with Database Schema: " + "connectURL=" + connectURL + "\nUser=" + dbSchemaUser + "\npassword=" + dbPassword, "Confirm", javax.swing.JOptionPane.OK_CANCEL_OPTION, javax.swing.JOptionPane.WARNING_MESSAGE);
        if (ok != javax.swing.JOptionPane.OK_OPTION) {
            throw new RuntimeException("Aborted by user");
        }
        SessionLog log = new StdoutSessionLog("CompareDatabaseSchema");
        ConnectionFactory conFactory = null;
        KeyFactory keyFactory = null;
        new cbit.vcell.resource.PropertyLoader();
        // 
        // get appropriate database factory objects
        // 
        DatabaseSyntax dbSyntax = null;
        if (args[0].equalsIgnoreCase(oracle)) {
            dbSyntax = DatabaseSyntax.ORACLE;
            String driverName = "oracle.jdbc.driver.OracleDriver";
            conFactory = DatabaseService.getInstance().createConnectionFactory(driverName, connectURL, dbSchemaUser, dbPassword);
            keyFactory = conFactory.getKeyFactory();
        } else if (args[0].equalsIgnoreCase(postgres)) {
            dbSyntax = DatabaseSyntax.POSTGRES;
            String driverName = "org.postgresql.Driver";
            conFactory = DatabaseService.getInstance().createConnectionFactory(driverName, connectURL, dbSchemaUser, dbPassword);
            keyFactory = conFactory.getKeyFactory();
        } else {
            System.out.println(usage);
            System.exit(1);
        }
        // 
        // compare with VCell Software 'tables'
        // 
        Table[] tables = SQLCreateAllTables.getVCellTables();
        compareSchemas(log, conFactory, keyFactory, tables, dbSyntax);
    } catch (Throwable e) {
        e.printStackTrace(System.out);
    }
    System.exit(0);
}
Also used : DatabaseSyntax(org.vcell.db.DatabaseSyntax) StdoutSessionLog(cbit.vcell.resource.StdoutSessionLog) StdoutSessionLog(cbit.vcell.resource.StdoutSessionLog) SessionLog(org.vcell.util.SessionLog) ConnectionFactory(org.vcell.db.ConnectionFactory) JFrame(javax.swing.JFrame) KeyFactory(org.vcell.db.KeyFactory)

Aggregations

StdoutSessionLog (cbit.vcell.resource.StdoutSessionLog)3 JFrame (javax.swing.JFrame)1 ConnectionFactory (org.vcell.db.ConnectionFactory)1 DatabaseSyntax (org.vcell.db.DatabaseSyntax)1 KeyFactory (org.vcell.db.KeyFactory)1 SessionLog (org.vcell.util.SessionLog)1