use of org.uberfire.commons.async.DescriptiveThreadFactory in project kie-wb-common by kiegroup.
the class IndexingTest method ioService.
protected IOService ioService() {
if (ioService == null) {
final Map<String, Analyzer> analyzers = getAnalyzers();
MetadataConfigBuilder configBuilder = new MetadataConfigBuilder().withInMemoryMetaModelStore().usingAnalyzers(analyzers).usingAnalyzerWrapperFactory(getAnalyzerWrapperFactory()).useInMemoryDirectory().useDirectoryBasedIndex();
if (config == null) {
config = configBuilder.build();
}
ExecutorService executorService = Executors.newCachedThreadPool(new DescriptiveThreadFactory());
ioService = new IOServiceIndexedImpl(config.getIndexEngine(), executorService);
final TestIndexer indexer = getIndexer();
IndexersFactory.clear();
IndexersFactory.addIndexer(indexer);
// Mock CDI injection and setup
indexer.setIOService(ioService);
indexer.setModuleService(getModuleService());
indexer.setResourceTypeDefinition(getResourceTypeDefinition());
}
return ioService;
}
use of org.uberfire.commons.async.DescriptiveThreadFactory in project kie-wb-common by kiegroup.
the class BaseLibraryIndexingTest method ioService.
@SuppressWarnings("unchecked")
protected IOService ioService() {
if (ioService == null) {
final Map<String, Analyzer> analyzers = getAnalyzers();
MetadataConfigBuilder configBuilder = new MetadataConfigBuilder().withInMemoryMetaModelStore().usingAnalyzers(analyzers).usingAnalyzerWrapperFactory(ImpactAnalysisAnalyzerWrapperFactory.getInstance()).useInMemoryDirectory().useDirectoryBasedIndex();
if (config == null) {
config = configBuilder.build();
}
ExecutorService executorService = Executors.newCachedThreadPool(new DescriptiveThreadFactory());
ioService = new IOServiceIndexedImpl(config.getIndexEngine(), executorService);
final LibraryIndexer indexer = new LibraryIndexer(new LibraryAssetTypeDefinition());
IndexersFactory.clear();
IndexersFactory.addIndexer(indexer);
// Mock CDI injection and setup
indexer.setIOService(ioService);
indexer.setModuleService(getModuleService());
}
return ioService;
}
use of org.uberfire.commons.async.DescriptiveThreadFactory in project kie-wb-common by kiegroup.
the class ExplorerServiceHelperTest method setUp.
@Before
public void setUp() throws Exception {
fileSystemProvider = new SimpleFileSystemProvider();
// Ensure URLs use the default:// scheme
fileSystemProvider.forceAsDefault();
path = fileSystemProvider.getPath(this.getClass().getResource("myfile.file").toURI());
when(srcPath.toURI()).thenReturn(path.toUri().toString());
when(srcTestPath.toURI()).thenReturn(path.toUri().toString());
when(srcResourcesPath.toURI()).thenReturn(path.toUri().toString());
when(testResourcesPath.toURI()).thenReturn(path.toUri().toString());
when(pkg.getPackageMainSrcPath()).thenReturn(srcPath);
when(pkg.getPackageTestSrcPath()).thenReturn(srcTestPath);
when(pkg.getPackageMainResourcesPath()).thenReturn(srcResourcesPath);
when(pkg.getPackageTestResourcesPath()).thenReturn(testResourcesPath);
when(metadataService.getTags(any(Path.class))).thenReturn(tags);
when(ioService.newDirectoryStream(any(org.uberfire.java.nio.file.Path.class), any(LinkedFilter.class))).thenReturn(new DirectoryStreamMock() {
private List<org.uberfire.java.nio.file.Path> items = new ArrayList<org.uberfire.java.nio.file.Path>() {
{
add(path);
}
};
@Override
public Iterator<org.uberfire.java.nio.file.Path> iterator() {
return items.iterator();
}
});
ExecutorService executorService = Executors.newCachedThreadPool(new DescriptiveThreadFactory());
helper = spy(new ExplorerServiceHelper(moduleService, folderListingResolver, ioService, ioServiceConfig, lockService, metadataService, userServices, deleteService, renameService, copyService, executorService));
}
Aggregations