use of com.google.pubsub.v1.ValidateSchemaResponse 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()));
}
use of com.google.pubsub.v1.ValidateSchemaResponse in project gapic-generator-java by googleapis.
the class SyncValidateSchemaProjectnameSchema method syncValidateSchemaProjectnameSchema.
public static void syncValidateSchemaProjectnameSchema() throws Exception {
// It may require modifications to work in your environment.
try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Schema schema = Schema.newBuilder().build();
ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema);
}
}
use of com.google.pubsub.v1.ValidateSchemaResponse in project gapic-generator-java by googleapis.
the class SyncValidateSchemaStringSchema method syncValidateSchemaStringSchema.
public static void syncValidateSchemaStringSchema() throws Exception {
// It may require modifications to work in your environment.
try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
Schema schema = Schema.newBuilder().build();
ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema);
}
}
Aggregations