use of org.kie.workbench.common.services.backend.project.ModuleClassLoaderHelper 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.kie.workbench.common.services.backend.project.ModuleClassLoaderHelper in project kie-wb-common by kiegroup.
the class BPMFinderServiceImplTest method initialize.
@Before
public void initialize() throws URISyntaxException, ClassNotFoundException {
when(ioService.newDirectoryStream(any(), any())).thenAnswer(invocationOnMock -> Files.newDirectoryStream((Path) invocationOnMock.getArguments()[0], (DirectoryStream.Filter<Path>) invocationOnMock.getArguments()[1]));
when(ioService.newInputStream(any())).thenAnswer(invocationOnMock -> new FileInputStream(((Path) invocationOnMock.getArguments()[0]).toFile()));
simpleFileSystemProvider = new SimpleFileSystemProvider();
simpleFileSystemProvider.forceAsDefault();
rootPath = simpleFileSystemProvider.getPath(this.getClass().getResource(RESOURCES_PATH).toURI());
when(moduleService.resolveModule(any())).thenReturn(module);
when(module.getRootPath()).thenReturn(Paths.convert(rootPath));
when(classLoader.loadClass(any())).thenAnswer((Answer<Class>) invocation -> String.class);
when(moduleClassLoaderHelper.getModuleClassLoader(any())).thenReturn(classLoader);
bpmnFormModelGenerator = new BPMNFormModelGeneratorImpl(moduleService, moduleClassLoaderHelper);
finderService = new BPMFinderServiceImpl(ioService, moduleService, bpmnFormModelGenerator);
finderService.init();
}
use of org.kie.workbench.common.services.backend.project.ModuleClassLoaderHelper in project kie-wb-common by kiegroup.
the class TestAppSetup method classLoaderHelper.
@Produces
@Alternative
public ModuleClassLoaderHelper classLoaderHelper() {
ModuleClassLoaderHelper classLoaderHelper = mock(ModuleClassLoaderHelper.class);
when(classLoaderHelper.getModuleClassLoader(any())).thenReturn(this.getClass().getClassLoader());
return classLoaderHelper;
}
Aggregations