Simon Hunt | f844f63 | 2015-05-20 19:06:35 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2015 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 | * |
| 16 | */ |
| 17 | |
| 18 | package org.onosproject.cord.gui.model; |
| 19 | |
| 20 | import org.junit.Test; |
| 21 | |
| 22 | import java.util.Set; |
| 23 | |
| 24 | import static org.junit.Assert.*; |
| 25 | import static org.onosproject.cord.gui.model.BundleFactory.availableBundles; |
| 26 | import static org.onosproject.cord.gui.model.XosFunctionDescriptor.*; |
| 27 | |
| 28 | /** |
| 29 | * Unit tests for {@link BundleFactory}. |
| 30 | */ |
| 31 | public class BundleFactoryTest { |
| 32 | |
| 33 | @Test |
| 34 | public void bundleCount() { |
| 35 | assertEquals("wrong count", 2, availableBundles().size()); |
| 36 | } |
| 37 | |
| 38 | @Test |
| 39 | public void basicBundle() { |
| 40 | BundleDescriptor bundle = availableBundles().get(0); |
| 41 | assertEquals("wrong id", "basic", bundle.id()); |
| 42 | assertEquals("wrong id", "Basic Bundle", bundle.displayName()); |
| 43 | Set<XosFunctionDescriptor> funcs = bundle.functions(); |
| 44 | assertTrue("missing internet", funcs.contains(INTERNET)); |
| 45 | assertTrue("missing firewall", funcs.contains(FIREWALL)); |
| 46 | assertFalse("unexpected url-f", funcs.contains(URL_FILTERING)); |
| 47 | } |
| 48 | |
| 49 | @Test |
| 50 | public void familyBundle() { |
| 51 | BundleDescriptor bundle = availableBundles().get(1); |
| 52 | assertEquals("wrong id", "family", bundle.id()); |
| 53 | assertEquals("wrong id", "Family Bundle", bundle.displayName()); |
| 54 | Set<XosFunctionDescriptor> funcs = bundle.functions(); |
| 55 | assertTrue("missing internet", funcs.contains(INTERNET)); |
| 56 | assertTrue("missing firewall", funcs.contains(FIREWALL)); |
| 57 | assertTrue("missing url-f", funcs.contains(URL_FILTERING)); |
| 58 | } |
| 59 | |
| 60 | } |
| 61 | |