@Test public void testLongTableNameLengthFailsCassandra() { 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)); }
public void addTableDefinition(String tableName, TableDefinition definition) { Preconditions.checkArgument( !tableDefinitions.containsKey(tableName) && !indexDefinitions.containsKey(tableName), "Table already defined: %s", tableName); Preconditions.checkArgument( Schemas.isTableNameValid(tableName), "Invalid table name %s", tableName); validateTableNameLength(tableName); tableDefinitions.put(tableName, definition); }
Schema { public void addTableDefinition(String tableName, TableDefinition definition) { Preconditions.checkArgument( !tableDefinitions.containsKey(tableName) && !indexDefinitions.containsKey(tableName), "Table already defined: %s", tableName); Preconditions.checkArgument( Schemas.isTableNameValid(tableName), "Invalid table name %s", tableName); validateTableNameLength(tableName); tableDefinitions.put(tableName, definition); } }
Schema { public void addTableDefinition(String tableName, TableDefinition definition) { Preconditions.checkArgument( !tableDefinitions.containsKey(tableName) && !indexDefinitions.containsKey(tableName), "Table already defined: %s", tableName); Preconditions.checkArgument( Schemas.isTableNameValid(tableName), "Invalid table name %s", tableName); validateTableNameLength(tableName); tableDefinitions.put(tableName, definition); } Schema(Namespace namespace);  Schema();  Schema(String name, String packageName, Namespace namespace);  Schema(String name, String packageName, Namespace namespace, OptionalType optionalType); }
Schema { public void addTableDefinition(String tableName, TableDefinition definition) { Preconditions.checkArgument( !tableDefinitions.containsKey(tableName) && !indexDefinitions.containsKey(tableName), "Table already defined: %s", tableName); Preconditions.checkArgument( Schemas.isTableNameValid(tableName), "Invalid table name %s", tableName); validateTableNameLength(tableName); tableDefinitions.put(tableName, definition); } Schema(Namespace namespace);  Schema();  Schema(String name, String packageName, Namespace namespace);  Schema(String name, String packageName, Namespace namespace, OptionalType optionalType); String getName(); void addTableDefinition(String tableName, TableDefinition definition); void addDefinitionsForTables(Iterable<String> tableNames, TableDefinition definition); TableDefinition getTableDefinition(TableReference tableRef); Map<TableReference, TableMetadata> getAllTablesAndIndexMetadata(); Set<TableReference> getAllIndexes(); Set<TableReference> getAllTables(); void addIndexDefinition(String idxName, IndexDefinition definition); void addStreamStoreDefinition(StreamStoreDefinition streamStoreDefinition); IndexDefinition getIndex(TableReference indexRef); void validate(); Map<TableReference, TableDefinition> getTableDefinitions(); Map<TableReference, IndexDefinition> getIndexDefinitions(); Namespace getNamespace(); void renderTables(File srcDir); void addCleanupTask(String rawTableName, OnCleanupTask task); void addCleanupTask(String rawTableName, Supplier<OnCleanupTask> task); Multimap<TableReference, OnCleanupTask> getCleanupTasksByTable(); void ignoreTableNameLengthChecks(); }
Schema { public void addTableDefinition(String tableName, TableDefinition definition) { Preconditions.checkArgument( !tableDefinitions.containsKey(tableName) && !indexDefinitions.containsKey(tableName), "Table already defined: %s", tableName); Preconditions.checkArgument( Schemas.isTableNameValid(tableName), "Invalid table name %s", tableName); validateTableNameLength(tableName); tableDefinitions.put(tableName, definition); } Schema(Namespace namespace);  Schema();  Schema(String name, String packageName, Namespace namespace);  Schema(String name, String packageName, Namespace namespace, OptionalType optionalType); String getName(); void addTableDefinition(String tableName, TableDefinition definition); void addDefinitionsForTables(Iterable<String> tableNames, TableDefinition definition); TableDefinition getTableDefinition(TableReference tableRef); Map<TableReference, TableMetadata> getAllTablesAndIndexMetadata(); Set<TableReference> getAllIndexes(); Set<TableReference> getAllTables(); void addIndexDefinition(String idxName, IndexDefinition definition); void addStreamStoreDefinition(StreamStoreDefinition streamStoreDefinition); IndexDefinition getIndex(TableReference indexRef); void validate(); Map<TableReference, TableDefinition> getTableDefinitions(); Map<TableReference, IndexDefinition> getIndexDefinitions(); Namespace getNamespace(); void renderTables(File srcDir); void addCleanupTask(String rawTableName, OnCleanupTask task); void addCleanupTask(String rawTableName, Supplier<OnCleanupTask> task); Multimap<TableReference, OnCleanupTask> getCleanupTasksByTable(); void ignoreTableNameLengthChecks();  }