use of org.uberfire.io.IOService in project kie-wb-common by kiegroup.
the class BPMFinderServiceImpl method scannProcessesForType.
protected void scannProcessesForType(final Path path, final String extension, final GenerationConfig generationConfig) {
List<org.uberfire.java.nio.file.Path> nioPaths = new ArrayList<>();
nioPaths.add(Paths.convert(path));
Collection<FileUtils.ScanResult> processes = fileUtils.scan(ioService, nioPaths, extension, true);
processes.stream().map(scanResult -> parse(scanResult)).filter(definitions -> definitions != null && generationConfig.getPredicate().test(definitions)).forEach(definitions -> {
BusinessProcessFormModel processFormModel = bpmnFormModelGenerator.generateProcessFormModel(definitions.get(), path);
List<TaskFormModel> taskModels = bpmnFormModelGenerator.generateTaskFormModels(definitions.get(), path);
generationConfig.getConsumer().accept(new JBPMProcessModel(processFormModel, taskModels));
});
}
use of org.uberfire.io.IOService in project kie-wb-common by kiegroup.
the class FormGenerationIntegrationTest method init.
@Before
public void init() {
formModelHandlerManager = new TestFormModelHandlerManager(moduleService, moduleClassLoaderHelper, fieldManager, finderService);
when(pathModelReaderService.getModelReader(any())).thenReturn(new RuntimeDMOModelReader(moduleClassLoader, new RawMVELEvaluator()));
when(formFinderService.findFormsForType(anyString(), any())).then((Answer<List<FormDefinition>>) invocationOnMock -> {
String type = invocationOnMock.getArguments()[0].toString();
return Collections.singletonList(readFormDefinitionForType(type));
});
service = new BPMNVFSFormDefinitionGeneratorService(fieldManager, pathModelReaderService, formModelHandlerManager, formFinderService, formSerializer, ioService, commentedOptionFactory, formModelSynchronizationUtil);
when(moduleService.resolveModule(any())).thenReturn(module);
when(moduleClassLoaderHelper.getModuleClassLoader(any())).thenReturn(moduleClassLoader);
generator = new BPMNFormModelGeneratorImpl(moduleService, moduleClassLoaderHelper);
final Path rootPathWithNestedForms = PathFactory.newPath(DATA_OBJECTS_FOLDER, getUriOfResource(PREPARED_NESTED_FORMS_FOLDER));
;
processFormModel = generator.generateProcessFormModel(formGenerationProcessDefinitions, rootPathWithNestedForms);
taskFormModels = generator.generateTaskFormModels(formGenerationProcessDefinitions, rootPathWithNestedForms);
}
use of org.uberfire.io.IOService in project kie-wb-common by kiegroup.
the class MigrationConfigurationServiceImplTest method mockIoService.
private IOService mockIoService() {
final IOService ioService = spy(fileSystemTestingUtils.getIoService());
doNothing().when(ioService).startBatch(any(FileSystem.class));
doNothing().when(ioService).endBatch();
doReturn(fileSystemTestingUtils.getFileSystem()).when(ioService).newFileSystem(any(URI.class), anyMap());
return ioService;
}
use of org.uberfire.io.IOService in project kie-wb-common by kiegroup.
the class PomMigrationTool method systemMigrationWasExecuted.
private boolean systemMigrationWasExecuted(MigrationServicesCDIWrapper cdiWrapper) {
if (!systemMigrationCheck) {
systemMigrationCheck = true;
final IOService systemIoService = cdiWrapper.getSystemIoService();
final Repository systemRepository = cdiWrapper.getSystemRepository();
if (!systemIoService.exists(systemIoService.get(systemRepository.getUri()).resolve("spaces"))) {
system.err().println(String.format("The SYSTEM CONFIGURATION DIRECTORY STRUCTURE MIGRATION must be ran before this one."));
return false;
}
return true;
} else {
return true;
}
}
use of org.uberfire.io.IOService in project kie-wb-common by kiegroup.
the class ImpactAnalysisJavaFileTest method setupForThisTest.
@Before
public void setupForThisTest() throws Exception {
// setup
IOService ioService = ioService();
// Get this class location
String fileName = this.getClass().getSimpleName() + ".java";
String fileLoc = getLocationOfTestClass(fileName);
// Add this class to the repository/index
Path path = basePath.resolve(fileName);
String javaSourceText = loadText(fileLoc);
ioService.write(path, javaSourceText);
// Get test java file indexer class location
fileName = TestJavaFileIndexer.class.getSimpleName() + ".java";
fileLoc = getLocationOfTestClass(fileName);
// create new branch
String randomBranchName = UUID.randomUUID().toString();
randomBranchName = randomBranchName.substring(0, randomBranchName.indexOf("-"));
final Path source = ioService.get(URI.create("git://master@" + getRepositoryName()));
final Path target = ioService.get(URI.create("git://" + randomBranchName + "@" + getRepositoryName()));
ioService.copy(source, target);
// Add this class to the repository/index
final Path branchedBasePath = ioService.get(URI.create("git://" + randomBranchName + "@" + getRepositoryName() + "/_someDir" + seed));
path = branchedBasePath.resolve(fileName);
javaSourceText = loadText(fileLoc);
ioService.write(path, javaSourceText);
// wait for events to be consumed from jgit -> (notify changes -> watcher -> index) -> lucene index
Thread.sleep(5000);
}
Aggregations