|
| 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 | + */ |
| 16 | +package com.datastax.driver.osgi; |
| 17 | + |
| 18 | +import com.datastax.driver.osgi.api.MailboxException; |
| 19 | +import org.ops4j.pax.exam.Configuration; |
| 20 | +import org.ops4j.pax.exam.Option; |
| 21 | +import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; |
| 22 | +import org.ops4j.pax.exam.testng.listener.PaxExam; |
| 23 | +import org.testng.SkipException; |
| 24 | +import org.testng.annotations.Listeners; |
| 25 | +import org.testng.annotations.Test; |
| 26 | + |
| 27 | +import static com.datastax.driver.osgi.BundleOptions.*; |
| 28 | +import static org.ops4j.pax.exam.CoreOptions.options; |
| 29 | + |
| 30 | +@Listeners({CCMBridgeListener.class, PaxExam.class}) |
| 31 | +public class MailboxServiceGuava21IT extends MailboxServiceTests { |
| 32 | + |
| 33 | + @Configuration |
| 34 | + public Option[] guava21Config() { |
| 35 | + MavenArtifactProvisionOption guavaBundle = guavaBundle(); |
| 36 | + String javaVersion = System.getProperty("java.version"); |
| 37 | + // Only bring in 21.0 if java version >= 1.8. If this is not done the framework |
| 38 | + // will fail to load for < 1.8 and we plan on skipping the test anyways. |
| 39 | + if (javaVersion.compareTo("1.8") >= 0) { |
| 40 | + guavaBundle = guavaBundle.version("21.0"); |
| 41 | + } |
| 42 | + |
| 43 | + return options( |
| 44 | + defaultOptions(), |
| 45 | + nettyBundles(), |
| 46 | + guavaBundle, |
| 47 | + driverBundle(), |
| 48 | + extrasBundle(), |
| 49 | + mappingBundle(), |
| 50 | + mailboxBundle() |
| 51 | + ); |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Exercises a 'mailbox' service provided by an OSGi bundle that depends on the driver with |
| 56 | + * Guava 21 explicitly enforced. |
| 57 | + * |
| 58 | + * @test_category packaging |
| 59 | + * @expected_result Can create, retrieve and delete data using the mailbox service. |
| 60 | + * @jira_ticket JAVA-620 |
| 61 | + * @since 2.0.10, 2.1.5 |
| 62 | + */ |
| 63 | + @Test(groups = "short") |
| 64 | + public void test_guava_21() throws MailboxException { |
| 65 | + String javaVersion = System.getProperty("java.version"); |
| 66 | + if (javaVersion.compareTo("1.8") < 0) { |
| 67 | + throw new SkipException("Guava 21 requires Java 1.8"); |
| 68 | + } |
| 69 | + checkService(); |
| 70 | + } |
| 71 | +} |
0 commit comments