blob: c140f33046acc3e29e27f6ec3ef27c8196536d0b [file] [log] [blame]
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -08003 *
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 */
16package org.onosproject.net.driver;
17
18import com.google.common.collect.ImmutableMap;
19import org.junit.Test;
20
Andrea Campanella80520b82016-01-05 17:55:29 -080021import java.util.ArrayList;
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080022import java.util.Set;
23
24import static com.google.common.collect.ImmutableSet.of;
25import static org.junit.Assert.assertEquals;
26
27public class DefaultDriverProviderTest {
28
29 @Test
30 public void basics() {
31 DefaultDriverProvider ddp = new DefaultDriverProvider();
Andrea Campanella80520b82016-01-05 17:55:29 -080032 DefaultDriver one = new DefaultDriver("foo.bar", new ArrayList<>(), "Circus", "lux", "1.2a",
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080033 ImmutableMap.of(TestBehaviour.class,
34 TestBehaviourImpl.class),
35 ImmutableMap.of("foo", "bar"));
Andrea Campanella80520b82016-01-05 17:55:29 -080036 DefaultDriver two = new DefaultDriver("foo.bar", new ArrayList<>(), "", "", "",
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080037 ImmutableMap.of(TestBehaviourTwo.class,
38 TestBehaviourTwoImpl.class),
39 ImmutableMap.of("goo", "wee"));
Andrea Campanella80520b82016-01-05 17:55:29 -080040 DefaultDriver three = new DefaultDriver("goo.foo", new ArrayList<>(), "BigTop", "better", "2.2",
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080041 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}