X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-binding-dom-it%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Ftest%2Fconnect%2Fdom%2FMessageCapturingFlowService.java;h=37514ae4af82697fc517405d25acf7204f48dab9;hb=258d8039ac144aeee2efa7943228c0fc6cdaf651;hp=47e79650fe1d865b0db61ccb733de584fa45de4c;hpb=54acc3c8f479b547877a5057cea143546e905470;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java index 47e79650fe..37514ae4af 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java @@ -9,108 +9,55 @@ package org.opendaylight.controller.sal.binding.test.connect.dom; import static org.junit.Assert.assertNotNull; -import java.util.concurrent.Future; - -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import com.google.common.util.concurrent.ListenableFuture; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.OpendaylightOfMigrationTestModelService; import org.opendaylight.yangtools.yang.binding.BaseIdentity; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.RpcResult; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; - -public class MessageCapturingFlowService implements SalFlowService, AutoCloseable { - - private Future> addFlowResult; - private Future> removeFlowResult; - private Future> updateFlowResult; +public class MessageCapturingFlowService implements OpendaylightOfMigrationTestModelService, AutoCloseable { - private final Multimap, AddFlowInput> receivedAddFlows = HashMultimap.create(); - private final Multimap, RemoveFlowInput> receivedRemoveFlows = HashMultimap.create(); - private final Multimap, UpdateFlowInput> receivedUpdateFlows = HashMultimap.create(); - private RoutedRpcRegistration registration; + private ListenableFuture> knockKnockResult; - @Override - public Future> addFlow(AddFlowInput arg0) { - receivedAddFlows.put(arg0.getNode().getValue(), arg0); - return addFlowResult; - } + private final Multimap, KnockKnockInput> receivedKnocks = HashMultimap.create(); + private RoutedRpcRegistration registration; - @Override - public Future> removeFlow(RemoveFlowInput arg0) { - receivedRemoveFlows.put(arg0.getNode().getValue(), arg0); - return removeFlowResult; + public ListenableFuture> getKnockKnockResult() { + return knockKnockResult; } - @Override - public Future> updateFlow(UpdateFlowInput arg0) { - receivedUpdateFlows.put(arg0.getNode().getValue(), arg0); - return updateFlowResult; - } - - public Future> getAddFlowResult() { - return addFlowResult; - } - - public MessageCapturingFlowService setAddFlowResult(Future> addFlowResult) { - this.addFlowResult = addFlowResult; + public MessageCapturingFlowService setKnockKnockResult(final ListenableFuture> kkOutput) { + this.knockKnockResult = kkOutput; return this; } - public Future> getRemoveFlowResult() { - return removeFlowResult; + public Multimap, KnockKnockInput> getReceivedKnocks() { + return receivedKnocks; } - public MessageCapturingFlowService setRemoveFlowResult(Future> removeFlowResult) { - this.removeFlowResult = removeFlowResult; - return this; - } - - public Future> getUpdateFlowResult() { - return updateFlowResult; - } - - public MessageCapturingFlowService setUpdateFlowResult(Future> updateFlowResult) { - this.updateFlowResult = updateFlowResult; - return this; - } - - public Multimap, AddFlowInput> getReceivedAddFlows() { - return receivedAddFlows; - } - - public Multimap, RemoveFlowInput> getReceivedRemoveFlows() { - return receivedRemoveFlows; - } - - public Multimap, UpdateFlowInput> getReceivedUpdateFlows() { - return receivedUpdateFlows; - } - - public MessageCapturingFlowService registerTo(RpcProviderRegistry registry) { - registration = registry.addRoutedRpcImplementation(SalFlowService.class, this); + public MessageCapturingFlowService registerTo(final RpcProviderRegistry registry) { + registration = registry.addRoutedRpcImplementation(OpendaylightOfMigrationTestModelService.class, this); assertNotNull(registration); return this; } + @Override public void close() throws Exception { registration.close(); } - public MessageCapturingFlowService registerPath(Class context, InstanceIdentifier path) { + public MessageCapturingFlowService registerPath(final Class context, final InstanceIdentifier path) { registration.registerPath(context, path); return this; } - public MessageCapturingFlowService unregisterPath(Class context, InstanceIdentifier path) { + public MessageCapturingFlowService unregisterPath(final Class context, final InstanceIdentifier path) { registration.unregisterPath(context, path); return this; } @@ -119,11 +66,17 @@ public class MessageCapturingFlowService implements SalFlowService, AutoCloseabl return new MessageCapturingFlowService(); } - public static MessageCapturingFlowService create(RpcProviderRegistry registry) { + public static MessageCapturingFlowService create(final RpcProviderRegistry registry) { MessageCapturingFlowService ret = new MessageCapturingFlowService(); ret.registerTo(registry); return ret; } + @Override + public ListenableFuture> knockKnock(final KnockKnockInput input) { + receivedKnocks.put(input.getKnockerId(), input); + return knockKnockResult; + } + }