+ protected Object prepareReadyTransactionMessage(boolean remoteReadWriteTransaction, Shard shard, ShardDataTreeCohort cohort,
+ String transactionID,
+ MutableCompositeModification modification) {
+ return prepareReadyTransactionMessage(remoteReadWriteTransaction, shard, cohort, transactionID, modification, false);
+ }
+
+ protected void setupCohortDecorator(Shard shard, final ShardDataTreeCohort cohort) {
+ shard.getCommitCoordinator().setCohortDecorator(new ShardCommitCoordinator.CohortDecorator() {
+ @Override
+ public ShardDataTreeCohort decorate(String transactionID, ShardDataTreeCohort actual) {
+ return cohort;
+ }
+ });
+ }
+
+ protected BatchedModifications prepareBatchedModifications(String transactionID,
+ MutableCompositeModification modification) {
+ return prepareBatchedModifications(transactionID, modification, false);
+ }
+
+ private static BatchedModifications prepareBatchedModifications(String transactionID,
+ MutableCompositeModification modification,
+ boolean doCommitOnReady) {
+ final BatchedModifications batchedModifications = new BatchedModifications(transactionID, CURRENT_VERSION, null);
+ batchedModifications.addModification(modification);
+ batchedModifications.setReady(true);
+ batchedModifications.setDoCommitOnReady(doCommitOnReady);
+ batchedModifications.setTotalMessagesSent(1);
+ return batchedModifications;
+ }