Search in sources :

Example 21 with Empty

use of com.google.protobuf.Empty in project google-cloud-java by GoogleCloudPlatform.

the class LoggingImplTest method testDeleteMetricAsync_Null.

@Test
public void testDeleteMetricAsync_Null() throws ExecutionException, InterruptedException {
    DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(METRIC_NAME_PB).build();
    ApiFuture<Empty> response = ApiFutures.immediateFuture(null);
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response);
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertFalse(logging.deleteMetricAsync(METRIC_NAME).get());
}
Also used : Empty(com.google.protobuf.Empty) DeleteLogMetricRequest(com.google.logging.v2.DeleteLogMetricRequest) Test(org.junit.Test)

Example 22 with Empty

use of com.google.protobuf.Empty in project google-cloud-java by GoogleCloudPlatform.

the class LoggingImplTest method testDeleteMetricAsync.

@Test
public void testDeleteMetricAsync() throws ExecutionException, InterruptedException {
    DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(METRIC_NAME_PB).build();
    ApiFuture<Empty> response = ApiFutures.immediateFuture(Empty.getDefaultInstance());
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response);
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertTrue(logging.deleteMetricAsync(METRIC_NAME).get());
}
Also used : Empty(com.google.protobuf.Empty) DeleteLogMetricRequest(com.google.logging.v2.DeleteLogMetricRequest) Test(org.junit.Test)

Example 23 with Empty

use of com.google.protobuf.Empty in project google-cloud-java by GoogleCloudPlatform.

the class SubscriptionAdminClientTest method modifyPushConfigTest.

@Test
@SuppressWarnings("all")
public void modifyPushConfigTest() {
    Empty expectedResponse = Empty.newBuilder().build();
    mockSubscriber.addResponse(expectedResponse);
    SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
    PushConfig pushConfig = PushConfig.newBuilder().build();
    client.modifyPushConfig(subscription, pushConfig);
    List<GeneratedMessageV3> actualRequests = mockSubscriber.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ModifyPushConfigRequest actualRequest = (ModifyPushConfigRequest) actualRequests.get(0);
    Assert.assertEquals(subscription, actualRequest.getSubscriptionAsSubscriptionName());
    Assert.assertEquals(pushConfig, actualRequest.getPushConfig());
}
Also used : PushConfig(com.google.pubsub.v1.PushConfig) Empty(com.google.protobuf.Empty) SubscriptionName(com.google.pubsub.v1.SubscriptionName) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) ModifyPushConfigRequest(com.google.pubsub.v1.ModifyPushConfigRequest) Test(org.junit.Test)

Example 24 with Empty

use of com.google.protobuf.Empty in project google-cloud-java by GoogleCloudPlatform.

the class TopicAdminClientTest method deleteTopicTest.

@Test
@SuppressWarnings("all")
public void deleteTopicTest() {
    Empty expectedResponse = Empty.newBuilder().build();
    mockPublisher.addResponse(expectedResponse);
    TopicName topic = TopicName.create("[PROJECT]", "[TOPIC]");
    client.deleteTopic(topic);
    List<GeneratedMessageV3> actualRequests = mockPublisher.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteTopicRequest actualRequest = (DeleteTopicRequest) actualRequests.get(0);
    Assert.assertEquals(topic, actualRequest.getTopicAsTopicName());
}
Also used : Empty(com.google.protobuf.Empty) DeleteTopicRequest(com.google.pubsub.v1.DeleteTopicRequest) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) TopicName(com.google.pubsub.v1.TopicName) Test(org.junit.Test)

Aggregations

Empty (com.google.protobuf.Empty)24 Test (org.junit.Test)24 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)13 DeleteLogMetricRequest (com.google.logging.v2.DeleteLogMetricRequest)5 DeleteSinkRequest (com.google.logging.v2.DeleteSinkRequest)5 SubscriptionName (com.google.pubsub.v1.SubscriptionName)4 DeleteLogRequest (com.google.logging.v2.DeleteLogRequest)3 ArrayList (java.util.ArrayList)3 ByteString (com.google.protobuf.ByteString)2 PatchTracesRequest (com.google.devtools.cloudtrace.v1.PatchTracesRequest)1 Traces (com.google.devtools.cloudtrace.v1.Traces)1 LogNameOneof (com.google.logging.v2.LogNameOneof)1 MetricNameOneof (com.google.logging.v2.MetricNameOneof)1 SinkNameOneof (com.google.logging.v2.SinkNameOneof)1 CreateTimeSeriesRequest (com.google.monitoring.v3.CreateTimeSeriesRequest)1 DeleteGroupRequest (com.google.monitoring.v3.DeleteGroupRequest)1 DeleteMetricDescriptorRequest (com.google.monitoring.v3.DeleteMetricDescriptorRequest)1 GroupName (com.google.monitoring.v3.GroupName)1 MetricDescriptorName (com.google.monitoring.v3.MetricDescriptorName)1 ProjectName (com.google.monitoring.v3.ProjectName)1