use of com.google.example.library.v1.CreateShelfRequest in project gapic-generator-java by googleapis.
the class AsyncCreateShelf method asyncCreateShelf.
public static void asyncCreateShelf() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
CreateShelfRequest request = CreateShelfRequest.newBuilder().setShelf(Shelf.newBuilder().build()).build();
ApiFuture<Shelf> future = libraryServiceClient.createShelfCallable().futureCall(request);
// Do something.
Shelf response = future.get();
}
}
use of com.google.example.library.v1.CreateShelfRequest in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method createShelfTest.
@Test
public void createShelfTest() throws Exception {
Shelf expectedResponse = Shelf.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setTheme("theme110327241").build();
mockLibraryService.addResponse(expectedResponse);
Shelf shelf = Shelf.newBuilder().build();
Shelf actualResponse = client.createShelf(shelf);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateShelfRequest actualRequest = ((CreateShelfRequest) actualRequests.get(0));
Assert.assertEquals(shelf, actualRequest.getShelf());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations