blob: f2b94b6c4b0554234462fe8f72e50c2ee90f6f2e [file] [log] [blame]
Simon Huntf844f632015-05-20 19:06:35 -07001/*
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
18package org.onosproject.cord.gui.model;
19
20import org.junit.Test;
21
22import java.util.Set;
23
24import static org.junit.Assert.*;
25import static org.onosproject.cord.gui.model.BundleFactory.availableBundles;
26import static org.onosproject.cord.gui.model.XosFunctionDescriptor.*;
27
28/**
29 * Unit tests for {@link BundleFactory}.
30 */
31public 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