BatchJobServiceClient implements BackgroundResource { public final ListBatchJobResultsPagedResponse listBatchJobResults(BatchJobName resourceName) { ListBatchJobResultsRequest request = ListBatchJobResultsRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return listBatchJobResults(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 listBatchJobResultsTest() { String nextPageToken = ""; BatchJobResult resultsElement = BatchJobResult.newBuilder().build(); List<BatchJobResult> results = Arrays.asList(resultsElement); ListBatchJobResultsResponse expectedResponse = ListBatchJobResultsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllResults(results) .build(); mockBatchJobService.addResponse(expectedResponse); BatchJobName resourceName = BatchJobName.of("[CUSTOMER]", "[BATCH_JOB]"); ListBatchJobResultsPagedResponse pagedListResponse = client.listBatchJobResults(resourceName); List<BatchJobResult> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getResultsList().get(0), resources.get(0)); List<AbstractMessage> actualRequests = mockBatchJobService.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListBatchJobResultsRequest actualRequest = (ListBatchJobResultsRequest) actualRequests.get(0); Assert.assertEquals(resourceName, BatchJobName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void listBatchJobResultsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockBatchJobService.addException(exception); try { BatchJobName resourceName = BatchJobName.of("[CUSTOMER]", "[BATCH_JOB]"); client.listBatchJobResults(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }