Search in sources :

Example 11 with FileManager

use of com.opensymphony.xwork2.FileManager in project struts by apache.

the class UrlUtilTest2 method testOpenWithJarProtocol.

public void testOpenWithJarProtocol() throws IOException {
    FileManager fileManager = new DefaultFileManager();
    URL url = ClassLoaderUtil.getResource("xwork-jar.jar", ClassLoaderUtil.class);
    URL jarUrl = new URL("jar", "", url.toExternalForm() + "!/");
    URL outputURL = fileManager.normalizeToFileProtocol(jarUrl);
    assertNotNull(outputURL);
    assertUrlCanBeOpened(outputURL);
}
Also used : DefaultFileManager(com.opensymphony.xwork2.util.fs.DefaultFileManager) FileManager(com.opensymphony.xwork2.FileManager) DefaultFileManager(com.opensymphony.xwork2.util.fs.DefaultFileManager) URL(java.net.URL)

Example 12 with FileManager

use of com.opensymphony.xwork2.FileManager in project struts by apache.

the class DefaultFileManagerTest method testReloadingConfigs.

public void testReloadingConfigs() throws Exception {
    // given
    container.getInstance(FileManagerFactory.class).setReloadingConfigs("false");
    FileManager fm = container.getInstance(FileManagerFactory.class).getFileManager();
    String resourceName = "xwork-sample.xml";
    assertFalse(fm.fileNeedsReloading(resourceName));
    // when
    container.getInstance(FileManagerFactory.class).setReloadingConfigs("true");
    // then
    fm = container.getInstance(FileManagerFactory.class).getFileManager();
    assertTrue(fm.fileNeedsReloading(resourceName));
}
Also used : FileManagerFactory(com.opensymphony.xwork2.FileManagerFactory) FileManager(com.opensymphony.xwork2.FileManager)

Example 13 with FileManager

use of com.opensymphony.xwork2.FileManager in project struts by apache.

the class DummyFileManager method testCreateDummyFileManager.

public void testCreateDummyFileManager() throws Exception {
    // given
    fileManager = new DummyFileManager();
    DefaultFileManagerFactory factory = new DefaultFileManagerFactory();
    factory.setFileManager(new DefaultFileManager());
    factory.setContainer(new DummyContainer());
    // when
    FileManager fm = factory.getFileManager();
    // then
    assertTrue(fm instanceof DummyFileManager);
}
Also used : FileManager(com.opensymphony.xwork2.FileManager)

Aggregations

FileManager (com.opensymphony.xwork2.FileManager)12 FileManagerFactory (com.opensymphony.xwork2.FileManagerFactory)6 DefaultFileManager (com.opensymphony.xwork2.util.fs.DefaultFileManager)4 HashSet (java.util.HashSet)3 Container (com.opensymphony.xwork2.inject.Container)2 DefaultFileManagerFactory (com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory)2 File (java.io.File)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 ActionContext (com.opensymphony.xwork2.ActionContext)1 SimpleAnnotationAction (com.opensymphony.xwork2.SimpleAnnotationAction)1 Configuration (com.opensymphony.xwork2.config.Configuration)1 FileManagerFactoryProvider (com.opensymphony.xwork2.config.FileManagerFactoryProvider)1 FileManagerProvider (com.opensymphony.xwork2.config.FileManagerProvider)1 PackageConfig (com.opensymphony.xwork2.config.entities.PackageConfig)1 DefaultConfiguration (com.opensymphony.xwork2.config.impl.DefaultConfiguration)1 XWorkConverter (com.opensymphony.xwork2.conversion.impl.XWorkConverter)1 OgnlTextParser (com.opensymphony.xwork2.util.OgnlTextParser)1 TextParser (com.opensymphony.xwork2.util.TextParser)1 ValueStack (com.opensymphony.xwork2.util.ValueStack)1