blob: 4568fd927e2fdadd601a7e49fa3b05089a45d7fc [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();
Thomas Vachuska635c2d72015-05-08 14:32:13 -070031 DefaultDriver one = new DefaultDriver("foo.bar", null, "Circus", "lux", "1.2a",
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080032 ImmutableMap.of(TestBehaviour.class,
33 TestBehaviourImpl.class),
34 ImmutableMap.of("foo", "bar"));
Thomas Vachuska635c2d72015-05-08 14:32:13 -070035 DefaultDriver two = new DefaultDriver("foo.bar", null, "", "", "",
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080036 ImmutableMap.of(TestBehaviourTwo.class,
37 TestBehaviourTwoImpl.class),
38 ImmutableMap.of("goo", "wee"));
Thomas Vachuska635c2d72015-05-08 14:32:13 -070039 DefaultDriver three = new DefaultDriver("goo.foo", null, "BigTop", "better", "2.2",
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080040 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}