use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class ConfigClientTest method deleteSinkTest.
@Test
@SuppressWarnings("all")
public void deleteSinkTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockConfigServiceV2.addResponse(expectedResponse);
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.create("[PROJECT]", "[SINK]"));
client.deleteSink(sinkName);
List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSinkRequest actualRequest = (DeleteSinkRequest) actualRequests.get(0);
Assert.assertEquals(sinkName, actualRequest.getSinkNameAsSinkNameOneof());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class LoggingClientTest method deleteLogTest.
@Test
@SuppressWarnings("all")
public void deleteLogTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockLoggingServiceV2.addResponse(expectedResponse);
LogNameOneof logName = LogNameOneof.from(LogName.create("[PROJECT]", "[LOG]"));
client.deleteLog(logName);
List<GeneratedMessageV3> actualRequests = mockLoggingServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteLogRequest actualRequest = (DeleteLogRequest) actualRequests.get(0);
Assert.assertEquals(logName, actualRequest.getLogNameAsLogNameOneof());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class LoggingClientTest method writeLogEntriesTest.
@Test
@SuppressWarnings("all")
public void writeLogEntriesTest() {
WriteLogEntriesResponse expectedResponse = WriteLogEntriesResponse.newBuilder().build();
mockLoggingServiceV2.addResponse(expectedResponse);
LogNameOneof logName = LogNameOneof.from(LogName.create("[PROJECT]", "[LOG]"));
MonitoredResource resource = MonitoredResource.newBuilder().build();
Map<String, String> labels = new HashMap<>();
List<LogEntry> entries = new ArrayList<>();
WriteLogEntriesResponse actualResponse = client.writeLogEntries(logName, resource, labels, entries);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockLoggingServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
WriteLogEntriesRequest actualRequest = (WriteLogEntriesRequest) actualRequests.get(0);
Assert.assertEquals(logName, actualRequest.getLogNameAsLogNameOneof());
Assert.assertEquals(resource, actualRequest.getResource());
Assert.assertEquals(labels, actualRequest.getLabelsMap());
Assert.assertEquals(entries, actualRequest.getEntriesList());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class LoggingClientTest method listLogEntriesTest.
@Test
@SuppressWarnings("all")
public void listLogEntriesTest() {
String nextPageToken = "";
LogEntry entriesElement = LogEntry.newBuilder().build();
List<LogEntry> entries = Arrays.asList(entriesElement);
ListLogEntriesResponse expectedResponse = ListLogEntriesResponse.newBuilder().setNextPageToken(nextPageToken).addAllEntries(entries).build();
mockLoggingServiceV2.addResponse(expectedResponse);
List<String> resourceNames = new ArrayList<>();
String filter = "filter-1274492040";
String orderBy = "orderBy1234304744";
ListLogEntriesPagedResponse pagedListResponse = client.listLogEntries(resourceNames, filter, orderBy);
List<LogEntry> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getEntriesList().get(0), resources.get(0));
List<GeneratedMessageV3> actualRequests = mockLoggingServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListLogEntriesRequest actualRequest = (ListLogEntriesRequest) actualRequests.get(0);
Assert.assertEquals(resourceNames, actualRequest.getResourceNamesList());
Assert.assertEquals(filter, actualRequest.getFilter());
Assert.assertEquals(orderBy, actualRequest.getOrderBy());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class MetricsClientTest method deleteLogMetricTest.
@Test
@SuppressWarnings("all")
public void deleteLogMetricTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockMetricsServiceV2.addResponse(expectedResponse);
MetricNameOneof metricName = MetricNameOneof.from(MetricName.create("[PROJECT]", "[METRIC]"));
client.deleteLogMetric(metricName);
List<GeneratedMessageV3> actualRequests = mockMetricsServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteLogMetricRequest actualRequest = (DeleteLogMetricRequest) actualRequests.get(0);
Assert.assertEquals(metricName, actualRequest.getMetricNameAsMetricNameOneof());
}
Aggregations