Elffuss BraidHub

kikocis/java-driver public

c8806d6ce912 · 3.6 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 org.ops4j.pax.exam.Option;
19import org.ops4j.pax.exam.options.CompositeOption;
20import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
21import org.ops4j.pax.exam.options.UrlProvisionOption;
22import org.ops4j.pax.exam.util.PathUtils;
23
24import static org.ops4j.pax.exam.CoreOptions.bundle;
25import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
26import static org.ops4j.pax.exam.CoreOptions.options;
27import static org.ops4j.pax.exam.CoreOptions.systemPackages;
28import static org.ops4j.pax.exam.CoreOptions.systemProperty;
29
30import com.datastax.driver.core.CCMBridge;
31
32import static com.datastax.driver.osgi.VersionProvider.projectVersion;
33
34public class BundleOptions {
35
36 public static UrlProvisionOption driverBundle() {
37 return driverBundle(false);
38 }
39
40 public static UrlProvisionOption driverBundle(boolean useShaded) {
41 String classifier = useShaded ? "-shaded" : "";
42 return bundle("reference:file:" + PathUtils.getBaseDir() + "/../../driver-core/target/cassandra-driver-core-" + projectVersion() + classifier + ".jar");
43 }
44
45 public static MavenArtifactProvisionOption guavaBundle() {
46 return mavenBundle("com.google.guava", "guava", "16.0.1");
47 }
48
49 public static CompositeOption nettyBundles() {
50 final String nettyVersion = "4.0.27.Final";
51 return new CompositeOption() {
52
53 @Override public Option[] getOptions() {
54 return options(
55 mavenBundle("io.netty", "netty-buffer", nettyVersion),
56 mavenBundle("io.netty", "netty-codec", nettyVersion),
57 mavenBundle("io.netty", "netty-common", nettyVersion),
58 mavenBundle("io.netty", "netty-handler", nettyVersion),
59 mavenBundle("io.netty", "netty-transport", nettyVersion)
60 );
61 }
62 };
63 }
64
65 public static UrlProvisionOption mailboxBundle() {
66 return bundle("reference:file:" + PathUtils.getBaseDir() + "/target/classes");
67 }
68
69 public static CompositeOption defaultOptions() {
70 return new CompositeOption() {
71
72 @Override public Option[] getOptions() {
73 return options(
74 systemProperty("cassandra.contactpoints").value(CCMBridge.IP_PREFIX + 1),
75 systemProperty("logback.configurationFile").value("file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml"),
76 mavenBundle("org.slf4j", "slf4j-api", "1.7.5"),
77 mavenBundle("ch.qos.logback", "logback-classic", "1.1.3"),
78 mavenBundle("ch.qos.logback", "logback-core", "1.1.3"),
79 mavenBundle("io.dropwizard.metrics", "metrics-core", "3.1.2"),
80 systemPackages("org.testng", "org.junit", "org.junit.runner", "org.junit.runner.manipulation",
81 "org.junit.runner.notification", "com.jcabi.manifests")
82 );
83 }
84 };
85 }
86}