diff options
author | Jiri Vanek <[email protected]> | 2013-11-01 11:08:06 +0100 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2013-11-01 11:08:06 +0100 |
commit | 113381d62d1eabb685f248573beff4195076740b (patch) | |
tree | 078043bf535410c68762b57b6648dacf96d52994 /tests/test-extensions/net/sourceforge/jnlp/mock | |
parent | 5c1af20ae6967095c67d2859824af90ea1bf22d5 (diff) |
tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java: added tests for custom attributes (getCustomAtributes), (getCustomAtributesEmpty) and test to ensure order during searching for attributes in manifests (checkOrderWhenReadingAttributes).
tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java: can now handle multiple source jars, and set main jar (new constructors), (jarFiles) and (jarDescs) redeclared to arrays.
Diffstat (limited to 'tests/test-extensions/net/sourceforge/jnlp/mock')
-rw-r--r-- | tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java b/tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java index dd3ea84..0ef4e10 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java +++ b/tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java @@ -17,25 +17,65 @@ import net.sourceforge.jnlp.Version; 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); + static JARDesc makeJarDesc(URL jarLocation, boolean main) { + return new JARDesc(jarLocation, new Version("1"), null, false,main, false,false); } - public URL codeBase, jarLocation; - public JARDesc jarDesc; + private final URL codeBase; + private final JARDesc[] jarDescs; + private final File[] jarFiles; - public DummyJNLPFileWithJar(File jarFile) throws MalformedURLException { - codeBase = jarFile.getParentFile().toURI().toURL(); - jarLocation = jarFile.toURI().toURL(); - jarDesc = makeJarDesc(jarLocation); + public DummyJNLPFileWithJar(File... jarFiles) throws MalformedURLException { + this(-1, jarFiles); + } + public DummyJNLPFileWithJar(int main, File... jarFiles) throws MalformedURLException { + codeBase = jarFiles[0].getParentFile().toURI().toURL(); + this.jarFiles = jarFiles; + jarDescs = new JARDesc[jarFiles.length]; + + for (int i = 0; i < jarFiles.length; i++) { + jarDescs[i] = makeJarDesc(jarFiles[i].toURI().toURL(), i==main); + + } info = new ArrayList<InformationDesc>(); } + public URL getJarLocation() { + try { + return jarFiles[0].toURI().toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + public URL getJarLocation(int i) { + try { + return jarFiles[i].toURI().toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + public JARDesc[] getJarDescs() { + return jarDescs; + } + + public JARDesc getJarDesc() { + return jarDescs[0]; + } + + public JARDesc getJarDesc(int i) { + return jarDescs[i]; + } + + @Override public ResourcesDesc getResources() { - ResourcesDesc resources = new ResourcesDesc(null, new Locale[0], new String[0], new String[0]); - resources.addResource(jarDesc); - return resources; + ResourcesDesc localResources = new ResourcesDesc(null, new Locale[0], new String[0], new String[0]); + for (JARDesc j : jarDescs) { + localResources.addResource(j); + } + return localResources; } @Override public ResourcesDesc[] getResourcesDescs(final Locale locale, final String os, final String arch) { |