use of com.google.cloud.grpc.GrpcTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteLoggingHelper method create.
/**
* Creates a {@code RemoteLoggingHelper} object for the given project id and JSON key input
* stream.
*
* @param projectId id of the project to be used for running the tests
* @param keyStream input stream for a JSON key
* @return A {@code RemoteLoggingHelper} object for the provided options
* @throws com.google.cloud.logging.testing.RemoteLoggingHelper.LoggingHelperException if
* {@code keyStream} is not a valid JSON key stream
*/
public static RemoteLoggingHelper create(String projectId, InputStream keyStream) throws LoggingHelperException {
try {
GrpcTransportOptions transportOptions = LoggingOptions.getDefaultGrpcTransportOptions();
LoggingOptions storageOptions = LoggingOptions.newBuilder().setCredentials(ServiceAccountCredentials.fromStream(keyStream)).setProjectId(projectId).setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteLoggingHelper(storageOptions);
} catch (IOException ex) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, ex.getMessage());
}
throw LoggingHelperException.translate(ex);
}
}
use of com.google.cloud.grpc.GrpcTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteLoggingHelper method create.
/**
* Creates a {@code RemoteLoggingHelper} object using default project id and authentication
* credentials.
*/
public static RemoteLoggingHelper create() throws LoggingHelperException {
GrpcTransportOptions transportOptions = LoggingOptions.getDefaultGrpcTransportOptions();
LoggingOptions loggingOptions = LoggingOptions.newBuilder().setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteLoggingHelper(loggingOptions);
}
use of com.google.cloud.grpc.GrpcTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class SerializationTest method serializableObjects.
@Override
protected Serializable[] serializableObjects() {
GrpcTransportOptions transportOptions = LoggingOptions.getDefaultGrpcTransportOptions();
LoggingOptions options = LoggingOptions.newBuilder().setProjectId("p1").setTransportOptions(transportOptions).build();
return new Serializable[] { options, HTTP_REQUEST, OPERATION, STRING_PAYLOAD, JSON_PAYLOAD, PROTO_PAYLOAD, ENTRY, METRIC_INFO, METRIC, BUCKET_DESTINATION, DATASET_DESTINATION, TOPIC_DESTINATION, SINK_INFO, SINK, PAGE_TOKEN_OPTION, PAGE_SIZE_OPTION, LABELS_OPTION, LOG_OPTION, RESOURCE_OPTION, ENTRY_PAGE_TOKEN_OPTION, ENTRY_PAGE_SIZE_OPTION, ENTRY_FILTER_OPTION, ENTRY_SORT_ORDER_OPTION };
}
Aggregations