Elffuss BraidHub

kikocis/java-driver public

3faae1558f54 · 4.8 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.CCMBridge;
19import com.datastax.driver.core.ProtocolOptions;
20import com.datastax.driver.core.TestUtils;
21import org.ops4j.pax.exam.Option;
22import org.ops4j.pax.exam.options.CompositeOption;
23import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
24import org.ops4j.pax.exam.options.UrlProvisionOption;
25import org.ops4j.pax.exam.util.PathUtils;
26
27import static com.datastax.driver.osgi.VersionProvider.projectVersion;
28import static org.ops4j.pax.exam.CoreOptions.*;
29
30public class BundleOptions {
31
32 public static UrlProvisionOption driverBundle() {
33 return driverBundle(false);
34 }
35
36 public static UrlProvisionOption driverBundle(boolean useShaded) {
37 String classifier = useShaded ? "-shaded" : "";
38 return bundle("reference:file:" + PathUtils.getBaseDir() + "/../../driver-core/target/cassandra-driver-core-" + projectVersion() + classifier + ".jar");
39 }
40
41 public static UrlProvisionOption mappingBundle() {
42 return bundle("reference:file:" + PathUtils.getBaseDir() + "/../../driver-mapping/target/cassandra-driver-mapping-" + projectVersion() + ".jar");
43 }
44
45 public static UrlProvisionOption extrasBundle() {
46 return bundle("reference:file:" + PathUtils.getBaseDir() + "/../../driver-extras/target/cassandra-driver-extras-" + projectVersion() + ".jar");
47 }
48
49 public static MavenArtifactProvisionOption guavaBundle() {
50 return mavenBundle("com.google.guava", "guava", "16.0.1");
51 }
52
53 public static CompositeOption lz4Bundle() {
54 return new CompositeOption() {
55
56 @Override
57 public Option[] getOptions() {
58 return options(
59 systemProperty("cassandra.compression").value(ProtocolOptions.Compression.LZ4.name()),
60 mavenBundle("net.jpountz.lz4", "lz4", "1.3.0")
61 );
62 }
63 };
64 }
65
66 public static CompositeOption nettyBundles() {
67 final String nettyVersion = "4.0.33.Final";
68 return new CompositeOption() {
69
70 @Override
71 public Option[] getOptions() {
72 return options(
73 mavenBundle("io.netty", "netty-buffer", nettyVersion),
74 mavenBundle("io.netty", "netty-codec", nettyVersion),
75 mavenBundle("io.netty", "netty-common", nettyVersion),
76 mavenBundle("io.netty", "netty-handler", nettyVersion),
77 mavenBundle("io.netty", "netty-transport", nettyVersion)
78 );
79 }
80 };
81 }
82
83 public static UrlProvisionOption mailboxBundle() {
84 return bundle("reference:file:" + PathUtils.getBaseDir() + "/target/classes");
85 }
86
87 public static CompositeOption defaultOptions() {
88 return new CompositeOption() {
89
90 @Override
91 public Option[] getOptions() {
92 return options(
93 // Delegate javax.security.cert to the parent classloader. javax.security.cert.X509Certificate is used in
94 // io.netty.util.internal.EmptyArrays, but not directly by the driver.
95 bootDelegationPackage("javax.security.cert"),
96 systemProperty("cassandra.version").value(CCMBridge.getCassandraVersion()),
97 systemProperty("cassandra.contactpoints").value(TestUtils.IP_PREFIX + 1),
98 systemProperty("logback.configurationFile").value("file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml"),
99 mavenBundle("org.slf4j", "slf4j-api", "1.7.5"),
100 mavenBundle("ch.qos.logback", "logback-classic", "1.1.3"),
101 mavenBundle("ch.qos.logback", "logback-core", "1.1.3"),
102 mavenBundle("io.dropwizard.metrics", "metrics-core", "3.1.2"),
103 mavenBundle("org.testng", "testng", "6.8.8"),
104 systemPackages("org.testng", "org.junit", "org.junit.runner", "org.junit.runner.manipulation",
105 "org.junit.runner.notification", "com.jcabi.manifests")
106 );
107 }
108 };
109 }
110}