5a031324a6b69383e82c5cdc2090a4408ff5f350
[bgpcep.git] / pcep / testtool / src / test / java / org / opendaylight / protocol / pcep / testtool / PCEPTestingToolTest.java
1 /*
2  * Copyright (c) 2013 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 package org.opendaylight.protocol.pcep.testtool;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13
14 import org.junit.Test;
15
16 import org.opendaylight.protocol.pcep.message.PCEPKeepAliveMessage;
17
18 public class PCEPTestingToolTest {
19
20         @Test
21         public void testSimpleSessionListener() {
22                 final SimpleSessionListener ssl = new SimpleSessionListener();
23                 assertEquals(0, ssl.messages.size());
24                 ssl.onMessage(null, new PCEPKeepAliveMessage());
25                 assertEquals(1, ssl.messages.size());
26                 assertTrue(ssl.messages.get(0) instanceof PCEPKeepAliveMessage);
27                 assertFalse(ssl.up);
28                 ssl.onSessionUp(null, null, null);
29                 assertTrue(ssl.up);
30                 ssl.onSessionDown(null, null, null);
31                 assertFalse(ssl.up);
32         }
33
34         @Test
35         public void testSessionListenerFactory() {
36                 assertTrue(new SessionListenerFactory().getSessionListener(null) instanceof SimpleSessionListener);
37         }
38 }