From 1c3034421f64b802cef7b30c44b8524b36255e2f Mon Sep 17 00:00:00 2001
From: Adam Domurad <adomurad@redhat.com>
Date: Wed, 29 May 2013 15:43:21 -0400
Subject: Move inner test class MockedOneJarJNLPFile to top-level
 DummyJNLPFileWithJar

---
 .../jnlp/mock/DummyJNLPFileWithJar.java            | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 tests/test-extensions/net/sourceforge/jnlp/mock/DummyJNLPFileWithJar.java

(limited to 'tests/test-extensions/net')

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
-- 
cgit v1.2.3