diff options
Diffstat (limited to 'tests/netx/unit/net/sourceforge')
7 files changed, 187 insertions, 151 deletions
diff --git a/tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java b/tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java index 0f2a83f..1056ea2 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/JNLPFileTest.java @@ -138,10 +138,10 @@ public class JNLPFileTest { "</jnlp>"; URL codeBase = new URL("http://www.redhat.com/"); - ; + InputStream is = new ByteArrayInputStream(jnlpContext.getBytes()); - JNLPFile jnlpFile = new JNLPFile(is, codeBase, false); + JNLPFile jnlpFile = new JNLPFile(is, codeBase, new ParserSettings(false,false,false)); Assert.assertEquals("http://icedtea.claspath.org/", jnlpFile.getCodeBase().toExternalForm()); Assert.assertEquals("redhat.embeddedjnlp", jnlpFile.getApplet().getMainClass()); diff --git a/tests/netx/unit/net/sourceforge/jnlp/ParserBasic.java b/tests/netx/unit/net/sourceforge/jnlp/ParserBasic.java index e1d009d..048e517 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/ParserBasic.java +++ b/tests/netx/unit/net/sourceforge/jnlp/ParserBasic.java @@ -61,9 +61,10 @@ public class ParserBasic { if (cl == null) { cl = ClassLoader.getSystemClassLoader(); } + ParserSettings defaultParser = new ParserSettings(); InputStream jnlpStream = cl.getResourceAsStream("net/sourceforge/jnlp/basic.jnlp"); - root = Parser.getRootNode(jnlpStream); - parser = new Parser(new DummyJNLPFile(), null, root, false, false); + root = Parser.getRootNode(jnlpStream, defaultParser); + parser = new Parser(new DummyJNLPFile(), null, root, defaultParser); } @Test diff --git a/tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java b/tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java index 00aa5d9..b987188 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java +++ b/tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java @@ -50,6 +50,7 @@ import org.junit.Test; /** Test various corner cases of the parser */ public class ParserCornerCases { + private static final ParserSettings defaultParser = new ParserSettings(false, true,true); @Test public void testCdata() throws ParseException, XMLParseException, IOException { @@ -63,7 +64,7 @@ public class ParserCornerCases { Assert.assertTrue(target.getContent().contains("DOCTYPE")); Assert.assertTrue(target.getContent().contains("<entry key=\"key\">value</entry>")); - Node node = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node node = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("argument", node.getNodeName()); String contents = node.getNodeValue(); Assert.assertTrue(contents.contains("xml")); @@ -90,7 +91,7 @@ public class ParserCornerCases { Assert.assertTrue(target.getContent().contains("DOCTYPE")); Assert.assertTrue(target.getContent().contains("<entry key=\"key\">value</entry>")); - Node node = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node node = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); node = node.getFirstChild().getFirstChild(); Assert.assertEquals("argument", node.getNodeName()); String contents = node.getNodeValue(); @@ -126,53 +127,36 @@ public class ParserCornerCases { @Test public void testUnsupportedSpecNumber() throws ParseException { String malformedJnlp = "<?xml?><jnlp spec='11.11'></jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); - Parser parser = new Parser(null, null, root, false, false); + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), defaultParser); + Parser parser = new Parser(null, null, root, defaultParser); Assert.assertEquals("11.11", parser.getSpecVersion().toString()); } @Test public void testApplicationAndComponent() throws ParseException { String malformedJnlp = "<?xml?><jnlp><application-desc/><component-desc/></jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); - Parser parser = new Parser(null, null, root, false, false); + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), defaultParser); + Parser parser = new Parser(null, null, root, defaultParser); Assert.assertNotNull(parser.getLauncher(root)); } @Test public void testCommentInElements() throws ParseException { String malformedJnlp = "<?xml?><jnlp spec='1.0' <!-- comment -->> </jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); - Parser p = new Parser(null, null, root, false, false); + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), defaultParser); + Parser p = new Parser(null, null, root, defaultParser); Assert.assertEquals("1.0", p.getSpecVersion().toString()); } @Test - public void testCommentInElements2() throws ParseException { - String malformedJnlp = "<?xml?><jnlp <!-- comment --> spec='1.0'> </jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); - Parser p = new Parser(null, null, root, false, false); - Assert.assertEquals("1.0", p.getSpecVersion().toString()); - } - - @Test - @KnownToFail - public void testCommentInAttributes() throws ParseException { - String malformedJnlp = "<?xml?><jnlp spec='<!-- something -->'></jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); - Parser p = new Parser(null, null, root, false, false); - Assert.assertEquals("<!-- something -->", p.getSpecVersion().toString()); - } - - @Test public void testNestedComments() throws ParseException { String malformedJnlp = "<?xml?>" + "<jnlp><information><title>testNestedComments</title>" + "<vendor>IcedTea</vendor><description>" + "<!-- outer <!-- inner --> -->" + "</description></information></jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); - Parser p = new Parser(null, null, root, false, false); + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), defaultParser); + Parser p = new Parser(null, null, root, defaultParser); Assert.assertEquals(" -->", p.getInfo(root).get(0).getDescription()); } @@ -186,8 +170,42 @@ public class ParserCornerCases { " -->\n" + " <information/>" + "</jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); - Parser p = new Parser(null, null, root, false, false); + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), defaultParser); + Parser p = new Parser(null, null, root, defaultParser); } + + @Test + public void testCommentInElements2() throws ParseException { + String malformedJnlp = "<?xml?><jnlp <!-- comment --> spec='1.0'> </jnlp>"; + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), new ParserSettings(false, true,true)); + Parser p = new Parser(null, null, root, defaultParser); + //defaultis used + Assert.assertEquals("1.0+", p.getSpecVersion().toString()); + } + + @Test + public void testCommentInElements2_malformedOff() throws ParseException { + String malformedJnlp = "<?xml?><jnlp <!-- comment --> spec='1.0'> </jnlp>"; + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), new ParserSettings(false, true,false)); + Parser p = new Parser(null, null, root, defaultParser); + Assert.assertEquals("1.0", p.getSpecVersion().toString()); + } + @Test + public void testCommentInAttributes() throws ParseException { + String malformedJnlp = "<?xml?><jnlp spec='<!-- something -->'></jnlp>"; + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), new ParserSettings(false, true,true)); + Parser p = new Parser(null, null, root, defaultParser); + Assert.assertEquals("<!-- something -->", p.getSpecVersion().toString()); + } + + + @Test + public void testCommentInAttributes_malformedOff() throws ParseException { + String malformedJnlp = "<?xml?><jnlp spec='<!-- something -->'></jnlp>"; + Node root = Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), new ParserSettings(false, true,false)); + Parser p = new Parser(null, null, root, defaultParser); + //defaultis used + Assert.assertEquals("1.0+", p.getSpecVersion().toString()); + } } diff --git a/tests/netx/unit/net/sourceforge/jnlp/ParserMalformedXml.java b/tests/netx/unit/net/sourceforge/jnlp/ParserMalformedXml.java index 2c30970..8c038e2 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/ParserMalformedXml.java +++ b/tests/netx/unit/net/sourceforge/jnlp/ParserMalformedXml.java @@ -51,6 +51,7 @@ import org.junit.Test; public class ParserMalformedXml { private static String originalJnlp = null; + private static ParserSettings lenientParserSettings = new ParserSettings(false, true, true); @BeforeClass public static void setUp() throws IOException { @@ -71,28 +72,38 @@ public class ParserMalformedXml { @Test public void testMissingXmlDecleration() throws ParseException { String malformedJnlp = originalJnlp.replaceFirst("<\\?xml.*\\?>", ""); - Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); + Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), lenientParserSettings); } @Test @KnownToFail public void testMalformedArguments() throws ParseException { String malformedJnlp = originalJnlp.replace("arg2</argument", "arg2<argument"); - Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); + Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), lenientParserSettings); } @Test - @KnownToFail public void testTagNotClosed() throws ParseException { String malformedJnlp = originalJnlp.replace("</jnlp>", "<jnlp>"); - Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); + Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), lenientParserSettings); } @Test - @KnownToFail public void testUnquotedAttributes() throws ParseException { String malformedJnlp = originalJnlp.replace("'jnlp.jnlp'", "jnlp.jnlp"); - Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes())); + Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), lenientParserSettings); + } + + @Test(expected = ParseException.class) + public void testTagNotClosedNoTagSoup() throws ParseException { + String malformedJnlp = originalJnlp.replace("</jnlp>", "<jnlp>"); + Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), new ParserSettings(false, true, false)); + } + + @Test(expected = ParseException.class) + public void testUnquotedAttributesNoTagSoup() throws ParseException { + String malformedJnlp = originalJnlp.replace("'jnlp.jnlp'", "jnlp.jnlp"); + Parser.getRootNode(new ByteArrayInputStream(malformedJnlp.getBytes()), new ParserSettings(false, true, false)); } } diff --git a/tests/netx/unit/net/sourceforge/jnlp/ParserTest.java b/tests/netx/unit/net/sourceforge/jnlp/ParserTest.java index 7def639..0e958dc 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/ParserTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/ParserTest.java @@ -58,15 +58,16 @@ public class ParserTest { private static final Locale LANG_COUNTRY_LOCALE = new Locale(LANG, COUNTRY); private static final Locale ALL_LOCALE = new Locale(LANG, COUNTRY, VARIANT); + ParserSettings defaultParser=new ParserSettings(); @Test(expected = MissingInformationException.class) public void testMissingInfoFullLocale() throws ParseException { String data = "<jnlp></jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); parser.getInfo(root); } @@ -77,11 +78,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -100,11 +101,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly one info desc should be found", infoDescs.size() == 1); @@ -130,10 +131,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly two info descs should be found", infoDescs.size() == 2); @@ -157,10 +158,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly two info descs should be found", infoDescs.size() == 2); @@ -180,10 +181,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly one info desc should be found", infoDescs.size() == 1); @@ -211,10 +212,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -242,10 +243,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -272,10 +273,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -301,10 +302,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -329,10 +330,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -356,10 +357,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -380,10 +381,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -404,10 +405,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -426,11 +427,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -449,11 +450,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -488,11 +489,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(ALL_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly five info descs should be found", infoDescs.size() == 5); @@ -511,11 +512,11 @@ public class ParserTest { public void testMissingInfoLangCountryLocale() throws ParseException { String data = "<jnlp></jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); parser.getInfo(root); } @@ -526,11 +527,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -549,11 +550,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly one info desc should be found", infoDescs.size() == 1); @@ -575,10 +576,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly two info descs should be found", infoDescs.size() == 2); @@ -602,10 +603,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly two info descs should be found", infoDescs.size() == 2); @@ -625,10 +626,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly one info desc should be found", infoDescs.size() == 1); @@ -656,10 +657,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -687,10 +688,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -717,10 +718,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -746,10 +747,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -774,10 +775,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -801,10 +802,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -825,10 +826,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -849,10 +850,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -871,11 +872,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -894,11 +895,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -933,11 +934,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_COUNTRY_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly five info descs should be found", infoDescs.size() == 5); @@ -956,11 +957,11 @@ public class ParserTest { public void testMissingInfoLangLocale() throws ParseException { String data = "<jnlp></jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); parser.getInfo(root); } @@ -971,11 +972,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -994,11 +995,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly one info desc should be found", infoDescs.size() == 1); @@ -1016,10 +1017,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly one info desc should be found", infoDescs.size() == 1); @@ -1040,10 +1041,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly two info descs should be found", infoDescs.size() == 2); @@ -1063,10 +1064,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly one info desc should be found", infoDescs.size() == 1); @@ -1094,10 +1095,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -1125,10 +1126,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly three info descs should be found", infoDescs.size() == 3); @@ -1151,10 +1152,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly two info descs should be found", infoDescs.size() == 2); @@ -1179,10 +1180,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -1206,10 +1207,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -1230,10 +1231,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -1254,10 +1255,10 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -1276,11 +1277,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -1299,11 +1300,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = new ArrayList<InformationDesc>(); infoDescs.addAll(parser.getInfo(root)); @@ -1338,11 +1339,11 @@ public class ParserTest { + " </information>\n" + "</jnlp>\n"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false); + Parser parser = new Parser(file, null, root, defaultParser); List<InformationDesc> infoDescs = parser.getInfo(root); Assert.assertTrue("Exactly five info descs should be found", infoDescs.size() == 5); @@ -1366,12 +1367,12 @@ public class ParserTest { ">\n" + "</jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); URL overwrittenCodebase = new URL("http://icedtea.classpath.org"); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false, overwrittenCodebase); + Parser parser = new Parser(file, null, root, defaultParser, overwrittenCodebase); Assert.assertEquals("http://www.redhat.com/", parser.getCodeBase().toExternalForm()); } @@ -1385,12 +1386,12 @@ public class ParserTest { ">\n" + "</jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); URL overwrittenCodebase = new URL("http://icedtea.classpath.org"); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false, overwrittenCodebase); + Parser parser = new Parser(file, null, root, defaultParser, overwrittenCodebase); Assert.assertEquals(overwrittenCodebase.toExternalForm(), parser.getCodeBase().toExternalForm()); } @@ -1403,12 +1404,12 @@ public class ParserTest { ">\n" + "</jnlp>"; - Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes())); + Node root = Parser.getRootNode(new ByteArrayInputStream(data.getBytes()), defaultParser); Assert.assertEquals("Root name is not jnlp", "jnlp", root.getNodeName()); URL overwrittenCodebase = new URL("http://icedtea.classpath.org"); MockJNLPFile file = new MockJNLPFile(LANG_LOCALE); - Parser parser = new Parser(file, null, root, false, false, overwrittenCodebase); + Parser parser = new Parser(file, null, root, defaultParser, overwrittenCodebase); Assert.assertEquals(overwrittenCodebase.toExternalForm(), parser.getCodeBase().toExternalForm()); } diff --git a/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java b/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java index 9015acf..951f9bf 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/PluginBridgeTest.java @@ -48,7 +48,8 @@ public class PluginBridgeTest { return JNLPHref; } - public JNLPFile create(URL location, Version version, boolean strict, + @Override + public JNLPFile create(URL location, Version version, ParserSettings settings, UpdatePolicy policy, URL forceCodebase) throws IOException, ParseException { JNLPHref = location; return new MockJNLPFile(); @@ -195,6 +196,8 @@ public class PluginBridgeTest { } @Test + //http://docs.oracle.com/javase/6/docs/technotes/guides/jweb/applet/codebase_determination.html + //example 3 public void testEmbeddedJnlpWithInvalidCodebase() throws Exception { URL overwrittenCodebase = new URL("http://icedtea.classpath.org"); String relativeLocation = "/EmbeddedJnlpFile.jnlp"; diff --git a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/InformationElementTest.java b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/InformationElementTest.java index 3cf06b2..1eea903 100644 --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/InformationElementTest.java +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/parts/InformationElementTest.java @@ -43,6 +43,7 @@ import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; import net.sourceforge.jnlp.JNLPFile; import net.sourceforge.jnlp.ParseException; +import net.sourceforge.jnlp.ParserSettings; import org.junit.Assert; import org.junit.Test; @@ -219,6 +220,7 @@ public class InformationElementTest { @Test public void createFromJNLP() throws UnsupportedEncodingException, ParseException { + ParserSettings parser = new ParserSettings(); JNLPFile jnlpFile0 = null; InformationElement ie0 = InformationElement.createFromJNLP(jnlpFile0); Assert.assertNotNull(ie0); @@ -226,7 +228,7 @@ public class InformationElementTest { Exception ex = null; JNLPFile jnlpFile1 = null; try { - jnlpFile1 = new JNLPFile(new ByteArrayInputStream(exJnlp1.getBytes("utf-8")), true); + jnlpFile1 = new JNLPFile(new ByteArrayInputStream(exJnlp1.getBytes("utf-8")), parser); } catch (Exception eex) { ex = eex; } @@ -236,28 +238,28 @@ public class InformationElementTest { //title, vendor and homepage are obligatory.. not so much to test String exJnlp2 = testJnlpheader + title.toXml() + "\n" + homepage.toXml() + "\n" + vendor.toXml() + "\n" + testJnlpFooter; - JNLPFile jnlpFile2 = new JNLPFile(new ByteArrayInputStream(exJnlp2.getBytes("utf-8")), true); + JNLPFile jnlpFile2 = new JNLPFile(new ByteArrayInputStream(exJnlp2.getBytes("utf-8")), parser); InformationElement ie2 = InformationElement.createFromJNLP(jnlpFile2); Assert.assertNotNull(ie2); Assert.assertEquals(3, ie2.getHeader().size()); Assert.assertEquals(0, ie2.getDescriptions().size()); String exJnlp3 = testJnlpheader + title.toXml() + "\n" + homepage.toXml() + "\n" + vendor.toXml() + "\n" + toolTipD.toXml() + "\n" + testJnlpFooter; - JNLPFile jnlpFile3 = new JNLPFile(new ByteArrayInputStream(exJnlp3.getBytes("utf-8")), true); + JNLPFile jnlpFile3 = new JNLPFile(new ByteArrayInputStream(exJnlp3.getBytes("utf-8")), parser); InformationElement ie3 = InformationElement.createFromJNLP(jnlpFile3); Assert.assertNotNull(ie3); Assert.assertEquals(3, ie3.getHeader().size()); Assert.assertEquals(1, ie3.getDescriptions().size()); String exJnlp4 = testJnlpheader + title.toXml() + "\n" + homepage.toXml() + "\n" + vendor.toXml() + "\n" + noKindD.toXml() + "\n" + testJnlpFooter; - JNLPFile jnlpFile4 = new JNLPFile(new ByteArrayInputStream(exJnlp4.getBytes("utf-8")), true); + JNLPFile jnlpFile4 = new JNLPFile(new ByteArrayInputStream(exJnlp4.getBytes("utf-8")), parser); InformationElement ie4 = InformationElement.createFromJNLP(jnlpFile4); Assert.assertNotNull(ie4); Assert.assertEquals(3, ie4.getHeader().size()); Assert.assertEquals(1, ie4.getDescriptions().size()); String exJnlp5 = testJnlpheader + title.toXml() + "\n" + homepage.toXml() + "\n" + vendor.toXml() + "\n" + noKindD.toXml() + "\n" + toolTipD.toXml() + "\n" + testJnlpFooter; - JNLPFile jnlpFile5 = new JNLPFile(new ByteArrayInputStream(exJnlp5.getBytes("utf-8")), true); + JNLPFile jnlpFile5 = new JNLPFile(new ByteArrayInputStream(exJnlp5.getBytes("utf-8")), parser); InformationElement ie5 = InformationElement.createFromJNLP(jnlpFile5); Assert.assertNotNull(ie5); Assert.assertEquals(3, ie5.getHeader().size()); |