Search in sources :

Example 16 with Book

use of com.google.example.library.v1.Book in project gapic-generator-java by googleapis.

the class SyncDeleteBookBookname method syncDeleteBookBookname.

public static void syncDeleteBookBookname() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        BookName name = BookName.of("[SHELF]", "[BOOK]");
        libraryServiceClient.deleteBook(name);
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) BookName(com.google.example.library.v1.BookName)

Example 17 with Book

use of com.google.example.library.v1.Book in project gapic-generator-java by googleapis.

the class AsyncListBooksPaged method asyncListBooksPaged.

public static void asyncListBooksPaged() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        ListBooksRequest request = ListBooksRequest.newBuilder().setParent(ShelfName.of("[SHELF_ID]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
        while (true) {
            ListBooksResponse response = libraryServiceClient.listBooksCallable().call(request);
            for (Book element : response.getResponsesList()) {
            // doThingsWith(element);
            }
            String nextPageToken = response.getNextPageToken();
            if (!Strings.isNullOrEmpty(nextPageToken)) {
                request = request.toBuilder().setPageToken(nextPageToken).build();
            } else {
                break;
            }
        }
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) ListBooksResponse(com.google.example.library.v1.ListBooksResponse) Book(com.google.example.library.v1.Book) ListBooksRequest(com.google.example.library.v1.ListBooksRequest)

Example 18 with Book

use of com.google.example.library.v1.Book in project gapic-generator-java by googleapis.

the class AsyncGetBook method asyncGetBook.

public static void asyncGetBook() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        GetBookRequest request = GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
        ApiFuture<Book> future = libraryServiceClient.getBookCallable().futureCall(request);
        // Do something.
        Book response = future.get();
    }
}
Also used : GetBookRequest(com.google.example.library.v1.GetBookRequest) LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Book(com.google.example.library.v1.Book)

Example 19 with Book

use of com.google.example.library.v1.Book in project FAST_JAVA by KIMTAEKJUN.

the class ArrayListTest method main.

public static void main(String[] args) {
    // Book의 ArrayList 객체 배열 선언
    ArrayList<Book> library = new ArrayList<>();
    // add() → 객체를 리스트에 추가
    library.add(new Book("태백산맥1", "조정래"));
    library.add(new Book("태백산맥2", "조정래"));
    library.add(new Book("태백산맥3", "조정래"));
    library.add(new Book("태백산맥4", "조정래"));
    library.add(new Book("태백산맥5", "조정래"));
    // size() → 리스트에 들어있는 원소 수, get() → 인덱스의 위치에 있는 객체를 리턴
    for (int i = 0; i < library.size(); i++) {
        // 
        library.get(i).showInfo();
    }
}
Also used : Book(ch21.Book) ArrayList(java.util.ArrayList)

Example 20 with Book

use of com.google.example.library.v1.Book in project wicket by apache.

the class WicketTesterTest method bookmarkableLink.

/**
 * @throws Exception
 */
@Test
public void bookmarkableLink() throws Exception {
    // for WebPage without default constructor, I define a TestPageSource to
    // let the page be instatiated lately.
    Book mockBook = new Book("xxId", "xxName");
    tester.startPage(new ViewBook(mockBook));
    // assertion
    tester.assertRenderedPage(ViewBook.class);
    tester.clickLink("link");
    tester.assertRenderedPage(CreateBook.class);
}
Also used : CreateBook(org.apache.wicket.util.tester.apps_1.CreateBook) ViewBook(org.apache.wicket.util.tester.apps_1.ViewBook) Book(org.apache.wicket.util.tester.apps_1.Book) ViewBook(org.apache.wicket.util.tester.apps_1.ViewBook) Test(org.junit.Test)

Aggregations

Book (com.google.example.library.v1.Book)33 Test (org.junit.Test)25 LibraryServiceClient (com.google.cloud.example.library.v1.LibraryServiceClient)22 Book (student_arturs_melnikovs.lesson_10.level_02.Book)16 BookName (com.google.example.library.v1.BookName)12 AbstractMessage (com.google.protobuf.AbstractMessage)12 ShelfName (com.google.example.library.v1.ShelfName)9 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)7 StatusRuntimeException (io.grpc.StatusRuntimeException)7 MoveBookRequest (com.google.example.library.v1.MoveBookRequest)6 DeleteBookRequest (com.google.example.library.v1.DeleteBookRequest)5 Scanner (java.util.Scanner)5 CreateBookRequest (com.google.example.library.v1.CreateBookRequest)4 GetBookRequest (com.google.example.library.v1.GetBookRequest)4 Page (org.apache.wicket.Page)4 Book (org.apache.wicket.core.util.tester.apps_1.Book)4 WebPage (org.apache.wicket.markup.html.WebPage)4 AccessDeniedPage (org.apache.wicket.markup.html.pages.AccessDeniedPage)4 DummyPage (org.apache.wicket.resource.DummyPage)4 Book (org.apache.wicket.util.tester.apps_1.Book)4