X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fcore%2FPublishingChannelInitializerTest.java;h=3d8717c7d0f599ad6122e197efdc00a0009fbd8e;hb=07de1ed897da9d7dc70c6d550f38c59339ed751e;hp=6666da3de000c1cc6bd759cd8eae4fd34032cfa0;hpb=c8e3b161e1e10753e53fbf1800bcc6e066e3d3b8;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializerTest.java index 6666da3d..3d8717c7 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializerTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializerTest.java @@ -34,9 +34,8 @@ import org.mockito.MockitoAnnotations; import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler; import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration; import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl; -import org.opendaylight.openflowjava.protocol.impl.connection.ConnectionAdapterFactory; -import org.opendaylight.openflowjava.protocol.impl.connection.ConnectionFacade; -import org.opendaylight.openflowjava.protocol.impl.core.PublishingChannelInitializer.COMPONENT_NAMES; +import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterFactory; +import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionFacade; import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory; import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType; @@ -63,16 +62,16 @@ public class PublishingChannelInitializerTest { TlsConfiguration tlsConfiguration ; InetSocketAddress inetSockAddr; - PublishingChannelInitializer pubChInitializer ; + TcpChannelInitializer pubChInitializer ; /** * Sets up test environment - * @throws Exception + * @throws Exception */ @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - pubChInitializer= new PublishingChannelInitializer(mockChGrp, mockConnAdaptorFactory) ; + pubChInitializer= new TcpChannelInitializer(mockChGrp, mockConnAdaptorFactory) ; pubChInitializer.setSerializationFactory(mockSerializationFactory); pubChInitializer.setDeserializationFactory(mockDeserializationFactory); pubChInitializer.setSwitchIdleTimeout(1) ; @@ -83,14 +82,14 @@ public class PublishingChannelInitializerTest { inetSockAddr = new InetSocketAddress(InetAddress.getLocalHost(), 8675 ) ; - when(mockConnAdaptorFactory.createConnectionFacade(mockSocketCh)) + when(mockConnAdaptorFactory.createConnectionFacade(mockSocketCh, null)) .thenReturn(mockConnFacade); when(mockSocketCh.remoteAddress()).thenReturn(inetSockAddr) ; when(mockSocketCh.localAddress()).thenReturn(inetSockAddr) ; when(mockSocketCh.remoteAddress()).thenReturn(inetSockAddr) ; when(mockSwConnHandler.accept(eq(InetAddress.getLocalHost()))).thenReturn(true) ; when(mockSocketCh.pipeline()).thenReturn(mockChPipeline) ; - + tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS, "/selfSignedController", PathType.CLASSPATH); } @@ -105,7 +104,7 @@ public class PublishingChannelInitializerTest { pubChInitializer.initChannel(mockSocketCh) ; verifyCommonHandlers(); - verify(mockChPipeline, times(1)).addLast(eq(COMPONENT_NAMES.SSL_HANDLER.name()),any(SslHandler.class)) ; + verify(mockChPipeline, times(1)).addLast(eq(PipelineHandlers.SSL_HANDLER.name()),any(SslHandler.class)) ; } /** @@ -117,7 +116,7 @@ public class PublishingChannelInitializerTest { pubChInitializer.initChannel(mockSocketCh) ; verifyCommonHandlers(); - verify(mockChPipeline, times(0)).addLast(eq(COMPONENT_NAMES.SSL_HANDLER.name()),any(SslHandler.class)) ; + verify(mockChPipeline, times(0)).addLast(eq(PipelineHandlers.SSL_HANDLER.name()),any(SslHandler.class)) ; } /** @@ -160,12 +159,12 @@ public class PublishingChannelInitializerTest { * All paths should install these six handlers: */ private void verifyCommonHandlers() { - verify(mockChPipeline, times(1)).addLast(eq(COMPONENT_NAMES.IDLE_HANDLER.name()),any(IdleHandler.class)) ; - verify(mockChPipeline, times(1)).addLast(eq(COMPONENT_NAMES.OF_DECODER.name()),any(OFDecoder.class)) ; - verify(mockChPipeline, times(1)).addLast(eq(COMPONENT_NAMES.OF_ENCODER.name()),any(OFEncoder.class)) ; - verify(mockChPipeline, times(1)).addLast(eq(COMPONENT_NAMES.OF_FRAME_DECODER.name()),any(OFFrameDecoder.class)) ; - verify(mockChPipeline, times(1)).addLast(eq(COMPONENT_NAMES.OF_VERSION_DETECTOR.name()),any(OFVersionDetector.class)) ; - verify(mockChPipeline, times(1)).addLast(eq(COMPONENT_NAMES.DELEGATING_INBOUND_HANDLER.name()),any(DelegatingInboundHandler.class)); + verify(mockChPipeline, times(1)).addLast(eq(PipelineHandlers.IDLE_HANDLER.name()),any(IdleHandler.class)) ; + verify(mockChPipeline, times(1)).addLast(eq(PipelineHandlers.OF_DECODER.name()),any(OFDecoder.class)) ; + verify(mockChPipeline, times(1)).addLast(eq(PipelineHandlers.OF_ENCODER.name()),any(OFEncoder.class)) ; + verify(mockChPipeline, times(1)).addLast(eq(PipelineHandlers.OF_FRAME_DECODER.name()),any(OFFrameDecoder.class)) ; + verify(mockChPipeline, times(1)).addLast(eq(PipelineHandlers.OF_VERSION_DETECTOR.name()),any(OFVersionDetector.class)) ; + verify(mockChPipeline, times(1)).addLast(eq(PipelineHandlers.DELEGATING_INBOUND_HANDLER.name()),any(DelegatingInboundHandler.class)); assertEquals(1, pubChInitializer.size()) ; } }