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;
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) ;
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);
}
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)) ;
}
/**
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)) ;
}
/**
* 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()) ;
}
}