Search in sources :

Example 6 with DeleteSchemaRequest

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()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest) SchemaName(com.google.pubsub.v1.SchemaName) Test(org.junit.Test)

Example 7 with DeleteSchemaRequest

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);
    }
}
Also used : DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest) SchemaServiceClient(com.google.cloud.pubsub.v1.SchemaServiceClient)

Example 8 with DeleteSchemaRequest

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()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest) SchemaName(com.google.pubsub.v1.SchemaName) Test(org.junit.Test)

Example 9 with DeleteSchemaRequest

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()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 10 with DeleteSchemaRequest

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);
}
Also used : DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest)

Aggregations

DeleteSchemaRequest (com.google.pubsub.v1.DeleteSchemaRequest)10 Empty (com.google.protobuf.Empty)5 AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 SchemaServiceClient (com.google.cloud.pubsub.v1.SchemaServiceClient)2 ByteString (com.google.protobuf.ByteString)2 SchemaName (com.google.pubsub.v1.SchemaName)2