@Test public void testCreateTables() { TableReference tableName1 = TableReference.createWithEmptyNamespace(TABLE_NAME + "1"); TableReference tableName2 = TableReference.createWithEmptyNamespace(TABLE_NAME + "2"); mockery.checking(new Expectations(){{ oneOf(kvs).createTables(with(tableMapContainsEntry(tableName1, getSimpleTableDefinitionAsBytes(tableName1)))); oneOf(kvs).createTables(with(tableMapContainsEntry(tableName2, getSimpleTableDefinitionAsBytes(tableName2)))); }}); Map<TableReference, TableDefinition> tables = Maps.newHashMap(); tables.put(tableName1, getSimpleTableDefinition(tableName1)); tables.put(tableName2, getSimpleTableDefinition(tableName2)); Schemas.createTables(kvs, tables); }
public static void createTables(KeyValueService kvs, Map<TableReference, TableDefinition> tableRefToDefinition) { Map<TableReference, byte[]> tableRefToMetadata = Maps.newHashMapWithExpectedSize(tableRefToDefinition.size()); for (Entry<TableReference, TableDefinition> tableEntry : tableRefToDefinition.entrySet()) { tableRefToMetadata.put(tableEntry.getKey(), tableEntry.getValue().toTableMetadata().persistToBytes()); } kvs.createTables(tableRefToMetadata); }
Schemas { public static void createTables(KeyValueService kvs, Map<TableReference, TableDefinition> tableRefToDefinition) { Map<TableReference, byte[]> tableRefToMetadata = Maps.newHashMapWithExpectedSize(tableRefToDefinition.size()); for (Entry<TableReference, TableDefinition> tableEntry : tableRefToDefinition.entrySet()) { tableRefToMetadata.put(tableEntry.getKey(), tableEntry.getValue().toTableMetadata().persistToBytes()); } kvs.createTables(tableRefToMetadata); } }
Schemas { public static void createTables(KeyValueService kvs, Map<TableReference, TableDefinition> tableRefToDefinition) { Map<TableReference, byte[]> tableRefToMetadata = Maps.newHashMapWithExpectedSize(tableRefToDefinition.size()); for (Entry<TableReference, TableDefinition> tableEntry : tableRefToDefinition.entrySet()) { tableRefToMetadata.put(tableEntry.getKey(), tableEntry.getValue().toTableMetadata().persistToBytes()); } kvs.createTables(tableRefToMetadata); } private  Schemas(); }
Schemas { public static void createTables(KeyValueService kvs, Map<TableReference, TableDefinition> tableRefToDefinition) { Map<TableReference, byte[]> tableRefToMetadata = Maps.newHashMapWithExpectedSize(tableRefToDefinition.size()); for (Entry<TableReference, TableDefinition> tableEntry : tableRefToDefinition.entrySet()) { tableRefToMetadata.put(tableEntry.getKey(), tableEntry.getValue().toTableMetadata().persistToBytes()); } kvs.createTables(tableRefToMetadata); } private  Schemas(); static TableReference appendIndexSuffix(String indexName, IndexDefinition definition); static void createIndices(KeyValueService kvs,
            Map<TableReference, IndexDefinition> fullIndexNameToDefinition); static void createTable(KeyValueService kvs, TableReference tableRef, TableDefinition definition); static void createTable(Schema schema, KeyValueService kvs, TableReference tableRef); static void createTables(KeyValueService kvs, Map<TableReference, TableDefinition>  tableRefToDefinition); static String getTableReferenceString(String tableName, Namespace namespace); static boolean isTableNameValid(String tableName); static void createTablesAndIndexes(Schema schema, KeyValueService kvs); static void deleteTablesAndIndexes(Schema schema, KeyValueService kvs); static void truncateTablesAndIndexes(Schema schema, KeyValueService kvs); }
Schemas { public static void createTables(KeyValueService kvs, Map<TableReference, TableDefinition> tableRefToDefinition) { Map<TableReference, byte[]> tableRefToMetadata = Maps.newHashMapWithExpectedSize(tableRefToDefinition.size()); for (Entry<TableReference, TableDefinition> tableEntry : tableRefToDefinition.entrySet()) { tableRefToMetadata.put(tableEntry.getKey(), tableEntry.getValue().toTableMetadata().persistToBytes()); } kvs.createTables(tableRefToMetadata); } private  Schemas(); static TableReference appendIndexSuffix(String indexName, IndexDefinition definition); static void createIndices(KeyValueService kvs,
            Map<TableReference, IndexDefinition> fullIndexNameToDefinition); static void createTable(KeyValueService kvs, TableReference tableRef, TableDefinition definition); static void createTable(Schema schema, KeyValueService kvs, TableReference tableRef); static void createTables(KeyValueService kvs, Map<TableReference, TableDefinition>  tableRefToDefinition); static String getTableReferenceString(String tableName, Namespace namespace); static boolean isTableNameValid(String tableName); static void createTablesAndIndexes(Schema schema, KeyValueService kvs); static void deleteTablesAndIndexes(Schema schema, KeyValueService kvs); static void truncateTablesAndIndexes(Schema schema, KeyValueService kvs);  }