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()));
}
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()));
}
Aggregations