Java源码示例:com.gs.fw.common.mithra.MithraTransaction
示例1
public void testSetPrimitiveAttributeToNullToDatedObject()
{
final Timestamp businessDate = new Timestamp(System.currentTimeMillis());
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
TestAgeBalanceSheetRunRate rate = new TestAgeBalanceSheetRunRate(businessDate);
rate.setTradingdeskLevelTypeId(11);
rate.setTradingDeskorDeskHeadId(1001);
rate.setNullablePrimitiveAttributesToNull();
rate.insert();
return null;
}
});
TestAgeBalanceSheetRunRateFinder.clearQueryCache();
Operation op = TestAgeBalanceSheetRunRateFinder.businessDate().eq(businessDate);
op = op.and(TestAgeBalanceSheetRunRateFinder.tradingdeskLevelTypeId().eq(11));
op = op.and(TestAgeBalanceSheetRunRateFinder.tradingDeskorDeskHeadId().eq(1001));
TestAgeBalanceSheetRunRate rate2 = TestAgeBalanceSheetRunRateFinder.findOne(op);
assertNotNull(rate2);
assertTrue(rate2.isPriceNull());
assertTrue(rate2.isValueNull());
}
示例2
public void xtestDeadConnectionInTransaction() throws Exception
{
final Order order = OrderFinder.findOne(OrderFinder.orderId().eq(1));
// put a break point on the next line, and kill the connection
System.out.println("kill the connection now!");
MithraManager.getInstance().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
order.getItems().forceResolve();
// for a second test, put a break point on the next line and kill the connection
order.getOrderStatus();
return null;
}
});
}
示例3
public void testCopyNonPrimaryKeyAttributesFromInMemoryObjectInTx2()
throws Exception
{
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
Order newOrder = new Order();
newOrder.setOrderDate(new Timestamp(System.currentTimeMillis()));
newOrder.setState("NEW");
newOrder.setDescription("New Order");
newOrder.setTrackingId("Tracking Id");
newOrder.setUserId(9876);
newOrder.setOrderId(1);
Order order = OrderFinder.findOne(OrderFinder.orderId().eq(1));
order.copyNonPrimaryKeyAttributesFrom(newOrder);
tx.commit();
assertTrue(compareOrderNonPrimaryKeyAttributes(order, newOrder));
}
示例4
public void testType3Update()
{
final EvoTypesRoot root = this.createEvoTypesRoot('B', false, (byte) 1, "update");
assertNull(EvoType3TxnTypesBFinder.findOneBypassCache(EvoType3TxnTypesBFinder.rootEvo().eq(root)));
final EvoType3TxnTypesB newTypes = EvoType3TxnTypesBFinder.findOneBypassCache(
EvoType3TxnTypesBFinder.pk().charAttribute().eq('B').and(
EvoType3TxnTypesBFinder.pk().booleanAttribute().eq(false)));
assertNotNull(newTypes);
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
newTypes.copyRootEvo(root);
return null;
}
});
assertNotNull(EvoType3TxnTypesBFinder.findOne(EvoType3TxnTypesBFinder.rootEvo().eq(root)));
assertNotNull(EvoType3TxnTypesBFinder.findOneBypassCache(EvoType3TxnTypesBFinder.rootEvo().eq(root)));
}
示例5
private boolean getManyFromUniqueSequential(Extractor[] extractors, boolean abortIfNotFound, Timestamp[] asOfDates,
MithraTransaction tx, FastList results, Iterator dataHolders, DatedSemiUniqueDataIndex uniqueIndex)
{
CommonExtractorBasedHashingStrategy hashStrategy = uniqueIndex.getNonDatedPkHashStrategy();
while(dataHolders.hasNext())
{
Object dataHolder = dataHolders.next();
populateAsOfDates(extractors, dataHolder, asOfDates);
MithraDataObject data = (MithraDataObject) uniqueIndex.getSemiUniqueAsOneWithDates(dataHolder,
extractors, asOfDates, hashStrategy.computeHashCode(dataHolder, extractors));
if (data != null)
{
MithraDatedObject businessObject = this.getBusinessObjectFromData(data, asOfDates, getNonDatedPkHashCode(data), false, tx, true);
if (businessObject == null)
{
return true;
}
results.add(businessObject);
}
else
{
if (abortIfNotFound) return true;
}
}
return false;
}
示例6
public void xtestDeadConnectionInTransaction() throws Exception
{
final Order order = OrderFinder.findOne(OrderFinder.orderId().eq(1));
// put a break point on the next line, and kill the connection
System.out.println("kill the connection now!");
MithraManager.getInstance().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
order.getItems().forceResolve();
// for a second test, put a break point on the next line and kill the connection
order.getOrderStatus();
return null;
}
});
}
示例7
public Object put(Object businessObject)
{
MithraTransaction tx = MithraManagerProvider.getMithraManager().zGetCurrentTransactionWithNoCheck();
if (tx != null)
{
TransactionLocalStorage txStorage = (TransactionLocalStorage) perTransactionStorage.get(tx);
NonUniqueIndex perThreadIndex = getAddedFromLocalStorage(txStorage);
if (perThreadIndex == null)
{
perThreadIndex = this.createPerThreadAddedIndex(tx, txStorage).added;
}
return perThreadIndex.put(businessObject);
}
else
{
return this.nonTransactionalPut(businessObject);
}
}
示例8
public void testType2BatchDelete()
{
final PureType2TxnTypesAList typesList = PureType2TxnTypesAFinder.findMany(PureType2TxnTypesAFinder.all());
assertEquals(2, typesList.size());
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
for (PureType2TxnTypesA types : typesList)
{
types.delete();
}
return null;
}
});
assertEquals(0, PureType2TxnTypesAFinder.findMany(PureType2TxnTypesAFinder.all()).size());
assertEquals(0, PureType2TxnTypesAFinder.findManyBypassCache(PureType2TxnTypesAFinder.all()).size());
}
示例9
public void testType2DatedIncrementUntil()
{
Operation op = EvoType2DatedTxnTypesBFinder.pk().charAttribute().eq('B').and(
EvoType2DatedTxnTypesBFinder.pk().booleanAttribute().eq(false)).and(
EvoType2DatedTxnTypesBFinder.businessDate().eq(Timestamp.valueOf("2007-09-10 00:00:00.0")));
final EvoType2DatedTxnTypesB types = EvoType2DatedTxnTypesBFinder.findOneBypassCache(op);
assertEquals(1.1d, types.getRootEvo().getDoubleAttribute());
final Timestamp newBusinessDateEnd = Timestamp.valueOf("2007-09-12 18:30:00.0");
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
types.getRootEvo().incrementDoubleAttributeUntil(6.0d, newBusinessDateEnd);
return null;
}
});
assertEquals(7.1d, EvoType2DatedTxnTypesBFinder.findOne(op).getRootEvo().getDoubleAttribute());
assertEquals(newBusinessDateEnd, EvoType2DatedTxnTypesBFinder.findOne(op).getBusinessDateTo());
assertEquals(7.1d, EvoType2DatedTxnTypesBFinder.findOneBypassCache(op).getRootEvo().getDoubleAttribute());
assertEquals(newBusinessDateEnd, EvoType2DatedTxnTypesBFinder.findOneBypassCache(op).getBusinessDateTo());
}
示例10
public void testOptimisticLocking()
{
final TestEodAcctIfPnlList list = TestEodAcctIfPnlFinder.findMany(TestEodAcctIfPnlFinder.all());
int size = list.size();
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand<Object>()
{
@Override
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
TestEodAcctIfPnlFinder.setTransactionModeReadCacheWithOptimisticLocking(tx);
for(TestEodAcctIfPnl pnl: list)
{
pnl.setUserId("fred");
}
return null;
}
});
assertEquals(size, TestEodAcctIfPnlFinder.findMany(TestEodAcctIfPnlFinder.userId().eq("fred")).size());
}
示例11
public void testPurgeAllAuditOnly()
{
AuditOnlyBalanceList auditOnlyList = this.getPurgeAllAuditOnlyList(2);
assertTrue(auditOnlyList.size() > 0);
//begin transaction
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
auditOnlyList = this.getPurgeAllAuditOnlyList(2);
auditOnlyList.purgeAll();
AuditOnlyBalanceList auditOnlyListCheck = this.getPurgeAllAuditOnlyList(2);
assertEquals(0, auditOnlyListCheck.size());
tx.commit();
//end transaction
auditOnlyListCheck = this.getPurgeAllAuditOnlyList(2);
assertEquals(0, auditOnlyListCheck.size());
}
示例12
public void testIsDeletedOrMarkForDeletionInTx() throws ParseException
{
Timestamp businessDate = new Timestamp(timestampFormat.parse("2006-01-01 00:00:00").getTime());
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
BitemporalOrder order1 = new BitemporalOrder(businessDate);
order1.setOrderId(987);
order1.setState("Created");
order1.setUserId(123);
order1.setOrderDate(new Timestamp(System.currentTimeMillis()));
assertFalse(order1.isDeletedOrMarkForDeletion());
order1.insert();
assertFalse(order1.isDeletedOrMarkForDeletion());
tx.commit();
tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
order1.terminate();
assertTrue(order1.isDeletedOrMarkForDeletion());
tx.commit();
}
示例13
public void testMultipleUpdatesToSameObjectInTransaction()
{
int id = 9876;
final Operation op = AllTypesFinder.id().eq(id);
MithraManagerProvider.getMithraManager().executeTransactionalCommand(
new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
AllTypes allTypes = AllTypesFinder.findOne(op);
allTypes.setIntValue(100);
allTypes.setNullableBooleanValue(true);
allTypes.setNullableByteValue((byte) 10);
allTypes.setNullableCharValue('a');
allTypes.setNullableShortValue((short) 1000);
allTypes.setNullableIntValue(987654);
return null;
}
}
);
String sql = "select " + getAllTypesColumns() + " from mithra.ALL_TYPES where ID = " + 9876;
validateMithraResult(op, sql);
}
示例14
public void testBitemporalInsertUntil()
{
Operation businessDate = AlarmBitemporalTransactionalFinder.businessDate().eq(Timestamp.valueOf("2012-01-01 23:59:00.0"));
final AlarmBitemporalTransactionalList alarms = new AlarmBitemporalTransactionalList(businessDate);
alarms.addOrderBy(AlarmBitemporalTransactionalFinder.id().ascendingOrderBy());
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand<Object>()
{
@Override
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
AlarmBitemporalTransactional insertAlarm = new AlarmBitemporalTransactional(Timestamp.valueOf("2012-01-01 23:59:00.0"));
insertAlarm.setTime(Time.withMillis(1, 1, 1, 1));
insertAlarm.setId(200);
insertAlarm.insertUntil(Timestamp.valueOf("2013-01-01 23:59:00.0"));
return null;
}
});
assertNotNull(AlarmBitemporalTransactionalFinder.findOne(AlarmBitemporalTransactionalFinder.businessDate().eq(Timestamp.valueOf("2012-12-12 23:59:00.0")).and(AlarmBitemporalTransactionalFinder.time().eq(Time.withMillis(1, 1, 1, 1)))));
Operation op = AlarmBitemporalTransactionalFinder.businessDate().eq(new Timestamp(System.currentTimeMillis())).and(AlarmBitemporalTransactionalFinder.time().eq(Time.withMillis(1, 1, 1, 1)));
assertNull(AlarmBitemporalTransactionalFinder.findOne(op));
}
示例15
public void testForceRefreshSingleDatedMultiPkListInTx() throws SQLException
{
Operation op = TestEodAcctIfPnlFinder.userId().eq("moh");
op = op.and(TestEodAcctIfPnlFinder.processingDate().eq(createNowTimestamp()));
TestEodAcctIfPnlList list = new TestEodAcctIfPnlList(op);
list.forceResolve();
assertTrue(list.size() > 1);
final TestEodAcctIfPnlList list2 = new TestEodAcctIfPnlList();
list2.addAll(list);
int count = this.getRetrievalCount();
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
list2.forceRefresh();
return null;
}
});
assertEquals(count+1, this.getRetrievalCount());
}
示例16
public void testType2DatedUpdateUntil()
{
final Timestamp businessDate = Timestamp.valueOf("2007-09-10 00:00:00.0");
final EvoTypesRoot root = this.createEvoTypesRoot('B', false, (byte) 1, "update");
Operation op = EvoType2DatedTxnTypesBFinder.rootEvo().eq(root).and(EvoType2DatedTxnTypesBFinder.businessDate().eq(businessDate));
assertNull(EvoType2DatedTxnTypesBFinder.findOneBypassCache(op));
final EvoType2DatedTxnTypesB types = EvoType2DatedTxnTypesBFinder.findOneBypassCache(
EvoType2DatedTxnTypesBFinder.pk().charAttribute().eq('B').and(
EvoType2DatedTxnTypesBFinder.pk().booleanAttribute().eq(false)).and(
EvoType2DatedTxnTypesBFinder.businessDate().eq(businessDate)));
assertNotNull(types);
final Timestamp newBusinessDateEnd = Timestamp.valueOf("2007-09-12 18:30:00.0");
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
types.copyRootEvoUntil(root, newBusinessDateEnd);
return null;
}
});
assertEquals(newBusinessDateEnd, EvoType2DatedTxnTypesBFinder.findOne(op).getBusinessDateTo());
assertEquals(newBusinessDateEnd, EvoType2DatedTxnTypesBFinder.findOneBypassCache(op).getBusinessDateTo());
}
示例17
public void testBulkInsert()
{
final int initialId = 10000;
final int listSize = 20;
MithraManagerProvider.getMithraManager().executeTransactionalCommand(
new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
ProductList productList = createNewProductList(initialId, listSize);
productList.insertAll();
tx.setBulkInsertThreshold(10);
return null;
}
}
);
Operation op = ProductFinder.productId().greaterThanEquals(initialId);
ProductList list = new ProductList(op);
assertEquals(listSize, list.size());
}
示例18
public void reloadDirty(MithraTransaction tx)
{
InternalList dirtyDataList = (InternalList) this.markedDirtyForReload.get(tx);
if (dirtyDataList != null)
{
if (this.isPartialCache())
{
for (int i = 0; i < dirtyDataList.size(); i++)
{
this.markDirty((MithraDataObject) dirtyDataList.get(i));
}
}
else
{
// this.portal.getMithraObjectPersister().refresh(, false)
throw new RuntimeException("optimistic lock failure not supported with full cache");
}
dirtyDataList.clear();
}
}
示例19
private void createAddress(final String city, final String state)
{
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand<Object>()
{
@Override
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
Address address = new Address(DefaultInfinityTimestamp.getDefaultInfinity());
address.setCity(city);
if(state != null)
address.setState(state);
address.setAddressId(addressId++);
address.setChangedBy("testusr");
address.insert();
return null;
}
});
}
示例20
@Override
public void prepareForReindexInTransaction(Object businessObject, MithraTransaction tx)
{
TransactionLocalStorage txStorage = (TransactionLocalStorage) perTransactionStorage.get(tx);
NonUniqueIndex threadIndex = getAddedFromLocalStorage(txStorage);
if (threadIndex != null &&
threadIndex.contains(businessObject))
{
threadIndex.remove(businessObject);
}
else
{
if (threadIndex == null)
{
txStorage = createPerThreadAddedIndex(tx, txStorage);
}
FullUniqueIndex deletedIndex = txStorage.deleted;
if (deletedIndex == null)
{
deletedIndex = this.createPerThreadDeletedIndex(tx, txStorage);
}
deletedIndex.put(this.nonTransactionalUnderlyingObjectGetter.getUnderlyingObject(businessObject));
}
}
示例21
public void testUpdatePropagation() throws Exception
{
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand<Object>()
{
@Override
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
Timestamp future = new Timestamp(timestampFormat.parse("2013-01-20 00:00:00").getTime());
Timestamp past = new Timestamp(timestampFormat.parse("2011-01-20 00:00:00").getTime());
Timestamp now = new Timestamp(timestampFormat.parse("2012-01-20 00:00:00").getTime());
NonAuditedBalanceInterface balPast = buildNonAuditedBalance(past);
balPast.setAcmapCode("A");
balPast.setBalanceId(2000);
balPast.setQuantity(-6851);
balPast.insert();
NonAuditedBalanceInterface balAtFuture = findNonAuditedBalanceForBusinessDate(2000, future);
assertEquals(-6851.0, balAtFuture.getQuantity(), 0.01);
NonAuditedBalanceInterface balNow = findNonAuditedBalanceForBusinessDate(2000, now);
assertEquals(-6851.0, balNow.getQuantity(), 0.01);
balNow.setQuantity(100);
assertEquals(100.0, balNow.getQuantity(), 0.01);
assertEquals(100.0, balAtFuture.getQuantity(), 0.01);
return null;
}
}, new TransactionStyle(10000));
}
示例22
public void testCount()
{
OrderList list = new OrderList(OrderFinder.state().eq("In-Progress"));
int count = list.count();
assertEquals(count, list.size());
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
Order order = new Order();
int orderId = 1017;
order.setOrderId(orderId);
Timestamp orderDate = new Timestamp(INITIAL_TIME);
order.setOrderDate(orderDate);
order.setUserIdNull();
String description = "new order description";
order.setDescription(description);
order.setTrackingId("T1");
order.setState("In-Progress");
order.insert();
list = new OrderList(OrderFinder.state().eq("In-Progress"));
assertEquals(count+1, list.count());
tx.commit();
}
示例23
public void testBulkInsert()
{
final int initialId = 10000;
final int listSize = 20;
MithraManagerProvider.getMithraManager().executeTransactionalCommand(
new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
ProductList productList = createNewProductList(initialId, listSize);
productList.insertAll();
tx.setBulkInsertThreshold(10);
return null;
}
}
);
Operation op = ProductFinder.productId().greaterThanEquals(initialId);
ProductList list = new ProductList(op);
assertEquals(listSize, list.size());
}
示例24
private void copyOrder(final DirectRefOrder order)
{
final int[] count = new int[1];
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
order.copyDetachedValuesToOriginalOrInsertIfNew();
if (count[0] == 0)
{
count[0] = 1;
MithraBusinessException excp = new MithraBusinessException("for testing retry");
excp.setRetriable(true);
throw excp;
}
return null;
}
});
}
示例25
public void testInsertThenIncrementInOneTransaction() throws SQLException
{
NonAuditedBalanceInterface tb = null;
Timestamp businessDate = new Timestamp(System.currentTimeMillis());
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
try
{
tb = findNonAuditedBalanceForBusinessDate(2000, businessDate);
assertNull(tb);
tb = buildNonAuditedBalance(businessDate);
tb.setAcmapCode("A");
tb.setBalanceId(2000);
tb.setQuantity(12.5);
tb.insert();
tb.incrementQuantity(1000);
tx.commit();
}
catch(Throwable t)
{
getLogger().error("transaction failed", t);
tx.rollback();
fail("transaction failed see exception");
}
// check the cache:
int count = MithraManagerProvider.getMithraManager().getDatabaseRetrieveCount();
NonAuditedBalanceInterface fromCache = findNonAuditedBalanceForBusinessDate(2000, businessDate);
assertSame(tb, fromCache);
assertEquals(1012.5, tb.getQuantity(), 0);
fromCache = findNonAuditedBalanceForBusinessDate(2000, InfinityTimestamp.getParaInfinity());
assertEquals(count, MithraManagerProvider.getMithraManager().getDatabaseRetrieveCount());
// test the database:
checker.checkDatedNonAuditedInfinityRow(2000, 1012.5, businessDate);
}
示例26
public void markDirtyForReload(MithraDataObject object, MithraTransaction tx)
{
InternalList dirtyDataList = (InternalList) this.markedDirtyForReload.get(tx);
if (dirtyDataList == null)
{
dirtyDataList = new InternalList();
this.markedDirtyForReload.set(tx, dirtyDataList);
}
dirtyDataList.add(object);
}
示例27
public void testEqualsEdgePointInTransaction()
{
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
testEqualsEdgePoint();
return null;
}
});
}
示例28
public void testIsModifiedByAttributeInTransactionWithCommit()
{
Order originalOrder = OrderFinder.findOne(OrderFinder.orderId().eq(1));
Order order = originalOrder.getDetachedCopy();
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
order.setDescription("test 1900");
order.setUserIdNull();
assertTrue(order.isModifiedSinceDetachment(OrderFinder.description()));
assertTrue(order.isModifiedSinceDetachment(OrderFinder.userId()));
tx.commit();
assertTrue(order.isModifiedSinceDetachment(OrderFinder.description()));
assertTrue(order.isModifiedSinceDetachment(OrderFinder.userId()));
}
示例29
public void run()
{
long start = 0;
while(true)
{
try
{
this.startBarrier.await();
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
constructNewOrder().insert();
tx.commit();
this.endBarrier.await();
if (System.currentTimeMillis() - start > 30000)
{
System.out.println("Thread "+Thread.currentThread().getName());
start = System.currentTimeMillis();
}
}
catch (Throwable e)
{
logger.error("unexpected", e);
this.exception = e;
interruptAll();
break;
}
}
}
示例30
public void testInsertThenIncrementInOneTransaction() throws SQLException
{
ParaBalance tb = null;
int balanceId = 4020;
java.util.Date paraBusinessDate = createParaBusinessDate(new java.util.Date());
Timestamp businessDate = addDaysAsTimestamp(paraBusinessDate, 1);
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
try
{
tb = findParaBalanceForBusinessDate(balanceId, businessDate);
assertNull(tb);
tb = new ParaBalance(businessDate, InfinityTimestamp.getParaInfinity());
tb.setAcmapCode("A");
tb.setBalanceId(balanceId);
tb.setQuantity(12.5);
tb.insert();
tb.incrementQuantity(1000);
tx.commit();
}
catch(Throwable t)
{
getLogger().error("transaction failed", t);
tx.rollback();
fail("transaction failed see exception");
}
// check the cache:
int count = MithraManagerProvider.getMithraManager().getDatabaseRetrieveCount();
ParaBalance fromCache = findParaBalanceForBusinessDate(balanceId, businessDate);
assertSame(tb, fromCache);
assertEquals(1012.5, tb.getQuantity(), 0);
fromCache = findParaBalanceForBusinessDate(balanceId, InfinityTimestamp.getParaInfinity());
assertEquals(count, MithraManagerProvider.getMithraManager().getDatabaseRetrieveCount());
// test the database:
checkParaInfinityRow(balanceId, 1012.5, new Timestamp(paraBusinessDate.getTime()));
}