Search in sources :

Example 31 with GeneratedMessageV3

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

the class GroupServiceClientTest method createGroupTest.

@Test
@SuppressWarnings("all")
public void createGroupTest() {
    GroupName name2 = GroupName.create("[PROJECT]", "[GROUP]");
    String displayName = "displayName1615086568";
    GroupName parentName = GroupName.create("[PROJECT]", "[GROUP]");
    String filter = "filter-1274492040";
    boolean isCluster = false;
    Group expectedResponse = Group.newBuilder().setNameWithGroupName(name2).setDisplayName(displayName).setParentNameWithGroupName(parentName).setFilter(filter).setIsCluster(isCluster).build();
    mockGroupService.addResponse(expectedResponse);
    ProjectName name = ProjectName.create("[PROJECT]");
    Group group = Group.newBuilder().build();
    Group actualResponse = client.createGroup(name, group);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateGroupRequest actualRequest = (CreateGroupRequest) actualRequests.get(0);
    Assert.assertEquals(name, actualRequest.getNameAsProjectName());
    Assert.assertEquals(group, actualRequest.getGroup());
}
Also used : GroupName(com.google.monitoring.v3.GroupName) Group(com.google.monitoring.v3.Group) ProjectName(com.google.monitoring.v3.ProjectName) CreateGroupRequest(com.google.monitoring.v3.CreateGroupRequest) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Example 32 with GeneratedMessageV3

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

the class GroupServiceClientTest method updateGroupTest.

@Test
@SuppressWarnings("all")
public void updateGroupTest() {
    GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
    String displayName = "displayName1615086568";
    GroupName parentName = GroupName.create("[PROJECT]", "[GROUP]");
    String filter = "filter-1274492040";
    boolean isCluster = false;
    Group expectedResponse = Group.newBuilder().setNameWithGroupName(name).setDisplayName(displayName).setParentNameWithGroupName(parentName).setFilter(filter).setIsCluster(isCluster).build();
    mockGroupService.addResponse(expectedResponse);
    Group group = Group.newBuilder().build();
    Group actualResponse = client.updateGroup(group);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateGroupRequest actualRequest = (UpdateGroupRequest) actualRequests.get(0);
    Assert.assertEquals(group, actualRequest.getGroup());
}
Also used : GroupName(com.google.monitoring.v3.GroupName) Group(com.google.monitoring.v3.Group) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) UpdateGroupRequest(com.google.monitoring.v3.UpdateGroupRequest) Test(org.junit.Test)

Example 33 with GeneratedMessageV3

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

the class GroupServiceClientTest method getGroupTest.

@Test
@SuppressWarnings("all")
public void getGroupTest() {
    GroupName name2 = GroupName.create("[PROJECT]", "[GROUP]");
    String displayName = "displayName1615086568";
    GroupName parentName = GroupName.create("[PROJECT]", "[GROUP]");
    String filter = "filter-1274492040";
    boolean isCluster = false;
    Group expectedResponse = Group.newBuilder().setNameWithGroupName(name2).setDisplayName(displayName).setParentNameWithGroupName(parentName).setFilter(filter).setIsCluster(isCluster).build();
    mockGroupService.addResponse(expectedResponse);
    GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
    Group actualResponse = client.getGroup(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0);
    Assert.assertEquals(name, actualRequest.getNameAsGroupName());
}
Also used : GroupName(com.google.monitoring.v3.GroupName) Group(com.google.monitoring.v3.Group) GetGroupRequest(com.google.monitoring.v3.GetGroupRequest) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Example 34 with GeneratedMessageV3

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

the class ConfigClientTest method createSinkTest.

@Test
@SuppressWarnings("all")
public void createSinkTest() {
    String name = "name3373707";
    ResourceName destination = ProjectName.create("[PROJECT]");
    String filter = "filter-1274492040";
    String writerIdentity = "writerIdentity775638794";
    LogSink expectedResponse = LogSink.newBuilder().setName(name).setDestinationWithResourceName(destination).setFilter(filter).setWriterIdentity(writerIdentity).build();
    mockConfigServiceV2.addResponse(expectedResponse);
    ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
    LogSink sink = LogSink.newBuilder().build();
    LogSink actualResponse = client.createSink(parent, sink);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateSinkRequest actualRequest = (CreateSinkRequest) actualRequests.get(0);
    Assert.assertEquals(parent, actualRequest.getParentAsParentNameOneof());
    Assert.assertEquals(sink, actualRequest.getSink());
}
Also used : LogSink(com.google.logging.v2.LogSink) ResourceName(com.google.api.resourcenames.ResourceName) ParentNameOneof(com.google.logging.v2.ParentNameOneof) CreateSinkRequest(com.google.logging.v2.CreateSinkRequest) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Example 35 with GeneratedMessageV3

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

the class ConfigClientTest method updateSinkTest.

@Test
@SuppressWarnings("all")
public void updateSinkTest() {
    String name = "name3373707";
    ResourceName destination = ProjectName.create("[PROJECT]");
    String filter = "filter-1274492040";
    String writerIdentity = "writerIdentity775638794";
    LogSink expectedResponse = LogSink.newBuilder().setName(name).setDestinationWithResourceName(destination).setFilter(filter).setWriterIdentity(writerIdentity).build();
    mockConfigServiceV2.addResponse(expectedResponse);
    SinkNameOneof sinkName = SinkNameOneof.from(SinkName.create("[PROJECT]", "[SINK]"));
    LogSink sink = LogSink.newBuilder().build();
    LogSink actualResponse = client.updateSink(sinkName, sink);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateSinkRequest actualRequest = (UpdateSinkRequest) actualRequests.get(0);
    Assert.assertEquals(sinkName, actualRequest.getSinkNameAsSinkNameOneof());
    Assert.assertEquals(sink, actualRequest.getSink());
}
Also used : LogSink(com.google.logging.v2.LogSink) ResourceName(com.google.api.resourcenames.ResourceName) SinkNameOneof(com.google.logging.v2.SinkNameOneof) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) UpdateSinkRequest(com.google.logging.v2.UpdateSinkRequest) Test(org.junit.Test)

Aggregations

GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)75 Test (org.junit.Test)75 ByteString (com.google.protobuf.ByteString)13 Empty (com.google.protobuf.Empty)13 SubscriptionName (com.google.pubsub.v1.SubscriptionName)9 ArrayList (java.util.ArrayList)8 TopicName (com.google.pubsub.v1.TopicName)7 Document (com.google.cloud.language.v1beta2.Document)5 GroupName (com.google.monitoring.v3.GroupName)5 ProjectName (com.google.monitoring.v3.ProjectName)5 Document (com.google.cloud.language.v1.Document)4 EncodingType (com.google.cloud.language.v1beta2.EncodingType)4 ProjectName (com.google.devtools.clouderrorreporting.v1beta1.ProjectName)4 LogMetric (com.google.logging.v2.LogMetric)4 LogSink (com.google.logging.v2.LogSink)4 ParentNameOneof (com.google.logging.v2.ParentNameOneof)4 MetricDescriptor (com.google.api.MetricDescriptor)3 ResourceName (com.google.api.resourcenames.ResourceName)3 EncodingType (com.google.cloud.language.v1.EncodingType)3 Policy (com.google.iam.v1.Policy)3