| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
import java.util.Arrays; |
| 39 |
import java.util.Collections; |
| 40 |
import java.util.List; |
| 41 |
import net.sourceforge.jnlp.ProcessResult; |
| 42 |
import net.sourceforge.jnlp.ServerAccess; |
| 43 |
import net.sourceforge.jnlp.annotations.Bug; |
| 44 |
|
| 45 |
import org.junit.Assert; |
| 46 |
import org.junit.Test; |
| 47 |
|
| 48 |
public class ExtensionJnlpTest { |
| 49 |
|
| 50 |
private static ServerAccess server = new ServerAccess(); |
| 51 |
private final List<String> l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); |
| 52 |
private final String jarOutput = "Running SignedJarResource.."; |
| 53 |
private final String signedJnlpException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: " |
| 54 |
+ "The signed JNLP file did not match the launching JNLP file. Missing Resource: Signed Application " |
| 55 |
+ "did not match launching JNLP File"; |
| 56 |
|
| 57 |
@Test |
| 58 |
public void checkingForRequiredResources() throws Exception { |
| 59 |
ProcessResult pr = server.executeJavawsHeadless(l, "/UsesSignedJar.jnlp"); |
| 60 |
Assert.assertTrue("Could not locate SignedJarResource class within SignedJarResource jar", pr.stdout.contains(jarOutput)); |
| 61 |
|
| 62 |
String s = "Running SignedJnlpResource.."; |
| 63 |
pr = server.executeJavawsHeadless(l, "/UsesSignedJnlp.jnlp"); |
| 64 |
Assert.assertTrue("Could not locate SignedJnlpResource class within SignedJnlpResource jar", pr.stdout.contains(s)); |
| 65 |
} |
| 66 |
|
| 67 |
@Bug(id = "PR1040") |
| 68 |
@Test |
| 69 |
public void usingSignedExtension() throws Exception { |
| 70 |
ProcessResult pr = server.executeJavawsHeadless(l, "/UsesSignedJarExtension.jnlp"); |
| 71 |
Assert.assertTrue("Stdout should contain " + jarOutput + " but did not", pr.stdout.contains(jarOutput)); |
| 72 |
} |
| 73 |
|
| 74 |
@Bug(id = "PR1041") |
| 75 |
@Test |
| 76 |
public void mainJarInExtension() throws Exception { |
| 77 |
ProcessResult pr = server.executeJavawsHeadless(l, "/UsesSignedJnlpJarAndSignedJarExtension.jnlp"); |
| 78 |
Assert.assertTrue("Stdout should contain " + jarOutput + " but did not", pr.stdout.contains(jarOutput)); |
| 79 |
} |
| 80 |
|
| 81 |
@Bug(id = "PR1042") |
| 82 |
@Test |
| 83 |
public void checkingSignedJnlpInExtension() throws Exception { |
| 84 |
ProcessResult pr = server.executeJavawsHeadless(l, "/UsesSignedJnlpExtension.jnlp"); |
| 85 |
Assert.assertTrue("Stdout should contain " + signedJnlpException + " but did not", pr.stderr.contains(signedJnlpException)); |
| 86 |
} |
| 87 |
} |