kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | a49b95c49f8d806369503fbcfbff28e01a61c036c2189a29fc510bf68d60c341 |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-08-14 18:00 -05:00 |
| Committer | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-08-14 18:00 -05:00 |
| Parents | a9c3f7efad0e |
2 files changed
modified driver-core/src/test/java/com/datastax/driver/core/NodeListRefreshDebouncerTest.java +7 −4
| @@ -54,6 +54,7 @@ | ||
| 54 | 54 | queryOptions = new QueryOptions(); |
| 55 | 55 | queryOptions.setRefreshNodeListIntervalMillis(DEBOUNCE_TIME); |
| 56 | 56 | queryOptions.setMaxPendingRefreshNodeListRequests(5); |
| 57 | + queryOptions.setRefreshSchemaIntervalMillis(0); | |
| 57 | 58 | // Create a separate cluster that will receive the schema events on its control connection. |
| 58 | 59 | cluster2 = this.configure(Cluster.builder()) |
| 59 | 60 | .addContactPointsWithPorts(newArrayList(hostAddress)) |
| @@ -108,14 +109,16 @@ | ||
| 108 | 109 | */ |
| 109 | 110 | @Test(groups = "short") |
| 110 | 111 | public void should_refresh_when_max_pending_requests_reached() { |
| 111 | - // Enable and disable schema management 5 times to cause | |
| 112 | + // Create keyspaces 5 times to cause | |
| 112 | 113 | // refreshNodeListAndTokenMap to be called. |
| 114 | + String prefix = "srwmprr"; | |
| 113 | 115 | for(int i = 0; i < 5; i++) { |
| 114 | - queryOptions.setMetadataEnabled(false); | |
| 115 | - queryOptions.setMetadataEnabled(true); | |
| 116 | + String keyspace = prefix + i; | |
| 117 | + session.execute(String.format(CREATE_KEYSPACE_SIMPLE_FORMAT, keyspace, 1)); | |
| 118 | + keyspaces.add(keyspace); | |
| 116 | 119 | } |
| 117 | 120 | |
| 118 | 121 | // add a 1 second delay to account for executor submit. |
| 119 | - verify(controlConnection, timeout(1000).times(1)).refreshNodeListAndTokenMap(); | |
| 122 | + verify(controlConnection, timeout(1000)).refreshNodeListAndTokenMap(); | |
| 120 | 123 | } |
| 121 | 124 | } |
modified driver-core/src/test/java/com/datastax/driver/core/SchemaChangesTest.java +1 −2
| @@ -356,8 +356,7 @@ | ||
| 356 | 356 | schemaDisabledCluster.getConfiguration().getQueryOptions().setMetadataEnabled(true); |
| 357 | 357 | |
| 358 | 358 | verify(schemaDisabledControlConnection, after(1000)).refreshSchema(null, null); |
| 359 | - // TODO: Remove atLeastOnce() if submitNodeRefresh removed from setMetadataEnabled. | |
| 360 | - verify(schemaDisabledControlConnection, atLeastOnce()).refreshNodeListAndTokenMap(); | |
| 359 | + verify(schemaDisabledControlConnection).refreshNodeListAndTokenMap(); | |
| 361 | 360 | |
| 362 | 361 | // Ensure that there is schema metadata. |
| 363 | 362 | assertThat(schemaDisabledCluster.getMetadata().getKeyspace(keyspace)).isNotNull(); |