test_class.declarator: TEST_PROJECT_ID = "domain:project"
test_class.modifier: private static final
test_class.original_string: private static final String TEST_PROJECT_ID = "domain:project";
test_class.type: String
test_class.var_name: TEST_PROJECT_ID
test_class.declarator: TEST_DATASET_ID = "dataset"
test_class.modifier: private static final
test_class.original_string: private static final String TEST_DATASET_ID = "dataset";
test_class.type: String
test_class.var_name: TEST_DATASET_ID
test_class.declarator: TEST_TABLE_ID = "table"
test_class.modifier: private static final
test_class.original_string: private static final String TEST_TABLE_ID = "table";
test_class.type: String
test_class.var_name: TEST_TABLE_ID
test_class.declarator: QUALIFIED_TEST_TABLE_ID =
        String.format("%s:%s.%s", TEST_PROJECT_ID, TEST_DATASET_ID, TEST_TABLE_ID)
test_class.modifier: private static final
test_class.original_string: private static final String QUALIFIED_TEST_TABLE_ID =
        String.format("%s:%s.%s", TEST_PROJECT_ID, TEST_DATASET_ID, TEST_TABLE_ID);
test_class.type: String
test_class.var_name: QUALIFIED_TEST_TABLE_ID
test_class.declarator: TEST_TIME_PARTITIONING =
        BigQueryTimePartitioning.wrap(new TimePartitioning().setType("DAY"))
test_class.modifier: private static final
test_class.original_string: private static final BigQueryTimePartitioning TEST_TIME_PARTITIONING =
        BigQueryTimePartitioning.wrap(new TimePartitioning().setType("DAY"));
test_class.type: BigQueryTimePartitioning
test_class.var_name: TEST_TIME_PARTITIONING
test_class.declarator: TEST_FILE_FORMAT =
        BigQueryFileFormat.NEWLINE_DELIMITED_JSON
test_class.modifier: private static final
test_class.original_string: private static final BigQueryFileFormat TEST_FILE_FORMAT =
        BigQueryFileFormat.NEWLINE_DELIMITED_JSON;
test_class.type: BigQueryFileFormat
test_class.var_name: TEST_FILE_FORMAT
test_class.declarator: TEST_WRITE_DISPOSITION =
        BigQueryConfiguration.OUTPUT_TABLE_WRITE_DISPOSITION.getDefault()
test_class.modifier: private static final
test_class.original_string: private static final String TEST_WRITE_DISPOSITION =
        BigQueryConfiguration.OUTPUT_TABLE_WRITE_DISPOSITION.getDefault();
test_class.type: String
test_class.var_name: TEST_WRITE_DISPOSITION
test_class.declarator: TEST_CREATE_DISPOSITION =
        BigQueryConfiguration.OUTPUT_TABLE_CREATE_DISPOSITION.getDefault()
test_class.modifier: private static final
test_class.original_string: private static final String TEST_CREATE_DISPOSITION =
        BigQueryConfiguration.OUTPUT_TABLE_CREATE_DISPOSITION.getDefault();
test_class.type: String
test_class.var_name: TEST_CREATE_DISPOSITION
test_class.declarator: TEST_OUTPUT_CLASS = TextOutputFormat.class
test_class.modifier: @SuppressWarnings("rawtypes")
    private static final
test_class.original_string: @SuppressWarnings("rawtypes")
    private static final Class<? extends FileOutputFormat> TEST_OUTPUT_CLASS = TextOutputFormat.class;
test_class.type: Class<? extends FileOutputFormat>
test_class.var_name: TEST_OUTPUT_CLASS
test_class.declarator: TEST_TABLE_SCHEMA =
        BigQueryTableSchema.wrap(
            new TableSchema()
                .setFields(
                    ImmutableList.of(
                        new TableFieldSchema().setName("Word").setType("STRING"),
                        new TableFieldSchema().setName("Count").setType("INTEGER"))))
test_class.modifier: private static final
test_class.original_string: private static final BigQueryTableSchema TEST_TABLE_SCHEMA =
        BigQueryTableSchema.wrap(
            new TableSchema()
                .setFields(
                    ImmutableList.of(
                        new TableFieldSchema().setName("Word").setType("STRING"),
                        new TableFieldSchema().setName("Count").setType("INTEGER"))));
test_class.type: BigQueryTableSchema
test_class.var_name: TEST_TABLE_SCHEMA
test_class.declarator: TEST_KMS_KEY_NAME =
        "projects/domain:project/locations/us-west1/keyRings/ring-1/cryptoKeys/key-1"
test_class.modifier: private static final
test_class.original_string: private static final String TEST_KMS_KEY_NAME =
        "projects/domain:project/locations/us-west1/keyRings/ring-1/cryptoKeys/key-1";
test_class.type: String
test_class.var_name: TEST_KMS_KEY_NAME
test_class.declarator: TEST_TASK_ATTEMPT_ID =
        new TaskAttemptID(new TaskID("sample_task", 100, false, 200), 1)
test_class.modifier: private static final
test_class.original_string: private static final TaskAttemptID TEST_TASK_ATTEMPT_ID =
        new TaskAttemptID(new TaskID("sample_task", 100, false, 200), 1);
test_class.type: TaskAttemptID
test_class.var_name: TEST_TASK_ATTEMPT_ID
test_class.declarator: TEST_OUTPUT_PATH_STRING = "gs://test_bucket/test_directory/"
test_class.modifier: private static final
test_class.original_string: private static final String TEST_OUTPUT_PATH_STRING = "gs://test_bucket/test_directory/";
test_class.type: String
test_class.var_name: TEST_OUTPUT_PATH_STRING
test_class.declarator: TEST_OUTPUT_FILE_STRING = TEST_OUTPUT_PATH_STRING + "test_file"
test_class.modifier: private static final
test_class.original_string: private static final String TEST_OUTPUT_FILE_STRING = TEST_OUTPUT_PATH_STRING + "test_file";
test_class.type: String
test_class.var_name: TEST_OUTPUT_FILE_STRING
test_class.declarator: ghfs
test_class.modifier: private
test_class.original_string: private InMemoryGoogleHadoopFileSystem ghfs;
test_class.type: InMemoryGoogleHadoopFileSystem
test_class.var_name: ghfs
test_class.declarator: outputTableRef
test_class.modifier: private
test_class.original_string: private TableReference outputTableRef;
test_class.type: TableReference
test_class.var_name: outputTableRef
test_class.declarator: conf
test_class.modifier: private
test_class.original_string: private Configuration conf;
test_class.type: Configuration
test_class.var_name: conf
test_class.declarator: outputPath
test_class.modifier: private
test_class.original_string: private Path outputPath;
test_class.type: Path
test_class.var_name: outputPath
test_class.declarator: outputSampleFilePath
test_class.modifier: private
test_class.original_string: private Path outputSampleFilePath;
test_class.type: Path
test_class.var_name: outputSampleFilePath
test_class.declarator: job
test_class.modifier: private
test_class.original_string: private Job job;
test_class.type: Job
test_class.var_name: job
test_class.declarator: committer
test_class.modifier: private
test_class.original_string: private IndirectBigQueryOutputCommitter committer;
test_class.type: IndirectBigQueryOutputCommitter
test_class.var_name: committer
test_class.declarator: mockBigQueryHelper
test_class.modifier: @Mock private
test_class.original_string: @Mock private BigQueryHelper mockBigQueryHelper;
test_class.type: BigQueryHelper
test_class.var_name: mockBigQueryHelper
test_class.declarator: mockTaskAttemptContext
test_class.modifier: @Mock private
test_class.original_string: @Mock private TaskAttemptContext mockTaskAttemptContext;
test_class.type: TaskAttemptContext
test_class.var_name: mockTaskAttemptContext
test_class.declarator: mockCommitter
test_class.modifier: @Mock private
test_class.original_string: @Mock private OutputCommitter mockCommitter;
test_class.type: OutputCommitter
test_class.var_name: mockCommitter
test_class.file: bigquery/src/test/java/com/google/cloud/hadoop/io/bigquery/output/IndirectBigQueryOutputCommitterTest.java
test_class.identifier: IndirectBigQueryOutputCommitterTest
test_case.body: @SuppressWarnings("unchecked")
    @Test
    public void testCommitJobInterrupt() throws Exception {
      // Setup the sample directory.
      generateSampleFiles();
  
      // Setup the expected exception
      InterruptedException helperInterruptedException = new InterruptedException("Test exception");
  
      // Configure special case mock.
      doThrow(helperInterruptedException)
          .when(mockBigQueryHelper)
          .importFromGcs(
              any(String.class),
              any(TableReference.class),
              any(TableSchema.class),
              any(TimePartitioning.class),
              anyString(),
              any(BigQueryFileFormat.class),
              any(String.class),
              any(String.class),
              any(List.class),
              eq(true));
  
      IOException thrown = assertThrows(IOException.class, () -> committer.commitJob(job));
      assertThat(thrown).hasCauseThat().isEqualTo(helperInterruptedException);
  
      // Verify we're making the BigQuery import call.
      verify(mockBigQueryHelper)
          .importFromGcs(
              eq(TEST_PROJECT_ID),
              eq(outputTableRef),
              eq(TEST_TABLE_SCHEMA.get()),
              eq(TEST_TIME_PARTITIONING.get()),
              eq(TEST_KMS_KEY_NAME),
              eq(TEST_FILE_FORMAT),
              eq(TEST_CREATE_DISPOSITION),
              eq(TEST_WRITE_DISPOSITION),
              any(List.class), // Tested, no need to capture
              eq(true));
  
      // Verify the delegate is being called.
      verify(mockCommitter).commitJob(eq(job));
    }
test_case.class_method_signature: IndirectBigQueryOutputCommitterTest.testCommitJobInterrupt()
test_case.full_signature: @SuppressWarnings("unchecked") @Test public void testCommitJobInterrupt()
test_case.identifier: testCommitJobInterrupt
test_case.invocations: generateSampleFiles importFromGcs when doThrow any any any any anyString any any any any eq assertThrows commitJob isEqualTo hasCauseThat assertThat importFromGcs verify eq eq eq get eq get eq eq eq eq any eq commitJob verify eq
test_case.modifiers: @SuppressWarnings("unchecked") @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCommitJobInterrupt()
focal_class.file: bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/IndirectBigQueryOutputCommitter.java
focal_class.identifier: IndirectBigQueryOutputCommitter
focal_class.class_method_signature: IndirectBigQueryOutputCommitter.IndirectBigQueryOutputCommitter(TaskAttemptContext context, OutputCommitter delegate)
focal_class.full_signature: public  IndirectBigQueryOutputCommitter(TaskAttemptContext context, OutputCommitter delegate)
focal_class.identifier: IndirectBigQueryOutputCommitter
focal_class.modifiers: public
focal_class.parameters: (TaskAttemptContext context, OutputCommitter delegate)
focal_class.signature:  IndirectBigQueryOutputCommitter(TaskAttemptContext context, OutputCommitter delegate)
focal_class.class_method_signature: IndirectBigQueryOutputCommitter.commitJob(JobContext context)
focal_class.full_signature: @Override public void commitJob(JobContext context)
focal_class.identifier: commitJob
focal_class.modifiers: @Override public
focal_class.parameters: (JobContext context)
focal_class.return: void
focal_class.signature: void commitJob(JobContext context)
focal_class.class_method_signature: IndirectBigQueryOutputCommitter.abortJob(JobContext context, State state)
focal_class.full_signature: @Override public void abortJob(JobContext context, State state)
focal_class.identifier: abortJob
focal_class.modifiers: @Override public
focal_class.parameters: (JobContext context, State state)
focal_class.return: void
focal_class.signature: void abortJob(JobContext context, State state)
focal_class.superclass: extends ForwardingBigQueryFileOutputCommitter
focal_method.body: @Override
    public void commitJob(JobContext context) throws IOException {
      super.commitJob(context);
  
      // Get the destination configuration information.
      Configuration conf = context.getConfiguration();
      TableReference destTable = BigQueryOutputConfiguration.getTableReference(conf);
      String jobProjectId = BigQueryOutputConfiguration.getJobProjectId(conf);
      String writeDisposition = BigQueryOutputConfiguration.getWriteDisposition(conf);
      String createDisposition = BigQueryOutputConfiguration.getCreateDisposition(conf);
      Optional<BigQueryTableSchema> destSchema = BigQueryOutputConfiguration.getTableSchema(conf);
      Optional<BigQueryTimePartitioning> timePartitioning =
          BigQueryOutputConfiguration.getTablePartitioning(conf);
      String kmsKeyName = BigQueryOutputConfiguration.getKmsKeyName(conf);
      BigQueryFileFormat outputFileFormat = BigQueryOutputConfiguration.getFileFormat(conf);
      List<String> sourceUris = getOutputFileURIs();
  
      try {
        getBigQueryHelper()
            .importFromGcs(
                jobProjectId,
                destTable,
                destSchema.isPresent() ? destSchema.get().get() : null,
                timePartitioning.isPresent() ? timePartitioning.get().get() : null,
                kmsKeyName,
                outputFileFormat,
                createDisposition,
                writeDisposition,
                sourceUris,
                true);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new IOException("Failed to import GCS into BigQuery", e);
      }
  
      cleanup(context);
    }
focal_method.class_method_signature: IndirectBigQueryOutputCommitter.commitJob(JobContext context)
focal_method.full_signature: @Override public void commitJob(JobContext context)
focal_method.identifier: commitJob
focal_method.invocations: commitJob getConfiguration getTableReference getJobProjectId getWriteDisposition getCreateDisposition getTableSchema getTablePartitioning getKmsKeyName getFileFormat getOutputFileURIs importFromGcs getBigQueryHelper isPresent get get isPresent get get interrupt currentThread cleanup
focal_method.modifiers: @Override public
focal_method.parameters: (JobContext context)
focal_method.return: void
focal_method.signature: void commitJob(JobContext context)