Search in sources :

Example 16 with SimpleFileSystemProvider

use of org.uberfire.java.nio.fs.file.SimpleFileSystemProvider in project kie-wb-common by kiegroup.

the class PackageNameWhiteListLoaderTest method setUp.

@Before
public void setUp() throws Exception {
    final SimpleFileSystemProvider fs = new SimpleFileSystemProvider();
    // Bootstrap WELD container
    weld = new Weld();
    final BeanManager beanManager = weld.initialize().getBeanManager();
    // Instantiate Paths used in tests for Path conversion
    final Bean pathsBean = (Bean) beanManager.getBeans(Paths.class).iterator().next();
    final CreationalContext cc = beanManager.createCreationalContext(pathsBean);
    Paths paths = (Paths) beanManager.getReference(pathsBean, Paths.class, cc);
    // Ensure URLs use the default:// scheme
    fs.forceAsDefault();
    tempFiles = new TempFiles();
    final File tempFile = tempFiles.createTempFile("white-list");
    final org.uberfire.java.nio.file.Path nioPackagePath = fs.getPath(tempFile.toURI());
    pathToWhiteList = paths.convert(nioPackagePath);
    loader = new PackageNameWhiteListLoader(packageNameSearchProvider, ioService);
}
Also used : Weld(org.jboss.weld.environment.se.Weld) Bean(javax.enterprise.inject.spi.Bean) SimpleFileSystemProvider(org.uberfire.java.nio.fs.file.SimpleFileSystemProvider) CreationalContext(javax.enterprise.context.spi.CreationalContext) Paths(org.uberfire.backend.server.util.Paths) BeanManager(javax.enterprise.inject.spi.BeanManager) File(java.io.File) TempFiles(org.guvnor.test.TempFiles) Before(org.junit.Before)

Aggregations

SimpleFileSystemProvider (org.uberfire.java.nio.fs.file.SimpleFileSystemProvider)16 Before (org.junit.Before)9 Test (org.junit.Test)8 Module (org.guvnor.common.services.project.model.Module)7 URL (java.net.URL)6 Path (org.uberfire.backend.vfs.Path)5 BuildMessage (org.guvnor.common.services.project.builder.model.BuildMessage)4 BuildResults (org.guvnor.common.services.project.builder.model.BuildResults)4 Paths (org.uberfire.backend.server.util.Paths)3 CreationalContext (javax.enterprise.context.spi.CreationalContext)2 Bean (javax.enterprise.inject.spi.Bean)2 KieModuleService (org.kie.workbench.common.services.shared.project.KieModuleService)2 IOService (org.uberfire.io.IOService)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1