Search in sources :

Example 6 with ValidateSchemaRequest

use of com.google.pubsub.v1.ValidateSchemaRequest in project java-pubsub by googleapis.

the class SchemaServiceClientTest method validateSchemaTest.

@Test
public void validateSchemaTest() throws Exception {
    ValidateSchemaResponse expectedResponse = ValidateSchemaResponse.newBuilder().build();
    mockSchemaService.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    Schema schema = Schema.newBuilder().build();
    ValidateSchemaResponse actualResponse = client.validateSchema(parent, schema);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ValidateSchemaRequest actualRequest = ((ValidateSchemaRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(schema, actualRequest.getSchema());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ValidateSchemaResponse(com.google.pubsub.v1.ValidateSchemaResponse) AbstractMessage(com.google.protobuf.AbstractMessage) ProjectName(com.google.pubsub.v1.ProjectName) Schema(com.google.pubsub.v1.Schema) ValidateSchemaRequest(com.google.pubsub.v1.ValidateSchemaRequest) Test(org.junit.Test)

Aggregations

ValidateSchemaRequest (com.google.pubsub.v1.ValidateSchemaRequest)6 ValidateSchemaResponse (com.google.pubsub.v1.ValidateSchemaResponse)6 AbstractMessage (com.google.protobuf.AbstractMessage)4 Schema (com.google.pubsub.v1.Schema)4 Test (org.junit.Test)4 SchemaServiceClient (com.google.cloud.pubsub.v1.SchemaServiceClient)2 ByteString (com.google.protobuf.ByteString)2 ProjectName (com.google.pubsub.v1.ProjectName)2