use of com.google.pubsub.v1.DeleteSchemaRequest in project java-pubsub by googleapis.
the class SchemaServiceClientTest method deleteSchemaTest.
@Test
public void deleteSchemaTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockSchemaService.addResponse(expectedResponse);
SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
client.deleteSchema(name);
List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSchemaRequest actualRequest = ((DeleteSchemaRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.pubsub.v1.DeleteSchemaRequest in project gapic-generator-java by googleapis.
the class SyncDeleteSchema method syncDeleteSchema.
public static void syncDeleteSchema() throws Exception {
// It may require modifications to work in your environment.
try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder().setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()).build();
schemaServiceClient.deleteSchema(request);
}
}
use of com.google.pubsub.v1.DeleteSchemaRequest in project gapic-generator-java by googleapis.
the class SchemaServiceClientTest method deleteSchemaTest.
@Test
public void deleteSchemaTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockSchemaService.addResponse(expectedResponse);
SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
client.deleteSchema(name);
List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSchemaRequest actualRequest = ((DeleteSchemaRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.pubsub.v1.DeleteSchemaRequest in project gapic-generator-java by googleapis.
the class SchemaServiceClientTest method deleteSchemaTest2.
@Test
public void deleteSchemaTest2() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockSchemaService.addResponse(expectedResponse);
String name = "name3373707";
client.deleteSchema(name);
List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSchemaRequest actualRequest = ((DeleteSchemaRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.pubsub.v1.DeleteSchemaRequest in project gapic-generator-java by googleapis.
the class SchemaServiceClient method deleteSchema.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a schema.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
* SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
* schemaServiceClient.deleteSchema(name);
* }
* }</pre>
*
* @param name Required. Name of the schema to delete. Format is
* `projects/{project}/schemas/{schema}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteSchema(SchemaName name) {
DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteSchema(request);
}
Aggregations