long scn = 10;
long timestamp = System.currentTimeMillis() * DbusConstants.NUM_NSECS_IN_MSEC;
List<TransactionState.PerSourceTransactionalUpdate> dbUpdates1 =
generateUpdates(sourceIds, keys, scn);
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates1,
new TransactionInfo(0, 0, timestamp, scn) });
timestamp = System.currentTimeMillis() * DbusConstants.NUM_NSECS_IN_MSEC + 1;
List<TransactionState.PerSourceTransactionalUpdate> dbUpdates2 =
generateUpdates(sourceIds, keys, scn); // Same SCN as before
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates2,
new TransactionInfo(0, 0, timestamp + 1, scn) });
// Expect no events as events are not yet appended to buffer.
testStats(gg,
new EventStatsValues(sourceIds[0], 0, 0, 0, 0, 0),
new EventStatsValues(sourceIds[1], 0, 0, 0, 0, 0),
new EventStatsValues(GoldenGateEventProducer.GLOBAL_SOURCE_ID,
0,
0,
0,
0,
0));
// SCN = 11 - Case where both transactions having same SCNs : same set of sources but
// different keys
{
scn = 11;
timestamp = System.currentTimeMillis() * DbusConstants.NUM_NSECS_IN_MSEC + 1;
dbUpdates1 = generateUpdates(sourceIds, keys, scn);
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates1,
new TransactionInfo(0, 0, timestamp, scn) });
timestamp = System.currentTimeMillis() * DbusConstants.NUM_NSECS_IN_MSEC + 1;
keys.clear();
keys.add("key2");
dbUpdates2 = generateUpdates(sourceIds, keys, scn); // Same SCN as before
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates2,
new TransactionInfo(0, 0, timestamp, scn) });
// Testing for SCN = 10 case
testStats(gg,
new EventStatsValues(sourceIds[0], 5, 0, 1, 0, 10),
new EventStatsValues(sourceIds[1], 5, 0, 1, 0, 10),
new EventStatsValues(GoldenGateEventProducer.GLOBAL_SOURCE_ID,
5,
0,
2,
0,
10));
}
// SCN = 12 - Case where both transactions having same SCNs but different set of
// sources
{
scn = 12;
keys.clear();
keys.add("key2");
timestamp = System.currentTimeMillis() * DbusConstants.NUM_NSECS_IN_MSEC + 2;
dbUpdates1 = generateUpdates(new short[] { sourceIds[1] }, keys, scn);
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates1,
new TransactionInfo(0, 0, timestamp, scn) });
dbUpdates2 = generateUpdates(new short[] { sourceIds[0] }, keys, scn); // Same SCN
// as before
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates2,
new TransactionInfo(0, 0, timestamp, scn) });
// Testing for SCN = 11 case
testStats(gg,
new EventStatsValues(sourceIds[0], 5, 0, 3, 0, 11),
new EventStatsValues(sourceIds[1], 5, 0, 3, 0, 11),
new EventStatsValues(GoldenGateEventProducer.GLOBAL_SOURCE_ID,
5,
0,
6,
0,
11));
}
// SCN = 13 - Case where more than 2 transactions having same SCNs and keys. The keys
// will be merged.
{
scn = 13;
timestamp = System.currentTimeMillis() * DbusConstants.NUM_NSECS_IN_MSEC + 3;
dbUpdates1 = generateUpdates(sourceIds, keys, scn);
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates1,
new TransactionInfo(0, 0, timestamp, scn) });
dbUpdates2 = generateUpdates(sourceIds, keys, scn); // Same SCN as before
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates2,
new TransactionInfo(0, 0, timestamp, scn) });
dbUpdates1 = generateUpdates(sourceIds, keys, scn);
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates1,
new TransactionInfo(0, 0, timestamp, scn) });
dbUpdates2 = generateUpdates(sourceIds, keys, scn); // Same SCN as before
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates2,
new TransactionInfo(0, 0, timestamp, scn) });
// Testing for SCN = 12 case
testStats(gg,
new EventStatsValues(sourceIds[0], 5, 0, 4, 0, 12),
new EventStatsValues(sourceIds[1], 5, 0, 4, 0, 12),
new EventStatsValues(GoldenGateEventProducer.GLOBAL_SOURCE_ID,
5,
0,
8,
0,
12));
}
// SCN = 14 - Case where more than 2 transactions having same SCNs but different keys.
{
scn = 14;
timestamp = System.currentTimeMillis() * DbusConstants.NUM_NSECS_IN_MSEC + 3;
dbUpdates1 = generateUpdates(sourceIds, keys, scn);
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates1,
new TransactionInfo(0, 0, timestamp, scn) });
dbUpdates2 = generateUpdates(sourceIds, keys, scn); // Same SCN as before
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates2,
new TransactionInfo(0, 0, timestamp, scn) });
keys.clear();
keys.add("key5");
dbUpdates1 = generateUpdates(sourceIds, keys, scn);
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates1,
new TransactionInfo(0, 0, timestamp, scn) });
dbUpdates2 = generateUpdates(sourceIds, keys, scn); // Same SCN as before
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates2,
new TransactionInfo(0, 0, timestamp, scn) });
// Testing for SCN = 13 case
testStats(gg,
new EventStatsValues(sourceIds[0], 5, 0, 5, 0, 13),
new EventStatsValues(sourceIds[1], 5, 0, 5, 0, 13),
new EventStatsValues(GoldenGateEventProducer.GLOBAL_SOURCE_ID,
5,
0,
10,
0,
13));
}
// THis is an extra-call but the corresponding events will not be added to EVB.
// This is needed to flush the events in the above call to EVB
scn = 15;
timestamp = System.currentTimeMillis() * DbusConstants.NUM_NSECS_IN_MSEC + 4;
method.invoke(handleXmlCallbackObject, new Object[] { dbUpdates1,
new TransactionInfo(0, 0, timestamp, scn) });
// Testing for SCN = 12 case
testStats(gg,
new EventStatsValues(sourceIds[0], 5, 0, 7, 0, 14),
new EventStatsValues(sourceIds[1], 5, 0, 7, 0, 14),
new EventStatsValues(GoldenGateEventProducer.GLOBAL_SOURCE_ID,