Merge "Increase timeout for waiting for broker service in sal-binding-it."
[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.systemProperty;
29
30 @RunWith(PaxExam.class)
31 public abstract class AbstractTest {
32
33     public static final String CONTROLLER = "org.opendaylight.controller";
34     public static final String YANGTOOLS = "org.opendaylight.yangtools";
35
36     public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
37     public static final String YANGTOOLS_MODELS = "org.opendaylight.yangtools.model";
38
39     @Inject
40     @Filter(timeout=120*1000)
41     BindingAwareBroker broker;
42
43     @Inject
44     BundleContext bundleContext;
45
46     public BindingAwareBroker getBroker() {
47         return broker;
48     }
49
50     public void setBroker(BindingAwareBroker broker) {
51         this.broker = broker;
52     }
53
54     public BundleContext getBundleContext() {
55         return bundleContext;
56     }
57
58     public void setBundleContext(BundleContext bundleContext) {
59         this.bundleContext = bundleContext;
60     }
61
62     @Configuration
63     public Option[] config() {
64         return options(systemProperty("osgi.console").value("2401"), mavenBundle("org.slf4j", "slf4j-api")
65                 .versionAsInProject(), //
66 //                systemProperty("logback.configurationFile").value(
67 //                        "file:" + PathUtils.getBaseDir()
68 //                                + "/src/test/resources/logback.xml"),
69                 mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), //
70                 mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(), //
71                 mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), //
72                 systemProperty("osgi.bundles.defaultStartLevel").value("4"),
73
74                 mdSalCoreBundles(),
75
76                 bindingAwareSalBundles(),
77                 configMinumumBundles(),
78                 // BASE Models
79                 baseModelBundles(),
80                 flowCapableModelBundles(),
81
82                 // Set fail if unresolved bundle present
83                 systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
84                 junitAndMockitoBundles());
85     }
86
87 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.