use of com.google.cloud.bigquery.Table in project google-cloud-java by GoogleCloudPlatform.
the class ITDatasetSnippets method testGetTable.
@Test
public void testGetTable() {
String expectedTableName = "test_table";
dataset.create(expectedTableName, StandardTableDefinition.newBuilder().build());
Table actualTable = datasetSnippets.getTable(expectedTableName);
assertNotNull(actualTable);
assertEquals(expectedTableName, actualTable.getTableId().getTable());
bigquery.delete(DATASET, expectedTableName);
}
use of com.google.cloud.bigquery.Table in project google-cloud-java by GoogleCloudPlatform.
the class ITDatasetSnippets method testCreateTable.
@Test
public void testCreateTable() {
String expectedTableName = "test_table";
String expectedFieldName = "test_field";
Table actualTable = datasetSnippets.createTable(expectedTableName, expectedFieldName);
assertNotNull(actualTable);
assertEquals(expectedTableName, actualTable.getTableId().getTable());
assertEquals(1, actualTable.getDefinition().getSchema().getFields().size());
Field actualField = actualTable.getDefinition().getSchema().getFields().get(0);
assertEquals(expectedFieldName, actualField.getName());
bigquery.delete(DATASET, expectedTableName);
}
use of com.google.cloud.bigquery.Table in project google-cloud-java by GoogleCloudPlatform.
the class ITDatasetSnippets method testListTablesNotEmpty.
@Test
public void testListTablesNotEmpty() {
String expectedTableName = "test_table";
dataset.create(expectedTableName, StandardTableDefinition.newBuilder().build());
Page<Table> tables = datasetSnippets.list();
Iterator<Table> iterator = tables.iterateAll().iterator();
assertTrue(iterator.hasNext());
Table actualTable = iterator.next();
assertEquals(expectedTableName, actualTable.getTableId().getTable());
assertFalse(iterator.hasNext());
bigquery.delete(DATASET, expectedTableName);
}
use of com.google.cloud.bigquery.Table in project google-cloud-java by GoogleCloudPlatform.
the class ITTableSnippets method testReloadTableWithFields.
@Test
public void testReloadTableWithFields() {
Table latestTable = tableSnippets.reloadTableWithFields(TableField.LAST_MODIFIED_TIME, TableField.NUM_ROWS);
assertNotNull(latestTable);
assertNotNull(latestTable.getLastModifiedTime());
}
Aggregations