Search in sources :

Example 6 with CanCommit

use of org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.CanCommit 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 7 with CanCommit

use of org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.CanCommit 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)7 CanCommit (org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.CanCommit)7 Test (org.junit.Test)6 TransactionIdentifier (org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier)6 PreCommit (org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.PreCommit)4 Abort (org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.Abort)3 Commit (org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.Commit)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 DataValidationFailedException (org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException)2 SchemaContext (org.opendaylight.yangtools.yang.model.api.SchemaContext)2 Patterns (akka.pattern.Patterns)1 Timeout (akka.util.Timeout)1 Futures (com.google.common.util.concurrent.Futures)1 JdkFutureAdapters (com.google.common.util.concurrent.JdkFutureAdapters)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)1 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)1 SimpleImmutableEntry (java.util.AbstractMap.SimpleImmutableEntry)1 Entry (java.util.Map.Entry)1