Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.intent; |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 17 | |
| 18 | import org.junit.Test; |
| 19 | |
| 20 | import static org.junit.Assert.assertEquals; |
Ray Milkey | bd4f011 | 2015-03-02 17:07:09 -0800 | [diff] [blame] | 21 | import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Suite of tests of the single-to-multi point intent descriptor. |
| 25 | */ |
| 26 | public class SinglePointToMultiPointIntentTest extends ConnectivityIntentTest { |
| 27 | |
Ray Milkey | bd4f011 | 2015-03-02 17:07:09 -0800 | [diff] [blame] | 28 | /** |
| 29 | * Checks that the SinglePointToMultiPointIntent class is immutable. |
| 30 | */ |
| 31 | @Test |
| 32 | public void testImmutability() { |
| 33 | assertThatClassIsImmutable(SinglePointToMultiPointIntent.class); |
| 34 | } |
| 35 | |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 36 | @Test |
| 37 | public void basics() { |
| 38 | SinglePointToMultiPointIntent intent = createOne(); |
Thomas Vachuska | c96058a | 2014-10-20 23:00:16 -0700 | [diff] [blame] | 39 | assertEquals("incorrect id", APPID, intent.appId()); |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 40 | assertEquals("incorrect match", MATCH, intent.selector()); |
| 41 | assertEquals("incorrect ingress", P1, intent.ingressPoint()); |
| 42 | assertEquals("incorrect egress", PS2, intent.egressPoints()); |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | @Override |
| 46 | protected SinglePointToMultiPointIntent createOne() { |
Thomas Vachuska | c96058a | 2014-10-20 23:00:16 -0700 | [diff] [blame] | 47 | return new SinglePointToMultiPointIntent(APPID, MATCH, NOP, P1, PS2); |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | @Override |
| 51 | protected SinglePointToMultiPointIntent createAnother() { |
Thomas Vachuska | c96058a | 2014-10-20 23:00:16 -0700 | [diff] [blame] | 52 | return new SinglePointToMultiPointIntent(APPID, MATCH, NOP, P2, PS1); |
Brian O'Connor | f3d0616 | 2014-10-02 15:54:12 -0700 | [diff] [blame] | 53 | } |
| 54 | } |