2 * Copyright (c) 2015 Cisco 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.openflowplugin.impl.device.listener;
11 import static org.junit.Assert.fail;
12 import org.junit.Before;
13 import org.junit.Ignore;
14 import org.junit.Test;
15 import org.junit.runner.RunWith;
16 import org.mockito.Mock;
17 import org.mockito.Mockito;
18 import org.mockito.runners.MockitoJUnitRunner;
19 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
20 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
21 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceReplyProcessor;
22 import org.opendaylight.openflowplugin.impl.connection.listener.OpenflowProtocolListenerInitialImpl;
23 import org.opendaylight.openflowplugin.impl.connection.testutil.MsgGeneratorTestUtils;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
29 * org.opendaylight.openflowplugin.impl.connection.listener
31 * test of {@link OpenflowProtocolListenerInitialImpl} - lightweight version, using basic ways (TDD)
33 * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
35 * Created: Mar 26, 2015
37 @RunWith(MockitoJUnitRunner.class)
38 public class OpenflowProtocolListenerFullImplTest {
41 private OpenflowProtocolListenerFullImpl ofProtocolListener;
44 private DeviceReplyProcessor deviceReplyProcessor;
46 private ConnectionAdapter connectionAdapter;
50 // place for mocking method's general behavior for HandshakeContext and ConnectionContext
51 ofProtocolListener = new OpenflowProtocolListenerFullImpl(connectionAdapter, deviceReplyProcessor);
55 * Test method for {@link OpenflowProtocolListenerInitialImpl#OpenflowProtocolListenerInitialImpl(org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext, org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext)}.
59 public void testOpenflowProtocolListenerImpl() {
60 fail("Not yet implemented");
64 * Test method for {@link OpenflowProtocolListenerInitialImpl#onEchoRequestMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage)}.
68 public void testOnEchoRequestMessage() {
69 fail("Not yet implemented");
73 * Test method for {@link OpenflowProtocolListenerInitialImpl#onErrorMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage)}.
77 public void testOnErrorMessage() {
78 fail("Not yet implemented");
82 * Test method for {@link OpenflowProtocolListenerInitialImpl#onExperimenterMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage)}.
86 public void testOnExperimenterMessage() {
87 fail("Not yet implemented");
91 * Test method for {@link OpenflowProtocolListenerInitialImpl#onFlowRemovedMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage)}.
95 public void testOnFlowRemovedMessage() {
96 fail("Not yet implemented");
100 * Test method for {@link OpenflowProtocolListenerInitialImpl#onHelloMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage)}.
104 public void testOnHelloMessage() {
105 fail("Not yet implemented");
109 * Test method for {@link OpenflowProtocolListenerInitialImpl#onMultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)}.
112 public void testOnMultipartReplyMessage() {
114 ofProtocolListener.registerMultipartMsg(xid);
115 final MultipartReply multipartReply = MsgGeneratorTestUtils.makeMultipartDescReply(xid, "test-val", false);
116 ofProtocolListener.onMultipartReplyMessage((MultipartReplyMessage) multipartReply);
117 Mockito.verify(deviceReplyProcessor, Mockito.times(1)).processReply(Mockito.any(Xid.class), Mockito.anyListOf(MultipartReply.class));
121 * Test method for {@link OpenflowProtocolListenerInitialImpl#onPacketInMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage)}.
125 public void testOnPacketInMessage() {
126 fail("Not yet implemented");
130 * Test method for {@link OpenflowProtocolListenerInitialImpl#onPortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)}.
134 public void testOnPortStatusMessage() {
135 fail("Not yet implemented");
139 * Test method for {@link OpenflowProtocolListenerInitialImpl#checkState(org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext.CONNECTION_STATE)}.
143 public void testCheckState() {
144 fail("Not yet implemented");