8000 Declare failsafe plugin at root level. Bump plugin version to latest. · kecmu/java-driver@12a279d · GitHub
[go: up one dir, main page]

Skip to content

Commit 12a279d

Browse files
Alexandre Dutratolbertam
authored andcommitted
Declare failsafe plugin at root level. Bump plugin version to latest.
Also fix some failing tests.
1 parent 0b37520 commit 12a279d

File tree

3 files changed

+61
-53
lines changed

3 files changed

+61
-53
lines changed

driver-core/src/test/java/com/datastax/driver/core/UserTypesTest.java

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,41 @@
2828
import java.net.InetAddress;
2929
import java.nio.ByteBuffer;
3030
import java.util.*;
31+
import java.util.concurrent.Callable;
3132

33+
import sta 10000 tic 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

3639
@CassandraVersion(major = 2.1)
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 @@ public void simpleWriteReadTest() throws Exception {
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 @@ public void simpleWriteReadTest() throws Exception {
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 @@ public void nonExistingTypesTest() throws Exception {
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 @@ public void nonExistingTypesTest() throws Exception {
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);

driver-examples/osgi/pom.xml

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

pom.xml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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>

0 commit comments

Comments
 (0)
0