multipart messge collector doesn't create own future
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / device / listener / MultiMsgCollectorImplTest.java
1 /**
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowplugin.impl.device.listener;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertTrue;
14 import static org.junit.Assert.fail;
15 import com.google.common.util.concurrent.ListenableFuture;
16 import java.util.Arrays;
17 import java.util.Collection;
18 import java.util.Collections;
19 import java.util.concurrent.ExecutionException;
20 import java.util.concurrent.TimeUnit;
21 import java.util.concurrent.TimeoutException;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.junit.runner.RunWith;
25 import org.mockito.Mock;
26 import org.mockito.runners.MockitoJUnitRunner;
27 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceReplyProcessor;
28 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
29 import org.opendaylight.openflowplugin.impl.connection.testutil.MsgGeneratorTestUtils;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyDescCase;
34
35 /**
36  * openflowplugin-api
37  * org.opendaylight.openflowplugin.impl.openflow.device
38  *
39  * Test class for testing basic method functionality for {@link MultiMsgCollector}
40  *
41  * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
42  * @author <a href="mailto:tkubas@cisco.com">Timotej Kubas</a>
43  *
44  * Created: Mar 23, 2015
45  */
46 @RunWith(MockitoJUnitRunner.class)
47 public class MultiMsgCollectorImplTest {
48
49     private MultiMsgCollectorImpl collector;
50     @Mock
51     DeviceReplyProcessor deviceProcessor;
52
53     @Before
54     public void initialization() {
55         collector = new MultiMsgCollectorImpl(3);
56         collector.setDeviceReplyProcessor(deviceProcessor);
57     }
58
59
60
61     /**
62      * Test could return NullPointerException if the body of addMultipartMsg not
63      */
64     @Test
65     public void testAddMultipartMsgNotExpectedXid() {
66         final long xid = 1l;
67         final String hwTestValue = "test-value";
68         collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, true));
69     }
70
71 }