Search in sources :

Example 1 with ExecutionContext

use of com.accenture.trac.common.concurrent.ExecutionContext in project tracdap by finos.

the class FileStorageReadWriteTest method setupStorage.

@BeforeEach
void setupStorage() {
    var storageProps = new Properties();
    storageProps.put(IStorageManager.PROP_STORAGE_KEY, "TEST_STORAGE");
    storageProps.put(LocalFileStorage.CONFIG_ROOT_PATH, storageDir.toString());
    storage = new LocalFileStorage(storageProps);
    execContext = new ExecutionContext(new DefaultEventExecutor(new DefaultThreadFactory("t-events")));
}
Also used : DefaultEventExecutor(io.netty.util.concurrent.DefaultEventExecutor) DefaultThreadFactory(io.netty.util.concurrent.DefaultThreadFactory) IExecutionContext(com.accenture.trac.common.concurrent.IExecutionContext) ExecutionContext(com.accenture.trac.common.concurrent.ExecutionContext) LocalFileStorage(com.accenture.trac.common.storage.local.LocalFileStorage) Properties(java.util.Properties)

Example 2 with ExecutionContext

use of com.accenture.trac.common.concurrent.ExecutionContext in project tracdap by finos.

the class FileStorageReadWriteStability method setupStorage.

@BeforeAll
static void setupStorage() {
    var storageProps = new Properties();
    storageProps.put(IStorageManager.PROP_STORAGE_KEY, "TEST_STORAGE");
    storageProps.put(LocalFileStorage.CONFIG_ROOT_PATH, storageDir.toString());
    storage = new LocalFileStorage(storageProps);
    execContext = new ExecutionContext(new DefaultEventExecutor(new DefaultThreadFactory("t-events")));
}
Also used : DefaultEventExecutor(io.netty.util.concurrent.DefaultEventExecutor) DefaultThreadFactory(io.netty.util.concurrent.DefaultThreadFactory) IExecutionContext(com.accenture.trac.common.concurrent.IExecutionContext) ExecutionContext(com.accenture.trac.common.concurrent.ExecutionContext) LocalFileStorage(com.accenture.trac.common.storage.local.LocalFileStorage) Properties(java.util.Properties)

Example 3 with ExecutionContext

use of com.accenture.trac.common.concurrent.ExecutionContext in project tracdap by finos.

the class FileStorageOperationsTest method setupStorage.

@BeforeEach
void setupStorage() {
    var storageProps = new Properties();
    storageProps.put(IStorageManager.PROP_STORAGE_KEY, "TEST_STORAGE");
    storageProps.put(LocalFileStorage.CONFIG_ROOT_PATH, storageDir.toString());
    storage = new LocalFileStorage(storageProps);
    execContext = new ExecutionContext(new DefaultEventExecutor(new DefaultThreadFactory("t-events")));
}
Also used : DefaultEventExecutor(io.netty.util.concurrent.DefaultEventExecutor) DefaultThreadFactory(io.netty.util.concurrent.DefaultThreadFactory) IExecutionContext(com.accenture.trac.common.concurrent.IExecutionContext) ExecutionContext(com.accenture.trac.common.concurrent.ExecutionContext) LocalFileStorage(com.accenture.trac.common.storage.local.LocalFileStorage) Properties(java.util.Properties) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with ExecutionContext

use of com.accenture.trac.common.concurrent.ExecutionContext in project tracdap by finos.

the class DataApiTestBase method setup.

@BeforeEach
void setup() throws Exception {
    // Create storage root dir referenced in config
    Files.createDirectory(tempDir.resolve(STORAGE_ROOT_DIR));
    var substitutions = Map.of("${TRAC_DIR}", tempDir.toString().replace("\\", "\\\\"));
    var configPath = ConfigHelpers.prepareConfig(TRAC_UNIT_CONFIG, tempDir, substitutions);
    // not yet used
    var keystoreKey = "";
    var startup = Startup.useConfigFile(TracDataService.class, tempDir, configPath.toString(), keystoreKey);
    startup.runStartupSequence();
    var plugins = startup.getPlugins();
    plugins.initRegularPlugins();
    var config = startup.getConfig();
    var platformConfig = config.loadRootConfigObject(PlatformConfig.class);
    var dataSvcConfig = platformConfig.getServices().getData();
    formats = new CodecManager(plugins);
    storage = new StorageManager(plugins);
    storage.initStorage(dataSvcConfig.getStorageMap(), formats);
    execContext = new ExecutionContext(new DefaultEventExecutor());
    var arrowAllocatorConfig = RootAllocator.configBuilder().allocationManagerFactory(NettyAllocationManager.FACTORY).build();
    var arrowAllocator = new RootAllocator(arrowAllocatorConfig);
    var dataSvcName = InProcessServerBuilder.generateName();
    workerGroup = new NioEventLoopGroup(6, new DefaultThreadFactory("data-svc"));
    var execRegister = new ExecutionRegister(workerGroup);
    var dataSvcClientChannelBuilder = NettyChannelBuilder.forAddress("localhost", METADATA_SVC_PORT).channelType(NioSocketChannel.class).eventLoopGroup(workerGroup).directExecutor().usePlaintext();
    dataSvcClientChannel = EventLoopChannel.wrapChannel(dataSvcClientChannelBuilder, workerGroup);
    var metaApi = TrustedMetadataApiGrpc.newFutureStub(dataSvcClientChannel);
    var dataRwSvc = new DataService(dataSvcConfig, arrowAllocator, storage, formats, metaApi);
    var fileRwSvc = new FileService(dataSvcConfig, storage, metaApi);
    var publicApiImpl = new TracDataApi(dataRwSvc, fileRwSvc);
    dataService = InProcessServerBuilder.forName(dataSvcName).addService(publicApiImpl).executor(workerGroup).intercept(execRegister.registerExecContext()).build().start();
    // Create a client channel and register for automatic graceful shutdown.
    dataClientChannel = InProcessChannelBuilder.forName(dataSvcName).directExecutor().build();
    dataClient = TracDataApiGrpc.newStub(dataClientChannel);
}
Also used : DefaultEventExecutor(io.netty.util.concurrent.DefaultEventExecutor) FileService(com.accenture.trac.svc.data.service.FileService) StorageManager(com.accenture.trac.common.storage.StorageManager) DataService(com.accenture.trac.svc.data.service.DataService) TracDataService(com.accenture.trac.svc.data.TracDataService) DefaultThreadFactory(io.netty.util.concurrent.DefaultThreadFactory) NioSocketChannel(io.netty.channel.socket.nio.NioSocketChannel) IExecutionContext(com.accenture.trac.common.concurrent.IExecutionContext) ExecutionContext(com.accenture.trac.common.concurrent.ExecutionContext) RootAllocator(org.apache.arrow.memory.RootAllocator) ExecutionRegister(com.accenture.trac.common.concurrent.ExecutionRegister) CodecManager(com.accenture.trac.common.codec.CodecManager) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ExecutionContext (com.accenture.trac.common.concurrent.ExecutionContext)4 IExecutionContext (com.accenture.trac.common.concurrent.IExecutionContext)4 DefaultEventExecutor (io.netty.util.concurrent.DefaultEventExecutor)4 DefaultThreadFactory (io.netty.util.concurrent.DefaultThreadFactory)4 LocalFileStorage (com.accenture.trac.common.storage.local.LocalFileStorage)3 Properties (java.util.Properties)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 CodecManager (com.accenture.trac.common.codec.CodecManager)1 ExecutionRegister (com.accenture.trac.common.concurrent.ExecutionRegister)1 StorageManager (com.accenture.trac.common.storage.StorageManager)1 TracDataService (com.accenture.trac.svc.data.TracDataService)1 DataService (com.accenture.trac.svc.data.service.DataService)1 FileService (com.accenture.trac.svc.data.service.FileService)1 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)1 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)1 RootAllocator (org.apache.arrow.memory.RootAllocator)1