use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class SyncDeleteShelfShelfname method syncDeleteShelfShelfname.
public static void syncDeleteShelfShelfname() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
ShelfName name = ShelfName.of("[SHELF_ID]");
libraryServiceClient.deleteShelf(name);
}
}
use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class SyncMergeShelvesShelfnameShelfname method syncMergeShelvesShelfnameShelfname.
public static void syncMergeShelvesShelfnameShelfname() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
ShelfName name = ShelfName.of("[SHELF_ID]");
ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
}
}
use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class SyncCreateBookShelfnameBook method syncCreateBookShelfnameBook.
public static void syncCreateBookShelfnameBook() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
ShelfName parent = ShelfName.of("[SHELF_ID]");
Book book = Book.newBuilder().build();
Book response = libraryServiceClient.createBook(parent, book);
}
}
use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method createBookTest.
@Test
public void createBookTest() throws Exception {
Book expectedResponse = Book.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).setAuthor("author-1406328437").setTitle("title110371416").setRead(true).build();
mockLibraryService.addResponse(expectedResponse);
ShelfName parent = ShelfName.of("[SHELF_ID]");
Book book = Book.newBuilder().build();
Book actualResponse = client.createBook(parent, book);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateBookRequest actualRequest = ((CreateBookRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(book, actualRequest.getBook());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method getShelfTest.
@Test
public void getShelfTest() throws Exception {
Shelf expectedResponse = Shelf.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setTheme("theme110327241").build();
mockLibraryService.addResponse(expectedResponse);
ShelfName name = ShelfName.of("[SHELF_ID]");
Shelf actualResponse = client.getShelf(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetShelfRequest actualRequest = ((GetShelfRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations