Thomas Vachuska | a8f4e7d | 2015-01-08 17:31:55 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Thomas Vachuska | a8f4e7d | 2015-01-08 17:31:55 -0800 | [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.net.driver; |
| 17 | |
| 18 | import com.google.common.collect.ImmutableMap; |
| 19 | import org.junit.Test; |
| 20 | |
Andrea Campanella | 80520b8 | 2016-01-05 17:55:29 -0800 | [diff] [blame] | 21 | import java.util.ArrayList; |
Thomas Vachuska | a8f4e7d | 2015-01-08 17:31:55 -0800 | [diff] [blame] | 22 | import java.util.Set; |
| 23 | |
| 24 | import static com.google.common.collect.ImmutableSet.of; |
| 25 | import static org.junit.Assert.assertEquals; |
| 26 | |
| 27 | public class DefaultDriverProviderTest { |
| 28 | |
| 29 | @Test |
| 30 | public void basics() { |
| 31 | DefaultDriverProvider ddp = new DefaultDriverProvider(); |
Andrea Campanella | 80520b8 | 2016-01-05 17:55:29 -0800 | [diff] [blame] | 32 | DefaultDriver one = new DefaultDriver("foo.bar", new ArrayList<>(), "Circus", "lux", "1.2a", |
Thomas Vachuska | a8f4e7d | 2015-01-08 17:31:55 -0800 | [diff] [blame] | 33 | ImmutableMap.of(TestBehaviour.class, |
| 34 | TestBehaviourImpl.class), |
| 35 | ImmutableMap.of("foo", "bar")); |
Andrea Campanella | 80520b8 | 2016-01-05 17:55:29 -0800 | [diff] [blame] | 36 | DefaultDriver two = new DefaultDriver("foo.bar", new ArrayList<>(), "", "", "", |
Thomas Vachuska | a8f4e7d | 2015-01-08 17:31:55 -0800 | [diff] [blame] | 37 | ImmutableMap.of(TestBehaviourTwo.class, |
| 38 | TestBehaviourTwoImpl.class), |
| 39 | ImmutableMap.of("goo", "wee")); |
Andrea Campanella | 80520b8 | 2016-01-05 17:55:29 -0800 | [diff] [blame] | 40 | DefaultDriver three = new DefaultDriver("goo.foo", new ArrayList<>(), "BigTop", "better", "2.2", |
Thomas Vachuska | a8f4e7d | 2015-01-08 17:31:55 -0800 | [diff] [blame] | 41 | ImmutableMap.of(TestBehaviourTwo.class, |
| 42 | TestBehaviourTwoImpl.class), |
| 43 | ImmutableMap.of("goo", "gee")); |
| 44 | |
| 45 | ddp.addDrivers(of(one, two, three)); |
| 46 | |
| 47 | Set<Driver> drivers = ddp.getDrivers(); |
| 48 | assertEquals("incorrect types", 2, drivers.size()); |
| 49 | } |
| 50 | } |