Elffuss BraidHub

kikocis/java-driver public

Declare failsafe plugin at root level. Bump plugin version to latest.

Also fix some failing tests.
Changeset605634f891eaed1b385329e41ea4d05c8861d35892437e8072ebc6ecb69c2394
AuthorAlexandre Dutra <alexandre.dutra@datastax.com> · 2016-03-09 11:36 +01:00
CommitterAndrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-11 13:23 -06:00
Parentsd969dcfd7ef6

Browse the files at this changeset

3 files changed

modified driver-core/src/test/java/com/datastax/driver/core/UserTypesTest.java +27 −9
@@ -28,8 +28,11 @@
2828 import java.net.InetAddress;
2929 import java.nio.ByteBuffer;
3030 import java.util.*;
31+import java.util.concurrent.Callable;
3132
33+import static com.datastax.driver.core.ConditionChecker.check;
3234 import static com.datastax.driver.core.Metadata.quote;
35+import static java.util.concurrent.TimeUnit.MINUTES;
3336 import static org.testng.Assert.assertEquals;
3437 import static org.testng.Assert.assertNotEquals;
3538
@@ -37,15 +40,29 @@
3740 public class UserTypesTest extends CCMTestsSupport {
3841
3942 private final static List<DataType> DATA_TYPE_PRIMITIVES = new ArrayList<DataType>(DataType.allPrimitiveTypes());
43+
44+ static {
45+ DATA_TYPE_PRIMITIVES.remove(DataType.counter());
46+ }
47+
4048 private final static List<DataType.Name> DATA_TYPE_NON_PRIMITIVE_NAMES =
4149 new ArrayList<DataType.Name>(EnumSet.of(DataType.Name.LIST, DataType.Name.SET, DataType.Name.MAP, DataType.Name.TUPLE));
4250
51+ private final Callable<Boolean> userTableExists = new Callable<Boolean>() {
52+ @Override
53+ public Boolean call() throws Exception {
54+ return cluster().getMetadata().getKeyspace(keyspace).getTable("user") != null;
55+ }
56+ };
57+
4358 @Override
4459 public void onTestContextInitialized() {
4560 String type1 = "CREATE TYPE phone (alias text, number text)";
46- String type2 = "CREATE TYPE address (street text, \"ZIP\" int, phones set<frozen<phone>>)";
47- String table = "CREATE TABLE user (id int PRIMARY KEY, addr frozen<address>)";
61+ String type2 = "CREATE TYPE \"\"\"User Address\"\"\" (street text, \"ZIP\"\"\" int, phones set<frozen<phone>>)";
62+ String table = "CREATE TABLE user (id int PRIMARY KEY, addr frozen<\"\"\"User Address\"\"\">)";
4863 execute(type1, type2, table);
64+ // Ci tests fail with "unconfigured columnfamily user"
65+ check().that(userTableExists).before(5, MINUTES).becomesTrue();
4966 }
5067
5168 /**
@@ -59,13 +76,13 @@
5976 PreparedStatement ins = session().prepare("INSERT INTO user(id, addr) VALUES (?, ?)");
6077 PreparedStatement sel = session().prepare("SELECT * FROM user WHERE id=?");
6178
62- UserType addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("address");
79+ UserType addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType(quote("\"User Address\""));
6380 UserType phoneDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("phone");
6481
6582 UDTValue phone1 = phoneDef.newValue().setString("alias", "home").setString("number", "0123548790");
6683 UDTValue phone2 = phoneDef.newValue().setString("alias", "work").setString("number", "0698265251");
6784
68- UDTValue addr = addrDef.newValue().setString("street", "1600 Pennsylvania Ave NW").setInt(quote("ZIP"), 20500).setSet("phones", ImmutableSet.of(phone1, phone2));
85+ UDTValue addr = addrDef.newValue().setString("street", "1600 Pennsylvania Ave NW").setInt(quote("ZIP\""), 20500).setSet("phones", ImmutableSet.of(phone1, phone2));
6986
7087 session().execute(ins.bind(userId, addr));
7188
@@ -83,13 +100,14 @@
83100 @Test(groups = "short")
84101 public void simpleUnpreparedWriteReadTest() throws Exception {
85102 int userId = 1;
86- UserType addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("address");
103+ session().execute("USE " + keyspace);
104+ UserType addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType(quote("\"User Address\""));
87105 UserType phoneDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("phone");
88106
89107 UDTValue phone1 = phoneDef.newValue().setString("alias", "home").setString("number", "0123548790");
90108 UDTValue phone2 = phoneDef.newValue().setString("alias", "work").setString("number", "0698265251");
91109
92- UDTValue addr = addrDef.newValue().setString("street", "1600 Pennsylvania Ave NW").setInt(quote("ZIP"), 20500).setSet("phones", ImmutableSet.of(phone1, phone2));
110+ UDTValue addr = addrDef.newValue().setString("street", "1600 Pennsylvania Ave NW").setInt(quote("ZIP\""), 20500).setSet("phones", ImmutableSet.of(phone1, phone2));
93111
94112 session().execute("INSERT INTO user(id, addr) VALUES (?, ?)", userId, addr);
95113
@@ -111,7 +129,7 @@
111129 assertEquals(addrDef, null);
112130 assertEquals(phoneDef, null);
113131
114- addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("address");
132+ addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType(quote("\"User Address\""));
115133 phoneDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("phone");
116134 assertNotEquals(addrDef, null);
117135 assertNotEquals(phoneDef, null);
@@ -122,14 +140,14 @@
122140 "WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1'}");
123141 session().execute("USE " + nonExistingKeyspace);
124142
125- addrDef = cluster().getMetadata().getKeyspace(nonExistingKeyspace).getUserType("address");
143+ addrDef = cluster().getMetadata().getKeyspace(nonExistingKeyspace).getUserType(quote("\"User Address\""));
126144 phoneDef = cluster().getMetadata().getKeyspace(nonExistingKeyspace).getUserType("phone");
127145 assertEquals(addrDef, null);
128146 assertEquals(phoneDef, null);
129147
130148 session().execute("USE " + keyspace);
131149
132- addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("address");
150+ addrDef = cluster().getMetadata().getKeyspace(keyspace).getUserType(quote("\"User Address\""));
133151 phoneDef = cluster().getMetadata().getKeyspace(keyspace).getUserType("phone");
134152 assertNotEquals(addrDef, null);
135153 assertNotEquals(phoneDef, null);
modified driver-examples/osgi/pom.xml +9 −43
@@ -138,7 +138,7 @@
138138 <plugin>
139139 <groupId>org.apache.maven.plugins</groupId>
140140 <artifactId>maven-failsafe-plugin</artifactId>
141- <version>2.18.1</version>
141+ <version>2.16</version>
142142 <executions>
143143 <execution>
144144 <goals>
@@ -195,60 +195,26 @@
195195 <plugins>
196196 <plugin>
197197 <groupId>org.apache.maven.plugins</groupId>
198- <artifactId>maven-failsafe-plugin</artifactId>
199- <version>2.18.1</version>
198+ <artifactId>maven-surefire-plugin</artifactId>
199+ <version>2.16</version>
200200 <configuration>
201201 <skip>true</skip>
202202 </configuration>
203203 </plugin>
204- <plugin>
205- <artifactId>maven-compiler-plugin</artifactId>
206- <configuration>
207- <compilerArgument>-Xlint:all</compilerArgument>
208- <showWarnings>true</showWarnings>
209- <showDeprecation>true</showDeprecation>
210- </configuration>
211- </plugin>
212- </plugins>
213- </build>
214- </profile>
215-
216- <profile>
217- <id>short</id>
218- <build>
219- <plugins>
220204 <plugin>
221205 <groupId>org.apache.maven.plugins</groupId>
222206 <artifactId>maven-failsafe-plugin</artifactId>
223- <version>2.18.1</version>
207+ <version>2.16</version>
224208 <configuration>
225- <groups>${test.groups}</groups>
226- <useFile>false</useFile>
227- <systemPropertyVariables>
228- <cassandra.version>${cassandra.version}</cassandra.version>
229- <ipprefix>${ipprefix}</ipprefix>
230- </systemPropertyVariables>
209+ <skip>true</skip>
231210 </configuration>
232211 </plugin>
233- </plugins>
234- </build>
235- </profile>
236-
237- <profile>
238- <id>long</id>
239- <build>
240- <plugins>
241212 <plugin>
242- <groupId>org.apache.maven.plugins</groupId>
243- <artifactId>maven-failsafe-plugin</artifactId>
244- <version>2.18.1</version>
213+ <artifactId>maven-compiler-plugin</artifactId>
245214 <configuration>
246- <groups>${test.groups}</groups>
247- <useFile>false</useFile>
248- <systemPropertyVariables>
249- <cassandra.version>${cassandra.version}</cassandra.version>
250- <ipprefix>${ipprefix}</ipprefix>
251- </systemPropertyVariables>
215+ <compilerArgument>-Xlint:all</compilerArgument>
216+ <showWarnings>true</showWarnings>
217+ <showDeprecation>true</showDeprecation>
252218 </configuration>
253219 </plugin>
254220 </plugins>
modified pom.xml +25 −1
@@ -133,7 +133,7 @@
133133 </properties>
134134 </profile>
135135 <profile>
136- <!-- default profile settings for 'isolated' test group, will skip tests unless overriden in child module. -->
136+ <!-- default profile settings for 'isolated' test group, will skip tests unless overridden in child module. -->
137137 <id>isolated</id>
138138 <properties>
139139 <env>default</env>
@@ -298,6 +298,30 @@
298298 </properties>
299299 </configuration>
300300 </plugin>
301+ <plugin>
302+ <groupId>org.apache.maven.plugins</groupId>
303+ <artifactId>maven-failsafe-plugin</artifactId>
304+ <version>2.16</version>
305+ <configuration>
306+ <groups>${test.groups}</groups>
307+ <useFile>false</useFile>
308+ <systemPropertyVariables>
309+ <cassandra.version>${cassandra.version}</cassandra.version>
310+ <ipprefix>${ipprefix}</ipprefix>
311+ <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60</com.datastax.driver.NEW_NODE_DELAY_SECONDS>
312+ </systemPropertyVariables>
313+ <classpathDependencyExcludes>
314+ <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
315+ </classpathDependencyExcludes>
316+ <properties>
317+ <property>
318+ <!-- Don't skip tests after a @Before method throws a SkipException -->
319+ <name>configfailurepolicy</name>
320+ <value>continue</value>
321+ </property>
322+ </properties>
323+ </configuration>
324+ </plugin>
301325 </plugins>
302326
303327 </build>