kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | bde0f3186d01fd54d67bd0c9292065ae0020bc17e0df9970ce8223d423a0e29a |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-03-09 16:23 -05:00 |
| Committer | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-03-09 16:23 -05:00 |
| Parents | a0bc0c0ae918 |
4 files changed
modified driver-core/src/test/java/com/datastax/driver/core/TokenRangeTest.java +1 −1
| @@ -89,7 +89,7 @@ | ||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | @Test(groups = "unit") |
| 92 | - public void should_could_intersection_with_ranges_around_ring() { | |
| 92 | + public void should_compute_intersection_with_ranges_around_ring() { | |
| 93 | 93 | // If a range wraps the ring like 10, -10 does this will produce two separate |
| 94 | 94 | // intersected ranges. |
| 95 | 95 | assertThat(tokenRange(10, -10).intersectWith(tokenRange(-20, 20))) |
modified driver-examples/osgi/pom.xml +47 −1
| @@ -122,6 +122,19 @@ | ||
| 122 | 122 | |
| 123 | 123 | <build> |
| 124 | 124 | <plugins> |
| 125 | + <plugin> | |
| 126 | + <groupId>org.apache.maven.plugins</groupId> | |
| 127 | + <artifactId>maven-failsafe-plugin</artifactId> | |
| 128 | + <version>2.18.1</version> | |
| 129 | + <executions> | |
| 130 | + <execution> | |
| 131 | + <goals> | |
| 132 | + <goal>integration-test</goal> | |
| 133 | + <goal>verify</goal> | |
| 134 | + </goals> | |
| 135 | + </execution> | |
| 136 | + </executions> | |
| 137 | + </plugin> | |
| 125 | 138 | <plugin> |
| 126 | 139 | <groupId>org.apache.felix</groupId> |
| 127 | 140 | <artifactId>maven-bundle-plugin</artifactId> |
| @@ -172,7 +185,14 @@ | ||
| 172 | 185 | <artifactId>maven-surefire-plugin</artifactId> |
| 173 | 186 | <version>2.14</version> |
| 174 | 187 | <configuration> |
| 175 | - <skipTests>true</skipTests> | |
| 188 | + </configuration> | |
| 189 | + </plugin> | |
| 190 | + <plugin> | |
| 191 | + <groupId>org.apache.maven.plugins</groupId> | |
| 192 | + <artifactId>maven-failsafe-plugin</artifactId> | |
| 193 | + <version>2.18.1</version> | |
| 194 | + <configuration> | |
| 195 | + <skip>true</skip> | |
| 176 | 196 | </configuration> |
| 177 | 197 | </plugin> |
| 178 | 198 | <plugin> |
| @@ -207,6 +227,19 @@ | ||
| 207 | 227 | </systemPropertyVariables> |
| 208 | 228 | </configuration> |
| 209 | 229 | </plugin> |
| 230 | + <plugin> | |
| 231 | + <groupId>org.apache.maven.plugins</groupId> | |
| 232 | + <artifactId>maven-failsafe-plugin</artifactId> | |
| 233 | + <version>2.18.1</version> | |
| 234 | + <configuration> | |
| 235 | + <groups>unit,short</groups> | |
| 236 | + <useFile>false</useFile> | |
| 237 | + <systemPropertyVariables> | |
| 238 | + <cassandra.version>${cassandra.version}</cassandra.version> | |
| 239 | + <ipprefix>${ipprefix}</ipprefix> | |
| 240 | + </systemPropertyVariables> | |
| 241 | + </configuration> | |
| 242 | + </plugin> | |
| 210 | 243 | </plugins> |
| 211 | 244 | </build> |
| 212 | 245 | </profile> |
| @@ -231,6 +264,19 @@ | ||
| 231 | 264 | </systemPropertyVariables> |
| 232 | 265 | </configuration> |
| 233 | 266 | </plugin> |
| 267 | + <plugin> | |
| 268 | + <groupId>org.apache.maven.plugins</groupId> | |
| 269 | + <artifactId>maven-failsafe-plugin</artifactId> | |
| 270 | + <version>2.18.1</version> | |
| 271 | + <configuration> | |
| 272 | + <groups>unit,short,long</groups> | |
| 273 | + <useFile>false</useFile> | |
| 274 | + <systemPropertyVariables> | |
| 275 | + <cassandra.version>${cassandra.version}</cassandra.version> | |
| 276 | + <ipprefix>${ipprefix}</ipprefix> | |
| 277 | + </systemPropertyVariables> | |
| 278 | + </configuration> | |
| 279 | + </plugin> | |
| 234 | 280 | </plugins> |
| 235 | 281 | </build> |
| 236 | 282 | </profile> |
added driver-examples/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceIT.java +180 −0
| @@ -0,0 +1,180 @@ | ||
| 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 java.util.ArrayList; | |
| 19 | +import java.util.Collection; | |
| 20 | +import java.util.GregorianCalendar; | |
| 21 | + | |
| 22 | +import javax.inject.Inject; | |
| 23 | +import org.ops4j.pax.exam.Configuration; | |
| 24 | +import org.ops4j.pax.exam.Option; | |
| 25 | +import org.ops4j.pax.exam.options.CompositeOption; | |
| 26 | +import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; | |
| 27 | +import org.ops4j.pax.exam.options.UrlProvisionOption; | |
| 28 | +import org.ops4j.pax.exam.testng.listener.PaxExam; | |
| 29 | +import org.testng.annotations.Listeners; | |
| 30 | +import org.testng.annotations.Test; | |
| 31 | + | |
| 32 | +import static org.ops4j.pax.exam.CoreOptions.*; | |
| 33 | +import static org.testng.Assert.assertEquals; | |
| 34 | + | |
| 35 | +import com.datastax.driver.core.CCMBridge; | |
| 36 | +import com.datastax.driver.osgi.api.MailboxException; | |
| 37 | +import com.datastax.driver.osgi.api.MailboxMessage; | |
| 38 | +import com.datastax.driver.osgi.api.MailboxService; | |
| 39 | + | |
| 40 | +import static com.datastax.driver.osgi.VersionProvider.projectVersion; | |
| 41 | + | |
| 42 | +@Listeners({CCMBridgeListener.class, PaxExam.class}) | |
| 43 | +@Test(groups="short") | |
| 44 | +public class MailboxServiceIT { | |
| 45 | + @Inject MailboxService service; | |
| 46 | + | |
| 47 | + private UrlProvisionOption driverBundle() { | |
| 48 | + return driverBundle(false); | |
| 49 | + } | |
| 50 | + | |
| 51 | + private UrlProvisionOption driverBundle(boolean useShaded) { | |
| 52 | + String classifier = useShaded ? "-shaded" : ""; | |
| 53 | + return bundle("reference:file:../../driver-core/target/cassandra-driver-core-" + projectVersion() + classifier + ".jar"); | |
| 54 | + } | |
| 55 | + | |
| 56 | + private MavenArtifactProvisionOption guavaBundle() { | |
| 57 | + return mavenBundle("com.google.guava", "guava", "14.0.1"); | |
| 58 | + } | |
| 59 | + | |
| 60 | + private MavenArtifactProvisionOption nettyBundle() { | |
| 61 | + return mavenBundle("io.netty", "netty", "3.9.0.Final"); | |
| 62 | + } | |
| 63 | + | |
| 64 | + private CompositeOption defaultOptions() { | |
| 65 | + return new CompositeOption() { | |
| 66 | + | |
| 67 | + @Override public Option[] getOptions() { | |
| 68 | + return options( | |
| 69 | + systemProperty("cassandra.contactpoints").value(CCMBridge.IP_PREFIX + 1), | |
| 70 | + bundle("reference:file:target/classes"), | |
| 71 | + mavenBundle("com.codahale.metrics", "metrics-core", "3.0.2"), | |
| 72 | + mavenBundle("org.slf4j", "slf4j-api", "1.7.5"), | |
| 73 | + mavenBundle("org.slf4j", "slf4j-simple", "1.7.5").noStart(), | |
| 74 | + systemPackages("org.testng", "org.junit", "org.junit.runner", "org.junit.runner.manipulation", | |
| 75 | + "org.junit.runner.notification", "com.jcabi.manifests") | |
| 76 | + ); | |
| 77 | + } | |
| 78 | + }; | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Configuration | |
| 82 | + public Option[] shadedConfig() { | |
| 83 | + return options( | |
| 84 | + driverBundle(true), | |
| 85 | + guavaBundle(), | |
| 86 | + defaultOptions() | |
| 87 | + ); | |
| 88 | + } | |
| 89 | + | |
| 90 | + @Configuration | |
| 91 | + public Option[] defaultConfig() { | |
| 92 | + return options( | |
| 93 | + driverBundle(), | |
| 94 | + guavaBundle(), | |
| 95 | + nettyBundle(), | |
| 96 | + defaultOptions() | |
| 97 | + ); | |
| 98 | + } | |
| 99 | + | |
| 100 | + @Configuration | |
| 101 | + public Option[] guava15Config() { | |
| 102 | + return options( | |
| 103 | + driverBundle(), | |
| 104 | + nettyBundle(), | |
| 105 | + guavaBundle().version("15.0"), | |
| 106 | + defaultOptions() | |
| 107 | + ); | |
| 108 | + } | |
| 109 | + | |
| 110 | + @Configuration | |
| 111 | + public Option[] guava16Config() { | |
| 112 | + return options( | |
| 113 | + driverBundle(), | |
| 114 | + nettyBundle(), | |
| 115 | + guavaBundle().version("16.0.1"), | |
| 116 | + defaultOptions() | |
| 117 | + ); | |
| 118 | + } | |
| 119 | + | |
| 120 | + @Configuration | |
| 121 | + public Option[] guava17Config() { | |
| 122 | + return options( | |
| 123 | + driverBundle(), | |
| 124 | + nettyBundle(), | |
| 125 | + guavaBundle().version("17.0"), | |
| 126 | + defaultOptions() | |
| 127 | + ); | |
| 128 | + } | |
| 129 | + | |
| 130 | + @Configuration | |
| 131 | + public Option[] guava18Config() { | |
| 132 | + return options( | |
| 133 | + driverBundle(), | |
| 134 | + nettyBundle(), | |
| 135 | + guavaBundle().version("18.0"), | |
| 136 | + defaultOptions() | |
| 137 | + ); | |
| 138 | + } | |
| 139 | + | |
| 140 | + /** | |
| 141 | + * <p> | |
| 142 | + * Exercises a 'mailbox' service provided by an OSGi bundle that depends on the driver. Ensures that | |
| 143 | + * queries can be made through the service with the current given configuration. | |
| 144 | + * </p> | |
| 145 | + * | |
| 146 | + * The following configurations are tried (defined via methods with the @Configuration annotation): | |
| 147 | + * <ol> | |
| 148 | + * <li>Default bundle (Driver with all of it's dependencies)</li> | |
| 149 | + * <li>Shaded bundle (Driver with netty shaded)</li> | |
| 150 | + * <li>With Guava 15</li> | |
| 151 | + * <li>With Guava 16</li> | |
| 152 | + * <li>With Guava 17</li> | |
| 153 | + * <li>With Guava 18</li> | |
| 154 | + * </ol> | |
| 155 | + * | |
| 156 | + * @test_category packaging | |
| 157 | + * @expected_result Can create, retrieve and delete data using the mailbox service. | |
| 158 | + * @jira_ticket JAVA-620 | |
| 159 | + * @since 2.0.10, 2.1.5 | |
| 160 | + */ | |
| 161 | + public void service_api_functional() throws MailboxException { | |
| 162 | + // Insert some data into mailbox for a particular user. | |
| 163 | + String recipient = "user@datastax.com"; | |
| 164 | + | |
| 165 | + try { | |
| 166 | + Collection<MailboxMessage> inMessages = new ArrayList<MailboxMessage>(); | |
| 167 | + for (int i = 0; i < 30; i++) { | |
| 168 | + MailboxMessage message = new MailboxMessage(recipient, new GregorianCalendar(2015, 1, i).getTime(), recipient, "" + i); | |
| 169 | + inMessages.add(message); | |
| 170 | + service.sendMessage(message); | |
| 171 | + } | |
| 172 | + | |
| 173 | + Collection<MailboxMessage> messages = service.getMessages(recipient); | |
| 174 | + | |
| 175 | + assertEquals(messages, inMessages); | |
| 176 | + } finally { | |
| 177 | + service.clearMailbox(recipient); | |
| 178 | + } | |
| 179 | + } | |
| 180 | +} |
deleted driver-examples/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceTest.java +0 −174
| @@ -1,174 +0,0 @@ | ||
| 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 java.util.ArrayList; | |
| 19 | -import java.util.Collection; | |
| 20 | -import java.util.GregorianCalendar; | |
| 21 | - | |
| 22 | -import javax.inject.Inject; | |
| 23 | -import org.ops4j.pax.exam.Configuration; | |
| 24 | -import org.ops4j.pax.exam.Option; | |
| 25 | -import org.ops4j.pax.exam.options.CompositeOption; | |
| 26 | -import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; | |
| 27 | -import org.ops4j.pax.exam.testng.listener.PaxExam; | |
| 28 | -import org.testng.annotations.Listeners; | |
| 29 | -import org.testng.annotations.Test; | |
| 30 | - | |
| 31 | -import static org.ops4j.pax.exam.CoreOptions.*; | |
| 32 | -import static org.testng.Assert.assertEquals; | |
| 33 | - | |
| 34 | -import com.datastax.driver.core.CCMBridge; | |
| 35 | -import com.datastax.driver.osgi.api.MailboxException; | |
| 36 | -import com.datastax.driver.osgi.api.MailboxMessage; | |
| 37 | -import com.datastax.driver.osgi.api.MailboxService; | |
| 38 | - | |
| 39 | -import static com.datastax.driver.osgi.VersionProvider.projectVersion; | |
| 40 | - | |
| 41 | -@Listeners({CCMBridgeListener.class, PaxExam.class}) | |
| 42 | -@Test(groups="short") | |
| 43 | -public class MailboxServiceTest { | |
| 44 | - @Inject MailboxService service; | |
| 45 | - | |
| 46 | - private MavenArtifactProvisionOption driverBundle() { | |
| 47 | - return mavenBundle("com.datastax.cassandra", "cassandra-driver-core", projectVersion()); | |
| 48 | - } | |
| 49 | - | |
| 50 | - private MavenArtifactProvisionOption guavaBundle() { | |
| 51 | - return mavenBundle("com.google.guava", "guava", "14.0.1"); | |
| 52 | - } | |
| 53 | - | |
| 54 | - private MavenArtifactProvisionOption nettyBundle() { | |
| 55 | - return mavenBundle("io.netty", "netty", "3.9.0.Final"); | |
| 56 | - } | |
| 57 | - | |
| 58 | - private CompositeOption defaultOptions() { | |
| 59 | - return new CompositeOption() { | |
| 60 | - | |
| 61 | - @Override public Option[] getOptions() { | |
| 62 | - return options( | |
| 63 | - systemProperty("cassandra.contactpoints").value(CCMBridge.IP_PREFIX + 1), | |
| 64 | - bundle("reference:file:target/classes"), | |
| 65 | - mavenBundle("com.codahale.metrics", "metrics-core", "3.0.2"), | |
| 66 | - mavenBundle("org.slf4j", "slf4j-api", "1.7.5"), | |
| 67 | - mavenBundle("org.slf4j", "slf4j-simple", "1.7.5").noStart(), | |
| 68 | - systemPackages("org.testng", "org.junit", "org.junit.runner", "org.junit.runner.manipulation", | |
| 69 | - "org.junit.runner.notification", "com.jcabi.manifests") | |
| 70 | - ); | |
| 71 | - } | |
| 72 | - }; | |
| 73 | - } | |
| 74 | - | |
| 75 | - @Configuration | |
| 76 | - public Option[] shadedConfig() { | |
| 77 | - return options( | |
| 78 | - driverBundle().classifier("shaded"), | |
| 79 | - guavaBundle(), | |
| 80 | - defaultOptions() | |
| 81 | - ); | |
| 82 | - } | |
| 83 | - | |
| 84 | - @Configuration | |
| 85 | - public Option[] defaultConfig() { | |
| 86 | - return options( | |
| 87 | - driverBundle(), | |
| 88 | - guavaBundle(), | |
| 89 | - nettyBundle(), | |
| 90 | - defaultOptions() | |
| 91 | - ); | |
| 92 | - } | |
| 93 | - | |
| 94 | - @Configuration | |
| 95 | - public Option[] guava15Config() { | |
| 96 | - return options( | |
| 97 | - driverBundle(), | |
| 98 | - nettyBundle(), | |
| 99 | - guavaBundle().version("15.0"), | |
| 100 | - defaultOptions() | |
| 101 | - ); | |
| 102 | - } | |
| 103 | - | |
| 104 | - @Configuration | |
| 105 | - public Option[] guava16Config() { | |
| 106 | - return options( | |
| 107 | - driverBundle(), | |
| 108 | - nettyBundle(), | |
| 109 | - guavaBundle().version("16.0.1"), | |
| 110 | - defaultOptions() | |
| 111 | - ); | |
| 112 | - } | |
| 113 | - | |
| 114 | - @Configuration | |
| 115 | - public Option[] guava17Config() { | |
| 116 | - return options( | |
| 117 | - driverBundle(), | |
| 118 | - nettyBundle(), | |
| 119 | - guavaBundle().version("17.0"), | |
| 120 | - defaultOptions() | |
| 121 | - ); | |
| 122 | - } | |
| 123 | - | |
| 124 | - @Configuration | |
| 125 | - public Option[] guava18Config() { | |
| 126 | - return options( | |
| 127 | - driverBundle(), | |
| 128 | - nettyBundle(), | |
| 129 | - guavaBundle().version("18.0"), | |
| 130 | - defaultOptions() | |
| 131 | - ); | |
| 132 | - } | |
| 133 | - | |
| 134 | - /** | |
| 135 | - * <p> | |
| 136 | - * Exercises a 'mailbox' service provided by an OSGi bundle that depends on the driver. Ensures that | |
| 137 | - * queries can be made through the service with the current given configuration. | |
| 138 | - * </p> | |
| 139 | - * | |
| 140 | - * The following configurations are tried (defined via methods with the @Configuration annotation): | |
| 141 | - * <ol> | |
| 142 | - * <li>Default bundle (Driver with all of it's dependencies)</li> | |
| 143 | - * <li>Shaded bundle (Driver with netty shaded)</li> | |
| 144 | - * <li>With Guava 15</li> | |
| 145 | - * <li>With Guava 16</li> | |
| 146 | - * <li>With Guava 17</li> | |
| 147 | - * <li>With Guava 18</li> | |
| 148 | - * </ol> | |
| 149 | - * | |
| 150 | - * @test_category packaging | |
| 151 | - * @expected_result Can create, retrieve and delete data using the mailbox service. | |
| 152 | - * @jira_ticket JAVA-620 | |
| 153 | - * @since 2.0.10, 2.1.5 | |
| 154 | - */ | |
| 155 | - public void service_api_functional() throws MailboxException { | |
| 156 | - // Insert some data into mailbox for a particular user. | |
| 157 | - String recipient = "user@datastax.com"; | |
| 158 | - | |
| 159 | - try { | |
| 160 | - Collection<MailboxMessage> inMessages = new ArrayList<MailboxMessage>(); | |
| 161 | - for (int i = 0; i < 30; i++) { | |
| 162 | - MailboxMessage message = new MailboxMessage(recipient, new GregorianCalendar(2015, 1, i).getTime(), recipient, "" + i); | |
| 163 | - inMessages.add(message); | |
| 164 | - service.sendMessage(message); | |
| 165 | - } | |
| 166 | - | |
| 167 | - Collection<MailboxMessage> messages = service.getMessages(recipient); | |
| 168 | - | |
| 169 | - assertEquals(messages, inMessages); | |
| 170 | - } finally { | |
| 171 | - service.clearMailbox(recipient); | |
| 172 | - } | |
| 173 | - } | |
| 174 | -} |