Refactor transaction support in preparation for migration to latest APIs
- Added a explicit transaction id type
- cli command now just returns the identifiers of in-progress transactions
- Removed redriveTransactions until a better alternative is provided
- Removed DatabaseUpdate and replaced its usage with MapUpdate
Change-Id: Ic4a14967072068834510cd8459fd2a6790e456ef
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
index 5711a88..21d8edc 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
@@ -27,6 +27,8 @@
import org.junit.Ignore;
import org.junit.Test;
import org.onlab.util.Tools;
+import org.onosproject.store.primitives.TransactionId;
+import org.onosproject.store.primitives.impl.Transaction;
import org.onosproject.store.service.MapEvent;
import org.onosproject.store.service.MapEventListener;
import org.onosproject.store.service.Versioned;
@@ -351,10 +353,9 @@
.withValue(value1)
.build();
- TransactionalMapUpdate<String, byte[]> txMapUpdate =
- new TransactionalMapUpdate<>(TransactionId.from("tx1"), Arrays.asList(update1));
+ Transaction tx = new Transaction(TransactionId.from("tx1"), Arrays.asList(update1));
- map.prepare(txMapUpdate).thenAccept(result -> {
+ map.prepare(tx).thenAccept(result -> {
assertEquals(PrepareResult.OK, result);
}).join();
assertNull(listener.event());
@@ -376,7 +377,7 @@
assertNull(listener.event());
- map.commit(txMapUpdate.transactionId()).join();
+ map.commit(tx.id()).join();
assertNotNull(listener.event());
assertEquals(MapEvent.Type.INSERT, listener.event().type());
assertTrue(Arrays.equals(value1, listener.event().newValue().value()));
@@ -406,14 +407,13 @@
.withKey("foo")
.withValue(value1)
.build();
- TransactionalMapUpdate<String, byte[]> txMapUpdate =
- new TransactionalMapUpdate<>(TransactionId.from("tx1"), Arrays.asList(update1));
- map.prepare(txMapUpdate).thenAccept(result -> {
+ Transaction tx = new Transaction(TransactionId.from("tx1"), Arrays.asList(update1));
+ map.prepare(tx).thenAccept(result -> {
assertEquals(PrepareResult.OK, result);
}).join();
assertNull(listener.event());
- map.rollback(txMapUpdate.transactionId()).join();
+ map.rollback(tx.id()).join();
assertNull(listener.event());
map.get("foo").thenAccept(result -> {