Search in sources :

Example 1 with Abort

use of org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.Abort in project controller by opendaylight.

the class DataTreeCohortActorTest method testAbortAfterCanCommit.

@Test
public void testAbortAfterCanCommit() throws Exception {
    ActorRef cohortActor = newCohortActor("testAbortAfterCanCommit");
    TransactionIdentifier txId = nextTransactionId();
    askAndAwait(cohortActor, new CanCommit(txId, CANDIDATES, MOCK_SCHEMA, cohortActor));
    verify(mockCohort).canCommit(txId, CANDIDATES, MOCK_SCHEMA);
    askAndAwait(cohortActor, new Abort(txId));
    verify(mockPostCanCommit).abort();
    resetMockCohort();
    askAndAwait(cohortActor, new CanCommit(txId, CANDIDATES, MOCK_SCHEMA, cohortActor));
    verify(mockCohort).canCommit(txId, CANDIDATES, MOCK_SCHEMA);
}
Also used : Abort(org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.Abort) ActorRef(akka.actor.ActorRef) TransactionIdentifier(org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier) CanCommit(org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.CanCommit) Test(org.junit.Test)

Example 2 with Abort

use of org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.Abort in project controller by opendaylight.

the class DataTreeCohortActorTest method testAbortAfterPreCommit.

@Test
public void testAbortAfterPreCommit() throws Exception {
    ActorRef cohortActor = newCohortActor("testAbortAfterPreCommit");
    TransactionIdentifier txId = nextTransactionId();
    askAndAwait(cohortActor, new CanCommit(txId, CANDIDATES, MOCK_SCHEMA, cohortActor));
    verify(mockCohort).canCommit(txId, CANDIDATES, MOCK_SCHEMA);
    askAndAwait(cohortActor, new PreCommit(txId));
    verify(mockPostCanCommit).preCommit();
    askAndAwait(cohortActor, new Abort(txId));
    verify(mockPostPreCommit).abort();
}
Also used : Abort(org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.Abort) ActorRef(akka.actor.ActorRef) TransactionIdentifier(org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier) PreCommit(org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.PreCommit) CanCommit(org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.CanCommit) Test(org.junit.Test)

Aggregations

ActorRef (akka.actor.ActorRef)2 Test (org.junit.Test)2 TransactionIdentifier (org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier)2 Abort (org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.Abort)2 CanCommit (org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.CanCommit)2 PreCommit (org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.PreCommit)1