Deprecate TestHelper
[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 /**
20  * @deprecated Use config-it and/or mdsal-it instead.
21  */
22 @Deprecated
23 public class TestHelper {
24
25     public static final String CONTROLLER = "org.opendaylight.controller";
26     public static final String MDSAL = "org.opendaylight.mdsal";
27     public static final String YANGTOOLS = "org.opendaylight.yangtools";
28
29     public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
30     public static final String MDSAL_MODELS = "org.opendaylight.mdsal.model";
31
32     public static Option mdSalCoreBundles() {
33         return new DefaultCompositeOption( //
34                 mavenBundle(YANGTOOLS, "concepts").versionAsInProject(), // //
35                 mavenBundle(YANGTOOLS, "util").versionAsInProject(), // //
36                 mavenBundle(MDSAL, "yang-binding").versionAsInProject(), // //
37                 mavenBundle(YANGTOOLS, "yang-common").versionAsInProject(), // //
38                 mavenBundle(YANGTOOLS, "object-cache-api").versionAsInProject(), // //
39                 mavenBundle(YANGTOOLS, "object-cache-guava").versionAsInProject(), // //
40                 mavenBundle(CONTROLLER, "sal-common-api").versionAsInProject(), // //
41                 mavenBundle(CONTROLLER, "sal-common-impl").versionAsInProject(), // //
42
43                 mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), //
44                 mavenBundle("com.google.guava", "guava").versionAsInProject(),
45                 mavenBundle("com.github.romix", "java-concurrent-hash-trie-map").versionAsInProject()
46         );
47     }
48
49     public static Option configMinumumBundles() {
50         return new DefaultCompositeOption(
51                 mavenBundle(CONTROLLER, "config-api").versionAsInProject(), // //
52                 bindingAwareSalBundles(),
53                 mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
54
55                 systemPackages("sun.nio.ch", "sun.misc"),
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-facade-xml").versionAsInProject(), //
61                 mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(), //
62                 mavenBundle(CONTROLLER, "logback-config").versionAsInProject(), //
63                 mavenBundle(CONTROLLER, "config-persister-api").versionAsInProject(), //
64
65                 mavenBundle(CONTROLLER, "config-persister-impl").versionAsInProject(), //
66
67                 mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.xerces", "2.11.0_1"),
68                 mavenBundle("org.eclipse.birt.runtime.3_7_1", "org.apache.xml.resolver", "1.2.0"),
69
70                 mavenBundle(CONTROLLER, "config-persister-file-xml-adapter").versionAsInProject().noStart(),
71                 mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.moxy").versionAsInProject(),
72                 mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.core").versionAsInProject());
73
74     }
75
76     public static Option bindingAwareSalBundles() {
77         return new DefaultCompositeOption( //
78                 mdSalCoreBundles(),
79
80                 mavenBundle("org.javassist", "javassist").versionAsInProject(), // //
81
82                 mavenBundle(YANGTOOLS, "yang-data-api").versionAsInProject(), // //
83                 mavenBundle(YANGTOOLS, "yang-data-util").versionAsInProject(), // //
84                 mavenBundle(YANGTOOLS, "yang-data-impl").versionAsInProject(), // //
85                 mavenBundle(YANGTOOLS, "yang-model-api").versionAsInProject(), // //
86                 mavenBundle(YANGTOOLS, "yang-model-util").versionAsInProject(), // //
87                 mavenBundle(YANGTOOLS, "yang-parser-api").versionAsInProject(), //
88                 mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(), //
89                 mavenBundle(MDSAL, "mdsal-binding-generator-api").versionAsInProject(), //
90                 mavenBundle(MDSAL, "mdsal-binding-generator-util").versionAsInProject(), //
91                 mavenBundle(MDSAL, "mdsal-binding-generator-impl").versionAsInProject(),
92                 mavenBundle(MDSAL, "mdsal-binding-dom-codec").versionAsInProject(),
93                 mavenBundle("org.antlr", "antlr4-runtime").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(MDSAL+".model", "yang-ext").versionAsInProject(), // //
165                 mavenBundle(MDSAL_MODELS, "ietf-inet-types").versionAsInProject(), // //
166                 mavenBundle(MDSAL_MODELS, "ietf-yang-types").versionAsInProject(), // //
167                 mavenBundle(MDSAL_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.