use of com.google.pubsub.v1.GetSchemaRequest in project gapic-generator-java by googleapis.
the class SchemaServiceClientTest method getSchemaTest2.
@Test
public void getSchemaTest2() throws Exception {
Schema expectedResponse = Schema.newBuilder().setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()).setDefinition("definition-1014418093").build();
mockSchemaService.addResponse(expectedResponse);
String name = "name3373707";
Schema actualResponse = client.getSchema(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetSchemaRequest actualRequest = ((GetSchemaRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.pubsub.v1.GetSchemaRequest in project gapic-generator-java by googleapis.
the class SchemaServiceClientTest method getSchemaTest.
@Test
public void getSchemaTest() throws Exception {
Schema expectedResponse = Schema.newBuilder().setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()).setDefinition("definition-1014418093").build();
mockSchemaService.addResponse(expectedResponse);
SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
Schema actualResponse = client.getSchema(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetSchemaRequest actualRequest = ((GetSchemaRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.pubsub.v1.GetSchemaRequest in project java-pubsub by googleapis.
the class SchemaServiceClientTest method getSchemaTest.
@Test
public void getSchemaTest() throws Exception {
Schema expectedResponse = Schema.newBuilder().setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()).setDefinition("definition-1014418093").build();
mockSchemaService.addResponse(expectedResponse);
SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
Schema actualResponse = client.getSchema(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetSchemaRequest actualRequest = ((GetSchemaRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.pubsub.v1.GetSchemaRequest in project java-pubsub by googleapis.
the class SchemaServiceClientTest method getSchemaTest2.
@Test
public void getSchemaTest2() throws Exception {
Schema expectedResponse = Schema.newBuilder().setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()).setDefinition("definition-1014418093").build();
mockSchemaService.addResponse(expectedResponse);
String name = "name3373707";
Schema actualResponse = client.getSchema(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetSchemaRequest actualRequest = ((GetSchemaRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.pubsub.v1.GetSchemaRequest in project gapic-generator-java by googleapis.
the class AsyncGetSchema method asyncGetSchema.
public static void asyncGetSchema() throws Exception {
// It may require modifications to work in your environment.
try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
GetSchemaRequest request = GetSchemaRequest.newBuilder().setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()).setView(SchemaView.forNumber(0)).build();
ApiFuture<Schema> future = schemaServiceClient.getSchemaCallable().futureCall(request);
// Do something.
Schema response = future.get();
}
}
Aggregations