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

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