Adjust unit test to YangModuleInfo API change
[controller.git] / opendaylight / md-sal / sal-binding-dom-it / src / test / java / org / opendaylight / controller / sal / binding / test / connect / dom / MessageCapturingFlowService.java
index 74f07818d5ce5c2df7e298d5876d6792c3b0aae1..0f9389703ff5b587a1068a2428ca5d1732907f2c 100644 (file)
@@ -1,18 +1,21 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.sal.binding.test.connect.dom;
 
-import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertNotNull;
 
 import java.util.concurrent.Future;
 
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 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;
@@ -20,76 +23,28 @@ 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<RpcResult<AddFlowOutput>> addFlowResult;
-    private Future<RpcResult<RemoveFlowOutput>> removeFlowResult;
-    private Future<RpcResult<UpdateFlowOutput>> updateFlowResult;
-
-    private final Multimap<InstanceIdentifier<?>, AddFlowInput> receivedAddFlows = HashMultimap.create();
-    private final Multimap<InstanceIdentifier<?>, RemoveFlowInput> receivedRemoveFlows = HashMultimap.create();
-    private final Multimap<InstanceIdentifier<?>, UpdateFlowInput> receivedUpdateFlows = HashMultimap.create();
-    private RoutedRpcRegistration<SalFlowService> registration;
-
-    @Override
-    public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput arg0) {
-        receivedAddFlows.put(arg0.getNode().getValue(), arg0);
-        return addFlowResult;
-    }
-
-    @Override
-    public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput arg0) {
-        receivedRemoveFlows.put(arg0.getNode().getValue(), arg0);
-        return removeFlowResult;
-    }
-
-    @Override
-    public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput arg0) {
-        receivedUpdateFlows.put(arg0.getNode().getValue(), arg0);
-        return updateFlowResult;
-    }
-
-    public Future<RpcResult<AddFlowOutput>> getAddFlowResult() {
-        return addFlowResult;
-    }
-
-    public MessageCapturingFlowService setAddFlowResult(Future<RpcResult<AddFlowOutput>> addFlowResult) {
-        this.addFlowResult = addFlowResult;
-        return this;
-    }
+public class MessageCapturingFlowService implements OpendaylightOfMigrationTestModelService, AutoCloseable {
 
-    public Future<RpcResult<RemoveFlowOutput>> getRemoveFlowResult() {
-        return removeFlowResult;
-    }
+    private Future<RpcResult<KnockKnockOutput>> knockKnockResult;
 
-    public MessageCapturingFlowService setRemoveFlowResult(Future<RpcResult<RemoveFlowOutput>> removeFlowResult) {
-        this.removeFlowResult = removeFlowResult;
-        return this;
-    }
+    private final Multimap<InstanceIdentifier<?>, KnockKnockInput> receivedKnocks = HashMultimap.create();
+    private RoutedRpcRegistration<OpendaylightOfMigrationTestModelService> registration;
 
-    public Future<RpcResult<UpdateFlowOutput>> getUpdateFlowResult() {
-        return updateFlowResult;
+    public Future<RpcResult<KnockKnockOutput>> getKnockKnockResult() {
+        return knockKnockResult;
     }
 
-    public MessageCapturingFlowService setUpdateFlowResult(Future<RpcResult<UpdateFlowOutput>> updateFlowResult) {
-        this.updateFlowResult = updateFlowResult;
+    public MessageCapturingFlowService setKnockKnockResult(Future<RpcResult<KnockKnockOutput>> kkOutput) {
+        this.knockKnockResult = kkOutput;
         return this;
     }
 
-    public Multimap<InstanceIdentifier<?>, AddFlowInput> getReceivedAddFlows() {
-        return receivedAddFlows;
-    }
-
-    public Multimap<InstanceIdentifier<?>, RemoveFlowInput> getReceivedRemoveFlows() {
-        return receivedRemoveFlows;
-    }
-
-    public Multimap<InstanceIdentifier<?>, UpdateFlowInput> getReceivedUpdateFlows() {
-        return receivedUpdateFlows;
+    public Multimap<InstanceIdentifier<?>, KnockKnockInput> getReceivedKnocks() {
+        return receivedKnocks;
     }
 
     public MessageCapturingFlowService registerTo(RpcProviderRegistry registry) {
-        registration = registry.addRoutedRpcImplementation(SalFlowService.class, this);
+        registration = registry.addRoutedRpcImplementation(OpendaylightOfMigrationTestModelService.class, this);
         assertNotNull(registration);
         return this;
     }
@@ -107,16 +62,22 @@ public class MessageCapturingFlowService implements SalFlowService, AutoCloseabl
         registration.unregisterPath(context, path);
         return this;
     }
-    
+
     public static MessageCapturingFlowService create() {
         return new MessageCapturingFlowService();
     }
-    
+
     public static MessageCapturingFlowService create(RpcProviderRegistry registry) {
         MessageCapturingFlowService ret = new MessageCapturingFlowService();
         ret.registerTo(registry);
         return ret;
     }
-    
-    
-}
\ No newline at end of file
+
+    @Override
+    public Future<RpcResult<KnockKnockOutput>> knockKnock(KnockKnockInput input) {
+        receivedKnocks.put(input.getKnockerId(), input);
+        return knockKnockResult;
+    }
+
+
+}