Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void setupRoles() {
session.execute(
"CREATE ROLE IF NOT EXISTS steve WITH PASSWORD = 'fakePasswordForSteve' AND LOGIN = TRUE");
session.execute(
"CREATE KEYSPACE IF NOT EXISTS aliceks WITH REPLICATION = {'class':'SimpleStrategy', 'replication_factor':'1'}");
"CREATE KEYSPACE IF NOT EXISTS aliceks WITH REPLICATION = {'class':'NetworkTopologyStrategy', 'dc1':'1'}");
session.execute(
"CREATE TABLE IF NOT EXISTS aliceks.alicetable (key text PRIMARY KEY, value text)");
session.execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void should_expose_graph_engine_if_set() {
CqlSession session = SESSION_RULE.session();
session.execute(
"CREATE KEYSPACE keyspace_metadata_it_graph_engine "
+ "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1} "
+ "WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1} "
+ "AND graph_engine = 'Core'");
Metadata metadata = session.getMetadata();
assertThat(metadata.getKeyspace("keyspace_metadata_it_graph_engine"))
Expand All @@ -66,7 +66,7 @@ public void should_expose_graph_engine_if_keyspace_altered() {
CqlSession session = SESSION_RULE.session();
session.execute(
"CREATE KEYSPACE keyspace_metadata_it_graph_engine_alter "
+ "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}");
+ "WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1}");
assertThat(session.getMetadata().getKeyspace("keyspace_metadata_it_graph_engine_alter"))
.hasValueSatisfying(
keyspaceMetadata ->
Expand All @@ -89,7 +89,7 @@ public void should_not_allow_classic_graph_engine_to_be_specified_on_keyspace()
() ->
session.execute(
"CREATE KEYSPACE keyspace_metadata_it_graph_engine_classic "
+ "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1} "
+ "WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1} "
+ "AND graph_engine = 'Classic'"))
.hasMessageContaining("Invalid/unknown graph engine name 'Classic'");
}
Expand All @@ -99,7 +99,7 @@ public void should_expose_core_graph_engine_if_set() {
CqlSession session = SESSION_RULE.session();
session.execute(
"CREATE KEYSPACE keyspace_metadata_it_graph_engine_core "
+ "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1} "
+ "WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1} "
+ "AND graph_engine = 'Core'");
Metadata metadata = session.getMetadata();
assertThat(metadata.getKeyspace("keyspace_metadata_it_graph_engine_core"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public void should_not_fail_on_empty_pages() {
SESSION_RULE
.session()
.execute(
"CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1}");
"CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class': 'NetworkTopologyStrategy', 'dc1': 1}");

SESSION_RULE
.session()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public static void setup() {
session.execute(
"CREATE KEYSPACE "
+ keyspace.asCql(false)
+ " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3}");
+ " WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 3}"
+ " AND tablets = {'enabled': false}");
session.execute("USE " + keyspace.asCql(false));
session.execute("CREATE TABLE foo (pk int, ck int, v int, PRIMARY KEY (pk, ck))");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,15 @@ public void should_handle_keyspace_creation() {
null,
String.format(
"CREATE KEYSPACE %s "
+ "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}",
+ "WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1}",
newKeyspaceId),
metadata -> metadata.getKeyspace(newKeyspaceId),
keyspace -> {
assertThat(keyspace.getName()).isEqualTo(newKeyspaceId);
assertThat(keyspace.isDurableWrites()).isTrue();
assertThat(keyspace.getReplication())
.hasSize(2)
.containsEntry("class", "org.apache.cassandra.locator.SimpleStrategy")
.containsEntry("replication_factor", "1");
.containsEntry("class", "org.apache.cassandra.locator.NetworkTopologyStrategy")
.containsEntry("dc1", "1");
},
(listener, keyspace) -> verify(listener).onKeyspaceCreated(keyspace),
newKeyspaceId);
Expand All @@ -121,7 +120,7 @@ public void should_handle_keyspace_drop() {
ImmutableList.of(
String.format(
"CREATE KEYSPACE %s "
+ "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}",
+ "WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1}",
newKeyspaceId.asCql(true))),
String.format("DROP KEYSPACE %s", newKeyspaceId.asCql(true)),
metadata -> metadata.getKeyspace(newKeyspaceId),
Expand All @@ -136,11 +135,11 @@ public void should_handle_keyspace_update() {
ImmutableList.of(
String.format(
"CREATE KEYSPACE %s "
+ "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}",
+ "WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1}",
newKeyspaceId.asCql(true))),
String.format(
"ALTER KEYSPACE %s "
+ "WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1} "
+ "WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1} "
+ "AND durable_writes = 'false'",
newKeyspaceId.asCql(true)),
metadata -> metadata.getKeyspace(newKeyspaceId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ protected static void createSchema(CqlSession session) {
for (String statement :
ImmutableList.of(
String.format(
"CREATE KEYSPACE %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}",
"CREATE KEYSPACE %s WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1}",
KS1.asCql(false)),
String.format(
"CREATE KEYSPACE %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 2}",
"CREATE KEYSPACE %s WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 2}",
KS2.asCql(false)),

// Shouldn't really do that, but it makes the rest of the tests a bit prettier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void setup() {
session.execute(
SimpleStatement.builder(
String.format(
"CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}",
"CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1}",
DEFAULT_KEYSPACE))
.setExecutionProfile(SESSION_RULE.slowProfile())
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void createSchema() {
ImmutableList.of(
"CREATE TABLE foo(k int PRIMARY KEY)",
String.format(
"CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}",
"CREATE KEYSPACE IF NOT EXISTS %s WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 1}",
OTHER_KEYSPACE.asCql(false)),
String.format("CREATE TABLE %s.foo(k int PRIMARY KEY)", OTHER_KEYSPACE.asCql(false)))) {
session.execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public synchronized void init() {
protected void createSchema() {
session.execute("DROP KEYSPACE IF EXISTS test_osgi");
session.execute(
"CREATE KEYSPACE IF NOT EXISTS test_osgi with replication = {'class': 'SimpleStrategy', 'replication_factor' : 1}");
"CREATE KEYSPACE IF NOT EXISTS test_osgi with replication = {'class': 'NetworkTopologyStrategy', 'dc1' : 1}");
session.execute(
"CREATE TABLE "
+ keyspace
Expand Down
Loading