ae32fa1400e21e3a91294796413c6d9769734b6a
[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                 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(YANGTOOLS, "binding-generator-spi").versionAsInProject(), // //
86                 mavenBundle(YANGTOOLS, "binding-model-api").versionAsInProject(), // //
87                 mavenBundle(YANGTOOLS, "binding-generator-util").versionAsInProject(), //
88                 mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(), //
89                 mavenBundle(YANGTOOLS, "binding-type-provider").versionAsInProject(), //
90                 mavenBundle(YANGTOOLS, "binding-generator-api").versionAsInProject(), mavenBundle(YANGTOOLS,
91                         "binding-generator-spi").versionAsInProject(), //
92                 mavenBundle(YANGTOOLS, "binding-generator-impl").versionAsInProject(),
93                 mavenBundle(YANGTOOLS, "binding-data-codec").versionAsInProject(),
94                 mavenBundle(YANGTOOLS + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject(), // //
95
96                 mavenBundle(CONTROLLER, "sal-core-api").versionAsInProject().update(), //
97                 mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(), // //
98                 mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(), //
99                 mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(), // //
100                 mavenBundle(CONTROLLER, "sal-binding-util").versionAsInProject(), //
101                 mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(), // //
102
103
104                 mavenBundle("com.lmax", "disruptor").versionAsInProject(),
105                 mavenBundle(CONTROLLER, "sal-inmemory-datastore").versionAsInProject(), //
106                 mavenBundle(CONTROLLER, "sal-broker-impl").versionAsInProject(), // //
107                 mavenBundle(CONTROLLER, "sal-core-spi").versionAsInProject().update(), //
108
109                 systemProperty("netconf.config.persister.active").value("1"), //
110                 systemProperty("netconf.config.persister.1.storageAdapterClass").value(
111                         "org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter"), //
112                 systemProperty("netconf.config.persister.1.properties.fileStorage")
113                         .value(PathUtils.getBaseDir() + "/src/test/resources/controller.xml"), //
114                 systemProperty("netconf.config.persister.1.properties.numberOfBackups").value("1") //
115
116         );
117
118     }
119
120     public static Option bindingIndependentSalBundles() {
121         return new DefaultCompositeOption(
122
123         );
124
125     }
126
127     public static Option protocolFrameworkBundles() {
128         return new DefaultCompositeOption(
129             mavenBundle("io.netty", "netty-common").versionAsInProject(), //
130             mavenBundle("io.netty", "netty-buffer").versionAsInProject(), //
131             mavenBundle("io.netty", "netty-handler").versionAsInProject(), //
132             mavenBundle("io.netty", "netty-codec").versionAsInProject(), //
133             mavenBundle("io.netty", "netty-transport").versionAsInProject(), //
134             mavenBundle(CONTROLLER, "netty-config-api").versionAsInProject(), //
135             mavenBundle(CONTROLLER, "protocol-framework").versionAsInProject()
136         );
137
138     }
139
140     public static Option flowCapableModelBundles() {
141         return new DefaultCompositeOption( //
142                 mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject() //
143         );
144
145     }
146
147     /**
148      * @return option containing models for testing purposes
149      */
150     public static Option salTestModelBundles() {
151         return new DefaultCompositeOption( //
152                 mavenBundle(CONTROLLER, "sal-test-model").versionAsInProject()
153         );
154
155     }
156
157     public static Option baseModelBundles() {
158         return new DefaultCompositeOption( //
159                 mavenBundle(YANGTOOLS_MODELS, "yang-ext").versionAsInProject(), // //
160                 mavenBundle(YANGTOOLS_MODELS, "ietf-inet-types").versionAsInProject(), // //
161                 mavenBundle(YANGTOOLS_MODELS, "ietf-yang-types").versionAsInProject(), // //
162                 mavenBundle(YANGTOOLS_MODELS, "opendaylight-l2-types").versionAsInProject() // //
163                 );
164     }
165
166     public static Option junitAndMockitoBundles() {
167         return new DefaultCompositeOption(
168         // Repository required to load harmcrest (OSGi-fied version).
169         // Mockito
170                 mavenBundle("org.mockito", "mockito-all", "1.9.5"), junitBundles(),
171
172                 /*
173                  * Felix has implicit boot delegation enabled by default. It
174                  * conflicts with Mockito: java.lang.LinkageError: loader
175                  * constraint violation in interface itable initialization: when
176                  * resolving method
177                  * "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
178                  * .
179                  * newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object
180                  * ;" the class loader (instance of
181                  * org/mockito/internal/creation/jmock/SearchingClassLoader) of
182                  * the current class, org/osgi/service/useradmin/
183                  * User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class
184                  * loader (instance of org/apache/felix/framework/
185                  * BundleWiringImpl$BundleClassLoaderJava5) for interface
186                  * org/mockito/cglib/proxy/Factory have different Class objects
187                  * for the type org/mockito/cglib/ proxy/Callback used in the
188                  * signature
189                  *
190                  * So we disable the bootdelegation. this property has no effect
191                  * on the other OSGi implementation.
192                  */
193                 frameworkProperty("felix.bootdelegation.implicit").value("false"));
194     }
195 }

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