Search in sources :

Example 1 with MergeShelvesRequest

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

the class LibraryServiceClientTest method mergeShelvesTest2.

@Test
public void mergeShelvesTest2() throws Exception {
    Shelf expectedResponse = Shelf.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setTheme("theme110327241").build();
    mockLibraryService.addResponse(expectedResponse);
    ShelfName name = ShelfName.of("[SHELF_ID]");
    String otherShelf = "otherShelf-193668870";
    Shelf actualResponse = client.mergeShelves(name, otherShelf);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    MergeShelvesRequest actualRequest = ((MergeShelvesRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertEquals(otherShelf, actualRequest.getOtherShelf());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) Shelf(com.google.example.library.v1.Shelf) ShelfName(com.google.example.library.v1.ShelfName) MergeShelvesRequest(com.google.example.library.v1.MergeShelvesRequest) Test(org.junit.Test)

Example 2 with MergeShelvesRequest

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

the class AsyncMergeShelves method asyncMergeShelves.

public static void asyncMergeShelves() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        MergeShelvesRequest request = MergeShelvesRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setOtherShelf(ShelfName.of("[SHELF_ID]").toString()).build();
        ApiFuture<Shelf> future = libraryServiceClient.mergeShelvesCallable().futureCall(request);
        // Do something.
        Shelf response = future.get();
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Shelf(com.google.example.library.v1.Shelf) MergeShelvesRequest(com.google.example.library.v1.MergeShelvesRequest)

Example 3 with MergeShelvesRequest

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

the class SyncMergeShelves method syncMergeShelves.

public static void syncMergeShelves() throws Exception {
    // It may require modifications to work in your environment.
    try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
        MergeShelvesRequest request = MergeShelvesRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setOtherShelf(ShelfName.of("[SHELF_ID]").toString()).build();
        Shelf response = libraryServiceClient.mergeShelves(request);
    }
}
Also used : LibraryServiceClient(com.google.cloud.example.library.v1.LibraryServiceClient) Shelf(com.google.example.library.v1.Shelf) MergeShelvesRequest(com.google.example.library.v1.MergeShelvesRequest)

Example 4 with MergeShelvesRequest

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

the class LibraryServiceClientTest method mergeShelvesTest.

@Test
public void mergeShelvesTest() throws Exception {
    Shelf expectedResponse = Shelf.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setTheme("theme110327241").build();
    mockLibraryService.addResponse(expectedResponse);
    ShelfName name = ShelfName.of("[SHELF_ID]");
    ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
    Shelf actualResponse = client.mergeShelves(name, otherShelf);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    MergeShelvesRequest actualRequest = ((MergeShelvesRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertEquals(otherShelf.toString(), actualRequest.getOtherShelf());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) Shelf(com.google.example.library.v1.Shelf) ShelfName(com.google.example.library.v1.ShelfName) MergeShelvesRequest(com.google.example.library.v1.MergeShelvesRequest) Test(org.junit.Test)

Example 5 with MergeShelvesRequest

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

the class LibraryServiceClientTest method mergeShelvesTest3.

@Test
public void mergeShelvesTest3() throws Exception {
    Shelf expectedResponse = Shelf.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setTheme("theme110327241").build();
    mockLibraryService.addResponse(expectedResponse);
    String name = "name3373707";
    ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
    Shelf actualResponse = client.mergeShelves(name, otherShelf);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    MergeShelvesRequest actualRequest = ((MergeShelvesRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertEquals(otherShelf.toString(), actualRequest.getOtherShelf());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) Shelf(com.google.example.library.v1.Shelf) ShelfName(com.google.example.library.v1.ShelfName) MergeShelvesRequest(com.google.example.library.v1.MergeShelvesRequest) Test(org.junit.Test)

Aggregations

MergeShelvesRequest (com.google.example.library.v1.MergeShelvesRequest)6 Shelf (com.google.example.library.v1.Shelf)6 AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ShelfName (com.google.example.library.v1.ShelfName)3 LibraryServiceClient (com.google.cloud.example.library.v1.LibraryServiceClient)2