diff --git a/ENSIM/Java/tp-deezer3-HERBRON_Tanguy/test/fr/ensim/json/47685332.json b/ENSIM/Java/tp-deezer3-HERBRON_Tanguy/test/fr/ensim/json/47685332.json new file mode 100644 index 0000000..1577816 --- /dev/null +++ b/ENSIM/Java/tp-deezer3-HERBRON_Tanguy/test/fr/ensim/json/47685332.json @@ -0,0 +1 @@ +{"id":47685332,"title":"The Evol\u2019","upc":"3596973516022","link":"http:\/\/www.deezer.com\/album\/47685332","share":"https:\/\/www.deezer.com\/album\/47685332?utm_source=deezer&utm_content=album-47685332&utm_term=0_1539528700&utm_medium=web","cover":"http:\/\/api.deezer.com\/2.0\/album\/47685332\/image","cover_small":"http:\/\/e-cdn-images.deezer.com\/images\/cover\/af85cc0e970fb3b7dd02776d66a9be2b\/56x56-000000-80-0-0.jpg","cover_medium":"http:\/\/e-cdn-images.deezer.com\/images\/cover\/af85cc0e970fb3b7dd02776d66a9be2b\/250x250-000000-80-0-0.jpg","cover_big":"http:\/\/e-cdn-images.deezer.com\/images\/cover\/af85cc0e970fb3b7dd02776d66a9be2b\/500x500-000000-80-0-0.jpg","cover_xl":"http:\/\/e-cdn-images.deezer.com\/images\/cover\/af85cc0e970fb3b7dd02776d66a9be2b\/1000x1000-000000-80-0-0.jpg","genre_id":152,"genres":{"data":[{"id":152,"name":"Rock","picture":"http:\/\/api.deezer.com\/2.0\/genre\/152\/image","type":"genre"}]},"label":"t\u00f4t ou tard","nb_tracks":13,"duration":3502,"fans":40939,"rating":0,"release_date":"2017-11-17","record_type":"album","available":true,"tracklist":"http:\/\/api.deezer.com\/2.0\/album\/47685332\/tracks","explicit_lyrics":false,"contributors":[{"id":83325,"name":"Shaka Ponk","link":"http:\/\/www.deezer.com\/artist\/83325","share":"https:\/\/www.deezer.com\/artist\/83325?utm_source=deezer&utm_content=artist-83325&utm_term=0_1539528700&utm_medium=web","picture":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/image","picture_small":"http:\/\/e-cdn-images.deezer.com\/images\/artist\/02e237973b38db56e35e9eac2ab9671a\/56x56-000000-80-0-0.jpg","picture_medium":"http:\/\/e-cdn-images.deezer.com\/images\/artist\/02e237973b38db56e35e9eac2ab9671a\/250x250-000000-80-0-0.jpg","picture_big":"http:\/\/e-cdn-images.deezer.com\/images\/artist\/02e237973b38db56e35e9eac2ab9671a\/500x500-000000-80-0-0.jpg","picture_xl":"http:\/\/e-cdn-images.deezer.com\/images\/artist\/02e237973b38db56e35e9eac2ab9671a\/1000x1000-000000-80-0-0.jpg","radio":true,"tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist","role":"Main"}],"artist":{"id":83325,"name":"Shaka Ponk","picture":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/image","picture_small":"http:\/\/e-cdn-images.deezer.com\/images\/artist\/02e237973b38db56e35e9eac2ab9671a\/56x56-000000-80-0-0.jpg","picture_medium":"http:\/\/e-cdn-images.deezer.com\/images\/artist\/02e237973b38db56e35e9eac2ab9671a\/250x250-000000-80-0-0.jpg","picture_big":"http:\/\/e-cdn-images.deezer.com\/images\/artist\/02e237973b38db56e35e9eac2ab9671a\/500x500-000000-80-0-0.jpg","picture_xl":"http:\/\/e-cdn-images.deezer.com\/images\/artist\/02e237973b38db56e35e9eac2ab9671a\/1000x1000-000000-80-0-0.jpg","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"album","tracks":{"data":[{"id":404076452,"readable":true,"title":"Gung Ho","title_short":"Gung Ho","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076452","duration":306,"rank":664404,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-a.deezer.com\/stream\/c-abbf47cd151375ceee9a5d3835545268-4.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076462,"readable":true,"title":"Fear Ya","title_short":"Fear Ya","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076462","duration":234,"rank":663642,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-f.deezer.com\/stream\/c-f2ff0cdc8bd8e4764f59d36ccf996d7c-4.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076472,"readable":true,"title":"Faking Love","title_short":"Faking Love","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076472","duration":233,"rank":669011,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-f.deezer.com\/stream\/c-fcb2d52821e6c04143c1f22e69d428b6-4.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076482,"readable":true,"title":"Bunker","title_short":"Bunker","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076482","duration":234,"rank":639588,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-f.deezer.com\/stream\/c-fcf5ccb3299d1a1704830381fdab640c-4.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076492,"readable":true,"title":"On Fire","title_short":"On Fire","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076492","duration":195,"rank":641658,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-4.deezer.com\/stream\/c-4e49a416fde18e3d9f279d9d8abefaac-3.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076502,"readable":true,"title":"Summer Camp","title_short":"Summer Camp","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076502","duration":196,"rank":593777,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-c.deezer.com\/stream\/c-c2faa52ad956a3f43c1eb9a0dd513b60-3.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076512,"readable":true,"title":"Wrong Side","title_short":"Wrong Side","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076512","duration":273,"rank":702120,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-d.deezer.com\/stream\/c-df381a09642648d8366cb0599876861a-4.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076522,"readable":true,"title":"Wataman","title_short":"Wataman","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076522","duration":231,"rank":572745,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-9.deezer.com\/stream\/c-95f2985340a37fc548e7d9ee59db221b-3.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076532,"readable":true,"title":"Slam & Slam'Ed (feat. Edouard Baer)","title_short":"Slam & Slam'Ed (feat. Edouard Baer)","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076532","duration":351,"rank":606302,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-e.deezer.com\/stream\/c-e78585cc5b14ad6b0722ac5155414ce5-3.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076542,"readable":true,"title":"Rusty Fonky","title_short":"Rusty Fonky","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076542","duration":249,"rank":597113,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-e.deezer.com\/stream\/c-ee21b7bada5a57f30d22f2fc62b06ddf-5.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076552,"readable":true,"title":"Share a Line","title_short":"Share a Line","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076552","duration":371,"rank":556159,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-2.deezer.com\/stream\/c-23bb98abf95e1615764b974d1c091bb8-5.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076562,"readable":true,"title":"Mysterious Ways","title_short":"Mysterious Ways","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076562","duration":271,"rank":831002,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-f.deezer.com\/stream\/c-f9924ab2fff9b4c5e9a133cadbbf191e-4.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"},{"id":404076572,"readable":true,"title":"Killing Hallelujah","title_short":"Killing Hallelujah","title_version":"","link":"http:\/\/www.deezer.com\/track\/404076572","duration":358,"rank":617395,"explicit_lyrics":false,"preview":"http:\/\/cdn-preview-d.deezer.com\/stream\/c-df337b3bceea2691b9acf814e5e321c8-5.mp3","artist":{"id":83325,"name":"Shaka Ponk","tracklist":"http:\/\/api.deezer.com\/2.0\/artist\/83325\/top?limit=50","type":"artist"},"type":"track"}]}} \ No newline at end of file diff --git a/ENSIM/Java/tp-deezer3-HERBRON_Tanguy/test/fr/ensim/json/JSONSearchAlbumTracksTest.java b/ENSIM/Java/tp-deezer3-HERBRON_Tanguy/test/fr/ensim/json/JSONSearchAlbumTracksTest.java index c599680..c5827df 100644 --- a/ENSIM/Java/tp-deezer3-HERBRON_Tanguy/test/fr/ensim/json/JSONSearchAlbumTracksTest.java +++ b/ENSIM/Java/tp-deezer3-HERBRON_Tanguy/test/fr/ensim/json/JSONSearchAlbumTracksTest.java @@ -9,6 +9,7 @@ import org.apache.log4j.Logger; import org.junit.Test; import fr.ensim.xml.deezer.data.Album; +import fr.ensim.xml.deezer.data.Track; public class JSONSearchAlbumTracksTest { @@ -20,24 +21,18 @@ public class JSONSearchAlbumTracksTest { // Recuperation du flux a parser //InputStream in = getClass().getResourceAsStream("../list-albums.json"); - InputStream in = getClass().getClassLoader().getResourceAsStream("fr/ensim/json/list-albums.json"); + InputStream in = getClass().getClassLoader().getResourceAsStream("fr/ensim/json/47685332.json"); - List listAlbums = new JSONSearchAlbum().readAlbums(in); - - assertEquals(10, handler.getListAlbum().size()); + List trackList = new JSONSearchAlbumTracks().find(in); + + assertEquals(13, trackList.size()); //First album - assertEquals("47685332", handler.getListAlbum().get(0).getId()); - assertEquals("The Evol", handler.getListAlbum().get(0).getTitle()); - assertEquals("http://api.deezer.com/2.0/album/47685332/image", handler.getListAlbum().get(0).getCover()); - assertEquals("83325", handler.getListAlbum().get(0).getArtist().getId()); - assertEquals("Shaka Ponk", handler.getListAlbum().get(0).getArtist().getName()); + assertEquals("Gung Ho", trackList.get(0).getTitle()); + assertEquals("http://cdn-preview-a.deezer.com/stream/c-abbf47cd151375ceee9a5d3835545268-4.mp3", trackList.get(0).getPreview()); //Second album - assertEquals("1121440", handler.getListAlbum().get(1).getId()); - assertEquals("The Geeks And The Jerkin' Socks", handler.getListAlbum().get(1).getTitle()); - assertEquals("http://api.deezer.com/2.0/album/1121440/image", handler.getListAlbum().get(1).getCover()); - assertEquals("83325", handler.getListAlbum().get(1).getArtist().getId()); - assertEquals("Shaka Ponk", handler.getListAlbum().get(1).getArtist().getName()); + assertEquals("Fear Ya", trackList.get(1).getTitle()); + assertEquals("http://cdn-preview-f.deezer.com/stream/c-f2ff0cdc8bd8e4764f59d36ccf996d7c-4.mp3", trackList.get(1).getPreview()); LOG.debug("<>testParse -17:15:23,450 DEBUG fr.ensim.xml.deezer.dom.DOMSearchAlbumTracks - >>find -17:15:23,461 DEBUG fr.ensim.xml.deezer.dom.DOMSearchAlbumTracks - >>find -17:15:23,462 DEBUG fr.ensim.xml.deezer.dom.DOMSearchAlbumTracksTest - <>testCount +17:25:23,071 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - >>count +17:25:23,082 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - <>testParse +17:25:23,083 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - >>readAlbums +17:25:23,085 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - <