X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsamples%2Fclustering-test-app%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fclustering%2Fit%2Fprovider%2FMdsalLowLevelTestProvider.java;h=92bacd1f89aacfdd67b12dfd299dce3fdaed64ab;hp=e2ac03b6e86945a76d465ce7760e26a49873379e;hb=95788d18b61dd21bdd8406a9c725ad76b3044535;hpb=258d8039ac144aeee2efa7943228c0fc6cdaf651 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 e2ac03b6e8..92bacd1f89 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; @@ -18,7 +17,6 @@ import akka.dispatch.OnComplete; import akka.pattern.Patterns; import com.google.common.base.Optional; import com.google.common.base.Strings; -import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; @@ -52,7 +50,6 @@ import org.opendaylight.controller.clustering.it.provider.impl.WriteTransactions import org.opendaylight.controller.clustering.it.provider.impl.YnlListener; import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction; import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener; @@ -61,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; @@ -172,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; @@ -199,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, @@ -550,7 +547,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService final DOMDataReadOnlyTransaction rTx = domDataBroker.newReadOnlyTransaction(); try { final Optional> readResult = - rTx.read(CONTROLLER_CONFIG, WriteTransactionsHandler.ID_INT_YID).checkedGet(); + rTx.read(CONTROLLER_CONFIG, WriteTransactionsHandler.ID_INT_YID).get(); if (!readResult.isPresent()) { final RpcError error = RpcResultBuilder.newError( @@ -559,11 +556,16 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService .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 ReadFailedException e) { + } catch (final InterruptedException | ExecutionException e) { final RpcError error = RpcResultBuilder.newError( ErrorType.APPLICATION, "Read failed.", "Final read from id-ints failed."); return Futures.immediateFuture(RpcResultBuilder.failed() @@ -684,7 +686,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 { @@ -695,7 +697,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(); @@ -796,14 +798,13 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService final ClientLocalHistory localHistory = distributedDataStoreClient.createLocalHistory(); final ClientTransaction tx = localHistory.createTransaction(); - final CheckedFuture>, - org.opendaylight.mdsal.common.api.ReadFailedException> read = + final ListenableFuture>> read = tx.read(YangInstanceIdentifier.of(ProduceTransactionsHandler.ID_INT)); tx.abort(); localHistory.close(); try { - final Optional> optional = read.checkedGet(); + final java.util.Optional> optional = read.get(); if (!optional.isPresent()) { LOG.warn("Final read from client is empty."); final RpcError error = RpcResultBuilder.newError( @@ -816,7 +817,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService RpcResultBuilder.success(new UnsubscribeDdtlOutputBuilder() .setCopyMatches(idIntsDdtl.checkEqual(optional.get()))).build()); - } catch (org.opendaylight.mdsal.common.api.ReadFailedException e) { + } catch (InterruptedException | ExecutionException e) { LOG.error("Unable to read data to verify ddtl data.", e); final RpcError error = RpcResultBuilder.newError( ErrorType.APPLICATION, "Read failed.", "Final read from id-ints failed.");