Merge "Do not use InstanceIdentifier.builder()"
[controller.git] / opendaylight / md-sal / sal-binding-it / src / test / java / org / opendaylight / controller / test / sal / binding / it / AbstractTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.test.sal.binding.it;
9
10 import org.junit.runner.RunWith;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
12 import org.ops4j.pax.exam.Configuration;
13 import org.ops4j.pax.exam.Option;
14 import org.ops4j.pax.exam.junit.PaxExam;
15 import org.ops4j.pax.exam.util.Filter;
16 import org.osgi.framework.BundleContext;
17
18 import javax.inject.Inject;
19
20 import static org.opendaylight.controller.test.sal.binding.it.TestHelper.baseModelBundles;
21 import static org.opendaylight.controller.test.sal.binding.it.TestHelper.bindingAwareSalBundles;
22 import static org.opendaylight.controller.test.sal.binding.it.TestHelper.configMinumumBundles;
23 import static org.opendaylight.controller.test.sal.binding.it.TestHelper.flowCapableModelBundles;
24 import static org.opendaylight.controller.test.sal.binding.it.TestHelper.junitAndMockitoBundles;
25 import static org.opendaylight.controller.test.sal.binding.it.TestHelper.mdSalCoreBundles;
26 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
27 import static org.ops4j.pax.exam.CoreOptions.options;
28 import static org.ops4j.pax.exam.CoreOptions.systemPackages;
29 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
30
31 @RunWith(PaxExam.class)
32 public abstract class AbstractTest {
33
34     public static final String CONTROLLER = "org.opendaylight.controller";
35     public static final String YANGTOOLS = "org.opendaylight.yangtools";
36
37     public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
38     public static final String YANGTOOLS_MODELS = "org.opendaylight.yangtools.model";
39
40     @Inject
41     @Filter(timeout=120*1000)
42     BindingAwareBroker broker;
43
44     @Inject
45     BundleContext bundleContext;
46
47     public BindingAwareBroker getBroker() {
48         return broker;
49     }
50
51     public void setBroker(BindingAwareBroker broker) {
52         this.broker = broker;
53     }
54
55     public BundleContext getBundleContext() {
56         return bundleContext;
57     }
58
59     public void setBundleContext(BundleContext bundleContext) {
60         this.bundleContext = bundleContext;
61     }
62
63     @Configuration
64     public Option[] config() {
65         return options(systemProperty("osgi.console").value("2401"), mavenBundle("org.slf4j", "slf4j-api")
66                 .versionAsInProject(), //
67 //                systemProperty("logback.configurationFile").value(
68 //                        "file:" + PathUtils.getBaseDir()
69 //                                + "/src/test/resources/logback.xml"),
70                 mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), //
71                 mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(), //
72                 mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), //
73                 systemProperty("osgi.bundles.defaultStartLevel").value("4"),
74                 systemPackages("sun.nio.ch"),
75
76                 mdSalCoreBundles(),
77
78                 bindingAwareSalBundles(),
79                 configMinumumBundles(),
80                 // BASE Models
81                 baseModelBundles(),
82                 flowCapableModelBundles(),
83
84                 // Set fail if unresolved bundle present
85                 systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
86                 junitAndMockitoBundles());
87     }
88
89 }