Added TestHelper with new PaxExam options, which could be reused by other ITs.
[controller.git] / opendaylight / md-sal / sal-binding-it / src / main / java / org / opendaylight / controller / test / sal / binding / it / TestHelper.java
1 package org.opendaylight.controller.test.sal.binding.it;
2
3 import static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
4 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
5 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
6 import static org.ops4j.pax.exam.CoreOptions.repository;
7
8 import org.ops4j.pax.exam.Option;
9 import org.ops4j.pax.exam.options.DefaultCompositeOption;
10
11 public class TestHelper {
12
13     public static final String CONTROLLER = "org.opendaylight.controller";
14     public static final String YANGTOOLS = "org.opendaylight.yangtools";
15
16     public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
17     public static final String YANGTOOLS_MODELS = "org.opendaylight.yangtools.model";
18
19     public static Option mdSalCoreBundles() {
20         return new DefaultCompositeOption( //
21                 mavenBundle(YANGTOOLS, "concepts").versionAsInProject(), //
22                 mavenBundle(YANGTOOLS, "yang-binding").versionAsInProject(), //
23                 mavenBundle(YANGTOOLS, "yang-common").versionAsInProject(), //
24                 mavenBundle(CONTROLLER, "sal-common").versionAsInProject(), //
25                 mavenBundle(CONTROLLER, "sal-common-api").versionAsInProject(), //
26                 mavenBundle("com.google.guava", "guava").versionAsInProject(), //
27                 mavenBundle(YANGTOOLS + ".thirdparty", "xtend-lib-osgi").versionAsInProject() //
28         );
29     }
30
31     public static Option bindingAwareSalBundles() {
32         return new DefaultCompositeOption( //
33                 mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(), //
34                 mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(), //
35                 mavenBundle("org.javassist", "javassist").versionAsInProject(), //
36                 mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject() //
37         );
38
39     }
40
41     public static Option bindingIndependentSalBundles() {
42         return new DefaultCompositeOption(
43
44         );
45
46     }
47
48     public static Option flowCapableModelBundles() {
49         return new DefaultCompositeOption( //
50                 mavenBundle(CONTROLLER_MODELS, "model-flow-base").versionAsInProject(), //
51                 mavenBundle(CONTROLLER_MODELS, "model-flow-service").versionAsInProject(), //
52                 mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject() //
53         );
54
55     }
56
57     public static Option baseModelBundles() {
58         return new DefaultCompositeOption( //
59                 mavenBundle(YANGTOOLS_MODELS, "yang-ext").versionAsInProject(), //
60                 mavenBundle(YANGTOOLS_MODELS, "ietf-inet-types").versionAsInProject(), //
61                 mavenBundle(YANGTOOLS_MODELS, "ietf-yang-types").versionAsInProject(), //
62                 mavenBundle(YANGTOOLS_MODELS, "opendaylight-l2-types").versionAsInProject(), //
63                 mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject());
64     }
65
66     public static Option junitAndMockitoBundles() {
67         return new DefaultCompositeOption(
68         // Repository required to load harmcrest (OSGi-fied version).
69                 repository("http://repository.springsource.com/maven/bundles/external").id(
70                         "com.springsource.repository.bundles.external"),
71
72                 // Mockito
73                 mavenBundle("org.mockito", "mockito-all", "1.9.5"),
74                 junitBundles(),
75
76                 /*
77                  * Felix has implicit boot delegation enabled by default. It
78                  * conflicts with Mockito: java.lang.LinkageError: loader
79                  * constraint violation in interface itable initialization: when
80                  * resolving method
81                  * "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
82                  * .
83                  * newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object
84                  * ;" the class loader (instance of
85                  * org/mockito/internal/creation/jmock/SearchingClassLoader) of
86                  * the current class, org/osgi/service/useradmin/
87                  * User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class
88                  * loader (instance of org/apache/felix/framework/
89                  * BundleWiringImpl$BundleClassLoaderJava5) for interface
90                  * org/mockito/cglib/proxy/Factory have different Class objects
91                  * for the type org/mockito/cglib/ proxy/Callback used in the
92                  * signature
93                  * 
94                  * So we disable the bootdelegation. this property has no effect
95                  * on the other OSGi implementation.
96                  */
97                 frameworkProperty("felix.bootdelegation.implicit").value("false"));
98     }
99 }