X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsamples%2Fclustering-test-app%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fclustering%2Fit%2Fprovider%2FMdsalLowLevelTestProvider.java;h=df314c127144b77eb4aa3dc742f736b4d0197d1c;hb=3a4510523d25b10905645c21b1bfbab44138ba81;hp=da6df6b85584f88faea634346f8eed3b18f35fff;hpb=3f7ac86f0548d587e88ba43e03ec25cc83eed6cf;p=controller.git diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java index da6df6b855..df314c1271 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.clustering.it.provider; import static akka.actor.ActorRef.noSender; @@ -59,12 +58,12 @@ import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistrati import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.controller.sal.core.api.model.SchemaService; import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; import org.opendaylight.mdsal.dom.api.DOMDataTreeLoopException; import org.opendaylight.mdsal.dom.api.DOMDataTreeService; +import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.AddShardReplicaInput; @@ -170,7 +169,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService private final DOMDataBroker domDataBroker; private final NotificationPublishService notificationPublishService; private final NotificationService notificationService; - private final SchemaService schemaService; + private final DOMSchemaService schemaService; private final ClusterSingletonServiceProvider singletonService; private final DOMRpcProviderService domRpcService; private final PrefixLeaderHandler prefixLeaderHandler; @@ -197,7 +196,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService public MdsalLowLevelTestProvider(final RpcProviderRegistry rpcRegistry, final DOMRpcProviderService domRpcService, final ClusterSingletonServiceProvider singletonService, - final SchemaService schemaService, + final DOMSchemaService schemaService, final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer, final NotificationPublishService notificationPublishService, final NotificationService notificationService, @@ -538,9 +537,8 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService dtclReg = null; if (!idIntsListener.hasTriggered()) { - final RpcError error = RpcResultBuilder.newError( - ErrorType.APPLICATION, "No notification received.", "id-ints listener has not received" - + "any notifications."); + final RpcError error = RpcResultBuilder.newError(ErrorType.APPLICATION, "data-missing", + "id-ints listener did not receive any notifications."); return Futures.immediateFuture(RpcResultBuilder.failed() .withRpcError(error).build()); } @@ -552,18 +550,23 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService if (!readResult.isPresent()) { final RpcError error = RpcResultBuilder.newError( - ErrorType.APPLICATION, "Final read empty.", "No data read from id-ints list."); + ErrorType.APPLICATION, "data-missing", "No data read from id-ints list."); return Futures.immediateFuture(RpcResultBuilder.failed() .withRpcError(error).build()); } + final boolean nodesEqual = idIntsListener.checkEqual(readResult.get()); + if (!nodesEqual) { + LOG.error("Final read of id-int does not match IdIntsListener's copy. {}", + idIntsListener.diffWithLocalCopy(readResult.get())); + } + return Futures.immediateFuture( - RpcResultBuilder.success(new UnsubscribeDtclOutputBuilder() - .setCopyMatches(idIntsListener.checkEqual(readResult.get()))).build()); + RpcResultBuilder.success(new UnsubscribeDtclOutputBuilder().setCopyMatches(nodesEqual)).build()); } catch (final InterruptedException | ExecutionException e) { final RpcError error = RpcResultBuilder.newError( - ErrorType.APPLICATION, "Read failed.", "Final read from id-ints failed."); + ErrorType.APPLICATION, "operation-failed", "Final read from id-ints failed.", null, null, e); return Futures.immediateFuture(RpcResultBuilder.failed() .withRpcError(error).build()); @@ -682,7 +685,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService context.findLocalShardAsync(shardName).onComplete(new OnComplete() { @Override - public void onComplete(final Throwable throwable, final ActorRef actorRef) throws Throwable { + public void onComplete(final Throwable throwable, final ActorRef actorRef) { if (throwable != null) { shutdownShardAsk.failure(throwable); } else { @@ -693,7 +696,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService shutdownShardAsk.future().onComplete(new OnComplete() { @Override - public void onComplete(final Throwable throwable, final Boolean gracefulStopResult) throws Throwable { + public void onComplete(final Throwable throwable, final Boolean gracefulStopResult) { if (throwable != null) { final RpcResult failedResult = RpcResultBuilder.failed() .withError(ErrorType.APPLICATION, "Failed to gracefully shutdown shard", throwable).build(); @@ -794,13 +797,13 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService final ClientLocalHistory localHistory = distributedDataStoreClient.createLocalHistory(); final ClientTransaction tx = localHistory.createTransaction(); - final ListenableFuture>> read = + final ListenableFuture>> read = tx.read(YangInstanceIdentifier.of(ProduceTransactionsHandler.ID_INT)); tx.abort(); localHistory.close(); try { - final Optional> optional = read.get(); + final java.util.Optional> optional = read.get(); if (!optional.isPresent()) { LOG.warn("Final read from client is empty."); final RpcError error = RpcResultBuilder.newError(