private String getCreateTaskLookupTableStatement() { return SchemaBuilder.createTable(config.getCassandraKeyspace(), TABLE_TASK_LOOKUP) .ifNotExists() .addPartitionKey(TASK_ID_KEY, DataType.uuid()) .addColumn(WORKFLOW_ID_KEY, DataType.uuid()) .getQueryString(); }
private String getCreateWorkflowsTableStatement() { return SchemaBuilder.createTable(config.getCassandraKeyspace(), TABLE_WORKFLOWS) .ifNotExists() .addPartitionKey(WORKFLOW_ID_KEY, DataType.uuid()) .addPartitionKey(SHARD_ID_KEY, DataType.cint()) .addClusteringColumn(ENTITY_KEY, DataType.text()) .addClusteringColumn(TASK_ID_KEY, DataType.text()) .addColumn(PAYLOAD_KEY, DataType.text()) .addStaticColumn(TOTAL_TASKS_KEY, DataType.cint()) .addStaticColumn(TOTAL_PARTITIONS_KEY, DataType.cint()) .getQueryString(); }
@Test(groups = "unit", expectedExceptions = IllegalStateException.class) public void should_fail_when_creating_table_without_partition_key() throws Exception { createTable("test").addColumn("name", DataType.text()).getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "The table 'test' cannot declare static columns '\\[stat\\]' without clustering columns") public void should_fail_if_static_column_in_non_clustered_table() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addStaticColumn("stat", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The keyspace name 'ADD' is not allowed because it is a reserved keyword") public void should_fail_if_keyspace_name_is_a_reserved_keyword() throws Exception { createTable("ADD", "test") .addPartitionKey("pk", DataType.bigint()) .addColumn("col", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "The '\\[pk\\]' columns can not be declared as partition keys and clustering keys at the same time") public void should_fail_if_same_partition_and_clustering_column() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addClusteringColumn("pk", DataType.bigint()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "The '\\[pk\\]' columns can not be declared as partition keys and simple columns at the same time") public void should_fail_if_same_partition_and_simple_column() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addColumn("pk", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "The '\\[pk\\]' columns can not be declared as partition keys and static columns at the same time") public void should_fail_if_same_partition_and_static_column() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addStaticColumn("pk", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The table name 'ADD' is not allowed because it is a reserved keyword") public void should_fail_if_table_name_is_a_reserved_keyword() throws Exception { createTable("ADD") .addPartitionKey("pk", DataType.bigint()) .addColumn("col", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The partition key name 'ADD' is not allowed because it is a reserved keyword") public void should_fail_if_partition_key_is_a_reserved_keyword() throws Exception { createTable("test") .addPartitionKey("ADD", DataType.bigint()) .addColumn("col", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "The '\\[cluster\\]' columns can not be declared as clustering keys and static columns at the same time") public void should_fail_if_same_clustering_and_static_column() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addClusteringColumn("cluster", DataType.bigint()) .addStaticColumn("cluster", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "The '\\[cluster\\]' columns can not be declared as clustering keys and simple columns at the same time") public void should_fail_if_same_clustering_and_simple_column() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addClusteringColumn("cluster", DataType.bigint()) .addColumn("cluster", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The clustering column name 'ADD' is not allowed because it is a reserved keyword") public void should_fail_if_clustering_key_is_a_reserved_keyword() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addClusteringColumn("ADD", DataType.uuid()) .addColumn("col", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The column name 'ADD' is not allowed because it is a reserved keyword") public void should_fail_if_simple_column_is_a_reserved_keyword() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addClusteringColumn("cluster", DataType.uuid()) .addColumn("ADD", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The static column name 'ADD' is not allowed because it is a reserved keyword") public void should_fail_if_static_column_is_a_reserved_keyword() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addClusteringColumn("cluster", DataType.uuid()) .addStaticColumn("ADD", DataType.text()) .addColumn("col", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "The '\\[col\\]' columns can not be declared as simple columns and static columns at the same time") public void should_fail_if_same_simple_and_static_column() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addClusteringColumn("cluster", DataType.uuid()) .addColumn("col", DataType.bigint()) .addStaticColumn("col", DataType.text()) .getQueryString(); }
create.addColumn("col" + i, DataType.blob()); execute(create.getQueryString());
@Test( groups = "unit", expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The keyspace name 'ADD' is not allowed because it is a reserved keyword") public void should_fail_if_keyspace_name_is_a_reserved_keyword() throws Exception { createTable("ADD", "test") .addPartitionKey("pk", DataType.bigint()) .addColumn("col", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "The '\\[pk\\]' columns can not be declared as partition keys and simple columns at the same time") public void should_fail_if_same_partition_and_simple_column() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addColumn("pk", DataType.text()) .getQueryString(); }
@Test( groups = "unit", expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The column name 'ADD' is not allowed because it is a reserved keyword") public void should_fail_if_simple_column_is_a_reserved_keyword() throws Exception { createTable("test") .addPartitionKey("pk", DataType.bigint()) .addClusteringColumn("cluster", DataType.uuid()) .addColumn("ADD", DataType.text()) .getQueryString(); }