/** * Start building a new ALTER KEYSPACE statement. * * @param keyspaceName the name of the keyspace to be altered. * @return an in-construction ALTER KEYSPACE statement. */ public static AlterKeyspace alterKeyspace(String keyspaceName) { return new AlterKeyspace(keyspaceName); }
@Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) public void incorrect_replication_options() throws Exception { Map<String, Object> replicationOptions = new HashMap<String, Object>(); replicationOptions.put("class", 5); // When alterKeyspace("test").with().replication(replicationOptions); } }
@Test(groups = "unit") public void should_alter_keyspace_with_options() throws Exception { Map<String, Object> replicationOptions = new HashMap<String, Object>(); replicationOptions.put("class", "SimpleStrategy"); replicationOptions.put("replication_factor", 1); // When SchemaStatement statement = alterKeyspace("test").with().durableWrites(true).replication(replicationOptions); // Then assertThat(statement.getQueryString()) .isEqualTo( "\n\tALTER KEYSPACE test" + "\n\tWITH\n\t\t" + "REPLICATION = {'replication_factor': 1, 'class': 'SimpleStrategy'}\n\t\t" + "AND DURABLE_WRITES = true"); }
/** * Start building a new ALTER KEYSPACE statement. * * @param keyspaceName the name of the keyspace to be altered. * @return an in-construction ALTER KEYSPACE statement. */ public static AlterKeyspace alterKeyspace(String keyspaceName) { return new AlterKeyspace(keyspaceName); }
@Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) public void incorrect_replication_options() throws Exception { Map<String, Object> replicationOptions = new HashMap<String, Object>(); replicationOptions.put("class", 5); // When alterKeyspace("test").with().replication(replicationOptions); } }
/** * Start building a new ALTER KEYSPACE statement. * * @param keyspaceName the name of the keyspace to be altered. * @return an in-construction ALTER KEYSPACE statement. */ public static AlterKeyspace alterKeyspace(String keyspaceName) { return new AlterKeyspace(keyspaceName); }
@Test(groups = "unit") public void should_alter_keyspace_with_options() throws Exception { Map<String, Object> replicationOptions = new HashMap<String, Object>(); replicationOptions.put("class", "SimpleStrategy"); replicationOptions.put("replication_factor", 1); // When SchemaStatement statement = alterKeyspace("test").with().durableWrites(true).replication(replicationOptions); // Then assertThat(statement.getQueryString()) .isEqualTo( "\n\tALTER KEYSPACE test" + "\n\tWITH\n\t\t" + "REPLICATION = {'replication_factor': 1, 'class': 'SimpleStrategy'}\n\t\t" + "AND DURABLE_WRITES = true"); }
/** * Start building a new ALTER KEYSPACE statement. * * @param keyspaceName the name of the keyspace to be altered. * @return an in-construction ALTER KEYSPACE statement. */ public static AlterKeyspace alterKeyspace(String keyspaceName) { return new AlterKeyspace(keyspaceName); }