Java Code Examples for com.facebook.presto.testing.QueryRunner#installPlugin()

The following examples show how to use com.facebook.presto.testing.QueryRunner#installPlugin() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestUtils.java    From presto-kinesis with Apache License 2.0 6 votes vote down vote up
/**
 * Install the plugin into the given query runner, using the mock client and the given table descriptions.
 *
 * The plug in is returned so that the injector can be accessed and other setup items tested.
 *
 * @param queryRunner
 * @param streamDescriptions
 * @return
 */
public static KinesisPlugin installKinesisPlugin(QueryRunner queryRunner, Map<SchemaTableName, KinesisStreamDescription> streamDescriptions)
{
    KinesisPlugin kinesisPlugin = createPluginInstance();
    // Note: function literal with provided descriptions instead of KinesisTableDescriptionSupplier:
    kinesisPlugin.setTableDescriptionSupplier(() -> streamDescriptions);
    kinesisPlugin.setAltProviderClass(KinesisTestClientManager.class);

    queryRunner.installPlugin(kinesisPlugin);

    Map<String, String> kinesisConfig = ImmutableMap.of(
            "kinesis.default-schema", "default",
            "kinesis.access-key", "",
            "kinesis.secret-key", "");
    queryRunner.createCatalog("kinesis", "kinesis", kinesisConfig);

    return kinesisPlugin;
}
 
Example 2
Source File: KuduQueryRunnerFactory.java    From presto-kudu with Apache License 2.0 5 votes vote down vote up
private static void installKuduConnector(QueryRunner runner, String schema)
{
    String masterAddresses = System.getProperty("kudu.client.master-addresses", "localhost:7051");
    Map<String, String> properties = ImmutableMap.of(
                "kudu.client.master-addresses", masterAddresses);

    runner.installPlugin(new KuduPlugin());
    runner.createCatalog("kudu", "kudu", properties);

    runner.execute("DROP SCHEMA IF EXISTS " + schema);
    runner.execute("CREATE SCHEMA " + schema);
}
 
Example 3
Source File: TestUtils.java    From presto-kinesis with Apache License 2.0 5 votes vote down vote up
/**
 * Install the plug in into the given query runner, using normal setup but with the given table descriptions.
 *
 * Note that this uses the actual client and will incur charges from AWS when run.  Mainly for full
 * integration tests.
 *
 * @param queryRunner
 * @param streamDescriptions
 * @param accessKey
 * @param secretKey
 */
public static void installKinesisPlugin(QueryRunner queryRunner, Map<SchemaTableName, KinesisStreamDescription> streamDescriptions, String accessKey, String secretKey)
{
    KinesisPlugin kinesisPlugin = createPluginInstance();
    // Note: function literal with provided descriptions instead of KinesisTableDescriptionSupplier:
    kinesisPlugin.setTableDescriptionSupplier(() -> streamDescriptions);
    queryRunner.installPlugin(kinesisPlugin);

    Map<String, String> kinesisConfig = ImmutableMap.of(
                "kinesis.default-schema", "default",
                "kinesis.access-key", accessKey,
                "kinesis.secret-key", secretKey);
    queryRunner.createCatalog("kinesis", "kinesis", kinesisConfig);
}