Merge "BUG 1839 - HTTP delete of non existing data"
[controller.git] / opendaylight / netconf / netconf-util / src / test / java / org / opendaylight / controller / netconf / util / messages / NetconfHelloMessageTest.java
1 /*
2  * Copyright (c) 2014 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.controller.netconf.util.messages;
10
11
12 import com.google.common.base.Optional;
13 import java.util.Set;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.mockito.internal.util.collections.Sets;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertTrue;
20
21 public class NetconfHelloMessageTest {
22
23     Set<String> caps;
24
25     @Before
26     public void setUp() throws Exception {
27         caps = Sets.newSet("cap1");
28     }
29
30     @Test
31     public void testConstructor() throws Exception {
32         NetconfHelloMessageAdditionalHeader additionalHeader = new NetconfHelloMessageAdditionalHeader("name","host","1","transp","id");
33         NetconfHelloMessage message = NetconfHelloMessage.createClientHello(caps, Optional.of(additionalHeader));
34         assertTrue(message.isHelloMessage(message));
35         assertEquals(Optional.of(additionalHeader), message.getAdditionalHeader());
36
37         NetconfHelloMessage serverMessage = NetconfHelloMessage.createServerHello(caps, 100L);
38         assertTrue(serverMessage.isHelloMessage(serverMessage));
39     }
40 }