+ private static final SchemaContext testSchemaContext = TestModel.createTestContext();
+ private static final TransactionType RO = TransactionType.READ_ONLY;
+ private static final TransactionType RW = TransactionType.READ_WRITE;
+ private static final TransactionType WO = TransactionType.WRITE_ONLY;
+
+ private static final ShardIdentifier SHARD_IDENTIFIER =
+ ShardIdentifier.create("inventory", MEMBER_NAME, "config");
+
+
+ private DatastoreContext datastoreContext = DatastoreContext.newBuilder().build();
+
+ private final ShardStats shardStats = new ShardStats(SHARD_IDENTIFIER.toString(), "DataStore");
+
+ private final ShardDataTree store = new ShardDataTree(testSchemaContext, TreeType.OPERATIONAL);
+
+ private ActorRef createShard() {
+ ActorRef shard = getSystem().actorOf(Shard.builder().id(SHARD_IDENTIFIER).datastoreContext(datastoreContext).
+ schemaContext(TestModel.createTestContext()).props());
+ ShardTestKit.waitUntilLeader(shard);
+ return shard;
+ }
+
+ private ActorRef newTransactionActor(TransactionType type, AbstractShardDataTreeTransaction<?> transaction, String name) {
+ return newTransactionActor(type, transaction, null, name);
+ }
+
+ private ActorRef newTransactionActor(TransactionType type, AbstractShardDataTreeTransaction<?> transaction, ActorRef shard, String name) {
+ Props props = ShardTransaction.props(type, transaction, shard != null ? shard : createShard(),
+ datastoreContext, shardStats);
+ return getSystem().actorOf(props, name);
+ }
+
+ private ReadOnlyShardDataTreeTransaction readOnlyTransaction() {
+ return store.newReadOnlyTransaction(nextTransactionId());
+ }