blob: 29b06f9121dfe7a693bc65d0bddedbb956146f6f [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;
17
18import org.jboss.netty.channel.ChannelPipeline;
19import org.junit.After;
20import org.junit.Before;
21import org.junit.Test;
22import org.onosproject.isis.controller.IsisInterface;
23import org.onosproject.isis.controller.IsisProcess;
24
25import java.util.ArrayList;
26import java.util.List;
27
28import static org.hamcrest.CoreMatchers.instanceOf;
29import static org.hamcrest.CoreMatchers.is;
30import static org.junit.Assert.assertThat;
31
32/**
33 * Unit test class for IsisPipelineFactory.
34 */
35public class IsisPipelineFactoryTest {
36
37 private IsisPipelineFactory isisPipelineFactory;
38 private IsisChannelHandler isisChannelHandler;
39 private List<IsisProcess> isisProcessList = new ArrayList<>();
40 private Controller controller;
41 private ChannelPipeline channelPipeline;
42 private DefaultIsisProcess isisProcess;
43 private String processId = "1";
44 private DefaultIsisInterface isisInterface;
45 private List<IsisInterface> isisInterfaces = new ArrayList<>();
46
47 @Before
48 public void setUp() throws Exception {
49 controller = new Controller();
50 isisProcess = new DefaultIsisProcess();
51 isisInterface = new DefaultIsisInterface();
52 isisInterfaces.add(isisInterface);
53 isisProcess.setIsisInterfaceList(isisInterfaces);
54 isisProcess.setProcessId(processId);
55 isisProcessList.add(isisProcess);
56 isisChannelHandler = new IsisChannelHandler(controller, isisProcessList);
57 isisPipelineFactory = new IsisPipelineFactory(isisChannelHandler);
58 }
59
60 @After
61 public void tearDown() throws Exception {
62 controller = null;
63 isisChannelHandler = null;
64 isisPipelineFactory = null;
65 }
66
67 /**
68 * Tests getPipeline() method.
69 */
70 @Test
71 public void testGetPipeline() throws Exception {
72 channelPipeline = isisPipelineFactory.getPipeline();
73 assertThat(channelPipeline, is(instanceOf(ChannelPipeline.class)));
74 }
75}