diff options
author | Adam Domurad <[email protected]> | 2013-05-29 15:43:21 -0400 |
---|---|---|
committer | Adam Domurad <[email protected]> | 2013-05-29 15:43:21 -0400 |
commit | 1c3034421f64b802cef7b30c44b8524b36255e2f (patch) | |
tree | 0ec64c7c55fd6049cb1469470579f484c2dcfa83 /tests/test-extensions/net | |
parent | 24907cfe8306bb88d954a08e3d4a50e2c118152d (diff) |
Move inner test class MockedOneJarJNLPFile to top-level DummyJNLPFileWithJar
Diffstat (limited to 'tests/test-extensions/net')
-rw-r--r-- | tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java b/tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java new file mode 100644 index 0000000..dd3ea84 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java @@ -0,0 +1,54 @@ +package net.sourceforge.jnlp.mock; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Locale; + +import net.sourceforge.jnlp.InformationDesc; +import net.sourceforge.jnlp.JARDesc; +import net.sourceforge.jnlp.JNLPFile; +import net.sourceforge.jnlp.ResourcesDesc; +import net.sourceforge.jnlp.SecurityDesc; +import net.sourceforge.jnlp.Version; + +/* A mocked dummy JNLP file with a single JAR. */ +public class DummyJNLPFileWithJar extends JNLPFile { + + /* Create a JARDesc for the given URL location */ + static JARDesc makeJarDesc(URL jarLocation) { + return new JARDesc(jarLocation, new Version("1"), null, false,false, false,false); + } + + public URL codeBase, jarLocation; + public JARDesc jarDesc; + + public DummyJNLPFileWithJar(File jarFile) throws MalformedURLException { + codeBase = jarFile.getParentFile().toURI().toURL(); + jarLocation = jarFile.toURI().toURL(); + jarDesc = makeJarDesc(jarLocation); + info = new ArrayList<InformationDesc>(); + } + + @Override + public ResourcesDesc getResources() { + ResourcesDesc resources = new ResourcesDesc(null, new Locale[0], new String[0], new String[0]); + resources.addResource(jarDesc); + return resources; + } + @Override + public ResourcesDesc[] getResourcesDescs(final Locale locale, final String os, final String arch) { + return new ResourcesDesc[] { getResources() }; + } + + @Override + public URL getCodeBase() { + return codeBase; + } + + @Override + public SecurityDesc getSecurity() { + return new SecurityDesc(this, SecurityDesc.SANDBOX_PERMISSIONS, null); + } +}
\ No newline at end of file |