Search in sources :

Example 1 with ActorFuture

use of io.camunda.zeebe.util.sched.future.ActorFuture in project zeebe by camunda.

the class ActorFutureTest method shouldInvokeCallbackOnEmptyFutureList.

@Test
public void shouldInvokeCallbackOnEmptyFutureList() {
    // given
    final List<ActorFuture<Void>> futures = Collections.emptyList();
    final List<Throwable> invocations = new ArrayList<>();
    final Actor waitingActor = new Actor() {

        @Override
        protected void onActorStarted() {
            actor.runOnCompletion(futures, t -> {
                invocations.add(t);
            });
        }
    };
    schedulerRule.submitActor(waitingActor);
    schedulerRule.workUntilDone();
    // then
    assertThat(invocations).hasSize(1).containsNull();
}
Also used : ActorFuture(io.camunda.zeebe.util.sched.future.ActorFuture) CompletableActorFuture(io.camunda.zeebe.util.sched.future.CompletableActorFuture) Actor(io.camunda.zeebe.util.sched.Actor) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with ActorFuture

use of io.camunda.zeebe.util.sched.future.ActorFuture in project zeebe by zeebe-io.

the class ActorFutureTest method shouldInvokeCallbackOnEmptyFutureList.

@Test
public void shouldInvokeCallbackOnEmptyFutureList() {
    // given
    final List<ActorFuture<Void>> futures = Collections.emptyList();
    final List<Throwable> invocations = new ArrayList<>();
    final Actor waitingActor = new Actor() {

        @Override
        protected void onActorStarted() {
            actor.runOnCompletion(futures, t -> {
                invocations.add(t);
            });
        }
    };
    schedulerRule.submitActor(waitingActor);
    schedulerRule.workUntilDone();
    // then
    assertThat(invocations).hasSize(1).containsNull();
}
Also used : ActorFuture(io.camunda.zeebe.util.sched.future.ActorFuture) CompletableActorFuture(io.camunda.zeebe.util.sched.future.CompletableActorFuture) Actor(io.camunda.zeebe.util.sched.Actor) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with ActorFuture

use of io.camunda.zeebe.util.sched.future.ActorFuture in project zeebe by camunda-cloud.

the class ActorFutureTest method shouldInvokeCallbackOnEmptyFutureList.

@Test
public void shouldInvokeCallbackOnEmptyFutureList() {
    // given
    final List<ActorFuture<Void>> futures = Collections.emptyList();
    final List<Throwable> invocations = new ArrayList<>();
    final Actor waitingActor = new Actor() {

        @Override
        protected void onActorStarted() {
            actor.runOnCompletion(futures, t -> {
                invocations.add(t);
            });
        }
    };
    schedulerRule.submitActor(waitingActor);
    schedulerRule.workUntilDone();
    // then
    assertThat(invocations).hasSize(1).containsNull();
}
Also used : ActorFuture(io.camunda.zeebe.util.sched.future.ActorFuture) CompletableActorFuture(io.camunda.zeebe.util.sched.future.CompletableActorFuture) Actor(io.camunda.zeebe.util.sched.Actor) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Actor (io.camunda.zeebe.util.sched.Actor)3 ActorFuture (io.camunda.zeebe.util.sched.future.ActorFuture)3 CompletableActorFuture (io.camunda.zeebe.util.sched.future.CompletableActorFuture)3 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3