kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 2f8dc102409ee3b90aef84dd2d4c7be27d41699b09e6e708a5cccc83ea9fded1 |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-03-30 17:07 -05:00 |
| Committer | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-03-30 17:07 -05:00 |
| Parents | 66f63295d45c |
16 files changed
modified driver-core/README.rst +4 −0
| @@ -1,6 +1,10 @@ | ||
| 1 | 1 | Driver Core |
| 2 | 2 | =========== |
| 3 | 3 | |
| 4 | +.. image:: https://travis-ci.org/datastax/java-driver.svg?branch=2.1 | |
| 5 | + :target: https://travis-ci.org/datastax/java-driver | |
| 6 | + :alt: Travis Build | |
| 7 | + | |
| 4 | 8 | This is the core module of the DataStax Java Driver for Apache Cassandra (C*), |
| 5 | 9 | which offers a simple (as in, not abstracted) but complete API to work with |
| 6 | 10 | CQL3. The main goal of the module is to handle all the functionality related |
modified driver-core/src/test/java/com/datastax/driver/core/ClusterStressTest.java +2 −1
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.Collection; |
| 5 | +import java.util.Collections; | |
| 5 | 6 | import java.util.List; |
| 6 | 7 | import java.util.concurrent.*; |
| 7 | 8 | |
| @@ -135,7 +136,7 @@ | ||
| 135 | 136 | public Cluster call() throws Exception { |
| 136 | 137 | startSignal.await(); |
| 137 | 138 | |
| 138 | - Cluster cluster = Cluster.builder().addContactPoints(CCMBridge.IP_PREFIX + '1') | |
| 139 | + Cluster cluster = Cluster.builder().addContactPointsWithPorts(Collections.singletonList(hostAddress)) | |
| 139 | 140 | .withPoolingOptions(new PoolingOptions().setCoreConnectionsPerHost(HostDistance.LOCAL, 1)).build(); |
| 140 | 141 | |
| 141 | 142 | try { |
modified driver-core/src/test/java/com/datastax/driver/core/SchemaTest.java +1 −3
| @@ -148,9 +148,7 @@ | ||
| 148 | 148 | TableMetadata metadata = cluster.getMetadata().getKeyspace(keyspace).getTable("with_options"); |
| 149 | 149 | |
| 150 | 150 | String withOpts = withOptions; |
| 151 | - VersionNumber version = cluster.getMetadata() | |
| 152 | - .getHost(new InetSocketAddress(CCMBridge.IP_PREFIX + "1", 9042)) | |
| 153 | - .getCassandraVersion(); | |
| 151 | + VersionNumber version = TestUtils.findHost(cluster, 1).getCassandraVersion(); | |
| 154 | 152 | |
| 155 | 153 | if (version.getMajor() == 2) { |
| 156 | 154 | // Strip the last ';' |
modified driver-core/src/test/java/com/datastax/driver/core/SessionLeakTest.java +4 −3
| @@ -17,15 +17,16 @@ | ||
| 17 | 17 | // create a new cluster object and ensure 0 sessions and connections |
| 18 | 18 | cluster = Cluster.builder().addContactPoints(CCMBridge.IP_PREFIX + '1').build(); |
| 19 | 19 | |
| 20 | - int corePoolSize = cluster.getConfiguration() | |
| 21 | - .getPoolingOptions() | |
| 22 | - .getCoreConnectionsPerHost(HostDistance.LOCAL); | |
| 23 | 20 | |
| 24 | 21 | assertEquals(cluster.manager.sessions.size(), 0); |
| 25 | 22 | assertEquals((int)cluster.getMetrics().getOpenConnections().getValue(), 0); |
| 26 | 23 | |
| 27 | 24 | // ensure sessions.size() returns with 1 control connection + core pool size. |
| 28 | 25 | Session session = cluster.connect(); |
| 26 | + | |
| 27 | + // Special check for protocol version 3, number of connections should be 1. | |
| 28 | + int corePoolSize = TestUtils.numberOfLocalCoreConnections(cluster); | |
| 29 | + | |
| 29 | 30 | assertEquals(cluster.manager.sessions.size(), 1); |
| 30 | 31 | assertEquals((int)cluster.getMetrics().getOpenConnections().getValue(), 1 + corePoolSize); |
| 31 | 32 |
modified driver-core/src/test/java/com/datastax/driver/core/SessionStressTest.java +1 −1
| @@ -54,7 +54,7 @@ | ||
| 54 | 54 | @Test(groups = "long") |
| 55 | 55 | public void sessions_should_not_leak_connections() { |
| 56 | 56 | // override inherited field with a new cluster object and ensure 0 sessions and connections |
| 57 | - cluster = Cluster.builder().addContactPoints(CCMBridge.IP_PREFIX + '1') | |
| 57 | + cluster = Cluster.builder().addContactPointsWithPorts(Collections.singletonList(hostAddress)) | |
| 58 | 58 | .withPoolingOptions(new PoolingOptions().setCoreConnectionsPerHost(HostDistance.LOCAL, 1)).build(); |
| 59 | 59 | |
| 60 | 60 | // The cluster has not been initialized yet, therefore the control connection is not opened |
modified driver-core/src/test/java/com/datastax/driver/core/SessionTest.java +1 −1
| @@ -149,7 +149,7 @@ | ||
| 149 | 149 | assertEquals(host.getAddress().toString(), hostAddress); |
| 150 | 150 | assertEquals(host.getDatacenter(), "datacenter1"); |
| 151 | 151 | assertEquals(host.getRack(), "rack1"); |
| 152 | - assertEquals(host.getSocketAddress().toString(), hostAddress + ":9042"); | |
| 152 | + assertEquals(host.getSocketAddress().toString(), hostAddress + ":" + ports[2]); | |
| 153 | 153 | |
| 154 | 154 | assertEquals(state.getOpenConnections(host), TestUtils.numberOfLocalCoreConnections(cluster)); |
| 155 | 155 | assertEquals(state.getInFlightQueries(host), 0); |
modified driver-core/src/test/java/com/datastax/driver/core/TupleTest.java +1 −3
| @@ -27,8 +27,6 @@ | ||
| 27 | 27 | |
| 28 | 28 | import com.datastax.driver.core.utils.CassandraVersion; |
| 29 | 29 | |
| 30 | -import static com.datastax.driver.core.TestUtils.SIMPLE_KEYSPACE; | |
| 31 | - | |
| 32 | 30 | @CassandraVersion(major=2.1) |
| 33 | 31 | public class TupleTest extends CCMBridge.PerClassSingleNodeCluster { |
| 34 | 32 | |
| @@ -60,7 +58,7 @@ | ||
| 60 | 58 | @Test(groups = "short") |
| 61 | 59 | public void simpleWriteReadTest() throws Exception { |
| 62 | 60 | try { |
| 63 | - session.execute("USE " + SIMPLE_KEYSPACE); | |
| 61 | + session.execute("USE " + keyspace); | |
| 64 | 62 | PreparedStatement ins = session.prepare("INSERT INTO t(k, v) VALUES (?, ?)"); |
| 65 | 63 | PreparedStatement sel = session.prepare("SELECT * FROM t WHERE k=?"); |
| 66 | 64 |
modified driver-core/src/test/java/com/datastax/driver/core/UserTypesTest.java +19 −18
| @@ -63,12 +63,12 @@ | ||
| 63 | 63 | int userId = 0; |
| 64 | 64 | |
| 65 | 65 | try { |
| 66 | - session.execute("USE ks"); | |
| 66 | + session.execute("USE " + keyspace); | |
| 67 | 67 | PreparedStatement ins = session.prepare("INSERT INTO user(id, addr) VALUES (?, ?)"); |
| 68 | 68 | PreparedStatement sel = session.prepare("SELECT * FROM user WHERE id=?"); |
| 69 | 69 | |
| 70 | - UserType addrDef = cluster.getMetadata().getKeyspace("ks").getUserType("address"); | |
| 71 | - UserType phoneDef = cluster.getMetadata().getKeyspace("ks").getUserType("phone"); | |
| 70 | + UserType addrDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("address"); | |
| 71 | + UserType phoneDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("phone"); | |
| 72 | 72 | |
| 73 | 73 | UDTValue phone1 = phoneDef.newValue().setString("alias", "home").setString("number", "0123548790"); |
| 74 | 74 | UDTValue phone2 = phoneDef.newValue().setString("alias", "work").setString("number", "0698265251"); |
| @@ -96,9 +96,9 @@ | ||
| 96 | 96 | int userId = 1; |
| 97 | 97 | |
| 98 | 98 | try { |
| 99 | - session.execute("USE ks"); | |
| 100 | - UserType addrDef = cluster.getMetadata().getKeyspace("ks").getUserType("address"); | |
| 101 | - UserType phoneDef = cluster.getMetadata().getKeyspace("ks").getUserType("phone"); | |
| 99 | + session.execute("USE " + keyspace); | |
| 100 | + UserType addrDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("address"); | |
| 101 | + UserType phoneDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("phone"); | |
| 102 | 102 | |
| 103 | 103 | UDTValue phone1 = phoneDef.newValue().setString("alias", "home").setString("number", "0123548790"); |
| 104 | 104 | UDTValue phone2 = phoneDef.newValue().setString("alias", "work").setString("number", "0698265251"); |
| @@ -124,32 +124,33 @@ | ||
| 124 | 124 | @Test(groups = "short") |
| 125 | 125 | public void nonExistingTypesTest() throws Exception { |
| 126 | 126 | try { |
| 127 | - session.execute("USE ks"); | |
| 127 | + session.execute("USE " + keyspace); | |
| 128 | 128 | |
| 129 | - UserType addrDef = cluster.getMetadata().getKeyspace("ks").getUserType("address1"); | |
| 130 | - UserType phoneDef = cluster.getMetadata().getKeyspace("ks").getUserType("phone1"); | |
| 129 | + UserType addrDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("address1"); | |
| 130 | + UserType phoneDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("phone1"); | |
| 131 | 131 | assertEquals(addrDef, null); |
| 132 | 132 | assertEquals(phoneDef, null); |
| 133 | 133 | |
| 134 | - addrDef = cluster.getMetadata().getKeyspace("ks").getUserType("address"); | |
| 135 | - phoneDef = cluster.getMetadata().getKeyspace("ks").getUserType("phone"); | |
| 134 | + addrDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("address"); | |
| 135 | + phoneDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("phone"); | |
| 136 | 136 | assertNotEquals(addrDef, null); |
| 137 | 137 | assertNotEquals(phoneDef, null); |
| 138 | 138 | |
| 139 | 139 | // create keyspace |
| 140 | - session.execute("CREATE KEYSPACE nonExistingTypesTest " + | |
| 140 | + String nonExistingKeyspace = keyspace + "_nonEx"; | |
| 141 | + session.execute("CREATE KEYSPACE " + nonExistingKeyspace + " " + | |
| 141 | 142 | "WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1'}"); |
| 142 | - session.execute("USE nonExistingTypesTest"); | |
| 143 | + session.execute("USE " + nonExistingKeyspace); | |
| 143 | 144 | |
| 144 | - addrDef = cluster.getMetadata().getKeyspace("nonExistingTypesTest").getUserType("address"); | |
| 145 | - phoneDef = cluster.getMetadata().getKeyspace("nonExistingTypesTest").getUserType("phone"); | |
| 145 | + addrDef = cluster.getMetadata().getKeyspace(nonExistingKeyspace).getUserType("address"); | |
| 146 | + phoneDef = cluster.getMetadata().getKeyspace(nonExistingKeyspace).getUserType("phone"); | |
| 146 | 147 | assertEquals(addrDef, null); |
| 147 | 148 | assertEquals(phoneDef, null); |
| 148 | 149 | |
| 149 | - session.execute("USE ks"); | |
| 150 | + session.execute("USE " + keyspace); | |
| 150 | 151 | |
| 151 | - addrDef = cluster.getMetadata().getKeyspace("ks").getUserType("address"); | |
| 152 | - phoneDef = cluster.getMetadata().getKeyspace("ks").getUserType("phone"); | |
| 152 | + addrDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("address"); | |
| 153 | + phoneDef = cluster.getMetadata().getKeyspace(keyspace).getUserType("phone"); | |
| 153 | 154 | assertNotEquals(addrDef, null); |
| 154 | 155 | assertNotEquals(phoneDef, null); |
| 155 | 156 |
modified driver-core/src/test/java/com/datastax/driver/core/querybuilder/QueryBuilderUDTExecutionTest.java +2 −2
| @@ -33,7 +33,7 @@ | ||
| 33 | 33 | |
| 34 | 34 | @Test(groups = "short") |
| 35 | 35 | public void insertUdtTest() throws Exception { |
| 36 | - UserType udtType = cluster.getMetadata().getKeyspace("ks").getUserType("udt"); | |
| 36 | + UserType udtType = cluster.getMetadata().getKeyspace(keyspace).getUserType("udt"); | |
| 37 | 37 | UDTValue udtValue = udtType.newValue().setInt("i", 2).setInet("a", InetAddress.getByName("localhost")); |
| 38 | 38 | |
| 39 | 39 | Statement insert = insertInto("udtTest").value("k", 1).value("t", udtValue); |
| @@ -51,7 +51,7 @@ | ||
| 51 | 51 | |
| 52 | 52 | @Test(groups = "short") |
| 53 | 53 | public void should_handle_collections_of_UDT() throws Exception { |
| 54 | - UserType udtType = cluster.getMetadata().getKeyspace("ks").getUserType("udt"); | |
| 54 | + UserType udtType = cluster.getMetadata().getKeyspace(keyspace).getUserType("udt"); | |
| 55 | 55 | UDTValue udtValue = udtType.newValue().setInt("i", 2).setInet("a", InetAddress.getByName("localhost")); |
| 56 | 56 | UDTValue udtValue2 = udtType.newValue().setInt("i", 3).setInet("a", InetAddress.getByName("localhost")); |
| 57 | 57 |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperDefaultKeyspaceTest.java +13 −6
| @@ -23,6 +23,7 @@ | ||
| 23 | 23 | import com.google.common.base.Objects; |
| 24 | 24 | import org.testng.annotations.Test; |
| 25 | 25 | |
| 26 | +import static com.datastax.driver.core.TestUtils.CREATE_KEYSPACE_SIMPLE_FORMAT; | |
| 26 | 27 | import static org.testng.Assert.assertEquals; |
| 27 | 28 | import static org.testng.Assert.assertNull; |
| 28 | 29 | |
| @@ -34,10 +35,12 @@ | ||
| 34 | 35 | */ |
| 35 | 36 | @CassandraVersion(major=2.1) |
| 36 | 37 | public class MapperDefaultKeyspaceTest extends CCMBridge.PerClassSingleNodeCluster { |
| 38 | + | |
| 39 | + private static final String KEYSPACE = "mapper_default_keyspace_test_ks"; | |
| 40 | + | |
| 37 | 41 | protected Collection<String> getTableDefinitions() { |
| 38 | 42 | return Arrays.asList("CREATE TABLE groups (group_id uuid PRIMARY KEY, name text)", |
| 39 | - "CREATE TYPE group_name (name text)", | |
| 40 | - "CREATE TABLE groups2 (group_id uuid PRIMARY KEY, name frozen<group_name>)"); | |
| 43 | + "CREATE TYPE IF NOT EXISTS group_name (name text)"); | |
| 41 | 44 | } |
| 42 | 45 | |
| 43 | 46 | /* |
| @@ -95,7 +98,7 @@ | ||
| 95 | 98 | @Test(groups = "short") |
| 96 | 99 | public void testTableWithDefaultKeyspace() throws Exception { |
| 97 | 100 | // Ensure that the test session is logged into the "ks" keyspace. |
| 98 | - session.execute("USE ks"); | |
| 101 | + session.execute("USE " + keyspace); | |
| 99 | 102 | |
| 100 | 103 | MappingManager manager = new MappingManager(session); |
| 101 | 104 | Mapper<Group> m = manager.mapper(Group.class); |
| @@ -114,7 +117,7 @@ | ||
| 114 | 117 | assertNull(m.get(groupId)); |
| 115 | 118 | } |
| 116 | 119 | |
| 117 | - @Table(keyspace = "ks", name = "groups2") | |
| 120 | + @Table(keyspace = KEYSPACE, name = "groups2") | |
| 118 | 121 | public static class Group2 { |
| 119 | 122 | |
| 120 | 123 | @PartitionKey |
| @@ -203,8 +206,12 @@ | ||
| 203 | 206 | |
| 204 | 207 | @Test(groups = "short") |
| 205 | 208 | public void testUDTWithDefaultKeyspace() throws Exception { |
| 206 | - // Ensure that the test session is logged into the "ks" keyspace. | |
| 207 | - session.execute("USE ks"); | |
| 209 | + // Create test specific keyspace and table. | |
| 210 | + session.execute(String.format("CREATE KEYSPACE IF NOT EXISTS %s WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }", KEYSPACE)); | |
| 211 | + session.execute(String.format("CREATE TYPE IF NOT EXISTS %s.group_name (name text)", KEYSPACE)); | |
| 212 | + session.execute(String.format("CREATE TABLE IF NOT EXISTS %s.groups2 (group_id uuid PRIMARY KEY, name frozen<group_name>)", KEYSPACE)); | |
| 213 | + // Ensure that the test session is logged into the keyspace. | |
| 214 | + session.execute("USE " + keyspace); | |
| 208 | 215 | |
| 209 | 216 | MappingManager manager = new MappingManager(session); |
| 210 | 217 | Mapper<Group2> m = manager.mapper(Group2.class); |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperNestedCollectionsTest.java +2 −2
| @@ -70,7 +70,7 @@ | ||
| 70 | 70 | assertThat(testTable2.getM2()).isEqualTo(m2); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - @UDT(keyspace = "ks", name = "testType") | |
| 73 | + @UDT(name = "testType") | |
| 74 | 74 | public static class TestType { |
| 75 | 75 | private int i; |
| 76 | 76 | |
| @@ -132,7 +132,7 @@ | ||
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - @Table(keyspace = "ks", name = "testTable") | |
| 135 | + @Table(name = "testTable") | |
| 136 | 136 | public static class TestTable { |
| 137 | 137 | @PartitionKey |
| 138 | 138 | private int k; |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperPrimitiveTypesTest.java +1 −1
| @@ -119,7 +119,7 @@ | ||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | - @Table(keyspace = "ks", name = "primitiveTypes") | |
| 122 | + @Table(name = "primitiveTypes") | |
| 123 | 123 | public static class PrimitiveTypes { |
| 124 | 124 | @PartitionKey |
| 125 | 125 | private ByteBuffer byteBufferCol; |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperTest.java +7 −7
| @@ -52,7 +52,7 @@ | ||
| 52 | 52 | * |
| 53 | 53 | * And the next step will be to support UDT (which should be relatively simple). |
| 54 | 54 | */ |
| 55 | - @Table(keyspace="ks", name = "users", | |
| 55 | + @Table(name = "users", | |
| 56 | 56 | readConsistency="QUORUM", |
| 57 | 57 | writeConsistency="QUORUM") |
| 58 | 58 | public static class User { |
| @@ -147,7 +147,7 @@ | ||
| 147 | 147 | * the order must be specified (@ClusteringColumn(0), @ClusteringColumn(1), ...). |
| 148 | 148 | * The same stands for the @PartitionKey. |
| 149 | 149 | */ |
| 150 | - @Table(keyspace = "ks", name = "posts") | |
| 150 | + @Table(name = "posts") | |
| 151 | 151 | public static class Post { |
| 152 | 152 | |
| 153 | 153 | @PartitionKey |
| @@ -263,31 +263,31 @@ | ||
| 263 | 263 | // don't have @Param annotation like in the 2 other method, we default to some |
| 264 | 264 | // harcoded arg0, arg1, .... A big annoying, and apparently Java 8 will fix that |
| 265 | 265 | // somehow, but well, not a huge deal. |
| 266 | - @Query("SELECT * FROM ks.posts WHERE user_id=:userId AND post_id=:postId") | |
| 266 | + @Query("SELECT * FROM posts WHERE user_id=:userId AND post_id=:postId") | |
| 267 | 267 | public Post getOne(@Param("userId") UUID userId, |
| 268 | 268 | @Param("postId") UUID postId); |
| 269 | 269 | |
| 270 | 270 | // Note that the following method will be asynchronous (it will use executeAsync |
| 271 | 271 | // underneath) because it's return type is a ListenableFuture. Similarly, we know |
| 272 | 272 | // that we need to map the result to the Post entity thanks to the return type. |
| 273 | - @Query("SELECT * FROM ks.posts WHERE user_id=?") | |
| 273 | + @Query("SELECT * FROM posts WHERE user_id=?") | |
| 274 | 274 | @QueryParameters(consistency="QUORUM") |
| 275 | 275 | public ListenableFuture<Result<Post>> getAllAsync(UUID userId); |
| 276 | 276 | |
| 277 | 277 | // The method above actually query stuff, but if a method is declared to return |
| 278 | 278 | // a Statement, it will not execute anything, but just return you the BoundStatement |
| 279 | 279 | // ready for execution. That way, you can batch stuff for instance (see usage below). |
| 280 | - @Query("UPDATE ks.posts SET content=? WHERE user_id=? AND post_id=?") | |
| 280 | + @Query("UPDATE posts SET content=? WHERE user_id=? AND post_id=?") | |
| 281 | 281 | public Statement updateContentQuery(String newContent, UUID userId, UUID postId); |
| 282 | 282 | |
| 283 | - @Query("SELECT * FROM ks.posts") | |
| 283 | + @Query("SELECT * FROM posts") | |
| 284 | 284 | public Result<Post> getAll(); |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | @Accessor |
| 288 | 288 | public interface UserAccessor { |
| 289 | 289 | // Demonstrates use of an enum as an accessor parameter |
| 290 | - @Query("UPDATE ks.users SET name=?, gender=? WHERE user_id=?") | |
| 290 | + @Query("UPDATE users SET name=?, gender=? WHERE user_id=?") | |
| 291 | 291 | ResultSet updateNameAndGender(String name, Gender gender, UUID userId); |
| 292 | 292 | } |
| 293 | 293 |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTCollectionsTest.java +2 −2
| @@ -38,7 +38,7 @@ | ||
| 38 | 38 | "CREATE TABLE collection_examples (id int PRIMARY KEY, l list<frozen<sub>>, s set<frozen<sub>>, m1 map<int,frozen<sub>>, m2 map<frozen<sub>,int>, m3 map<frozen<sub>,frozen<sub>>)"); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - @UDT(keyspace = "ks", name = "sub") | |
| 41 | + @UDT(name = "sub") | |
| 42 | 42 | public static class Sub { |
| 43 | 43 | private int i; |
| 44 | 44 | |
| @@ -72,7 +72,7 @@ | ||
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - @Table(keyspace = "ks", name = "collection_examples") | |
| 75 | + @Table(name = "collection_examples") | |
| 76 | 76 | public static class CollectionExamples { |
| 77 | 77 | @PartitionKey |
| 78 | 78 | private int id; |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java +6 −6
| @@ -47,7 +47,7 @@ | ||
| 47 | 47 | session.execute("TRUNCATE users"); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - @Table(keyspace = "ks", name = "users", | |
| 50 | + @Table(name = "users", | |
| 51 | 51 | readConsistency = "QUORUM", |
| 52 | 52 | writeConsistency = "QUORUM") |
| 53 | 53 | public static class User { |
| @@ -123,7 +123,7 @@ | ||
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - @UDT(keyspace = "ks", name = "address") | |
| 126 | + @UDT(name = "address") | |
| 127 | 127 | public static class Address { |
| 128 | 128 | |
| 129 | 129 | // Dummy constant to test that static fields are properly ignored |
| @@ -199,16 +199,16 @@ | ||
| 199 | 199 | |
| 200 | 200 | @Accessor |
| 201 | 201 | public interface UserAccessor { |
| 202 | - @Query("SELECT * FROM ks.users WHERE user_id=:userId") | |
| 202 | + @Query("SELECT * FROM users WHERE user_id=:userId") | |
| 203 | 203 | User getOne(@Param("userId") UUID userId); |
| 204 | 204 | |
| 205 | - @Query("UPDATE ks.users SET other_addresses[:name]=:address WHERE user_id=:id") | |
| 205 | + @Query("UPDATE users SET other_addresses[:name]=:address WHERE user_id=:id") | |
| 206 | 206 | ResultSet addAddress(@Param("id") UUID id, @Param("name") String addressName, @Param("address") Address address); |
| 207 | 207 | |
| 208 | - @Query("UPDATE ks.users SET other_addresses=:addresses where user_id=:id") | |
| 208 | + @Query("UPDATE users SET other_addresses=:addresses where user_id=:id") | |
| 209 | 209 | ResultSet setOtherAddresses(@Param("id") UUID id, @Param("addresses") Map<String, Address> addresses); |
| 210 | 210 | |
| 211 | - @Query("SELECT * FROM ks.users") | |
| 211 | + @Query("SELECT * FROM users") | |
| 212 | 212 | public Result<User> getAll(); |
| 213 | 213 | } |
| 214 | 214 |
modified driver-mapping/src/test/java/com/datastax/driver/mapping/SyntheticFieldsMapperTest.java +1 −1
| @@ -88,7 +88,7 @@ | ||
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - @Table(keyspace = "ks", name = "synthetic_fields") | |
| 91 | + @Table(name = "synthetic_fields") | |
| 92 | 92 | public static class ClassWithSyntheticField { |
| 93 | 93 | @PartitionKey |
| 94 | 94 | private int id; |