Elffuss BraidHub

kikocis/java-driver public

Fix quoting issue that caused Mapper.getTableMetadata() to return null.
Changesetd615cb0827097507906b4b5b29e92775a9985ff258ccf06f1ca9a431f7a1343e
AuthorRegis Leray <regis.leray@appdirect.com> · 2015-11-04 20:58 -05:00
Committerolim7t <omichallat+github@gmail.com> · 2015-11-06 18:58 +01:00
Parents221b4b695b84

Browse the files at this changeset

2 files changed

modified driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java +1 −1
@@ -75,7 +75,7 @@
7575 this.mapper = mapper;
7676
7777 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());
7979
8080 this.protocolVersion = manager.getSession().getCluster().getConfiguration().getProtocolOptions().getProtocolVersionEnum();
8181 this.mapOneFunction = new Function<ResultSet, T>() {
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperTest.java +12 −0
@@ -419,6 +419,18 @@
419419 session.execute("delete from posts where user_id = " + u1.getUserId());
420420 }
421421
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+
422434 @Test(groups="short")
423435 public void should_not_initialize_session_when_protocol_version_provided() {
424436 Session newSession = cluster.newSession();