);
assertEquals(expected, composed.toWaveletOperations());
}
{
DocOp insertDocOp = insertDocOp(1, 5);
WaveAggregateOp op1 = new WaveOpBuilder(CREATOR1_ID).addParticipant(TARGET1).build();
WaveAggregateOp op2 = new WaveOpBuilder(CREATOR2_ID).docOp("doc", insertDocOp).build();
WaveAggregateOp composed = compose(op1, op2);
List<WaveletOperation> expected = Arrays.<WaveletOperation>asList(
new AddParticipant(CREATOR1_CONTEXT, new ParticipantId(TARGET1)),
new WaveletBlipOperation("doc", new BlipContentOperation(CREATOR2_CONTEXT, insertDocOp))
);
assertEquals(expected, composed.toWaveletOperations());
}
// Test compose of document op from the same creator
{
DocOp insertDocOp1 = insertDocOp(1, 3);
DocOp insertDocOp2 = insertDocOp(3, 4);
DocOp deleteDocOp = deleteDocOp(2, 5);
WaveAggregateOp op1 = new WaveOpBuilder(CREATOR1_ID).docOp("doc", insertDocOp1).build();
WaveAggregateOp op2 = new WaveOpBuilder(CREATOR1_ID)
.docOp("doc", insertDocOp2)
.docOp("doc", deleteDocOp)
.build();
WaveAggregateOp composed = compose(op1, op2);
DocOp expectedDocOp = new DocOpBuilder()
.retain(1)
.characters("a")
.deleteCharacters("a")
.characters("a")
.retain(1)