| 1 | package be.nikiroo.gofetch.test; |
| 2 | |
| 3 | import java.io.File; |
| 4 | import java.io.IOException; |
| 5 | import java.io.InputStream; |
| 6 | import java.net.MalformedURLException; |
| 7 | import java.net.URL; |
| 8 | import java.util.HashMap; |
| 9 | import java.util.Map; |
| 10 | |
| 11 | import be.nikiroo.gofetch.support.Slashdot; |
| 12 | import be.nikiroo.gofetch.support.Type; |
| 13 | |
| 14 | public class TestSlashdot extends TestBase { |
| 15 | |
| 16 | static private Map<URL, File> getMap() throws MalformedURLException { |
| 17 | Map<URL, File> map = new HashMap<URL, File>(); |
| 18 | |
| 19 | map.put(new URL("https://slashdot.org/"), new File("index.html")); |
| 20 | |
| 21 | map.put(new URL( |
| 22 | "https://developers.slashdot.org/story/18/09/06/2024232/software-developers-are-now-more-valuable-to-companies-than-money-says-survey"), |
| 23 | new File( |
| 24 | "developers.slashdot.org/story_18_09_06_2024232_software-developers-are-now-more-valuable-to-companies-than-money-says-survey.html")); |
| 25 | map.put(new URL( |
| 26 | "https://games.slashdot.org/story/18/09/06/1921222/eve-online-studio-acquired-by-korean-mmo-maker"), |
| 27 | new File( |
| 28 | "games.slashdot.org/story_18_09_06_1921222_eve-online-studio-acquired-by-korean-mmo-maker.html")); |
| 29 | map.put(new URL( |
| 30 | "https://games.slashdot.org/story/18/09/06/2146237/valve-explains-how-it-decides-whos-a-straight-up-troll-publishing-video-games-on-steam"), |
| 31 | new File( |
| 32 | "games.slashdot.org/story_18_09_06_2146237_valve-explains-how-it-decides-whos-a-straight-up-troll-publishing-video-games-on-steam.html")); |
| 33 | map.put(new URL( |
| 34 | "https://hardware.slashdot.org/story/18/09/06/1719243/robot-boat-sails-into-history-by-finishing-atlantic-crossing"), |
| 35 | new File( |
| 36 | "hardware.slashdot.org/story_18_09_06_1719243_robot-boat-sails-into-history-by-finishing-atlantic-crossing.html")); |
| 37 | map.put(new URL( |
| 38 | "https://hardware.slashdot.org/story/18/09/06/2058201/mit-graduate-creates-robot-that-swims-through-pipes-to-find-out-if-theyre-leaking"), |
| 39 | new File( |
| 40 | "hardware.slashdot.org/story_18_09_06_2058201_mit-graduate-creates-robot-that-swims-through-pipes-to-find-out-if-theyre-leaking.html")); |
| 41 | map.put(new URL( |
| 42 | "https://it.slashdot.org/story/18/09/07/0247228/380000-card-payments-compromised-in-british-airways-breach"), |
| 43 | new File( |
| 44 | "it.slashdot.org/story_18_09_07_0247228_380000-card-payments-compromised-in-british-airways-breach.html")); |
| 45 | map.put(new URL( |
| 46 | "https://mobile.slashdot.org/story/18/09/06/235254/icelanders-seek-to-keep-remote-nordic-peninsula-digital-free"), |
| 47 | new File( |
| 48 | "mobile.slashdot.org/story_18_09_06_235254_icelanders-seek-to-keep-remote-nordic-peninsula-digital-free.html")); |
| 49 | map.put(new URL( |
| 50 | "https://news.slashdot.org/story/18/09/06/1558206/computer-chips-are-still-made-in-usa"), |
| 51 | new File( |
| 52 | "news.slashdot.org/story_18_09_06_1558206_computer-chips-are-still-made-in-usa.html")); |
| 53 | map.put(new URL( |
| 54 | "https://news.slashdot.org/story/18/09/06/2043213/professor-who-coined-term-net-neutrality-thinks-its-time-to-break-up-facebook"), |
| 55 | new File( |
| 56 | "news.slashdot.org/story_18_09_06_2043213_professor-who-coined-term-net-neutrality-thinks-its-time-to-break-up-facebook.html")); |
| 57 | map.put(new URL( |
| 58 | "https://politics.slashdot.org/story/18/09/06/2137245/blockchains-are-not-safe-for-voting-concludes-nap-report"), |
| 59 | new File( |
| 60 | "politics.slashdot.org/story_18_09_06_2137245_blockchains-are-not-safe-for-voting-concludes-nap-report.html")); |
| 61 | map.put(new URL( |
| 62 | "https://science.slashdot.org/story/18/09/06/2153223/study-finds-probiotics-not-as-beneficial-for-gut-health-as-previously-thought"), |
| 63 | new File( |
| 64 | "science.slashdot.org/story_18_09_06_2153223_study-finds-probiotics-not-as-beneficial-for-gut-health-as-previously-thought.html")); |
| 65 | map.put(new URL( |
| 66 | "https://tech.slashdot.org/story/18/09/06/1839242/google-investigating-issue-with-blurry-fonts-on-new-chrome-69"), |
| 67 | new File( |
| 68 | "tech.slashdot.org/story_18_09_06_1839242_google-investigating-issue-with-blurry-fonts-on-new-chrome-69.html")); |
| 69 | map.put(new URL( |
| 70 | "https://tech.slashdot.org/story/18/09/06/1954253/400000-websites-vulnerable-through-exposed-git-directories"), |
| 71 | new File( |
| 72 | "tech.slashdot.org/story_18_09_06_1954253_400000-websites-vulnerable-through-exposed-git-directories.html")); |
| 73 | map.put(new URL( |
| 74 | "https://tech.slashdot.org/story/18/09/06/205221/ive-seen-the-future-of-consumer-ai-and-it-doesnt-have-one"), |
| 75 | new File( |
| 76 | "tech.slashdot.org/story_18_09_06_205221_ive-seen-the-future-of-consumer-ai-and-it-doesnt-have-one.html")); |
| 77 | map.put(new URL( |
| 78 | "https://yro.slashdot.org/story/18/09/06/1651255/tor-browser-gets-a-redesign-switches-to-new-firefox-quantum-engine"), |
| 79 | new File( |
| 80 | "yro.slashdot.org/story_18_09_06_1651255_tor-browser-gets-a-redesign-switches-to-new-firefox-quantum-engine.html")); |
| 81 | |
| 82 | return map; |
| 83 | } |
| 84 | |
| 85 | public TestSlashdot(String[] args) { |
| 86 | super(new Slashdot() { |
| 87 | @Override |
| 88 | protected InputStream open(URL url) throws IOException { |
| 89 | return doOpen(this, getMap(), url); |
| 90 | } |
| 91 | |
| 92 | @Override |
| 93 | public Type getType() { |
| 94 | return Type.SLASHDOT; |
| 95 | } |
| 96 | }, args); |
| 97 | } |
| 98 | } |