Ejemplo n.º 1
0
 @Test
 public void testUpdateWithOptions() throws Exception {
   BaseTableInfo updatedInfo = TABLE_INFO.toBuilder().description("Description").build();
   expect(bigquery.update(updatedInfo, BigQuery.TableOption.fields())).andReturn(updatedInfo);
   replay(bigquery);
   Table updatedTable = table.update(updatedInfo, BigQuery.TableOption.fields());
   assertSame(bigquery, updatedTable.bigquery());
   assertEquals(updatedInfo, updatedTable.info());
 }
Ejemplo n.º 2
0
 @Test
 public void testGetFromIdWithOptions() throws Exception {
   expect(bigquery.getTable(TABLE_INFO.tableId(), BigQuery.TableOption.fields()))
       .andReturn(TABLE_INFO);
   replay(bigquery);
   Table loadedTable = Table.get(bigquery, TABLE_INFO.tableId(), BigQuery.TableOption.fields());
   assertNotNull(loadedTable);
   assertEquals(TABLE_INFO, loadedTable.info());
 }
Ejemplo n.º 3
0
 @Test
 public void testExists_False() throws Exception {
   BigQuery.TableOption[] expectedOptions = {BigQuery.TableOption.fields()};
   expect(bigquery.getTable(TABLE_INFO.tableId(), expectedOptions)).andReturn(null);
   replay(bigquery);
   assertFalse(table.exists());
 }
Ejemplo n.º 4
0
 /**
  * Checks if this table exists.
  *
  * @return {@code true} if this table exists, {@code false} otherwise
  * @throws BigQueryException upon failure
  */
 public boolean exists() {
   return bigquery.getTable(info.tableId(), BigQuery.TableOption.fields()) != null;
 }