X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-it%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Ftest%2Fsal%2Fbinding%2Fit%2FRoutedServiceTest.java;h=d49d6f0e25e271e43c8550feb5eef63d96301184;hb=28ad802448833cad483f185cfe442497ddc5c296;hp=3f610ba4f385c1b89b3185464105429253b58345;hpb=6b5e1e50d209999f53a32ae44e9a7c03a79e499c;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java index 3f610ba4f3..d49d6f0e25 100644 --- a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java +++ b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java @@ -1,3 +1,10 @@ +/* + * 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.test.sal.binding.it; import static org.junit.Assert.assertNotNull; @@ -14,10 +21,12 @@ import org.junit.Test; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; -import org.opendaylight.controller.sal.binding.api.*; +import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer; +import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; @@ -59,7 +68,7 @@ public class RoutedServiceTest extends AbstractTest { /** * Register provider 1 with first implementation of SalFlowService - * service1 - * + * */ broker.registerProvider(provider1, getBundleContext()); assertNotNull("Registration should not be null", firstReg); @@ -77,7 +86,7 @@ public class RoutedServiceTest extends AbstractTest { /** * Register provider 2 with first implementation of SalFlowService - * service2 - * + * */ broker.registerProvider(provider2, getBundleContext()); assertNotNull("Registration should not be null", firstReg); @@ -105,7 +114,7 @@ public class RoutedServiceTest extends AbstractTest { /** * Consumer creates addFlow message for node one and sends it to the * MD-SAL - * + * */ AddFlowInput addFlowFirstMessage = createSampleAddFlow(nodeOne, 1); consumerService.addFlow(addFlowFirstMessage); @@ -113,19 +122,19 @@ public class RoutedServiceTest extends AbstractTest { /** * Verifies that implementation of the first provider received the same * message from MD-SAL. - * + * */ verify(salFlowService1).addFlow(addFlowFirstMessage); /** * Verifies that second instance was not invoked with first message - * + * */ verify(salFlowService2, times(0)).addFlow(addFlowFirstMessage); /** * Provider 2 registers path of node 2 - * + * */ NodeRef nodeTwo = createNodeRef("foo:node:2"); secondReg.registerPath(NodeContext.class, nodeTwo.getValue()); @@ -142,26 +151,26 @@ public class RoutedServiceTest extends AbstractTest { /** * Verifies that second instance was invoked 3 times with second message * and first instance wasn't invoked. - * + * */ verify(salFlowService2, times(3)).addFlow(AddFlowSecondMessage); verify(salFlowService1, times(0)).addFlow(AddFlowSecondMessage); /** * Unregisteration of the path for the node one in the first provider - * + * */ firstReg.unregisterPath(NodeContext.class, nodeOne.getValue()); /** * Provider 2 registers path of node 1 - * + * */ secondReg.registerPath(NodeContext.class, nodeOne.getValue()); /** * A consumer sends third message to node 1 - * + * */ AddFlowInput AddFlowThirdMessage = createSampleAddFlow(nodeOne, 3); consumerService.addFlow(AddFlowThirdMessage); @@ -177,22 +186,21 @@ public class RoutedServiceTest extends AbstractTest { /** * Returns node reference from string which represents path - * + * * @param string * string with key(path) * @return instance of the type NodeRef */ private static NodeRef createNodeRef(String string) { NodeKey key = new NodeKey(new NodeId(string)); - InstanceIdentifier path = InstanceIdentifier.builder().node(Nodes.class).node(Node.class, key) - .toInstance(); + InstanceIdentifier path = InstanceIdentifier.builder(Nodes.class).child(Node.class, key).build(); return new NodeRef(path); } /** * Creates flow AddFlowInput for which only node and cookie are set - * + * * @param node * NodeRef value * @param cookie @@ -202,7 +210,7 @@ public class RoutedServiceTest extends AbstractTest { static AddFlowInput createSampleAddFlow(NodeRef node, int cookie) { AddFlowInputBuilder ret = new AddFlowInputBuilder(); ret.setNode(node); - ret.setCookie(BigInteger.valueOf(cookie)); + ret.setCookie(new FlowCookie(BigInteger.valueOf(cookie))); return ret.build(); } }