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

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