Java Code Examples for io.prestosql.spi.NodeManager

The following examples show how to use io.prestosql.spi.NodeManager. These examples are extracted from open source projects. 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 Project: presto   Source File: KafkaConnectorFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new JsonModule(),
            new KafkaConnectorModule(),
            extension,
            binder -> {
                binder.bind(ClassLoader.class).toInstance(KafkaConnectorFactory.class.getClassLoader());
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            });

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(KafkaConnector.class);
}
 
Example 2
Source Project: presto   Source File: JmxConnectorFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    Bootstrap app = new Bootstrap(
            new MBeanServerModule(),
            binder -> {
                configBinder(binder).bindConfig(JmxConnectorConfig.class);
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                binder.bind(JmxConnector.class).in(Scopes.SINGLETON);
                binder.bind(JmxHistoricalData.class).in(Scopes.SINGLETON);
                binder.bind(JmxMetadata.class).in(Scopes.SINGLETON);
                binder.bind(JmxSplitManager.class).in(Scopes.SINGLETON);
                binder.bind(JmxPeriodicSampler.class).in(Scopes.SINGLETON);
                binder.bind(JmxRecordSetProvider.class).in(Scopes.SINGLETON);
            });

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(JmxConnector.class);
}
 
Example 3
Source Project: presto   Source File: JdbcConnectorFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> requiredConfig, ConnectorContext context)
{
    requireNonNull(requiredConfig, "requiredConfig is null");

    Bootstrap app = new Bootstrap(
            binder -> binder.bind(TypeManager.class).toInstance(context.getTypeManager()),
            binder -> binder.bind(NodeManager.class).toInstance(context.getNodeManager()),
            binder -> binder.bind(VersionEmbedder.class).toInstance(context.getVersionEmbedder()),
            new JdbcModule(catalogName),
            moduleProvider.getModule(catalogName));

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(requiredConfig)
            .initialize();

    return injector.getInstance(JdbcConnector.class);
}
 
Example 4
Source Project: presto   Source File: ShardCleaner.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public ShardCleaner(
        DaoSupplier<ShardDao> shardDaoSupplier,
        Ticker ticker,
        NodeManager nodeManager,
        StorageService storageService,
        Optional<BackupStore> backupStore,
        ShardCleanerConfig config)
{
    this(
            shardDaoSupplier,
            nodeManager.getCurrentNode().getNodeIdentifier(),
            nodeManager.getCurrentNode().isCoordinator(),
            ticker,
            storageService,
            backupStore,
            config.getMaxTransactionAge(),
            config.getTransactionCleanerInterval(),
            config.getLocalCleanerInterval(),
            config.getLocalCleanTime(),
            config.getBackupCleanerInterval(),
            config.getBackupCleanTime(),
            config.getBackupDeletionThreads(),
            config.getMaxCompletedTransactionAge());
}
 
Example 5
Source Project: presto   Source File: BucketBalancer.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public BucketBalancer(
        NodeManager nodeManager,
        NodeSupplier nodeSupplier,
        ShardManager shardManager,
        BucketBalancerConfig config,
        BackupService backupService,
        RaptorConnectorId connectorId)
{
    this(nodeSupplier,
            shardManager,
            config.isBalancerEnabled(),
            config.getBalancerInterval(),
            backupService.isBackupAvailable(),
            nodeManager.getCurrentNode().isCoordinator(),
            connectorId.toString());
}
 
Example 6
Source Project: presto   Source File: ShardRecoveryManager.java    License: Apache License 2.0 6 votes vote down vote up
public ShardRecoveryManager(
        StorageService storageService,
        Optional<BackupStore> backupStore,
        NodeManager nodeManager,
        ShardManager shardManager,
        Duration missingShardDiscoveryInterval,
        int recoveryThreads)
{
    this.storageService = requireNonNull(storageService, "storageService is null");
    this.backupStore = requireNonNull(backupStore, "backupStore is null");
    this.nodeIdentifier = requireNonNull(nodeManager, "nodeManager is null").getCurrentNode().getNodeIdentifier();
    this.shardManager = requireNonNull(shardManager, "shardManager is null");
    this.missingShardDiscoveryInterval = requireNonNull(missingShardDiscoveryInterval, "missingShardDiscoveryInterval is null");
    this.shardQueue = new MissingShardsQueue(new PrioritizedFifoExecutor<>(executorService, recoveryThreads, new MissingShardComparator()));
    this.stats = new ShardRecoveryStats();
}
 
Example 7
Source Project: presto   Source File: ShardEjector.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public ShardEjector(
        NodeManager nodeManager,
        NodeSupplier nodeSupplier,
        ShardManager shardManager,
        StorageService storageService,
        StorageManagerConfig config,
        Optional<BackupStore> backupStore,
        RaptorConnectorId connectorId)
{
    this(nodeManager.getCurrentNode().getNodeIdentifier(),
            nodeSupplier,
            shardManager,
            storageService,
            config.getShardEjectorInterval(),
            backupStore,
            connectorId.toString());
}
 
Example 8
Source Project: presto   Source File: ShardCompactionManager.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public ShardCompactionManager(@ForMetadata IDBI dbi,
        NodeManager nodeManager,
        ShardManager shardManager,
        ShardOrganizer organizer,
        TemporalFunction temporalFunction,
        StorageManagerConfig config)
{
    this(dbi,
            nodeManager.getCurrentNode().getNodeIdentifier(),
            shardManager,
            organizer,
            temporalFunction,
            config.getCompactionInterval(),
            config.getMaxShardSize(),
            config.getMaxShardRows(),
            config.isCompactionEnabled());
}
 
Example 9
Source Project: presto   Source File: ShardOrganizationManager.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public ShardOrganizationManager(
        @ForMetadata IDBI dbi,
        NodeManager nodeManager,
        ShardManager shardManager,
        ShardOrganizer organizer,
        TemporalFunction temporalFunction,
        StorageManagerConfig config)
{
    this(dbi,
            nodeManager.getCurrentNode().getNodeIdentifier(),
            shardManager,
            organizer,
            temporalFunction,
            config.isOrganizationEnabled(),
            config.getOrganizationInterval(),
            config.getOrganizationDiscoveryInterval());
}
 
Example 10
Source Project: presto   Source File: ElasticsearchConnectorFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new MBeanModule(),
            new MBeanServerModule(),
            new ConnectorObjectNameGeneratorModule(catalogName, "io.prestosql.elasticsearch", "presto.plugin.elasticsearch"),
            new JsonModule(),
            new ElasticsearchConnectorModule(),
            binder -> {
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            });

    Injector injector = app.strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(ElasticsearchConnector.class);
}
 
Example 11
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new JsonModule(),
            new ElasticsearchConnectorModule(),
            binder -> {
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            });

    Injector injector = app.strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(ElasticsearchConnector.class);
}
 
Example 12
Source Project: presto   Source File: BigQueryConnectorFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new JsonModule(),
            new BigQueryConnectorModule(context.getNodeManager()),
            binder -> {
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            });

    Injector injector = app.strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(BigQueryConnector.class);
}
 
Example 13
Source Project: presto   Source File: LocalFileConnectorFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            binder -> binder.bind(NodeManager.class).toInstance(context.getNodeManager()),
            new LocalFileModule());

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(LocalFileConnector.class);
}
 
Example 14
Source Project: presto   Source File: RubixInitializer.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
RubixInitializer(
        RetryDriver coordinatorRetryDriver,
        RubixConfig rubixConfig,
        NodeManager nodeManager,
        CatalogName catalogName,
        HdfsConfigurationInitializer hdfsConfigurationInitializer,
        Optional<ConfigurationInitializer> extraConfigInitializer)
{
    this.coordinatorRetryDriver = coordinatorRetryDriver;
    this.startServerOnCoordinator = rubixConfig.isStartServerOnCoordinator();
    this.parallelWarmupEnabled = rubixConfig.getReadMode().isParallelWarmupEnabled();
    this.cacheLocation = rubixConfig.getCacheLocation();
    this.cacheTtlMillis = rubixConfig.getCacheTtl().toMillis();
    this.diskUsagePercentage = rubixConfig.getDiskUsagePercentage();
    this.bookKeeperServerPort = rubixConfig.getBookKeeperServerPort();
    this.dataTransferServerPort = rubixConfig.getDataTransferServerPort();
    this.nodeManager = nodeManager;
    this.catalogName = catalogName;
    this.hdfsConfigurationInitializer = hdfsConfigurationInitializer;
    this.extraConfigInitializer = extraConfigInitializer;
}
 
Example 15
@Inject
public DefaultThriftMetastoreClientFactory(
        ThriftMetastoreConfig config,
        HiveMetastoreAuthentication metastoreAuthentication,
        NodeManager nodeManager)
{
    this(
            buildSslContext(
                    config.isTlsEnabled(),
                    Optional.ofNullable(config.getKeystorePath()),
                    Optional.ofNullable(config.getKeystorePassword()),
                    config.getTruststorePath()),
            Optional.ofNullable(config.getSocksProxy()),
            config.getMetastoreTimeout(),
            metastoreAuthentication,
            nodeManager.getCurrentNode().getHost());
}
 
Example 16
Source Project: presto   Source File: RedisJedisManager.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
RedisJedisManager(
        RedisConnectorConfig redisConnectorConfig,
        NodeManager nodeManager)
{
    this.redisConnectorConfig = requireNonNull(redisConnectorConfig, "redisConfig is null");
    this.jedisPoolCache = CacheBuilder.newBuilder().build(CacheLoader.from(this::createConsumer));
    this.jedisPoolConfig = new JedisPoolConfig();
}
 
Example 17
Source Project: presto   Source File: RedisConnectorFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new JsonModule(),
            new RedisConnectorModule(),
            binder -> {
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());

                if (tableDescriptionSupplier.isPresent()) {
                    binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, RedisTableDescription>>>() {}).toInstance(tableDescriptionSupplier.get());
                }
                else {
                    binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, RedisTableDescription>>>() {})
                            .to(RedisTableDescriptionSupplier.class)
                            .in(Scopes.SINGLETON);
                }
            });

    Injector injector = app.strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(RedisConnector.class);
}
 
Example 18
Source Project: presto   Source File: JmxRecordSetProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public JmxRecordSetProvider(MBeanServer mbeanServer, NodeManager nodeManager, JmxHistoricalData jmxHistoricalData)
{
    this.mbeanServer = requireNonNull(mbeanServer, "mbeanServer is null");
    this.nodeId = requireNonNull(nodeManager, "nodeManager is null").getCurrentNode().getNodeIdentifier();
    this.jmxHistoricalData = requireNonNull(jmxHistoricalData, "jmxHistoryHolder is null");
}
 
Example 19
Source Project: presto   Source File: TpcdsConnectorFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    int splitsPerNode = getSplitsPerNode(config);
    NodeManager nodeManager = context.getNodeManager();
    return new Connector()
    {
        @Override
        public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly)
        {
            return TpcdsTransactionHandle.INSTANCE;
        }

        @Override
        public ConnectorMetadata getMetadata(ConnectorTransactionHandle transactionHandle)
        {
            return new TpcdsMetadata();
        }

        @Override
        public ConnectorSplitManager getSplitManager()
        {
            return new TpcdsSplitManager(nodeManager, splitsPerNode, isWithNoSexism(config));
        }

        @Override
        public ConnectorRecordSetProvider getRecordSetProvider()
        {
            return new TpcdsRecordSetProvider();
        }

        @Override
        public ConnectorNodePartitioningProvider getNodePartitioningProvider()
        {
            return new TpcdsNodePartitioningProvider(nodeManager, splitsPerNode);
        }
    };
}
 
Example 20
Source Project: presto   Source File: TpcdsNodePartitioningProvider.java    License: Apache License 2.0 5 votes vote down vote up
public TpcdsNodePartitioningProvider(NodeManager nodeManager, int splitsPerNode)
{
    requireNonNull(nodeManager, "nodeManager is null");
    checkArgument(splitsPerNode > 0, "splitsPerNode must be at least 1");

    this.nodeManager = nodeManager;
    this.splitsPerNode = splitsPerNode;
}
 
Example 21
Source Project: presto   Source File: TpcdsSplitManager.java    License: Apache License 2.0 5 votes vote down vote up
public TpcdsSplitManager(NodeManager nodeManager, int splitsPerNode, boolean noSexism)
{
    requireNonNull(nodeManager);
    checkArgument(splitsPerNode > 0, "splitsPerNode must be at least 1");

    this.nodeManager = nodeManager;
    this.splitsPerNode = splitsPerNode;
    this.noSexism = noSexism;
}
 
Example 22
Source Project: presto   Source File: ConnectorContextInstance.java    License: Apache License 2.0 5 votes vote down vote up
public ConnectorContextInstance(
        NodeManager nodeManager,
        VersionEmbedder versionEmbedder,
        TypeManager typeManager,
        PageSorter pageSorter,
        PageIndexerFactory pageIndexerFactory,
        Supplier<ClassLoader> duplicatePluginClassLoaderFactory)
{
    this.nodeManager = requireNonNull(nodeManager, "nodeManager is null");
    this.versionEmbedder = requireNonNull(versionEmbedder, "versionEmbedder is null");
    this.typeManager = requireNonNull(typeManager, "typeManager is null");
    this.pageSorter = requireNonNull(pageSorter, "pageSorter is null");
    this.pageIndexerFactory = requireNonNull(pageIndexerFactory, "pageIndexerFactory is null");
    this.duplicatePluginClassLoaderFactory = requireNonNull(duplicatePluginClassLoaderFactory, "duplicatePluginClassLoaderFactory is null");
}
 
Example 23
Source Project: presto   Source File: MemoryModule.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void configure(Binder binder)
{
    binder.bind(TypeManager.class).toInstance(typeManager);
    binder.bind(NodeManager.class).toInstance(nodeManager);

    binder.bind(MemoryConnector.class).in(Scopes.SINGLETON);
    binder.bind(MemoryMetadata.class).in(Scopes.SINGLETON);
    binder.bind(MemorySplitManager.class).in(Scopes.SINGLETON);
    binder.bind(MemoryPagesStore.class).in(Scopes.SINGLETON);
    binder.bind(MemoryPageSourceProvider.class).in(Scopes.SINGLETON);
    binder.bind(MemoryPageSinkProvider.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(MemoryConfig.class);
}
 
Example 24
Source Project: presto   Source File: RaptorConnector.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public RaptorConnector(
        LifeCycleManager lifeCycleManager,
        NodeManager nodeManager,
        RaptorMetadataFactory metadataFactory,
        RaptorSplitManager splitManager,
        RaptorPageSourceProvider pageSourceProvider,
        RaptorPageSinkProvider pageSinkProvider,
        RaptorNodePartitioningProvider nodePartitioningProvider,
        RaptorSessionProperties sessionProperties,
        RaptorTableProperties tableProperties,
        Set<SystemTable> systemTables,
        ConnectorAccessControl accessControl,
        @ForMetadata IDBI dbi)
{
    this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
    this.metadataFactory = requireNonNull(metadataFactory, "metadataFactory is null");
    this.splitManager = requireNonNull(splitManager, "splitManager is null");
    this.pageSourceProvider = requireNonNull(pageSourceProvider, "pageSourceProvider is null");
    this.pageSinkProvider = requireNonNull(pageSinkProvider, "pageSinkProvider is null");
    this.nodePartitioningProvider = requireNonNull(nodePartitioningProvider, "nodePartitioningProvider is null");
    this.sessionProperties = requireNonNull(sessionProperties, "sessionProperties is null").getSessionProperties();
    this.tableProperties = requireNonNull(tableProperties, "tableProperties is null").getTableProperties();
    this.systemTables = requireNonNull(systemTables, "systemTables is null");
    this.accessControl = requireNonNull(accessControl, "accessControl is null");
    this.dao = onDemandDao(dbi, MetadataDao.class);
    this.coordinator = nodeManager.getCurrentNode().isCoordinator();
}
 
Example 25
Source Project: presto   Source File: RaptorConnectorFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    Bootstrap app = new Bootstrap(
            new JsonModule(),
            new MBeanModule(),
            new ConnectorObjectNameGeneratorModule(catalogName, "io.prestosql.plugin.raptor.legacy", "presto.plugin.raptor.legacy"),
            new MBeanServerModule(),
            binder -> {
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                binder.bind(PageSorter.class).toInstance(context.getPageSorter());
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
            },
            metadataModule,
            new BackupModule(backupProviders),
            new StorageModule(),
            new RaptorModule(catalogName),
            new RaptorSecurityModule(catalogName));

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(RaptorConnector.class);
}
 
Example 26
Source Project: presto   Source File: HttpBackupStore.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public HttpBackupStore(
        @ForHttpBackup HttpClient httpClient,
        @ForHttpBackup Supplier<URI> baseUriSupplier,
        NodeManager nodeManager)
{
    this.httpClient = requireNonNull(httpClient, "httpClient is null");
    this.baseUriSupplier = requireNonNull(baseUriSupplier, "baseUriSupplier is null");
    this.environment = requireNonNull(nodeManager, "nodeManager is null").getEnvironment();
}
 
Example 27
Source Project: presto   Source File: OrcStorageManager.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public OrcStorageManager(
        NodeManager nodeManager,
        StorageService storageService,
        Optional<BackupStore> backupStore,
        StorageManagerConfig config,
        RaptorConnectorId connectorId,
        BackupManager backgroundBackupManager,
        ShardRecoveryManager recoveryManager,
        ShardRecorder shardRecorder,
        TypeManager typeManager)
{
    this(nodeManager.getCurrentNode().getNodeIdentifier(),
            storageService,
            backupStore,
            config.toOrcReaderOptions(),
            backgroundBackupManager,
            recoveryManager,
            shardRecorder,
            typeManager,
            connectorId.toString(),
            config.getDeletionThreads(),
            config.getShardRecoveryTimeout(),
            config.getMaxShardRows(),
            config.getMaxShardSize(),
            config.getMinAvailableSpace());
}
 
Example 28
Source Project: presto   Source File: ShardRecoveryManager.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public ShardRecoveryManager(
        StorageService storageService,
        Optional<BackupStore> backupStore,
        NodeManager nodeManager,
        ShardManager shardManager,
        StorageManagerConfig config)
{
    this(storageService,
            backupStore,
            nodeManager,
            shardManager,
            config.getMissingShardDiscoveryInterval(),
            config.getRecoveryThreads());
}
 
Example 29
Source Project: presto   Source File: TestRaptorMetadata.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setupDatabase()
{
    TypeManager typeManager = new InternalTypeManager(createTestMetadataManager());
    dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + ThreadLocalRandom.current().nextLong());
    dbi.registerMapper(new TableColumn.Mapper(typeManager));
    dbi.registerMapper(new Distribution.Mapper(typeManager));
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);

    NodeManager nodeManager = new TestingNodeManager();
    NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
    shardManager = createShardManager(dbi, nodeSupplier, systemTicker());
    metadata = new RaptorMetadata(dbi, shardManager);
}
 
Example 30
Source Project: presto   Source File: TestHttpBackupStore.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup()
{
    temporary = createTempDir();

    Map<String, String> properties = ImmutableMap.<String, String>builder()
            .put("backup.http.uri", "http://localhost:8080")
            .build();

    Bootstrap app = new Bootstrap(
            new TestingNodeModule(),
            new TestingHttpServerModule(),
            new JsonModule(),
            new JaxrsModule(),
            binder -> jaxrsBinder(binder).bind(TestingHttpBackupResource.class),
            binder -> binder.bind(NodeManager.class).toInstance(new TestingNodeManager()),
            override(new HttpBackupModule()).with(new TestingModule()));

    Injector injector = app
            .strictConfig()
            .setRequiredConfigurationProperties(properties)
            .doNotInitializeLogging()
            .quiet()
            .initialize();

    lifeCycleManager = injector.getInstance(LifeCycleManager.class);

    store = injector.getInstance(BackupStore.class);
}