2 * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowjava.protocol.impl.core;
11 import static org.junit.Assert.assertNotNull;
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.mockito.Mock;
16 import org.mockito.MockitoAnnotations;
17 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;
18 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
19 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfigurationImpl;
20 import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;
21 import org.opendaylight.openflowjava.protocol.impl.serialization.SerializationFactory;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
29 public class PublishingChannelInitializerFactoryTest {
31 TlsConfiguration tlsConfiguration ;
32 ChannelInitializerFactory factory;
33 private final long switchIdleTimeOut = 60;
34 @Mock SwitchConnectionHandler switchConnectionHandler ;
35 @Mock SerializationFactory serializationFactory;
36 @Mock DeserializationFactory deserializationFactory ;
39 * Sets up test environment
43 MockitoAnnotations.initMocks(this);
44 factory = new ChannelInitializerFactory();
45 tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/exemplary-ctlTrustStore",
46 PathType.CLASSPATH, KeystoreType.JKS, "/exemplary-ctlKeystore", PathType.CLASSPATH);
47 factory.setDeserializationFactory(deserializationFactory);
48 factory.setSerializationFactory(serializationFactory);
49 factory.setSwitchConnectionHandler(switchConnectionHandler);
50 factory.setSwitchIdleTimeout(switchIdleTimeOut);
51 factory.setTlsConfig(tlsConfiguration);
55 * Test {@link TcpChannelInitializer} creation
58 public void testCreatePublishingChannelInitializer() {
59 TcpChannelInitializer initializer = factory.createPublishingChannelInitializer() ;
60 assertNotNull( initializer );