0eace4daaca15973e76e056cb1b923627dfd51b6
[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 import static org.ops4j.pax.exam.CoreOptions.repositories;
8 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
9
10 import org.ops4j.pax.exam.Option;
11 import org.ops4j.pax.exam.options.DefaultCompositeOption;
12 import org.ops4j.pax.exam.util.PathUtils;
13
14 public class TestHelper {
15
16     public static final String CONTROLLER = "org.opendaylight.controller";
17     public static final String YANGTOOLS = "org.opendaylight.yangtools";
18
19     public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
20     public static final String YANGTOOLS_MODELS = "org.opendaylight.yangtools.model";
21     private static final String OPENDAYLIGHT_SNAPSHOT = "http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/";
22     private static final String OPENDAYLIGHT_RELEASE = "http://nexus.opendaylight.org/content/repositories/opendaylight.release/";
23
24     public static Option mdSalCoreBundles() {
25         return new DefaultCompositeOption( //
26                 mavenBundle(YANGTOOLS, "concepts").versionAsInProject(), // //
27                 mavenBundle(YANGTOOLS, "yang-binding").versionAsInProject(), // //
28                 mavenBundle(YANGTOOLS, "yang-common").versionAsInProject(), // //
29                 mavenBundle(CONTROLLER, "sal-common").versionAsInProject(), // //
30                 mavenBundle(CONTROLLER, "sal-common-api").versionAsInProject(), // //
31                 mavenBundle(CONTROLLER, "sal-common-impl").versionAsInProject(), // //
32
33                 mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), //
34                 mavenBundle("com.google.guava", "guava").versionAsInProject(), // //
35                 mavenBundle(YANGTOOLS + ".thirdparty", "xtend-lib-osgi").versionAsInProject() //
36         );
37     }
38
39     public static Option configMinumumBundles() {
40         return new DefaultCompositeOption(
41                 mavenBundle("org.opendaylight.bgpcep", "framework").versionAsInProject(), //
42                 mavenBundle("org.opendaylight.bgpcep", "util").versionAsInProject(), //
43                 mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
44                 
45                 mavenBundle(CONTROLLER, "config-api").versionAsInProject(), // //
46                 mavenBundle(CONTROLLER, "config-manager").versionAsInProject(), // //
47                 mavenBundle("commons-io", "commons-io").versionAsInProject(), //
48                 mavenBundle(CONTROLLER, "config-api").versionAsInProject(), //
49                 mavenBundle(CONTROLLER, "config-manager").versionAsInProject(), //
50                 mavenBundle(CONTROLLER, "config-util").versionAsInProject(), //
51                 mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(), //
52                 mavenBundle(CONTROLLER, "yang-store-api").versionAsInProject(), //
53                 mavenBundle(CONTROLLER, "yang-store-impl").versionAsInProject(), //
54                 mavenBundle(CONTROLLER, "logback-config").versionAsInProject(), //
55                 mavenBundle(CONTROLLER, "config-persister-api").versionAsInProject(), //
56                 mavenBundle(CONTROLLER, "netconf-api").versionAsInProject(), //
57                
58                 mavenBundle(CONTROLLER, "netconf-client").versionAsInProject(), //
59                 mavenBundle(CONTROLLER, "netconf-util").versionAsInProject(), //
60                 mavenBundle(CONTROLLER + ".thirdparty", "ganymed", "1.0-SNAPSHOT"), //
61                 mavenBundle(CONTROLLER, "netconf-mapping-api").versionAsInProject(), //
62
63                 mavenBundle(CONTROLLER, "config-persister-impl").versionAsInProject(), //
64                 
65                 mavenBundle("io.netty", "netty-handler").versionAsInProject(), //
66                 mavenBundle("io.netty", "netty-codec").versionAsInProject(), //
67                 mavenBundle("io.netty", "netty-buffer").versionAsInProject(), //
68                 mavenBundle("io.netty", "netty-transport").versionAsInProject(), //
69                 mavenBundle("io.netty", "netty-common").versionAsInProject(), //
70                 
71                 mavenBundle("org.opendaylight.controller.thirdparty", "exificient", "0.9.2-SNAPSHOT"), //
72                 
73                 mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.xerces", "2.11.0_1"),
74                 mavenBundle("org.eclipse.birt.runtime.3_7_1", "org.apache.xml.resolver", "1.2.0"),
75                 
76                 mavenBundle(CONTROLLER, "config-netconf-connector").versionAsInProject(), //
77                 mavenBundle(CONTROLLER, "netconf-impl").versionAsInProject(), //
78                 
79                 mavenBundle(CONTROLLER, "config-persister-file-adapter").versionAsInProject().noStart());
80             
81     }
82
83     public static Option bindingAwareSalBundles() {
84         return new DefaultCompositeOption( //
85                 mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(), // //
86                 mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(), //
87                 mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(), // //
88                 mavenBundle("org.javassist", "javassist").versionAsInProject(), // //
89                 mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(), // //
90
91                 mavenBundle(YANGTOOLS, "yang-data-api").versionAsInProject(), // //
92                 mavenBundle(YANGTOOLS, "yang-data-impl").versionAsInProject(), // //
93                 mavenBundle(YANGTOOLS, "yang-model-api").versionAsInProject(), // //
94                 mavenBundle(YANGTOOLS, "yang-model-util").versionAsInProject(), // //
95                 mavenBundle(YANGTOOLS, "yang-parser-api").versionAsInProject(), //
96                 mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(),
97
98                 mavenBundle(YANGTOOLS, "binding-generator-spi").versionAsInProject(), // //
99                 mavenBundle(YANGTOOLS, "binding-model-api").versionAsInProject(), // //
100                 mavenBundle(YANGTOOLS, "binding-generator-util").versionAsInProject(), //
101                 mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(), //
102                 mavenBundle(YANGTOOLS, "binding-type-provider").versionAsInProject(), //
103                 mavenBundle(YANGTOOLS, "binding-generator-api").versionAsInProject(), mavenBundle(YANGTOOLS,
104                         "binding-generator-spi").versionAsInProject(), //
105                 mavenBundle(YANGTOOLS, "binding-generator-impl").versionAsInProject(),
106
107                 mavenBundle(CONTROLLER, "sal-core-api").versionAsInProject().update(), //
108                 mavenBundle(CONTROLLER, "sal-broker-impl").versionAsInProject(), // //
109                 mavenBundle(CONTROLLER, "sal-core-spi").versionAsInProject().update(), //
110
111                 mavenBundle(YANGTOOLS + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject(), // //
112
113                 systemProperty("netconf.tcp.address").value("0.0.0.0"), //
114                 systemProperty("netconf.tcp.port").value("18383"), //
115                 systemProperty("netconf.config.persister.storageAdapterClass").value(
116                         "org.opendaylight.controller.config.persist.storage.file.FileStorageAdapter"), //
117                 systemProperty("fileStorage").value(PathUtils.getBaseDir() + "/src/test/resources/controller.config"), //
118                 systemProperty("numberOfBackups").value("1") //
119                 //systemProperty("yangstore.blacklist").value(".*controller.model.*") //
120
121         );
122
123     }
124
125     public static Option bindingIndependentSalBundles() {
126         return new DefaultCompositeOption(
127
128         );
129
130     }
131
132     public static Option flowCapableModelBundles() {
133         return new DefaultCompositeOption( //
134                 mavenBundle(CONTROLLER_MODELS, "model-flow-base").versionAsInProject(), // //
135                 mavenBundle(CONTROLLER_MODELS, "model-flow-service").versionAsInProject(), // //
136                 mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject() //
137         );
138
139     }
140
141     public static Option baseModelBundles() {
142         return new DefaultCompositeOption( //
143                 mavenBundle(YANGTOOLS_MODELS, "yang-ext").versionAsInProject(), // //
144                 mavenBundle(YANGTOOLS_MODELS, "ietf-inet-types").versionAsInProject(), // //
145                 mavenBundle(YANGTOOLS_MODELS, "ietf-yang-types").versionAsInProject(), // //
146                 mavenBundle(YANGTOOLS_MODELS, "opendaylight-l2-types").versionAsInProject(), // //
147                 mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject());
148     }
149
150     public static Option junitAndMockitoBundles() {
151         return new DefaultCompositeOption(
152         // Repository required to load harmcrest (OSGi-fied version).
153         // Mockito
154                 mavenBundle("org.mockito", "mockito-all", "1.9.5"), junitBundles(),
155
156                 /*
157                  * Felix has implicit boot delegation enabled by default. It
158                  * conflicts with Mockito: java.lang.LinkageError: loader
159                  * constraint violation in interface itable initialization: when
160                  * resolving method
161                  * "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
162                  * .
163                  * newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object
164                  * ;" the class loader (instance of
165                  * org/mockito/internal/creation/jmock/SearchingClassLoader) of
166                  * the current class, org/osgi/service/useradmin/
167                  * User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class
168                  * loader (instance of org/apache/felix/framework/
169                  * BundleWiringImpl$BundleClassLoaderJava5) for interface
170                  * org/mockito/cglib/proxy/Factory have different Class objects
171                  * for the type org/mockito/cglib/ proxy/Callback used in the
172                  * signature
173                  * 
174                  * So we disable the bootdelegation. this property has no effect
175                  * on the other OSGi implementation.
176                  */
177                 frameworkProperty("felix.bootdelegation.implicit").value("false"));
178     }
179 }

©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.