Elffuss BraidHub

kikocis/java-driver public

Separate out EXTENDED_PEER_CHECK tests so they may run in isolated mode.
Changeset33a7fd42cbadf1ea0720f0ded85b400b01ab80315a45e91c7030c6e988dd91c7
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-10 16:57 -06:00
Committerolim7t <omichallat+github@gmail.com> · 2016-03-15 10:31 +01:00
Parentsd95a45e479a7

Browse the files at this changeset

3 files changed

modified driver-core/pom.xml +1 −0
@@ -381,6 +381,7 @@
381381 <include>**/SSL*Test.java</include>
382382 <include>**/UUIDsPID*.java</include>
383383 <include>**/ControlConnectionTest.java</include>
384+ <include>**/ExtendedPeerCheckDisabledTest.java</include>
384385 </includes>
385386 </configuration>
386387 </plugin>
modified driver-core/src/test/java/com/datastax/driver/core/ControlConnectionTest.java +2 −16
@@ -225,7 +225,7 @@
225225 }
226226
227227 @DataProvider
228- public Object[][] disallowedNullColumnsInPeerData() {
228+ public static Object[][] disallowedNullColumnsInPeerData() {
229229 return new Object[][]{
230230 {"host_id"},
231231 {"data_center"},
@@ -325,20 +325,6 @@
325325 }
326326 }
327327
328- /**
329- * Validates that if the com.datastax.driver.EXTENDED_PEER_CHECK system property is set to false that a peer
330- * with null values for host_id, data_center, rack, tokens is not ignored.
331- *
332- * @test_category host:metadata
333- * @jira_ticket JAVA-852
334- * @since 2.1.10
335- */
336- @Test(groups = "isolated", dataProvider = "disallowedNullColumnsInPeerData")
337- @CCMConfig(createCcm = false)
338- public void should_use_peer_if_extended_peer_check_is_disabled(String columns) {
339- System.setProperty("com.datastax.driver.EXTENDED_PEER_CHECK", "false");
340- run_with_null_peer_info(columns, true);
341- }
342328
343329 /**
344330 * Validates that if the com.datastax.driver.EXTENDED_PEER_CHECK system property is set to true that a peer
@@ -368,7 +354,7 @@
368354 run_with_null_peer_info(columns, false);
369355 }
370356
371- private void run_with_null_peer_info(String columns, boolean expectPeer2) {
357+ static void run_with_null_peer_info(String columns, boolean expectPeer2) {
372358 // given: A cluster with peer 2 having a null rack.
373359 ScassandraCluster.ScassandraClusterBuilder builder = ScassandraCluster.builder()
374360 .withNodes(3);
added driver-core/src/test/java/com/datastax/driver/core/ExtendedPeerCheckDisabledTest.java +36 −0
@@ -0,0 +1,36 @@
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.core;
17+
18+import org.testng.annotations.Test;
19+
20+public class ExtendedPeerCheckDisabledTest {
21+
22+ /**
23+ * Validates that if the com.datastax.driver.EXTENDED_PEER_CHECK system property is set to false that a peer
24+ * with null values for host_id, data_center, rack, tokens is not ignored.
25+ *
26+ * @test_category host:metadata
27+ * @jira_ticket JAVA-852
28+ * @since 2.1.10
29+ */
30+ @Test(groups = "isolated", dataProvider = "disallowedNullColumnsInPeerData", dataProviderClass = ControlConnectionTest.class)
31+ @CCMConfig(createCcm = false)
32+ public void should_use_peer_if_extended_peer_check_is_disabled(String columns) {
33+ System.setProperty("com.datastax.driver.EXTENDED_PEER_CHECK", "false");
34+ ControlConnectionTest.run_with_null_peer_info(columns, true);
35+ }
36+}