kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 44c762a33a2ed722eecdb799928508f61f05ab7af185496d63a15b9ad1d284f0 |
|---|---|
| Author | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-10-19 15:40 +02:00 |
| Committer | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-10-19 15:40 +02:00 |
| Parents | 2ce86b39619b, 044b7f20f16b |
4 files changed
modified changelog/README.md +1 −0
| @@ -16,6 +16,7 @@ | ||
| 16 | 16 | - [improvement] Warn if a custom codec collides with an existing one (JAVA-934) |
| 17 | 17 | - [improvement] Allow typed getters/setters to target any CQL type (JAVA-940) |
| 18 | 18 | - [bug] Fix Cluster.connect with a case-sensitive keyspace (JAVA-950) |
| 19 | +- [bug] Fix MaterializedViewMetadata when base table name is case sensitive (JAVA-953) | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | ### 3.0.0-alpha3 |
modified driver-core/src/main/java/com/datastax/driver/core/MaterializedViewMetadata.java +1 −1
| @@ -60,7 +60,7 @@ | ||
| 60 | 60 | |
| 61 | 61 | String name = row.getString("view_name"); |
| 62 | 62 | String tableName = row.getString("base_table_name"); |
| 63 | - TableMetadata baseTable = keyspace.getTable(tableName); | |
| 63 | + TableMetadata baseTable = keyspace.tables.get(tableName); | |
| 64 | 64 | if(baseTable == null) { |
| 65 | 65 | logger.trace(String.format("Cannot find base table %s for materialized view %s.%s: " |
| 66 | 66 | + "Cluster.getMetadata().getKeyspace(\"%s\").getView(\"%s\") will return null", |
modified driver-core/src/test/java/com/datastax/driver/core/MaterializedViewMetadataTest.java +7 −7
| @@ -94,16 +94,16 @@ | ||
| 94 | 94 | public void should_create_view_metadata_with_quoted_identifiers() { |
| 95 | 95 | // given |
| 96 | 96 | String createTable = String.format( |
| 97 | - "CREATE TABLE %s.t1 (" | |
| 97 | + "CREATE TABLE %s.\"T1\" (" | |
| 98 | 98 | + "\"theKey\" int, " |
| 99 | 99 | + "\"the;Clustering\" int, " |
| 100 | 100 | + "\"the Value\" int, " |
| 101 | 101 | + "PRIMARY KEY (\"theKey\", \"the;Clustering\"))", |
| 102 | 102 | keyspace); |
| 103 | 103 | String createMV = String.format( |
| 104 | - "CREATE MATERIALIZED VIEW %s.mv1 AS " | |
| 104 | + "CREATE MATERIALIZED VIEW %s.\"Mv1\" AS " | |
| 105 | 105 | + "SELECT \"theKey\", \"the;Clustering\", \"the Value\" " |
| 106 | - + "FROM %s.t1 " | |
| 106 | + + "FROM %s.\"T1\" " | |
| 107 | 107 | + "WHERE \"theKey\" IS NOT NULL AND \"the;Clustering\" IS NOT NULL AND \"the Value\" IS NOT NULL " |
| 108 | 108 | + "PRIMARY KEY (\"theKey\", \"the;Clustering\")", |
| 109 | 109 | keyspace, keyspace); |
| @@ -111,13 +111,13 @@ | ||
| 111 | 111 | session.execute(createTable); |
| 112 | 112 | session.execute(createMV); |
| 113 | 113 | // then |
| 114 | - TableMetadata table = cluster.getMetadata().getKeyspace(keyspace).getTable("t1"); | |
| 115 | - MaterializedViewMetadata mv = cluster.getMetadata().getKeyspace(keyspace).getMaterializedView("mv1"); | |
| 116 | - assertThat(table).isNotNull().hasName("t1").hasMaterializedView(mv).hasNumberOfColumns(3); | |
| 114 | + TableMetadata table = cluster.getMetadata().getKeyspace(keyspace).getTable("\"T1\""); | |
| 115 | + MaterializedViewMetadata mv = cluster.getMetadata().getKeyspace(keyspace).getMaterializedView("\"Mv1\""); | |
| 116 | + assertThat(table).isNotNull().hasName("T1").hasMaterializedView(mv).hasNumberOfColumns(3); | |
| 117 | 117 | assertThat(table.getColumns().get(0)).isNotNull().hasName("theKey").isPartitionKey().hasType(cint()); |
| 118 | 118 | assertThat(table.getColumns().get(1)).isNotNull().hasName("the;Clustering").isClusteringColumn().hasType(cint()); |
| 119 | 119 | assertThat(table.getColumns().get(2)).isNotNull().hasName("the Value").isRegularColumn().hasType(cint()); |
| 120 | - assertThat(mv).isNotNull().hasName("mv1").hasBaseTable(table).hasNumberOfColumns(3); | |
| 120 | + assertThat(mv).isNotNull().hasName("Mv1").hasBaseTable(table).hasNumberOfColumns(3); | |
| 121 | 121 | assertThat(mv.getColumns().get(0)).isNotNull().hasName("theKey").isPartitionKey().hasType(cint()); |
| 122 | 122 | assertThat(mv.getColumns().get(1)).isNotNull().hasName("the;Clustering").isClusteringColumn().hasType(cint()); |
| 123 | 123 | assertThat(mv.getColumns().get(2)).isNotNull().hasName("the Value").isRegularColumn().hasType(cint()); |
modified driver-core/src/test/java/com/datastax/driver/core/TableMetadataAssert.java +1 −1
| @@ -77,7 +77,7 @@ | ||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public TableMetadataAssert hasMaterializedView(MaterializedViewMetadata expected) { |
| 80 | - assertThat(actual.getView(expected.getName())).isNotNull().isEqualTo(expected); | |
| 80 | + assertThat(actual.getView(Metadata.quote(expected.getName()))).isNotNull().isEqualTo(expected); | |
| 81 | 81 | return this; |
| 82 | 82 | } |
| 83 | 83 |