blob: adfa4862037fe938ec194760a6f5a9e84fb82467 [file] [log] [blame]
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -08001/*
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 */
16package org.onosproject.net.driver;
17
18import com.google.common.collect.ImmutableMap;
19import org.junit.Test;
20
21import java.util.Set;
22
23import static com.google.common.collect.ImmutableSet.of;
24import static org.junit.Assert.assertEquals;
25
26public class DefaultDriverProviderTest {
27
28 @Test
29 public void basics() {
30 DefaultDriverProvider ddp = new DefaultDriverProvider();
31 DefaultDriver one = new DefaultDriver("foo.bar", "Circus", "lux", "1.2a",
32 ImmutableMap.of(TestBehaviour.class,
33 TestBehaviourImpl.class),
34 ImmutableMap.of("foo", "bar"));
35 DefaultDriver two = new DefaultDriver("foo.bar", "", "", "",
36 ImmutableMap.of(TestBehaviourTwo.class,
37 TestBehaviourTwoImpl.class),
38 ImmutableMap.of("goo", "wee"));
39 DefaultDriver three = new DefaultDriver("goo.foo", "BigTop", "better", "2.2",
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}