return createCache(false, numBuddies, buddyPoolName, useDataGravitation, removeOnFind, start);
}
protected PojoCache createCache(boolean optimisticLocks, int numBuddies, String buddyPoolName, boolean useDataGravitation, boolean removeOnFind, boolean start) throws Exception
{
PojoCache c = new PojoCache();
c.setCacheMode(TreeCache.REPL_SYNC);
c.setClusterName("BuddyReplicationTest");
// basic config
String xmlString = "<config><buddyReplicationEnabled>true</buddyReplicationEnabled>\n" +
"<buddyCommunicationTimeout>600000</buddyCommunicationTimeout>\n" +
" <buddyLocatorClass>org.jboss.cache.buddyreplication.NextMemberBuddyLocator</buddyLocatorClass>\n" +
" <autoDataGravitation>"+useDataGravitation+"</autoDataGravitation>\n" +
" <dataGravitationRemoveOnFind>"+removeOnFind+"</dataGravitationRemoveOnFind>\n" +
" <dataGravitationSearchSubtrees>true</dataGravitationSearchSubtrees>\n" +
" <buddyLocatorProperties>numBuddies = "+numBuddies+"</buddyLocatorProperties>\n";
if (buddyPoolName != null) xmlString += "<buddyPoolName>"+buddyPoolName+"</buddyPoolName>";
xmlString += "</config>";
c.setBuddyReplicationConfig( XmlHelper.stringToElement(xmlString) );
c.setFetchInMemoryState(true);
if (optimisticLocks)
{
c.setNodeLockingScheme("OPTIMISTIC");
}
c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
c.setSyncCommitPhase(true); // helps track down breakages
if (start)
c.startService();
return c;
}