BatchJobServiceClient implements BackgroundResource { public final MutateBatchJobResponse mutateBatchJob( String customerId, BatchJobOperation operation) { MutateBatchJobRequest request = MutateBatchJobRequest.newBuilder() .setCustomerId(customerId) .setOperation(operation) .build(); return mutateBatchJob(request); } protected  BatchJobServiceClient(BatchJobServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  BatchJobServiceClient(BatchJobServiceStub stub); static final BatchJobServiceClient create(); static final BatchJobServiceClient create(BatchJobServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final BatchJobServiceClient create(BatchJobServiceStub stub); final BatchJobServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") BatchJobServiceStub getStub(); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationsClient getOperationsClient(); final MutateBatchJobResponse mutateBatchJob(
      String customerId, BatchJobOperation operation); final MutateBatchJobResponse mutateBatchJob(MutateBatchJobRequest request); final UnaryCallable<MutateBatchJobRequest, MutateBatchJobResponse> mutateBatchJobCallable(); final BatchJob getBatchJob(BatchJobName resourceName); final BatchJob getBatchJob(String resourceName); final BatchJob getBatchJob(GetBatchJobRequest request); final UnaryCallable<GetBatchJobRequest, BatchJob> getBatchJobCallable(); final ListBatchJobResultsPagedResponse listBatchJobResults(BatchJobName resourceName); final ListBatchJobResultsPagedResponse listBatchJobResults(String resourceName); final ListBatchJobResultsPagedResponse listBatchJobResults(
      ListBatchJobResultsRequest request); final UnaryCallable<ListBatchJobResultsRequest, ListBatchJobResultsPagedResponse> listBatchJobResultsPagedCallable(); final UnaryCallable<ListBatchJobResultsRequest, ListBatchJobResultsResponse> listBatchJobResultsCallable(); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationFuture<Empty, BatchJobMetadata> runBatchJobAsync(
      BatchJobName resourceName); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationFuture<Empty, BatchJobMetadata> runBatchJobAsync(String resourceName); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationFuture<Empty, BatchJobMetadata> runBatchJobAsync(
      RunBatchJobRequest request); @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") final OperationCallable<RunBatchJobRequest, Empty, BatchJobMetadata> runBatchJobOperationCallable(); final UnaryCallable<RunBatchJobRequest, Operation> runBatchJobCallable(); final AddBatchJobOperationsResponse addBatchJobOperations(
      BatchJobName resourceName, String sequenceToken, List<MutateOperation> mutateOperations); final AddBatchJobOperationsResponse addBatchJobOperations(
      String resourceName, String sequenceToken, List<MutateOperation> mutateOperations); final AddBatchJobOperationsResponse addBatchJobOperations(
      BatchJobName resourceName, List<MutateOperation> mutateOperations); final AddBatchJobOperationsResponse addBatchJobOperations(
      String resourceName, List<MutateOperation> mutateOperations); final AddBatchJobOperationsResponse addBatchJobOperations(
      AddBatchJobOperationsRequest request); final UnaryCallable<AddBatchJobOperationsRequest, AddBatchJobOperationsResponse> addBatchJobOperationsCallable(); @Override final void close(); @Override void shutdown(); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override void shutdownNow(); @Override boolean awaitTermination(long duration, TimeUnit unit);  }
@Test @SuppressWarnings("all") public void mutateBatchJobTest() { MutateBatchJobResponse expectedResponse = MutateBatchJobResponse.newBuilder().build(); mockBatchJobService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; BatchJobOperation operation = BatchJobOperation.newBuilder().build(); MutateBatchJobResponse actualResponse = client.mutateBatchJob(customerId, operation); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockBatchJobService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateBatchJobRequest actualRequest = (MutateBatchJobRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operation, actualRequest.getOperation()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void mutateBatchJobExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockBatchJobService.addException(exception); try { String customerId = "customerId-1772061412"; BatchJobOperation operation = BatchJobOperation.newBuilder().build(); client.mutateBatchJob(customerId, operation); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }