SamplePojo pojo = new SamplePojo(21, "test");
cache.put("/one/two", "key1", pojo);
GlobalTransaction gtx = cache.getCurrentTransaction(tx);
TransactionTable table = cache.getTransactionTable();
OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
assertNotNull(mgr.getTransaction());
mgr.commit();
GlobalTransaction remoteGtx = new GlobalTransaction();
remoteGtx.setAddress(new Address()
{
public boolean isMulticastAddress()
{
return false;
}
public void readExternal(ObjectInput arg0) throws IOException,
ClassNotFoundException
{
}
public void writeExternal(ObjectOutput arg0) throws IOException
{
}
public int compareTo(Object arg0)
{
return 0;
}
public int size()
{
return 0;
}
public void writeTo(DataOutputStream arg0) throws IOException
{
}
public void readFrom(DataInputStream arg0) throws IOException, IllegalAccessException, InstantiationException
{
}
});
//hack the method call to make it have the remote gtx
MethodCall meth = (MethodCall) entry.getModifications().get(0);
meth.getArgs()[0] = remoteGtx;
//call our remote method
MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, new Object[]{remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE});
try
{
cache._replicate(prepareMethod);
}
catch (Throwable t)