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