kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 975993e025a79c6b9b2d75d6386e33043f584182f3dfb35edb6ab41b00e7c4c0 |
|---|---|
| Author | Olivier Michallat <olim7t@users.noreply.github.com> · 2016-03-07 16:52 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-04-01 11:55 +02:00 |
| Parents | a8f33563abe0 |
3 files changed
modified driver-core/pom.xml +21 −35
| @@ -358,41 +358,27 @@ | ||
| 358 | 358 | </build> |
| 359 | 359 | </profile> |
| 360 | 360 | |
| 361 | - <profile> | |
| 362 | - <id>isolated</id> | |
| 363 | - <properties> | |
| 364 | - <env>default</env> | |
| 365 | - </properties> | |
| 366 | - <build> | |
| 367 | - <plugins> | |
| 368 | - <plugin> | |
| 369 | - <groupId>org.apache.maven.plugins</groupId> | |
| 370 | - <artifactId>maven-surefire-plugin</artifactId> | |
| 371 | - <version>2.16</version> | |
| 372 | - <configuration> | |
| 373 | - <forkCount>1</forkCount> | |
| 374 | - <reuseForks>false</reuseForks> | |
| 375 | - <groups>isolated</groups> | |
| 376 | - <!-- Files containing tests to be included must be added here. | |
| 377 | - this prevents a fork being created for each test class. --> | |
| 378 | - <includes> | |
| 379 | - <include>**/SSL*Test.java</include> | |
| 380 | - </includes> | |
| 381 | - <reportNameSuffix>isolated</reportNameSuffix> | |
| 382 | - <useFile>false</useFile> | |
| 383 | - <systemPropertyVariables> | |
| 384 | - <cassandra.version>${cassandra.version}</cassandra.version> | |
| 385 | - <ipprefix>${ipprefix}</ipprefix> | |
| 386 | - </systemPropertyVariables> | |
| 387 | - <classpathDependencyExcludes> | |
| 388 | - <classpathDependencyExcludes>io.netty:netty-transport-native-epoll | |
| 389 | - </classpathDependencyExcludes> | |
| 390 | - </classpathDependencyExcludes> | |
| 391 | - </configuration> | |
| 392 | - </plugin> | |
| 393 | - </plugins> | |
| 394 | - </build> | |
| 395 | - </profile> | |
| 361 | + <profile> | |
| 362 | + <id>isolated</id> | |
| 363 | + <properties> | |
| 364 | + <env>default</env> | |
| 365 | + </properties> | |
| 366 | + <build> | |
| 367 | + <plugins> | |
| 368 | + <plugin> | |
| 369 | + <groupId>org.apache.maven.plugins</groupId> | |
| 370 | + <artifactId>maven-surefire-plugin</artifactId> | |
| 371 | + <version>2.16</version> | |
| 372 | + <configuration> | |
| 373 | + <skip>false</skip> | |
| 374 | + <includes> | |
| 375 | + <include>**/SSL*Test.java</include> | |
| 376 | + </includes> | |
| 377 | + </configuration> | |
| 378 | + </plugin> | |
| 379 | + </plugins> | |
| 380 | + </build> | |
| 381 | + </profile> | |
| 396 | 382 | |
| 397 | 383 | <profile> |
| 398 | 384 | <id>long</id> |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperAccessorParamsTest.java +25 −0
| @@ -17,10 +17,14 @@ | ||
| 17 | 17 | |
| 18 | 18 | import com.datastax.driver.core.CCMTestsSupport; |
| 19 | 19 | import com.datastax.driver.core.Row; |
| 20 | +import com.datastax.driver.core.exceptions.CodecNotFoundException; | |
| 20 | 21 | import com.datastax.driver.core.utils.CassandraVersion; |
| 21 | 22 | import com.datastax.driver.mapping.annotations.*; |
| 23 | +import com.google.common.collect.Lists; | |
| 22 | 24 | import org.testng.annotations.Test; |
| 23 | 25 | |
| 26 | +import java.util.List; | |
| 27 | + | |
| 24 | 28 | import static org.assertj.core.api.Assertions.assertThat; |
| 25 | 29 | |
| 26 | 30 | @SuppressWarnings("unused") |
| @@ -75,6 +79,19 @@ | ||
| 75 | 79 | .createAccessor(UserPhoneAccessor_TooManyParams.class); |
| 76 | 80 | } |
| 77 | 81 | |
| 82 | + /** | |
| 83 | + * Ensures that a wrong parameter type is detected when | |
| 84 | + * the accessor is called with a wrong data type. | |
| 85 | + * | |
| 86 | + * @jira_ticket JAVA-974 | |
| 87 | + */ | |
| 88 | + @Test(groups = "short", expectedExceptions = CodecNotFoundException.class) | |
| 89 | + public void should_fail_if_wrong_parameter_type() { | |
| 90 | + UserPhoneAccessor_WrongParameterTypes accessor = new MappingManager(session()) | |
| 91 | + .createAccessor(UserPhoneAccessor_WrongParameterTypes.class); | |
| 92 | + accessor.findUsersBykeys(Lists.newArrayList(1, 2, 3)); | |
| 93 | + } | |
| 94 | + | |
| 78 | 95 | private void assertPhonesEqual(int key, String home, String work) { |
| 79 | 96 | Row row = session().execute("select * from user where key = " + key).one(); |
| 80 | 97 | assertThat(row.getString("home_phone")).isEqualTo(home); |
| @@ -188,4 +205,12 @@ | ||
| 188 | 205 | this.gender = val; |
| 189 | 206 | } |
| 190 | 207 | } |
| 208 | + | |
| 209 | + @Accessor | |
| 210 | + public interface UserPhoneAccessor_WrongParameterTypes { | |
| 211 | + @Query("select * from user where key IN (?)") | |
| 212 | + // WRONG, should be "where key IN ?" | |
| 213 | + void findUsersBykeys(List<Integer> keys); | |
| 214 | + } | |
| 215 | + | |
| 191 | 216 | } |
modified pom.xml +36 −0
| @@ -100,6 +100,42 @@ | ||
| 100 | 100 | </properties> |
| 101 | 101 | </profile> |
| 102 | 102 | |
| 103 | + <profile> | |
| 104 | + <!-- default profile settings for 'isolated' test group, will skip tests unless overriden in child module. --> | |
| 105 | + <id>isolated</id> | |
| 106 | + <properties> | |
| 107 | + <env>default</env> | |
| 108 | + </properties> | |
| 109 | + <build> | |
| 110 | + <plugins> | |
| 111 | + <plugin> | |
| 112 | + <groupId>org.apache.maven.plugins</groupId> | |
| 113 | + <artifactId>maven-surefire-plugin</artifactId> | |
| 114 | + <version>2.16</version> | |
| 115 | + <configuration> | |
| 116 | + <skip>true</skip> | |
| 117 | + <forkCount>1</forkCount> | |
| 118 | + <reuseForks>false</reuseForks> | |
| 119 | + <groups>isolated</groups> | |
| 120 | + <reportNameSuffix>isolated</reportNameSuffix> | |
| 121 | + <useFile>false</useFile> | |
| 122 | + <systemPropertyVariables> | |
| 123 | + <cassandra.version>${cassandra.version}</cassandra.version> | |
| 124 | + <ipprefix>${ipprefix}</ipprefix> | |
| 125 | + </systemPropertyVariables> | |
| 126 | + <classpathDependencyExcludes> | |
| 127 | + <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes> | |
| 128 | + </classpathDependencyExcludes> | |
| 129 | + <!-- This requires includes to be explicitly specified by implementing classes. | |
| 130 | + This is needed to prevent creating a JVM fork for each test, even those that don't | |
| 131 | + have the isolated group. --> | |
| 132 | + <includes/> | |
| 133 | + </configuration> | |
| 134 | + </plugin> | |
| 135 | + </plugins> | |
| 136 | + </build> | |
| 137 | + </profile> | |
| 138 | + | |
| 103 | 139 | <profile> |
| 104 | 140 | <id>enforce-java8</id> |
| 105 | 141 | <build> |