2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.openflowplugin.openflow.md.core;
\r
11 import org.junit.Assert;
\r
12 import org.junit.Test;
\r
13 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
\r
14 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationQueueWrapper;
\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder;
\r
18 * @author michal.polkorab
\r
21 public class NotificationQueueWrapperTest {
\r
24 * Test NotificationQueueWrapper creation
\r
26 @Test(expected=IllegalArgumentException.class)
\r
27 public void test() {
\r
28 NotificationQueueWrapper queueWrapper = new NotificationQueueWrapper(null, null);
\r
32 * Test NotificationQueueWrapper creation
\r
34 @Test(expected=IllegalArgumentException.class)
\r
35 public void test2() {
\r
36 EchoRequestMessageBuilder echoBuilder = new EchoRequestMessageBuilder();
\r
37 NotificationQueueWrapper queueWrapper = new NotificationQueueWrapper(echoBuilder.build(), null);
\r
41 * Test NotificationQueueWrapper creation
\r
44 public void test3() {
\r
45 EchoRequestMessageBuilder echoBuilder = new EchoRequestMessageBuilder();
\r
46 NotificationQueueWrapper queueWrapper = new NotificationQueueWrapper(echoBuilder.build(),
\r
47 (short) EncodeConstants.OF13_VERSION_ID);
\r
49 Assert.assertEquals("Wrong implemented interface", "org.opendaylight.openflowplugin.api.openflow.md"
\r
50 + ".core.NotificationQueueWrapper", queueWrapper.getImplementedInterface().getName());
\r
51 Assert.assertEquals("Wrong version", 4, queueWrapper.getVersion().intValue());
\r
52 Assert.assertEquals("Wrong notification", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol"
\r
53 + ".rev130731.EchoRequestMessage", queueWrapper.getNotification().getImplementedInterface().getName());
\r
54 Assert.assertEquals("Wrong xid", -1, queueWrapper.getXid().longValue());
\r
55 queueWrapper.setXid(12345L);
\r
56 Assert.assertEquals("Wrong xid", 12345, queueWrapper.getXid().intValue());
\r