Search in sources :

Example 6 with LifeCycleManager

use of com.facebook.airlift.bootstrap.LifeCycleManager in project presto by prestodb.

the class TestHttpBackupStore method setup.

@BeforeMethod
public void setup() throws Exception {
    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(true), binder -> jaxrsBinder(binder).bind(TestingHttpBackupResource.class), override(new HttpBackupModule()).with(new TestingModule()));
    Injector injector = app.setRequiredConfigurationProperties(properties).doNotInitializeLogging().quiet().initialize();
    lifeCycleManager = injector.getInstance(LifeCycleManager.class);
    store = injector.getInstance(BackupStore.class);
}
Also used : TestingHttpServerModule(com.facebook.airlift.http.server.testing.TestingHttpServerModule) TestingNodeModule(com.facebook.airlift.node.testing.TestingNodeModule) JaxrsModule(com.facebook.airlift.jaxrs.JaxrsModule) JsonModule(com.facebook.airlift.json.JsonModule) LifeCycleManager(com.facebook.airlift.bootstrap.LifeCycleManager) Injector(com.google.inject.Injector) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 7 with LifeCycleManager

use of com.facebook.airlift.bootstrap.LifeCycleManager in project presto by prestodb.

the class TestRaptorConnector method setup.

@BeforeMethod
public void setup() throws Exception {
    FunctionAndTypeManager functionAndTypeManager = createTestFunctionAndTypeManager();
    DBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + "_" + ThreadLocalRandom.current().nextInt());
    dbi.registerMapper(new TableColumn.Mapper(functionAndTypeManager));
    dummyHandle = dbi.open();
    metadataDao = dbi.onDemand(MetadataDao.class);
    createTablesWithRetry(dbi);
    dataDir = Files.createTempDir();
    RaptorConnectorId connectorId = new RaptorConnectorId("test");
    NodeManager nodeManager = new TestingNodeManager();
    NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
    ShardManager shardManager = createShardManager(dbi);
    StorageManager storageManager = createOrcStorageManager(dbi, dataDir);
    StorageManagerConfig config = new StorageManagerConfig();
    connector = new RaptorConnector(new LifeCycleManager(ImmutableList.of(), null), new TestingNodeManager(), new RaptorMetadataFactory(connectorId, dbi, shardManager, functionAndTypeManager), new RaptorSplitManager(connectorId, nodeSupplier, shardManager, false), new RaptorPageSourceProvider(storageManager), new RaptorPageSinkProvider(storageManager, new PagesIndexPageSorter(new PagesIndex.TestingFactory(false)), new TemporalFunction(DateTimeZone.forID("America/Los_Angeles")), config), new RaptorNodePartitioningProvider(nodeSupplier), new RaptorSessionProperties(config), new RaptorTableProperties(functionAndTypeManager), ImmutableSet.of(), new AllowAllAccessControl(), dbi, ImmutableSet.of());
}
Also used : StorageManager(com.facebook.presto.raptor.storage.StorageManager) TestOrcStorageManager.createOrcStorageManager(com.facebook.presto.raptor.storage.TestOrcStorageManager.createOrcStorageManager) DBI(org.skife.jdbi.v2.DBI) ShardManager(com.facebook.presto.raptor.metadata.ShardManager) TestDatabaseShardManager.createShardManager(com.facebook.presto.raptor.metadata.TestDatabaseShardManager.createShardManager) StorageManagerConfig(com.facebook.presto.raptor.storage.StorageManagerConfig) TemporalFunction(com.facebook.presto.raptor.storage.organization.TemporalFunction) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) FunctionAndTypeManager.createTestFunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager.createTestFunctionAndTypeManager) TestingNodeManager(com.facebook.presto.testing.TestingNodeManager) AllowAllAccessControl(com.facebook.presto.plugin.base.security.AllowAllAccessControl) MetadataDao(com.facebook.presto.raptor.metadata.MetadataDao) TableColumn(com.facebook.presto.raptor.metadata.TableColumn) NodeManager(com.facebook.presto.spi.NodeManager) TestingNodeManager(com.facebook.presto.testing.TestingNodeManager) LifeCycleManager(com.facebook.airlift.bootstrap.LifeCycleManager) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

LifeCycleManager (com.facebook.airlift.bootstrap.LifeCycleManager)7 Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)6 Injector (com.google.inject.Injector)6 JsonModule (com.facebook.airlift.json.JsonModule)4 NodeManager (com.facebook.presto.spi.NodeManager)3 BeforeClass (org.testng.annotations.BeforeClass)3 EventModule (com.facebook.airlift.event.client.EventModule)2 TestingHttpServerModule (com.facebook.airlift.http.server.testing.TestingHttpServerModule)2 JaxrsModule (com.facebook.airlift.jaxrs.JaxrsModule)2 TestingNodeModule (com.facebook.airlift.node.testing.TestingNodeModule)2 DriftNettyServerModule (com.facebook.drift.transport.netty.server.DriftNettyServerModule)2 CachingModule (com.facebook.presto.cache.CachingModule)2 TypeManager (com.facebook.presto.common.type.TypeManager)2 HiveAuthenticationModule (com.facebook.presto.hive.authentication.HiveAuthenticationModule)2 HiveMetastoreModule (com.facebook.presto.hive.metastore.HiveMetastoreModule)2 HiveS3Module (com.facebook.presto.hive.s3.HiveS3Module)2 AllowAllAccessControl (com.facebook.presto.plugin.base.security.AllowAllAccessControl)2 PageIndexerFactory (com.facebook.presto.spi.PageIndexerFactory)2 ThreadContextClassLoader (com.facebook.presto.spi.classloader.ThreadContextClassLoader)2 ConnectorNodePartitioningProvider (com.facebook.presto.spi.connector.ConnectorNodePartitioningProvider)2