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);
}
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));
}
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);
}
Aggregations