play.libs.F.ArchivedEventStream.publish() - java examples

Here are the examples of the java api play.libs.F.ArchivedEventStream.publish() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

15 View Complete Implementation : ArchivedEventStreamTest.java
Copyright Apache License 2.0
Author : eBay
/**
 * Test method for {@link play.libs.F.ArchivedEventStream#publish(java.lang.Object)}.
 * @throws ExecutionException
 * @throws InterruptedException
 */
@Test
public void testPublishMultiple() throws InterruptedException, ExecutionException {
    Promise<List<IndexedEvent<String>>> p1 = stream.nextEvents(0);
    Promise<List<IndexedEvent<String>>> p2 = stream.nextEvents(0);
    Promise<List<IndexedEvent<String>>> p3 = stream.nextEvents(0);
    stream.publish(VALUE_1);
    replacedertTrue(p1.isDone());
    replacedertTrue(p2.isDone());
    replacedertTrue(p3.isDone());
    replacedertEquals(1, p1.get().size());
    replacedertEquals(VALUE_1, p1.get().get(0).data);
    replacedertEquals(1, p2.get().size());
    replacedertEquals(VALUE_1, p2.get().get(0).data);
    replacedertEquals(1, p2.get().size());
    replacedertEquals(VALUE_1, p2.get().get(0).data);
    stream.publish(VALUE_2);
    replacedertTrue(p1.isDone());
    replacedertTrue(p2.isDone());
    replacedertTrue(p3.isDone());
    replacedertEquals(1, p1.get().size());
    replacedertEquals(VALUE_1, p1.get().get(0).data);
    replacedertEquals(1, p2.get().size());
    replacedertEquals(VALUE_1, p2.get().get(0).data);
    replacedertEquals(1, p2.get().size());
    replacedertEquals(VALUE_1, p2.get().get(0).data);
}