return sb.toString();
}
private static void test(final DataSource dataSource, final IdFactory idFactory, final byte[] data, final byte[] response, final String data_s, final String response_s, final PrintStream ps) throws InterruptedException, Exception {
Thread.sleep(30000);
final StmtStatistic a = new StmtStatistic("INSERT INTO BUSI", new NullRuntimeStatisticsCollector());
final StmtStatistic b = new StmtStatistic("INSERT INTO WAIT", new NullRuntimeStatisticsCollector());
final StmtStatistic c = new StmtStatistic("INSERT INTO RESP", new NullRuntimeStatisticsCollector());
for (int i=0; i<5; i++) {
final List<String> ids = new ArrayList<String>(100000);
final List<String> cids = new ArrayList<String>(100000);
new RetryingTransaction<Void>(dataSource) {
@Override
protected Void execute() throws Exception {
PreparedStatement stmtBP = getConnection().prepareStatement("INSERT INTO COP_WORKFLOW_INSTANCE (ID,STATE,PRIORITY,LAST_MOD_TS,PPOOL_ID,DATA_S) VALUES (?,2,5,SYSTIMESTAMP,'P#DEFAULT',?)");
for (int k=0; k<100; k++) {
for (int i=0; i<200; i++) {
String id = idFactory.createId();
ids.add(id);
stmtBP.setString(1, id);
//stmtBP.setBytes(2, data);
stmtBP.setString(2, data_s);
stmtBP.addBatch();
}
a.start();
stmtBP.executeBatch();
getConnection().commit();
a.stop(200);
stmtBP.clearBatch();
}
PreparedStatement stmtWAIT = getConnection().prepareStatement("INSERT INTO COP_WAIT (CORRELATION_ID, WORKFLOW_INSTANCE_ID, CS_WAITMODE, COUNT) VALUES (?,?,0,1)");
for (int k=0; k<100; k++) {
for (int i=0; i<200; i++) {
String bp_id = ids.remove(ids.size()-1);
String c_id = idFactory.createId();
cids.add(c_id);
stmtWAIT.setString(1, c_id);
stmtWAIT.setString(2, bp_id);
stmtWAIT.addBatch();
}
b.start();
stmtWAIT.executeBatch();
getConnection().commit();
b.stop(200);
stmtWAIT.clearBatch();
}
PreparedStatement stmtRES = getConnection().prepareStatement("INSERT INTO COP_RESPONSE (CORRELATION_ID, RESPONSE_TS, RESPONSE_S) VALUES (?,SYSTIMESTAMP,?)");
for (int k=0; k<25; k++) {
for (int i=0; i<200; i++) {
String c_id = cids.remove(cids.size()-1);
stmtRES.setString(1, c_id);
//stmtRES.setBytes(2, response);
stmtRES.setString(2, response_s);
stmtRES.addBatch();
}
c.start();
stmtRES.executeBatch();
getConnection().commit();
c.stop(200);
stmtRES.clearBatch();
}
return null;
}