Elffuss BraidHub

kikocis/java-driver public

2dce578ceea2 · 3.7 KiBRawPermalink
1/*
2 * Copyright (C) 2012-2015 DataStax Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.datastax.driver.osgi;
17
18import com.datastax.driver.core.TestUtils;
19import org.ops4j.pax.exam.Option;
20import org.ops4j.pax.exam.options.CompositeOption;
21import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
22import org.ops4j.pax.exam.options.UrlProvisionOption;
23import org.ops4j.pax.exam.util.PathUtils;
24
25import static com.datastax.driver.osgi.VersionProvider.projectVersion;
26import static org.ops4j.pax.exam.CoreOptions.*;
27
28public class BundleOptions {
29
30 public static UrlProvisionOption driverBundle() {
31 return driverBundle(false);
32 }
33
34 public static UrlProvisionOption driverBundle(boolean useShaded) {
35 String classifier = useShaded ? "-shaded" : "";
36 return bundle("reference:file:" + PathUtils.getBaseDir() + "/../../driver-core/target/cassandra-driver-core-" + projectVersion() + classifier + ".jar");
37 }
38
39 public static MavenArtifactProvisionOption guavaBundle() {
40 return mavenBundle("com.google.guava", "guava", "16.0.1");
41 }
42
43 public static CompositeOption nettyBundles() {
44 final String nettyVersion = "4.0.33.Final";
45 return new CompositeOption() {
46
47 @Override
48 public Option[] getOptions() {
49 return options(
50 mavenBundle("io.netty", "netty-buffer", nettyVersion),
51 mavenBundle("io.netty", "netty-codec", nettyVersion),
52 mavenBundle("io.netty", "netty-common", nettyVersion),
53 mavenBundle("io.netty", "netty-handler", nettyVersion),
54 mavenBundle("io.netty", "netty-transport", nettyVersion)
55 );
56 }
57 };
58 }
59
60 public static UrlProvisionOption mailboxBundle() {
61 return bundle("reference:file:" + PathUtils.getBaseDir() + "/target/classes");
62 }
63
64 public static CompositeOption defaultOptions() {
65 return new CompositeOption() {
66
67 @Override
68 public Option[] getOptions() {
69 return options(
70 // Delegate javax.security.cert to the parent classloader. javax.security.cert.X509Certificate is used in
71 // io.netty.util.internal.EmptyArrays, but not directly by the driver.
72 bootDelegationPackage("javax.security.cert"),
73 systemProperty("cassandra.contactpoints").value(TestUtils.IP_PREFIX + 1),
74 systemProperty("logback.configurationFile").value("file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml"),
75 mavenBundle("org.slf4j", "slf4j-api", "1.7.5"),
76 mavenBundle("ch.qos.logback", "logback-classic", "1.1.3"),
77 mavenBundle("ch.qos.logback", "logback-core", "1.1.3"),
78 mavenBundle("io.dropwizard.metrics", "metrics-core", "3.1.2"),
79 systemPackages("org.testng", "org.junit", "org.junit.runner", "org.junit.runner.manipulation",
80 "org.junit.runner.notification", "com.jcabi.manifests")
81 );
82 }
83 };
84 }
85}