use of org.opendaylight.controller.cluster.datastore.messages.DataExistsReply in project controller by opendaylight.
the class ShardTransactionTest method testOnReceiveDataExistsPositive.
@Test
public void testOnReceiveDataExistsPositive() throws Exception {
new TestKit(getSystem()) {
{
testOnReceiveDataExistsPositive(newTransactionActor(RO, readOnlyTransaction(), "testDataExistsPositiveRO"));
testOnReceiveDataExistsPositive(newTransactionActor(RW, readWriteTransaction(), "testDataExistsPositiveRW"));
}
private void testOnReceiveDataExistsPositive(final ActorRef transaction) {
transaction.tell(new DataExists(YangInstanceIdentifier.EMPTY, DataStoreVersions.CURRENT_VERSION), getRef());
DataExistsReply reply = expectMsgClass(duration("5 seconds"), DataExistsReply.class);
assertTrue(reply.exists());
}
};
}
use of org.opendaylight.controller.cluster.datastore.messages.DataExistsReply in project controller by opendaylight.
the class ShardTransaction method dataExists.
protected void dataExists(final AbstractShardDataTreeTransaction<?> transaction, final DataExists message) {
if (checkClosed(transaction)) {
return;
}
final YangInstanceIdentifier path = message.getPath();
boolean exists = transaction.getSnapshot().readNode(path).isPresent();
getSender().tell(new DataExistsReply(exists, message.getVersion()).toSerializable(), getSelf());
}
use of org.opendaylight.controller.cluster.datastore.messages.DataExistsReply in project controller by opendaylight.
the class ShardTransactionTest method testOnReceiveDataExistsNegative.
@Test
public void testOnReceiveDataExistsNegative() throws Exception {
new TestKit(getSystem()) {
{
testOnReceiveDataExistsNegative(newTransactionActor(RO, readOnlyTransaction(), "testDataExistsNegativeRO"));
testOnReceiveDataExistsNegative(newTransactionActor(RW, readWriteTransaction(), "testDataExistsNegativeRW"));
}
private void testOnReceiveDataExistsNegative(final ActorRef transaction) {
transaction.tell(new DataExists(TestModel.TEST_PATH, DataStoreVersions.CURRENT_VERSION), getRef());
DataExistsReply reply = expectMsgClass(duration("5 seconds"), DataExistsReply.class);
assertFalse(reply.exists());
}
};
}
Aggregations