kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | d6b0dc0c73f3ebf43ff881a57bbe4bc2e8b1f0cf02d82947c3a96f4253ed0850 |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-01-26 12:03 +01:00 |
| Committer | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-01-26 12:03 +01:00 |
| Parents | a159b8bff32c |
3 files changed
modified driver-core/src/main/java/com/datastax/driver/core/TableMetadata.java +8 −8
| @@ -330,12 +330,12 @@ | ||
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
| 333 | - * Returns a list containing all the indexes of this table. | |
| 333 | + * Returns all indexes based on this table. | |
| 334 | 334 | * |
| 335 | - * @return a list containing the metadata for the indexes of this table. | |
| 335 | + * @return all indexes based on this table. | |
| 336 | 336 | */ |
| 337 | - public List<IndexMetadata> getIndexes() { | |
| 338 | - return new ArrayList<IndexMetadata>(indexes.values()); | |
| 337 | + public Collection<IndexMetadata> getIndexes() { | |
| 338 | + return Collections.unmodifiableCollection(indexes.values()); | |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
| @@ -352,12 +352,12 @@ | ||
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /** |
| 355 | - * Returns a list containing all the viewes of this table. | |
| 355 | + * Returns all views based on this table. | |
| 356 | 356 | * |
| 357 | - * @return a list containing the metadata for the viewes of this table. | |
| 357 | + * @return all views based on this table. | |
| 358 | 358 | */ |
| 359 | - public List<MaterializedViewMetadata> getViews() { | |
| 360 | - return new ArrayList<MaterializedViewMetadata>(views.values()); | |
| 359 | + public Collection<MaterializedViewMetadata> getViews() { | |
| 360 | + return Collections.unmodifiableCollection(views.values()); | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | void add(MaterializedViewMetadata view) { |
modified driver-core/src/test/java/com/datastax/driver/core/MaterializedViewMetadataTest.java +1 −0
| @@ -113,6 +113,7 @@ | ||
| 113 | 113 | TableMetadata table = cluster.getMetadata().getKeyspace(keyspace).getTable("\"T1\""); |
| 114 | 114 | MaterializedViewMetadata mv = cluster.getMetadata().getKeyspace(keyspace).getMaterializedView("\"Mv1\""); |
| 115 | 115 | assertThat(table).isNotNull().hasName("T1").hasMaterializedView(mv).hasNumberOfColumns(3); |
| 116 | + assertThat(table.getViews()).hasSize(1).containsOnly(mv); | |
| 116 | 117 | assertThat(table.getColumns().get(0)).isNotNull().hasName("theKey").isPartitionKey().hasType(cint()); |
| 117 | 118 | assertThat(table.getColumns().get(1)).isNotNull().hasName("the;Clustering").isClusteringColumn().hasType(cint()); |
| 118 | 119 | assertThat(table.getColumns().get(2)).isNotNull().hasName("the Value").isRegularColumn().hasType(cint()); |
modified driver-core/src/test/java/com/datastax/driver/core/TableMetadataTest.java +2 −4
| @@ -20,8 +20,6 @@ | ||
| 20 | 20 | import org.testng.annotations.Test; |
| 21 | 21 | |
| 22 | 22 | import java.nio.ByteBuffer; |
| 23 | -import java.util.Collection; | |
| 24 | -import java.util.Collections; | |
| 25 | 23 | |
| 26 | 24 | import static com.datastax.driver.core.Assertions.assertThat; |
| 27 | 25 | import static com.datastax.driver.core.ClusteringOrder.ASC; |
| @@ -462,9 +460,9 @@ | ||
| 462 | 460 | TableMetadata table_cd = cluster.getMetadata().getKeyspace(keyspace).getTable("test_cd"); |
| 463 | 461 | |
| 464 | 462 | assertThat(table_ab.getIndexes().size()).isEqualTo(1); |
| 465 | - assertThat(table_ab.getIndexes().get(0).getName()).isEqualTo("test_b"); | |
| 463 | + assertThat(table_ab.getIndexes()).extracting("name").containsOnly("test_b"); | |
| 466 | 464 | assertThat(table_cd.getIndexes().size()).isEqualTo(1); |
| 467 | - assertThat(table_cd.getIndexes().get(0).getName()).isEqualTo("test_d"); | |
| 465 | + assertThat(table_cd.getIndexes()).extracting("name").containsOnly("test_d"); | |
| 468 | 466 | } |
| 469 | 467 | |
| 470 | 468 | /** |