use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class SchemaTest method testIgnoreTableNameLengthFlag.
@Test
public void testIgnoreTableNameLengthFlag() throws IOException {
Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
schema.ignoreTableNameLengthChecks();
String longTableName = String.join("", Collections.nCopies(1000, "x"));
TableReference tableRef = TableReference.createWithEmptyNamespace(longTableName);
schema.addTableDefinition(longTableName, getSimpleTableDefinition(tableRef));
}
use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class SchemaTest method testLongTableNameLengthFailsCassandra.
@Test
public void testLongTableNameLengthFailsCassandra() throws IOException {
Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
int longLengthCassandra = AtlasDbConstants.CASSANDRA_TABLE_NAME_CHAR_LIMIT + 1;
String longTableName = String.join("", Collections.nCopies(longLengthCassandra, "x"));
TableReference tableRef = TableReference.createWithEmptyNamespace(longTableName);
List<CharacterLimitType> kvsList = new ArrayList<CharacterLimitType>();
kvsList.add(CharacterLimitType.CASSANDRA);
assertThatThrownBy(() -> schema.addTableDefinition(longTableName, getSimpleTableDefinition(tableRef))).isInstanceOf(IllegalArgumentException.class).hasMessage(getErrorMessage(longTableName, kvsList));
}
use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class SchemaTest method testLongIndexNameLengthFailsCassandra.
@Test
public void testLongIndexNameLengthFailsCassandra() throws IOException {
Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
int longLengthCassandra = AtlasDbConstants.CASSANDRA_TABLE_NAME_CHAR_LIMIT;
String longTableName = String.join("", Collections.nCopies(longLengthCassandra, "x"));
TableReference tableRef = TableReference.createWithEmptyNamespace(longTableName);
List<CharacterLimitType> kvsList = new ArrayList<>();
kvsList.add(CharacterLimitType.CASSANDRA);
schema.addTableDefinition(longTableName, getSimpleTableDefinition(tableRef));
assertThatThrownBy(() -> {
IndexDefinition id = new IndexDefinition(IndexDefinition.IndexType.ADDITIVE);
id.onTable(longTableName);
schema.addIndexDefinition(longTableName, id);
}).isInstanceOf(IllegalArgumentException.class).hasMessage(getErrorMessage(longTableName + IndexDefinition.IndexType.ADDITIVE.getIndexSuffix(), kvsList));
}
use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class StreamTableTypeTest method isStreamStoreValueTableReturnsTrueForTableWithEmptyNamespace.
@Test
public void isStreamStoreValueTableReturnsTrueForTableWithEmptyNamespace() {
String tableName = StreamTableType.VALUE.getTableName(TEST_TABLE);
TableReference tableReference = TableReference.createWithEmptyNamespace(tableName);
assertTrue(StreamTableType.isStreamStoreValueTable(tableReference));
}
use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class SchemasTest method testDeleteTablesForSweepSchema.
@Test
public void testDeleteTablesForSweepSchema() {
Set<TableReference> allTableNames = Sets.newHashSet();
allTableNames.add(TableReference.createFromFullyQualifiedName("sweep.priority"));
mockery.checking(new Expectations() {
{
oneOf(kvs).getAllTableNames();
will(returnValue(allTableNames));
oneOf(kvs).dropTables(allTableNames);
oneOf(kvs).getAllTableNames();
}
});
Schemas.deleteTablesAndIndexes(SweepSchema.INSTANCE.getLatestSchema(), kvs);
}
Aggregations