Search in sources :

Example 1 with FileResolverImpl

use of io.vertx.core.file.impl.FileResolverImpl in project vert.x by eclipse.

the class FileResolverTestBase method testResolveAfterCloseThrowsISE.

@Test
public void testResolveAfterCloseThrowsISE() throws Exception {
    FileResolver resolver2 = new FileResolverImpl();
    File file = resolver2.resolveFile("webroot/somefile.html");
    assertTrue(file.exists());
    File cacheDir = file.getParentFile().getParentFile();
    assertTrue(cacheDir.exists());
    resolver2.close();
    assertFalse(cacheDir.exists());
    try {
        resolver2.resolveFile("webroot/somefile.html");
        fail("Should fail");
    } catch (IllegalStateException e) {
    // OK
    }
}
Also used : FileResolverImpl(io.vertx.core.file.impl.FileResolverImpl) FileResolver(io.vertx.core.spi.file.FileResolver) File(java.io.File) Test(org.junit.Test)

Example 2 with FileResolverImpl

use of io.vertx.core.file.impl.FileResolverImpl in project vert.x by eclipse.

the class FileResolverTestBase method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    testCL = Thread.currentThread().getContextClassLoader();
    File baseDir = new File(new File(new File(new File("src"), "test"), "classpath"), "fileresolver");
    assertTrue(baseDir.exists() && baseDir.isDirectory());
    ClassLoader resourcesLoader = resourcesLoader(baseDir);
    Thread.currentThread().setContextClassLoader(resourcesLoader);
    resolver = new FileResolverImpl();
}
Also used : FileResolverImpl(io.vertx.core.file.impl.FileResolverImpl) File(java.io.File)

Example 3 with FileResolverImpl

use of io.vertx.core.file.impl.FileResolverImpl in project vert.x by eclipse.

the class FileResolverTestBase method testDeleteCacheDir.

@Test
public void testDeleteCacheDir() throws Exception {
    FileResolver resolver2 = new FileResolverImpl();
    File file = resolver2.resolveFile("webroot/somefile.html");
    assertTrue(file.exists());
    File cacheDir = file.getParentFile().getParentFile();
    assertTrue(cacheDir.exists());
    resolver2.close();
    assertFalse(cacheDir.exists());
}
Also used : FileResolverImpl(io.vertx.core.file.impl.FileResolverImpl) FileResolver(io.vertx.core.spi.file.FileResolver) File(java.io.File) Test(org.junit.Test)

Aggregations

FileResolverImpl (io.vertx.core.file.impl.FileResolverImpl)3 File (java.io.File)3 FileResolver (io.vertx.core.spi.file.FileResolver)2 Test (org.junit.Test)2