@@ -58,12 +58,13 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
session.execute(
|
||||
"CREATE TABLE addamsFamily (name varchar PRIMARY KEY, gender varchar,\n" + " lastknownlocation bigint);");
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").alter("lastKnownLocation",
|
||||
DataType.varint());
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
.alter("lastKnownLocation", DataType.varint());
|
||||
|
||||
execute(spec);
|
||||
|
||||
ColumnMetadata column = getTableMetadata("addamsFamily").getColumn("lastKnownLocation");
|
||||
|
||||
assertThat(column.getType(), is(equalTo(DataType.varint())));
|
||||
}
|
||||
|
||||
@@ -76,12 +77,13 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
session.execute(
|
||||
"CREATE TABLE addamsFamily (name varchar PRIMARY KEY, gender varchar,\n" + " lastknownlocation list<ascii>);");
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").alter("lastKnownLocation",
|
||||
DataType.list(DataType.varchar()));
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
.alter("lastKnownLocation", DataType.list(DataType.varchar()));
|
||||
|
||||
execute(spec);
|
||||
|
||||
ColumnMetadata column = getTableMetadata("addamsFamily").getColumn("lastKnownLocation");
|
||||
|
||||
assertThat(column.getType(), is(equalTo((DataType) DataType.list(DataType.varchar()))));
|
||||
}
|
||||
|
||||
@@ -94,12 +96,13 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
session.execute(
|
||||
"CREATE TABLE addamsFamily (name varchar PRIMARY KEY, gender varchar,\n" + " lastknownlocation varchar);");
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").add("gravesite",
|
||||
DataType.varchar());
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
.add("gravesite", DataType.varchar());
|
||||
|
||||
execute(spec);
|
||||
|
||||
ColumnMetadata column = getTableMetadata("addamsFamily").getColumn("gravesite");
|
||||
|
||||
assertThat(column.getType(), is(equalTo(DataType.varchar())));
|
||||
}
|
||||
|
||||
@@ -111,12 +114,13 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
|
||||
session.execute("CREATE TABLE users (user_name varchar PRIMARY KEY);");
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("users").add("top_places",
|
||||
DataType.list(DataType.ascii()));
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("users")
|
||||
.add("top_places", DataType.list(DataType.ascii()));
|
||||
|
||||
execute(spec);
|
||||
|
||||
ColumnMetadata column = getTableMetadata("users").getColumn("top_places");
|
||||
|
||||
assertThat(column.getType(), is(equalTo((DataType) DataType.list(DataType.ascii()))));
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
@Test
|
||||
public void alterTableAlterColumnType() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").alter("lastKnownLocation",
|
||||
DataType.uuid());
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
.alter("lastKnownLocation", DataType.uuid());
|
||||
|
||||
assertThat(toCql(spec), is(equalTo("ALTER TABLE addamsfamily ALTER lastknownlocation TYPE uuid;")));
|
||||
}
|
||||
@@ -56,8 +56,8 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
@Test
|
||||
public void alterTableAlterListColumnType() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").alter("lastKnownLocation",
|
||||
DataType.list(DataType.ascii()));
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
.alter("lastKnownLocation", DataType.list(DataType.ascii()));
|
||||
|
||||
assertThat(toCql(spec), is(equalTo("ALTER TABLE addamsfamily ALTER lastknownlocation TYPE list<ascii>;")));
|
||||
}
|
||||
@@ -68,8 +68,8 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
@Test
|
||||
public void alterTableAddColumn() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").add("gravesite",
|
||||
DataType.varchar());
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
.add("gravesite", DataType.varchar());
|
||||
|
||||
assertThat(toCql(spec), is(equalTo("ALTER TABLE addamsfamily ADD gravesite varchar;")));
|
||||
}
|
||||
@@ -80,8 +80,8 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
@Test
|
||||
public void alterTableAddListColumn() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("users").add("top_places",
|
||||
DataType.list(DataType.ascii()));
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("users")
|
||||
.add("top_places", DataType.list(DataType.ascii()));
|
||||
|
||||
assertThat(toCql(spec), is(equalTo("ALTER TABLE users ADD top_places list<ascii>;")));
|
||||
}
|
||||
@@ -103,7 +103,8 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
@Test
|
||||
public void alterTableRenameColumn() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").rename("firstname", "lastname");
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
.rename("firstname", "lastname");
|
||||
|
||||
assertThat(toCql(spec), is(equalTo("ALTER TABLE addamsfamily RENAME firstname TO lastname;")));
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cassandra.core.cql.generator.AlterTableCqlGeneratorUnitTests;
|
||||
import org.springframework.cassandra.core.cql.generator.CreateTableCqlGeneratorUnitTests;
|
||||
import org.springframework.cassandra.core.cql.generator.DropTableCqlGenerator;
|
||||
import org.springframework.cassandra.core.cql.generator.DropTableCqlGeneratorUnitTests;
|
||||
@@ -39,7 +38,8 @@ public class TableLifecycleIntegrationTests extends AbstractKeyspaceCreatingInte
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(TableLifecycleIntegrationTests.class);
|
||||
|
||||
CreateTableCqlGeneratorUnitTests.MultipleOptionsTest createTableTest = new CreateTableCqlGeneratorUnitTests.MultipleOptionsTest();
|
||||
CreateTableCqlGeneratorUnitTests.MultipleOptionsTest createTableTest =
|
||||
new CreateTableCqlGeneratorUnitTests.MultipleOptionsTest();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -47,7 +47,7 @@ public class TableLifecycleIntegrationTests extends AbstractKeyspaceCreatingInte
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDrop() {
|
||||
public void dropIsSuccessful() {
|
||||
|
||||
createTableTest.prepare();
|
||||
|
||||
@@ -79,7 +79,5 @@ public class TableLifecycleIntegrationTests extends AbstractKeyspaceCreatingInte
|
||||
public DropTableCqlGenerator generator() {
|
||||
return new DropTableCqlGenerator(specification);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user