List of usage examples for org.apache.commons.io FileUtils copyURLToFile
public static void copyURLToFile(URL source, File destination) throws IOException
source
to a file destination
. From source file:org.geoserver.python.filter.FilterFunctionIntegrationTest.java
@Override protected void setUpInternal() throws Exception { Python py = (Python) applicationContext.getBean("python"); FileUtils.copyURLToFile(getClass().getResource("wfs.py"), new File(py.getFilterRoot(), "wfs.py")); FileUtils.copyURLToFile(getClass().getResource("sld.py"), new File(py.getFilterRoot(), "sld.py")); }
From source file:org.geoserver.python.filter.PythonFilterFunctionAdapterTest.java
@BeforeClass public static void setUpData() throws Exception { GeoServerResourceLoader loader = new GeoServerResourceLoader(new File("target")); py = new Python(loader); File f = new File("target", "foo_function.py"); FileUtils.copyURLToFile(PythonFilterFunctionAdapterTest.class.getResource("foo_function.py"), f); adapter = new PythonFilterFunctionAdapter(f, py); }
From source file:org.geoserver.python.format.PythonMapFormatAdapterTest.java
@BeforeClass public static void setUpData() throws Exception { GeoServerResourceLoader loader = new GeoServerResourceLoader(new File("target")); py = new Python(loader); File f = new File("target", "foo_mapformat.py"); FileUtils.copyURLToFile(PythonVectorFormatAdapterTest.class.getResource("foo_mapformat.py"), f); adapter = new PythonMapFormatAdapter(f, py); }
From source file:org.geoserver.python.format.PythonVectorFormatAdapterTest.java
@BeforeClass public static void setUpData() throws Exception { GeoServerResourceLoader loader = new GeoServerResourceLoader(new File("target")); py = new Python(loader); File f = new File("target", "foo_vectorformat.py"); FileUtils.copyURLToFile(PythonVectorFormatAdapterTest.class.getResource("foo_vectorformat.py"), f); adapter = new PythonVectorFormatAdapter(f, py); }
From source file:org.geoserver.python.process.PythonProcessAdapterTest.java
@BeforeClass public static void setUpData() throws Exception { GeoServerResourceLoader loader = new GeoServerResourceLoader(new File("target")); py = new Python(loader); File f = new File("target", "foo_process.py"); FileUtils.copyURLToFile(PythonProcessAdapterTest.class.getResource("foo_process.py"), f); adapter = new PythonProcessAdapter(f, py); }
From source file:org.geoserver.script.app.AppTest.java
public void testSimple() throws Exception { FileUtils.copyURLToFile(getClass().getResource("main-helloWorld." + ext), new File(app, "main." + ext)); MockHttpServletResponse resp = getAsServletResponse("/script/apps/foo/main." + ext); assertEquals(200, resp.getStatusCode()); assertEquals("Hello World!", resp.getOutputStreamContent()); }
From source file:org.geoserver.script.function.ScriptFunctionIntTest.java
@Override protected void setUpInternal() throws Exception { super.setUpInternal(); File script = new File(getScriptManager().getFunctionRoot(), "wfs.js"); FileUtils.copyURLToFile(getClass().getResource(script.getName()), script); script = new File(getScriptManager().getFunctionRoot(), "sld.js"); FileUtils.copyURLToFile(getClass().getResource(script.getName()), script); }
From source file:org.geoserver.script.function.ScriptFunctionTest.java
@Override protected void setUp() throws Exception { super.setUp(); File function = scriptMgr.getFunctionRoot(); File script = new File(function, "factorial." + getExtension()); FileUtils.copyURLToFile(getClass().getResource(script.getName()), script); }
From source file:org.geoserver.script.py.PyAppTest.java
public void testSimple() throws Exception { FileUtils.copyURLToFile(getClass().getResource("main-helloWorld.py"), new File(app, "main.py")); MockHttpServletResponse resp = getAsServletResponse("/script/apps/foo/main.py"); assertEquals(200, resp.getStatusCode()); assertEquals("Hello World!", resp.getOutputStreamContent()); }
From source file:org.geoserver.script.py.PyAppTest.java
public void testContentType() throws Exception { FileUtils.copyURLToFile(getClass().getResource("main-helloWorldJSON.py"), new File(app, "main.py")); MockHttpServletResponse resp = getAsServletResponse("/script/apps/foo/main.py"); assertEquals(200, resp.getStatusCode()); assertEquals("application/json", resp.getContentType()); }