Elffuss BraidHub

kikocis/java-driver public

Define isolated profile that disables tests at parent level.

(cherry picked from 2.1)

Also cherry-picked
MapperAccessorParamsTest.should_fail_if_wrong_parameter_type
coming from JAVA-974 (974 didn't need to be merged to 3.0.x because it
was already covered with the new codec mechanism, but it doesn't hurt to
have the test).
Changeset975993e025a79c6b9b2d75d6386e33043f584182f3dfb35edb6ab41b00e7c4c0
AuthorOlivier Michallat <olim7t@users.noreply.github.com> · 2016-03-07 16:52 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2016-04-01 11:55 +02:00
Parentsa8f33563abe0

Browse the files at this changeset

3 files changed

modified driver-core/pom.xml +21 −35
@@ -358,41 +358,27 @@
358358 </build>
359359 </profile>
360360
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>
396382
397383 <profile>
398384 <id>long</id>
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperAccessorParamsTest.java +25 −0
@@ -17,10 +17,14 @@
1717
1818 import com.datastax.driver.core.CCMTestsSupport;
1919 import com.datastax.driver.core.Row;
20+import com.datastax.driver.core.exceptions.CodecNotFoundException;
2021 import com.datastax.driver.core.utils.CassandraVersion;
2122 import com.datastax.driver.mapping.annotations.*;
23+import com.google.common.collect.Lists;
2224 import org.testng.annotations.Test;
2325
26+import java.util.List;
27+
2428 import static org.assertj.core.api.Assertions.assertThat;
2529
2630 @SuppressWarnings("unused")
@@ -75,6 +79,19 @@
7579 .createAccessor(UserPhoneAccessor_TooManyParams.class);
7680 }
7781
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+
7895 private void assertPhonesEqual(int key, String home, String work) {
7996 Row row = session().execute("select * from user where key = " + key).one();
8097 assertThat(row.getString("home_phone")).isEqualTo(home);
@@ -188,4 +205,12 @@
188205 this.gender = val;
189206 }
190207 }
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+
191216 }
modified pom.xml +36 −0
@@ -100,6 +100,42 @@
100100 </properties>
101101 </profile>
102102
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+
103139 <profile>
104140 <id>enforce-java8</id>
105141 <build>