@Test public void testExactMatchesWithCaseMixture() throws Exception { GadgetBlacklist bl = createBlacklist(someUri + "\nhttp://BAZ.com/foo.xml"); assertTrue(bl.isBlacklisted(someUri)); assertTrue(bl.isBlacklisted(Uri.parse("http://BLA.com/foo.xml"))); assertTrue(bl.isBlacklisted(Uri.parse("http://baz.com/foo.xml"))); }
@Test public void testRegexpMatches() throws Exception { GadgetBlacklist bl = createBlacklist("REGEXP http://bla.com/.*"); assertTrue(bl.isBlacklisted(someUri)); assertTrue(bl.isBlacklisted(Uri.parse("http://bla.com/bar.xml"))); assertFalse(bl.isBlacklisted(Uri.parse("http://blo.com/bar.xml"))); }
@Test public void testExactMatches() throws Exception { GadgetBlacklist bl = createBlacklist(someUri + "\nhttp://baz.com/foo.xml"); assertFalse(bl.isBlacklisted(Uri.parse("http://random.com/uri.xml"))); assertTrue(bl.isBlacklisted(someUri)); }
@Test public void testEmptyBlacklist() throws Exception { GadgetBlacklist bl = createBlacklist(""); assertFalse(bl.isBlacklisted(someUri)); }
@Test public void testIgnoredCommentsAndWhitespace() throws Exception { GadgetBlacklist bl = createBlacklist( "# comment\n \t" + someUri + " \n # comment\n\n"); assertTrue(bl.isBlacklisted(someUri)); }
if (blacklist.isBlacklisted(context.getUrl())) { LOG.info("Attempted to render blacklisted gadget: " + context.getUrl()); throw new ProcessingException("The requested gadget is unavailable",
if (blacklist.isBlacklisted(context.getUrl())) { LOG.info("Attempted to render blacklisted gadget: " + context.getUrl()); throw new ProcessingException("The requested gadget is unavailable",