X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Futil%2FMdSalRegistrationUtilsTest.java;h=61f994824b4b75094d552d6385157c07d5df0af9;hb=a6d47f9fa6afde0ddde3d2f06dcc45e0627e8fc8;hp=cf0149cd79ffea230d337755f76834bdb7e5be30;hpb=0f768f0752ac94e454c3c9e51879fac9abb61144;p=openflowplugin.git diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java index cf0149cd79..61f994824b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java @@ -1,12 +1,9 @@ /* + * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * - * * Copyright (c) 2015 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 - * - * + * 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.openflowplugin.impl.util; @@ -17,16 +14,19 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; + import java.math.BigInteger; import org.junit.Test; import org.mockito.Matchers; import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; +import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.DeviceState; import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext; +import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider; +import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager; +import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput; -import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole; import org.opendaylight.yangtools.yang.binding.RpcService; public class MdSalRegistrationUtilsTest { @@ -35,7 +35,7 @@ public class MdSalRegistrationUtilsTest { * Number of currently registrated services (can be changed) * (RpcContext, DeviceContext)} */ - private static final int NUMBER_OF_RPC_SERVICE_REGISTRATION = 13; + private static final int NUMBER_OF_RPC_SERVICE_REGISTRATION = 14; @Test public void registerServiceTest() { @@ -45,20 +45,22 @@ public class MdSalRegistrationUtilsTest { final ConnectionContext mockedConnectionContext = mock(ConnectionContext.class); final DeviceState mockedDeviceState = mock(DeviceState.class); + final DeviceInfo mockedDeviceInfo = mock(DeviceInfo.class); when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState); + when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo); final FeaturesReply mockedFeatures = mock(FeaturesReply.class); when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeatures); - final GetFeaturesOutput mockedFeaturesOutput = mock(GetFeaturesOutput.class); - when(mockedDeviceState.getFeatures()).thenReturn(mockedFeaturesOutput); - final BigInteger mockedDataPathId = mock(BigInteger.class); when(mockedFeatures.getDatapathId()).thenReturn(mockedDataPathId); - when(mockedFeaturesOutput.getDatapathId()).thenReturn(mockedDataPathId); + when(mockedDeviceInfo.getDatapathId()).thenReturn(mockedDataPathId); when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext); - MdSalRegistrationUtils.registerMasterServices(mockedRpcContext, mockedDeviceContext, OfpRole.BECOMEMASTER); + + final ExtensionConverterProvider extensionConverterProvider = mock(ExtensionConverterProvider.class); + final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager(); + MdSalRegistrationUtils.registerServices(mockedRpcContext, mockedDeviceContext, extensionConverterProvider, convertorManager); verify(mockedRpcContext, times(NUMBER_OF_RPC_SERVICE_REGISTRATION)).registerRpcServiceImplementation( Matchers.> any(), any(RpcService.class)); }