kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | d615cb0827097507906b4b5b29e92775a9985ff258ccf06f1ca9a431f7a1343e |
|---|---|
| Author | Regis Leray <regis.leray@appdirect.com> · 2015-11-04 20:58 -05:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2015-11-06 18:58 +01:00 |
| Parents | 221b4b695b84 |
2 files changed
modified driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java +1 −1
| @@ -75,7 +75,7 @@ | ||
| 75 | 75 | this.mapper = mapper; |
| 76 | 76 | |
| 77 | 77 | KeyspaceMetadata keyspace = session().getCluster().getMetadata().getKeyspace(mapper.getKeyspace()); |
| 78 | - this.tableMetadata = keyspace == null ? null : keyspace.getTable(Metadata.quote(mapper.getTable())); | |
| 78 | + this.tableMetadata = keyspace == null ? null : keyspace.getTable(mapper.getTable()); | |
| 79 | 79 | |
| 80 | 80 | this.protocolVersion = manager.getSession().getCluster().getConfiguration().getProtocolOptions().getProtocolVersionEnum(); |
| 81 | 81 | this.mapOneFunction = new Function<ResultSet, T>() { |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperTest.java +12 −0
| @@ -419,6 +419,18 @@ | ||
| 419 | 419 | session.execute("delete from posts where user_id = " + u1.getUserId()); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | + | |
| 423 | + @Test(groups="short") | |
| 424 | + public void should_return_table_metadata() throws Exception { | |
| 425 | + MappingManager manager = new MappingManager(session); | |
| 426 | + | |
| 427 | + Mapper<Post> m = manager.mapper(Post.class); | |
| 428 | + | |
| 429 | + assertThat(m.getTableMetadata()).isNotNull(); | |
| 430 | + assertThat(m.getTableMetadata().getName()).isEqualTo("posts"); | |
| 431 | + assertThat(m.getTableMetadata().getPartitionKey()).hasSize(1); | |
| 432 | + } | |
| 433 | + | |
| 422 | 434 | @Test(groups="short") |
| 423 | 435 | public void should_not_initialize_session_when_protocol_version_provided() { |
| 424 | 436 | Session newSession = cluster.newSession(); |