use of org.uberfire.java.nio.fs.file.SimpleFileSystemProvider in project kie-wb-common by kiegroup.
the class JavaRoasterModelDriverTest method initTest.
@Before
public void initTest() throws Exception {
simpleFileSystemProvider = new SimpleFileSystemProvider();
simpleFileSystemProvider.forceAsDefault();
rootPath = getRootPath();
}
use of org.uberfire.java.nio.fs.file.SimpleFileSystemProvider 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));
}
use of org.uberfire.java.nio.fs.file.SimpleFileSystemProvider in project kie-wb-common by kiegroup.
the class BPMNVFSFormDefinitionGeneratorServiceTest method setup.
@Before
public void setup() throws IOException {
when(projectService.resolveModule(any())).thenReturn(module);
when(projectClassLoaderHelper.getModuleClassLoader(module)).thenReturn(this.getClass().getClassLoader());
source = mock(Path.class);
simpleFileSystemProvider = new SimpleFileSystemProvider();
simpleFileSystemProvider.forceAsDefault();
when(source.toURI()).thenReturn("default:///src/main/resources/test.frm");
when(commentedOptionFactory.makeCommentedOption(anyString())).then(invocationOnMock -> new CommentedOption("1", invocationOnMock.getArguments()[0].toString()));
formModelHandlerManager = new TestFormModelHandlerManager(projectService, projectClassLoaderHelper, fieldManager, dataObjectFinderService);
service = new BPMNVFSFormDefinitionGeneratorService(fieldManager, formModelHandlerManager, formFinderService, formSerializer, ioService, commentedOptionFactory, new FormModelSynchronizationUtilImpl(fieldManager, templateGenerator));
}
use of org.uberfire.java.nio.fs.file.SimpleFileSystemProvider 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.uberfire.java.nio.fs.file.SimpleFileSystemProvider in project kie-wb-common by kiegroup.
the class BuilderTest method testBuilderKModuleHasSnapshotDependency.
@Test
public void testBuilderKModuleHasSnapshotDependency() throws Exception {
URL url = this.getClass().getResource("/GuvnorM2RepoDependencyExample2Snapshot");
SimpleFileSystemProvider p = new SimpleFileSystemProvider();
org.uberfire.java.nio.file.Path path = p.getPath(url.toURI());
final Module module = moduleService.resolveModule(Paths.convert(path));
final Builder builder = new Builder(module, ioService, moduleService, importsService, new ArrayList<>(), dependenciesClassLoaderCache, pomModelCache, getPackageNameWhiteListService(), alwaysTrue);
final BuildResults results = builder.build();
// Debug output
if (!results.getMessages().isEmpty()) {
for (BuildMessage m : results.getMessages()) {
logger.debug(m.getText());
}
}
assertTrue(results.getMessages().isEmpty());
}
Aggregations