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

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