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.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;
37 * org.opendaylight.openflowplugin.impl.openflow.device
39 * Test class for testing basic method functionality for {@link MultiMsgCollector}
41 * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
42 * @author <a href="mailto:tkubas@cisco.com">Timotej Kubas</a>
44 * Created: Mar 23, 2015
46 @RunWith(MockitoJUnitRunner.class)
47 public class MultiMsgCollectorImplTest {
49 private MultiMsgCollectorImpl collector;
51 DeviceReplyProcessor deviceProcessor;
54 public void initialization() {
55 collector = new MultiMsgCollectorImpl(3);
56 collector.setDeviceReplyProcessor(deviceProcessor);
62 * Test could return NullPointerException if the body of addMultipartMsg not
65 public void testAddMultipartMsgNotExpectedXid() {
67 final String hwTestValue = "test-value";
68 collector.addMultipartMsg(MsgGeneratorTestUtils.makeMultipartDescReply(xid, hwTestValue, true));