Search in sources :

Example 26 with TestProbe

use of akka.testkit.TestProbe in project controller by opendaylight.

the class ActorBehaviorTest method setUp.

@Before
public void setUp() throws Exception {
    initialBehavior = createInitialBehaviorMock();
    system = ActorSystem.apply("system1");
    final ActorRef storeRef = system.registerExtension(Persistence.lookup()).snapshotStoreFor(null);
    probe = new TestProbe(system);
    storeRef.tell(probe.ref(), ActorRef.noSender());
    final MemberName name = MemberName.forName("member-1");
    id = FrontendIdentifier.create(name, FrontendType.forName("type-1"));
    mockedActor = system.actorOf(MockedActor.props(id, initialBehavior));
    // handle initial actor recovery
    saveRequest = handleRecovery(null);
}
Also used : ActorRef(akka.actor.ActorRef) TestProbe(akka.testkit.TestProbe) MemberName(org.opendaylight.controller.cluster.access.concepts.MemberName) Before(org.junit.Before)

Example 27 with TestProbe

use of akka.testkit.TestProbe in project controller by opendaylight.

the class ClientActorContextTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    probe = new TestProbe(system);
    ctx = new ClientActorContext(probe.ref(), PERSISTENCE_ID, system, CLIENT_ID, AccessClientUtil.newMockClientActorConfig());
}
Also used : TestProbe(akka.testkit.TestProbe) Before(org.junit.Before)

Example 28 with TestProbe

use of akka.testkit.TestProbe in project controller by opendaylight.

the class AbstractClientConnectionTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    system = ActorSystem.apply();
    backendProbe = new TestProbe(system);
    contextProbe = new TestProbe(system);
    context = new ClientActorContext(contextProbe.ref(), PERSISTENCE_ID, system, CLIENT_ID, AccessClientUtil.newMockClientActorConfig());
    replyToProbe = new TestProbe(system);
    connection = createConnection();
}
Also used : TestProbe(akka.testkit.TestProbe) Before(org.junit.Before)

Example 29 with TestProbe

use of akka.testkit.TestProbe in project controller by opendaylight.

the class RequestEnvelopeTest method createEnvelope.

@Override
protected RequestEnvelope createEnvelope() {
    replyToProbe = new TestProbe(system);
    replyTo = replyToProbe.ref();
    final TransactionPurgeRequest message = new TransactionPurgeRequest(OBJECT, 2L, replyTo);
    return new RequestEnvelope(message, 1L, 2L);
}
Also used : TransactionPurgeRequest(org.opendaylight.controller.cluster.access.commands.TransactionPurgeRequest) TestProbe(akka.testkit.TestProbe)

Example 30 with TestProbe

use of akka.testkit.TestProbe in project controller by opendaylight.

the class AbstractDataStoreClientBehaviorTest method testOnCommand.

@Test
public void testOnCommand() throws Exception {
    final TestProbe probe = new TestProbe(system);
    final GetClientRequest request = new GetClientRequest(probe.ref());
    final AbstractDataStoreClientBehavior nextBehavior = behavior.onCommand(request);
    final Status.Success success = probe.expectMsgClass(Status.Success.class);
    Assert.assertEquals(behavior, success.status());
    Assert.assertSame(behavior, nextBehavior);
}
Also used : Status(akka.actor.Status) TestProbe(akka.testkit.TestProbe) Test(org.junit.Test)

Aggregations

TestProbe (akka.testkit.TestProbe)51 Test (org.junit.Test)30 Before (org.junit.Before)13 ModifyTransactionRequest (org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequest)10 ClientActorContext (org.opendaylight.controller.cluster.access.client.ClientActorContext)8 ModifyTransactionRequestBuilder (org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder)7 Response (org.opendaylight.controller.cluster.access.concepts.Response)5 ActorContext (org.opendaylight.controller.cluster.datastore.utils.ActorContext)5 AbortLocalTransactionRequest (org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest)4 ConnectClientSuccess (org.opendaylight.controller.cluster.access.commands.ConnectClientSuccess)4 TransactionPurgeRequest (org.opendaylight.controller.cluster.access.commands.TransactionPurgeRequest)4 CursorAwareDataTreeModification (org.opendaylight.yangtools.yang.data.api.schema.tree.CursorAwareDataTreeModification)4 CommitLocalTransactionRequest (org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest)3 ExistsTransactionRequest (org.opendaylight.controller.cluster.access.commands.ExistsTransactionRequest)3 ReadTransactionRequest (org.opendaylight.controller.cluster.access.commands.ReadTransactionRequest)3 TransactionAbortRequest (org.opendaylight.controller.cluster.access.commands.TransactionAbortRequest)3 ActorRef (akka.actor.ActorRef)2 ArrayList (java.util.ArrayList)2 TransactionDoCommitRequest (org.opendaylight.controller.cluster.access.commands.TransactionDoCommitRequest)2 TransactionPreCommitRequest (org.opendaylight.controller.cluster.access.commands.TransactionPreCommitRequest)2