BUG-2637: migrate features
[controller.git] / opendaylight / md-sal / sal-binding-it / src / main / java / org / opendaylight / controller / test / sal / binding / it / TestHelper.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 static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
11 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
12 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
13 import static org.ops4j.pax.exam.CoreOptions.systemPackages;
14 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
15 import org.ops4j.pax.exam.Option;
16 import org.ops4j.pax.exam.options.DefaultCompositeOption;
17 import org.ops4j.pax.exam.util.PathUtils;
18
19 public class TestHelper {
20
21     public static final String CONTROLLER = "org.opendaylight.controller";
22     public static final String YANGTOOLS = "org.opendaylight.yangtools";
23
24     public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
25     public static final String YANGTOOLS_MODELS = "org.opendaylight.yangtools.model";
26
27     public static Option mdSalCoreBundles() {
28         return new DefaultCompositeOption( //
29                 mavenBundle(YANGTOOLS, "concepts").versionAsInProject(), // //
30                 mavenBundle(YANGTOOLS, "util").versionAsInProject(), // //
31                 mavenBundle(YANGTOOLS, "yang-binding").versionAsInProject(), // //
32                 mavenBundle(YANGTOOLS, "yang-common").versionAsInProject(), // //
33                 mavenBundle(YANGTOOLS, "object-cache-api").versionAsInProject(), // //
34                 mavenBundle(YANGTOOLS, "object-cache-guava").versionAsInProject(), // //
35                 mavenBundle(CONTROLLER, "sal-common").versionAsInProject(), // //
36                 mavenBundle(CONTROLLER, "sal-common-api").versionAsInProject(), // //
37                 mavenBundle(CONTROLLER, "sal-common-impl").versionAsInProject(), // //
38
39                 mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), //
40                 mavenBundle("com.google.guava", "guava").versionAsInProject()
41         );
42     }
43
44     public static Option configMinumumBundles() {
45         return new DefaultCompositeOption(
46                 mavenBundle(CONTROLLER, "config-api").versionAsInProject(), // //
47                 bindingAwareSalBundles(),
48                 mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
49
50                 systemPackages("sun.nio.ch", "sun.misc"),
51                 mavenBundle("io.netty", "netty-common").versionAsInProject(), //
52                 mavenBundle("io.netty", "netty-buffer").versionAsInProject(), //
53                 mavenBundle("io.netty", "netty-handler").versionAsInProject(), //
54                 mavenBundle("io.netty", "netty-codec").versionAsInProject(), //
55                 mavenBundle("io.netty", "netty-transport").versionAsInProject(), //
56
57                 mavenBundle(CONTROLLER, "config-manager").versionAsInProject(), // //
58                 mavenBundle(CONTROLLER, "config-util").versionAsInProject(), // //
59                 mavenBundle("commons-io", "commons-io").versionAsInProject(), //
60                 mavenBundle(CONTROLLER, "config-manager").versionAsInProject(), //
61                 mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(), //
62                 mavenBundle(CONTROLLER, "logback-config").versionAsInProject(), //
63                 mavenBundle(CONTROLLER, "config-persister-api").versionAsInProject(), //
64                 mavenBundle(CONTROLLER, "netconf-api").versionAsInProject(), //
65                 mavenBundle(CONTROLLER, "ietf-netconf-monitoring").versionAsInProject(), //
66                 mavenBundle(CONTROLLER, "ietf-netconf-monitoring-extension").versionAsInProject(), //
67                 mavenBundle(CONTROLLER, "netconf-monitoring").versionAsInProject(), //
68
69                 mavenBundle(CONTROLLER, "netty-config-api").versionAsInProject(), //
70                 mavenBundle(CONTROLLER, "protocol-framework").versionAsInProject(), //
71
72                 mavenBundle(CONTROLLER, "netconf-client").versionAsInProject(), //
73                 mavenBundle(CONTROLLER, "netconf-util").versionAsInProject(), //
74                 mavenBundle(CONTROLLER, "netconf-netty-util").versionAsInProject(), //
75                 mavenBundle("org.apache.sshd", "sshd-core").versionAsInProject(), //
76                 mavenBundle("org.openexi", "nagasena").versionAsInProject(), //
77                 mavenBundle("org.openexi", "nagasena-rta").versionAsInProject(), //
78                 mavenBundle(CONTROLLER, "netconf-mapping-api").versionAsInProject(), //
79
80                 mavenBundle(CONTROLLER, "config-persister-impl").versionAsInProject(), //
81
82                 mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.xerces", "2.11.0_1"),
83                 mavenBundle("org.eclipse.birt.runtime.3_7_1", "org.apache.xml.resolver", "1.2.0"),
84
85                 mavenBundle(CONTROLLER, "config-netconf-connector").versionAsInProject(), //
86                 mavenBundle(CONTROLLER, "netconf-notifications-api").versionAsInProject(), //
87                 mavenBundle(CONTROLLER, "ietf-netconf").versionAsInProject(), //
88                 mavenBundle(CONTROLLER, "ietf-netconf-notifications").versionAsInProject(), //
89                 mavenBundle(CONTROLLER, "netconf-impl").versionAsInProject(), //
90
91                 mavenBundle(CONTROLLER, "config-persister-file-xml-adapter").versionAsInProject().noStart(),
92                 mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.moxy").versionAsInProject(),
93                 mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.core").versionAsInProject());
94
95     }
96
97     public static Option bindingAwareSalBundles() {
98         return new DefaultCompositeOption( //
99                 mdSalCoreBundles(),
100
101                 mavenBundle("org.javassist", "javassist").versionAsInProject(), // //
102
103                 mavenBundle(YANGTOOLS, "yang-data-api").versionAsInProject(), // //
104                 mavenBundle(YANGTOOLS, "yang-data-util").versionAsInProject(), // //
105                 mavenBundle(YANGTOOLS, "yang-data-impl").versionAsInProject(), // //
106                 mavenBundle(YANGTOOLS, "yang-model-api").versionAsInProject(), // //
107                 mavenBundle(YANGTOOLS, "yang-model-util").versionAsInProject(), // //
108                 mavenBundle(YANGTOOLS, "yang-parser-api").versionAsInProject(), //
109                 mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(),
110                 mavenBundle(YANGTOOLS, "binding-generator-spi").versionAsInProject(), // //
111                 mavenBundle(YANGTOOLS, "binding-model-api").versionAsInProject(), // //
112                 mavenBundle(YANGTOOLS, "binding-generator-util").versionAsInProject(), //
113                 mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(), //
114                 mavenBundle(YANGTOOLS, "binding-type-provider").versionAsInProject(), //
115                 mavenBundle(YANGTOOLS, "binding-generator-api").versionAsInProject(), mavenBundle(YANGTOOLS,
116                         "binding-generator-spi").versionAsInProject(), //
117                 mavenBundle(YANGTOOLS, "binding-generator-impl").versionAsInProject(),
118                 mavenBundle(YANGTOOLS, "binding-data-codec").versionAsInProject(),
119                 mavenBundle(YANGTOOLS + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject(), // //
120
121                 mavenBundle(CONTROLLER, "sal-core-api").versionAsInProject().update(), //
122                 mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(), // //
123                 mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(), //
124                 mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(), // //
125                 mavenBundle(CONTROLLER, "sal-binding-util").versionAsInProject(), //
126                 mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(), // //
127
128
129                 mavenBundle("com.lmax", "disruptor").versionAsInProject(),
130                 mavenBundle(CONTROLLER, "sal-inmemory-datastore").versionAsInProject(), //
131                 mavenBundle(CONTROLLER, "sal-broker-impl").versionAsInProject(), // //
132                 mavenBundle(CONTROLLER, "sal-core-spi").versionAsInProject().update(), //
133
134
135                 systemProperty("netconf.tcp.address").value("0.0.0.0"), //
136                 systemProperty("netconf.tcp.port").value("18383"), //
137                 systemProperty("netconf.tcp.client.address").value("127.0.0.1"), //
138                 systemProperty("netconf.tcp.client.port").value("18383"), //
139                 systemProperty("netconf.config.persister.active").value("1"), //
140                 systemProperty("netconf.config.persister.1.storageAdapterClass").value(
141                         "org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter"), //
142                 systemProperty("netconf.config.persister.1.properties.fileStorage")
143                         .value(PathUtils.getBaseDir() + "/src/test/resources/controller.xml"), //
144                 systemProperty("netconf.config.persister.1.properties.numberOfBackups").value("1") //
145
146         );
147
148     }
149
150     public static Option bindingIndependentSalBundles() {
151         return new DefaultCompositeOption(
152
153         );
154
155     }
156
157     public static Option flowCapableModelBundles() {
158         return new DefaultCompositeOption( //
159                 mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject() //
160         );
161
162     }
163
164     /**
165      * @return option containing models for testing purposes
166      */
167     public static Option salTestModelBundles() {
168         return new DefaultCompositeOption( //
169                 mavenBundle(CONTROLLER, "sal-test-model").versionAsInProject()
170         );
171
172     }
173
174     public static Option baseModelBundles() {
175         return new DefaultCompositeOption( //
176                 mavenBundle(YANGTOOLS_MODELS, "yang-ext").versionAsInProject(), // //
177                 mavenBundle(YANGTOOLS_MODELS, "ietf-inet-types").versionAsInProject(), // //
178                 mavenBundle(YANGTOOLS_MODELS, "ietf-yang-types").versionAsInProject(), // //
179                 mavenBundle(YANGTOOLS_MODELS, "opendaylight-l2-types").versionAsInProject() // //
180                 );
181     }
182
183     public static Option junitAndMockitoBundles() {
184         return new DefaultCompositeOption(
185         // Repository required to load harmcrest (OSGi-fied version).
186         // Mockito
187                 mavenBundle("org.mockito", "mockito-all", "1.9.5"), junitBundles(),
188
189                 /*
190                  * Felix has implicit boot delegation enabled by default. It
191                  * conflicts with Mockito: java.lang.LinkageError: loader
192                  * constraint violation in interface itable initialization: when
193                  * resolving method
194                  * "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
195                  * .
196                  * newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object
197                  * ;" the class loader (instance of
198                  * org/mockito/internal/creation/jmock/SearchingClassLoader) of
199                  * the current class, org/osgi/service/useradmin/
200                  * User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class
201                  * loader (instance of org/apache/felix/framework/
202                  * BundleWiringImpl$BundleClassLoaderJava5) for interface
203                  * org/mockito/cglib/proxy/Factory have different Class objects
204                  * for the type org/mockito/cglib/ proxy/Callback used in the
205                  * signature
206                  *
207                  * So we disable the bootdelegation. this property has no effect
208                  * on the other OSGi implementation.
209                  */
210                 frameworkProperty("felix.bootdelegation.implicit").value("false"));
211     }
212 }

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