예제 #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());
 }
예제 #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());
 }
예제 #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());
 }
예제 #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;
 }