Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Laboratory |
Dhruv Dhody | b585012 | 2016-02-17 17:51:19 +0530 | [diff] [blame] | 3 | * |
| 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 | */ |
| 16 | package org.onosproject.ospf.controller.impl; |
| 17 | |
| 18 | import org.jboss.netty.channel.ChannelPipeline; |
| 19 | import org.junit.After; |
| 20 | import org.junit.Before; |
| 21 | import org.junit.Test; |
| 22 | import org.onosproject.ospf.controller.area.OspfAreaImpl; |
| 23 | import org.onosproject.ospf.controller.area.OspfInterfaceImpl; |
| 24 | |
| 25 | import static org.hamcrest.CoreMatchers.*; |
| 26 | import static org.hamcrest.MatcherAssert.assertThat; |
| 27 | |
| 28 | /** |
| 29 | * Unit test class for OspfPipelineFactory. |
| 30 | */ |
| 31 | public class OspfPipelineFactoryTest { |
| 32 | |
| 33 | private OspfPipelineFactory ospfPipelineFactory; |
| 34 | private ChannelPipeline channelPipeline; |
| 35 | |
| 36 | @Before |
| 37 | public void setUp() throws Exception { |
| 38 | ospfPipelineFactory = new OspfPipelineFactory(new Controller(), new OspfAreaImpl(), new OspfInterfaceImpl()); |
| 39 | |
| 40 | } |
| 41 | |
| 42 | @After |
| 43 | public void tearDown() throws Exception { |
| 44 | ospfPipelineFactory = null; |
| 45 | channelPipeline = null; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Tests getPipeline() method. |
| 50 | */ |
| 51 | @Test |
| 52 | public void testGetPipeline() throws Exception { |
| 53 | channelPipeline = ospfPipelineFactory.getPipeline(); |
| 54 | assertThat(channelPipeline, is(notNullValue())); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Tests releaseExternalResources() method. |
| 59 | */ |
| 60 | @Test |
| 61 | public void testReleaseExternalResources() throws Exception { |
| 62 | ospfPipelineFactory.releaseExternalResources(); |
| 63 | assertThat(channelPipeline, is(nullValue())); |
| 64 | } |
| 65 | } |