xmlBlaster 2.1.0 API

org.xmlBlaster.contrib.dbwriter
Class DbWatcherTester

java.lang.Object
  extended by org.xmlBlaster.contrib.dbwriter.DbWatcherTester

public class DbWatcherTester
extends java.lang.Object

This application writes into the 'replitems' table (which is the table used for replication) in an own thread. Everytime a commit (or a rollback) is done, it waits until the dbwatcher part has become the new entries. It then compares the sent entries with the entries which the DBWatcher has detected. It compares number of messages and sequence of them.

You can edit this file and change the configuration settings.

Simple usage example:

java org.xmlBlaster.contrib.dbwriter.Example -db.password secret

java -Djava.util.logging.config.file=testlog.properties org.xmlBlaster.contrib.dbwriter.Example -db.password secret

Author:
Marcel Ruff

Field Summary
private  boolean commitCheck
           
private  int compareCount
           
private  int compareNmax
           
private  I_DbPool dbPool
           
private  boolean exceptionOccured
           
private  I_Info info
           
private static java.util.logging.Logger log
           
private  int nmax
           
private  java.util.List operations
           
private  java.util.Random random
           
private  long seed
           
private  long sleep
           
 
Constructor Summary
DbWatcherTester(I_Info info)
           
 
Method Summary
private  void assertEquals(java.lang.String msg, int val1, int val2)
           
private  void assertEquals(java.lang.String msg, java.lang.String val1, java.lang.String val2)
           
private  void checkConsistency(java.sql.Connection conn, java.lang.String tableName, long timeToSleep)
           
private  void checkReplItems(java.sql.Connection conn)
           
private  void commit(java.sql.Connection conn)
           
private  int doDelete(java.sql.Connection conn)
           
private  int doInsert(java.sql.Connection conn)
           
private  int doUpdate(java.sql.Connection conn)
           
private  java.lang.String getEmail()
           
private  java.lang.String getName()
           
private  java.lang.String getPhoto()
           
private  java.lang.String getSurname()
           
private  java.lang.String getTable()
           
private  int getUniqueId()
           
private  java.lang.String getWhere()
           
static java.util.prefs.Preferences loadArgs(java.lang.String[] args)
          Parse command line arguments
static void main(java.lang.String[] args)
          Example code.
 void run()
           
private  int update(java.sql.Connection conn, java.lang.String sql)
           
static void usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

dbPool

private I_DbPool dbPool

info

private I_Info info

random

private java.util.Random random

nmax

private int nmax

sleep

private long sleep

compareNmax

private int compareNmax

compareCount

private int compareCount

seed

private long seed

operations

private java.util.List operations

commitCheck

private boolean commitCheck

exceptionOccured

private boolean exceptionOccured
Constructor Detail

DbWatcherTester

public DbWatcherTester(I_Info info)
                throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

usage

public static void usage()

getUniqueId

private int getUniqueId()

getName

private java.lang.String getName()

getSurname

private java.lang.String getSurname()

getEmail

private java.lang.String getEmail()

getPhoto

private java.lang.String getPhoto()

getTable

private java.lang.String getTable()

getWhere

private java.lang.String getWhere()

update

private int update(java.sql.Connection conn,
                   java.lang.String sql)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

doInsert

private int doInsert(java.sql.Connection conn)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

doDelete

private int doDelete(java.sql.Connection conn)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

doUpdate

private int doUpdate(java.sql.Connection conn)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

assertEquals

private void assertEquals(java.lang.String msg,
                          java.lang.String val1,
                          java.lang.String val2)
                   throws java.lang.Exception
Throws:
java.lang.Exception

assertEquals

private void assertEquals(java.lang.String msg,
                          int val1,
                          int val2)
                   throws java.lang.Exception
Throws:
java.lang.Exception

checkConsistency

private void checkConsistency(java.sql.Connection conn,
                              java.lang.String tableName,
                              long timeToSleep)
                       throws java.lang.Exception
Throws:
java.lang.Exception

checkReplItems

private void checkReplItems(java.sql.Connection conn)
                     throws java.lang.Exception
Throws:
java.lang.Exception

commit

private void commit(java.sql.Connection conn)

run

public void run()

main

public static void main(java.lang.String[] args)
Example code.

java -Djava.util.logging.config.file=testlog.properties org.xmlBlaster.contrib.dbwatcher.Example -alertScheduler.pollInterval 10000 -db.password secret

Parameters:
args - Command line

loadArgs

public static java.util.prefs.Preferences loadArgs(java.lang.String[] args)
Parse command line arguments

Parameters:
args - Command line
Returns:
Configuration

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.