blob: 98684ad80630e8efb4e667c5c6c7c3403f9b739c [file] [log] [blame]
chidambar babu344dc812016-05-02 19:13:10 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
chidambar babu344dc812016-05-02 19:13:10 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.isis.controller.impl.lsdb;
17
18import org.junit.After;
19import org.junit.Before;
20import org.junit.Test;
sunish vk4b5ce002016-05-09 20:18:35 +053021import org.onosproject.isis.controller.impl.DefaultIsisInterface;
chidambar babu344dc812016-05-02 19:13:10 +053022
sunish vk4b5ce002016-05-09 20:18:35 +053023import java.net.InetSocketAddress;
24import java.net.SocketAddress;
25import java.util.concurrent.ArrayBlockingQueue;
chidambar babu344dc812016-05-02 19:13:10 +053026import java.util.concurrent.BlockingQueue;
27
28import static org.hamcrest.CoreMatchers.is;
29import static org.hamcrest.CoreMatchers.notNullValue;
30import static org.junit.Assert.assertThat;
31
32/**
33 * Unit test case for IsisLspQueueConsumer.
34 */
35public class IsisLspQueueConsumerTest {
36
37 private IsisLspQueueConsumer isisLspQueueConsumer;
sunish vk4b5ce002016-05-09 20:18:35 +053038 private BlockingQueue blockingQueue = new ArrayBlockingQueue(1024);
39 private DefaultLspWrapper lspWrapper;
40 private DefaultLspWrapper lspWrapper1;
41 private SocketAddress socketAddress = InetSocketAddress.createUnresolved("127.0.0.1", 7000);
chidambar babu344dc812016-05-02 19:13:10 +053042
43 @Before
44 public void setUp() throws Exception {
sunish vk4b5ce002016-05-09 20:18:35 +053045 lspWrapper = new DefaultLspWrapper();
46 lspWrapper.setLspProcessing("refreshLsp");
47 lspWrapper.setSelfOriginated(true);
48 lspWrapper.setIsisInterface(new DefaultIsisInterface());
49 lspWrapper1 = new DefaultLspWrapper();
50 lspWrapper1.setLspProcessing("maxAgeLsp");
51 lspWrapper1.setIsisInterface(new DefaultIsisInterface());
52 blockingQueue.add(lspWrapper);
53 blockingQueue.add(lspWrapper1);
chidambar babu344dc812016-05-02 19:13:10 +053054 isisLspQueueConsumer = new IsisLspQueueConsumer(blockingQueue);
55 }
56
57 @After
58 public void tearDown() throws Exception {
59 isisLspQueueConsumer = null;
60 }
61
62 /**
63 * Tests run() method.
64 */
65 @Test
66 public void testRun() throws Exception {
67 isisLspQueueConsumer.run();
68 assertThat(isisLspQueueConsumer, is(notNullValue()));
69 }
70}