Search in sources :

Example 1 with ImportDocumentsRequest

use of com.google.firestore.admin.v1.ImportDocumentsRequest in project java-firestore by googleapis.

the class FirestoreAdminClientTest method importDocumentsTest2.

@Test
public void importDocumentsTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    Operation resultOperation = Operation.newBuilder().setName("importDocumentsTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
    mockFirestoreAdmin.addResponse(resultOperation);
    String name = "name3373707";
    client.importDocumentsAsync(name).get();
    List<AbstractMessage> actualRequests = mockFirestoreAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ImportDocumentsRequest actualRequest = ((ImportDocumentsRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) ImportDocumentsRequest(com.google.firestore.admin.v1.ImportDocumentsRequest) Operation(com.google.longrunning.Operation) Test(org.junit.Test)

Example 2 with ImportDocumentsRequest

use of com.google.firestore.admin.v1.ImportDocumentsRequest in project java-firestore by googleapis.

the class FirestoreAdminClientTest method importDocumentsTest.

@Test
public void importDocumentsTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    Operation resultOperation = Operation.newBuilder().setName("importDocumentsTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
    mockFirestoreAdmin.addResponse(resultOperation);
    DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
    client.importDocumentsAsync(name).get();
    List<AbstractMessage> actualRequests = mockFirestoreAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ImportDocumentsRequest actualRequest = ((ImportDocumentsRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DatabaseName(com.google.firestore.admin.v1.DatabaseName) ImportDocumentsRequest(com.google.firestore.admin.v1.ImportDocumentsRequest) Operation(com.google.longrunning.Operation) Test(org.junit.Test)

Aggregations

ImportDocumentsRequest (com.google.firestore.admin.v1.ImportDocumentsRequest)2 Operation (com.google.longrunning.Operation)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Empty (com.google.protobuf.Empty)2 Test (org.junit.Test)2 DatabaseName (com.google.firestore.admin.v1.DatabaseName)1