Search in sources :

Example 1 with ExportDocumentsRequest

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

the class FirestoreAdminClientTest method exportDocumentsTest.

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

Example 2 with ExportDocumentsRequest

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

the class FirestoreAdminClientTest method exportDocumentsTest2.

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

Aggregations

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