diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateBookmarkTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateBookmarkTest.kt index 10f253c8..6cfba699 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateBookmarkTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateBookmarkTest.kt @@ -9,7 +9,7 @@ class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.createBookmark(1, 1).execute() + client.api.createBookmark("1", 1).execute() } } @@ -17,14 +17,14 @@ class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.createBookmark(213, 123213L).execute() + val response = client.api.createBookmark("213", 123213L).execute() assertResponseSuccessful(response) } @Test fun `Should pass id in request params`() { - val id = 544 + val id = "544" mockWebServerRule.assertRequestParam(expectedParam = "id=$id") { client.api.createBookmark(id = id, position = 123).execute() @@ -36,7 +36,7 @@ class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() { val position = 4412333L mockWebServerRule.assertRequestParam(expectedParam = "position=$position") { - client.api.createBookmark(id = 12, position = position).execute() + client.api.createBookmark(id = "12", position = position).execute() } } @@ -45,7 +45,7 @@ class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() { val comment = "some-comment" mockWebServerRule.assertRequestParam(expectedParam = "comment=$comment") { - client.api.createBookmark(id = 1, position = 1, comment = comment).execute() + client.api.createBookmark(id = "1", position = 1, comment = comment).execute() } } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreatePlaylistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreatePlaylistTest.kt index f7450c6c..e41e580f 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreatePlaylistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreatePlaylistTest.kt @@ -24,7 +24,7 @@ class SubsonicApiCreatePlaylistTest : SubsonicAPIClientTest() { @Test fun `Should pass id param in request`() { - val id = 56L + val id = "56" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "playlistId=$id") { @@ -44,7 +44,7 @@ class SubsonicApiCreatePlaylistTest : SubsonicAPIClientTest() { @Test fun `Should pass song id param in request`() { - val songId = listOf(4410L, 852L) + val songId = listOf("4410", "852") mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "songId=${songId[0]}&songId=${songId[1]}") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateShareTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateShareTest.kt index caebfde4..82f95769 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateShareTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiCreateShareTest.kt @@ -28,7 +28,7 @@ class SubsonicApiCreateShareTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) response.body().shares.size `should equal to` 1 with(response.body().shares[0]) { - id `should equal to` 0 + id `should equal to` "0" url `should equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1NiJ9." + "eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8hJ692" + "UxorHdHWFU2RB-fMCmCA4IJ_dTw" @@ -39,13 +39,13 @@ class SubsonicApiCreateShareTest : SubsonicAPIClientTest() { description `should equal to` "Awesome link!" visitCount `should equal to` 0 items.size `should equal to` 1 - items[0] `should equal` MusicDirectoryChild(id = 4212, parent = 4186, isDir = false, + items[0] `should equal` MusicDirectoryChild(id = "4212", parent = "4186", isDir = false, title = "Heaven Knows", album = "Going to Hell", artist = "The Pretty Reckless", track = 3, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 9025090, contentType = "audio/mpeg", suffix = "mp3", duration = 225, bitRate = 320, path = "The Pretty Reckless/Going to Hell/03 Heaven Knows.mp3", isVideo = false, playCount = 2, discNumber = 1, created = parseDate("2016-10-23T21:30:40.000Z"), - albumId = 388, artistId = 238, type = "music") + albumId = "388", artistId = "238", type = "music") } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteBookmarkTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteBookmarkTest.kt index c38a0e02..bd16192f 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteBookmarkTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteBookmarkTest.kt @@ -9,7 +9,7 @@ class SubsonicApiDeleteBookmarkTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.deleteBookmark(1).execute() + client.api.deleteBookmark("1").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiDeleteBookmarkTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.deleteBookmark(1).execute() + val response = client.api.deleteBookmark("1").execute() assertResponseSuccessful(response) } @Test fun `Should pass id in request params`() { - val id = 233 + val id = "233" mockWebServerRule.assertRequestParam(expectedParam = "id=$id") { client.api.deleteBookmark(id).execute() diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeletePlaylistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeletePlaylistTest.kt index 749975cd..ec9c0227 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeletePlaylistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeletePlaylistTest.kt @@ -9,7 +9,7 @@ class SubsonicApiDeletePlaylistTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.deletePlaylist(10).execute() + client.api.deletePlaylist("10").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiDeletePlaylistTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.deletePlaylist(10).execute() + val response = client.api.deletePlaylist("10").execute() assertResponseSuccessful(response) } @Test fun `Should pass id param in request`() { - val id = 534L + val id = "534" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "id=$id") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteShareTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteShareTest.kt index 82852c48..a0a95014 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteShareTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiDeleteShareTest.kt @@ -9,7 +9,7 @@ class SubsonicApiDeleteShareTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.deleteShare(123).execute() + client.api.deleteShare("123").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiDeleteShareTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.deleteShare(12).execute() + val response = client.api.deleteShare("12").execute() assertResponseSuccessful(response) } @Test fun `Should pass id in request params`() { - val id = 224L + val id = "224" mockWebServerRule.assertRequestParam(expectedParam = "id=$id") { client.api.deleteShare(id).execute() diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumList2Test.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumList2Test.kt index 48bb9b20..817a9f36 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumList2Test.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumList2Test.kt @@ -30,12 +30,12 @@ class SubsonicApiGetAlbumList2Test : SubsonicAPIClientTest() { assertResponseSuccessful(response) with(response.body().albumList) { this.size `should equal to` 2 - this[0] `should equal` Album(id = 962, name = "Fury", artist = "Sick Puppies", - artistId = 473, coverArt = "al-962", songCount = 13, duration = 2591, + this[0] `should equal` Album(id = "962", name = "Fury", artist = "Sick Puppies", + artistId = "473", coverArt = "al-962", songCount = 13, duration = 2591, created = parseDate("2017-09-02T17:34:51.000Z"), year = 2016, genre = "Alternative Rock") - this[1] `should equal` Album(id = 961, name = "Endless Forms Most Beautiful", - artist = "Nightwish", artistId = 559, coverArt = "al-961", songCount = 22, + this[1] `should equal` Album(id = "961", name = "Endless Forms Most Beautiful", + artist = "Nightwish", artistId = "559", coverArt = "al-961", songCount = 22, duration = 9469, created = parseDate("2017-09-02T16:22:47.000Z"), year = 2015, genre = "Symphonic Metal") } @@ -103,7 +103,7 @@ class SubsonicApiGetAlbumList2Test : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 9422L + val musicFolderId = "9422" mockWebServerRule.assertRequestParam(responseResourceName = "get_album_list_2_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumListRequestTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumListRequestTest.kt index 258b3489..eb2ffb6f 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumListRequestTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumListRequestTest.kt @@ -29,7 +29,7 @@ class SubsonicApiGetAlbumListRequestTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) with(response.body().albumList) { size `should equal to` 2 - this[1] `should equal` MusicDirectoryChild(id = 9997, parent = 9996, isDir = true, + this[1] `should equal` MusicDirectoryChild(id = "9997", parent = "9996", isDir = true, title = "Endless Forms Most Beautiful", album = "Endless Forms Most Beautiful", artist = "Nightwish", year = 2015, genre = "Symphonic Metal", coverArt = "9997", playCount = 11, @@ -99,7 +99,7 @@ class SubsonicApiGetAlbumListRequestTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request params`() { - val folderId = 545L + val folderId = "545" mockWebServerRule.assertRequestParam(responseResourceName = "get_album_list_ok.json", expectedParam = "musicFolderId=$folderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumTest.kt index d56d4927..14ad35ba 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetAlbumTest.kt @@ -14,7 +14,7 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() { @Test fun `Should parse error responce`() { val response = checkErrorCallParsed(mockWebServerRule) { - client.api.getAlbum(56L).execute() + client.api.getAlbum("56").execute() } response.album `should not be` null @@ -23,7 +23,7 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() { @Test fun `Should add id to request params`() { - val id = 76L + val id = "76" mockWebServerRule.assertRequestParam(responseResourceName = "get_album_ok.json", expectedParam = "id=$id") { @@ -35,14 +35,14 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() { fun `Should parse ok response`() { mockWebServerRule.enqueueResponse("get_album_ok.json") - val response = client.api.getAlbum(512L).execute() + val response = client.api.getAlbum("512").execute() assertResponseSuccessful(response) with(response.body().album) { - id `should equal to` 618L + id `should equal to` "618" name `should equal to` "Black Ice" artist `should equal to` "AC/DC" - artistId `should equal to` 362L + artistId `should equal to` "362" coverArt `should equal to` "al-618" songCount `should equal to` 15 duration `should equal to` 3331 @@ -50,20 +50,20 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() { year `should equal to` 2008 genre `should equal to` "Hard Rock" songList.size `should equal to` 15 - songList[0] `should equal` MusicDirectoryChild(id = 6491L, parent = 6475L, isDir = false, + songList[0] `should equal` MusicDirectoryChild(id = "6491", parent = "6475", isDir = false, title = "Rock 'n' Roll Train", album = "Black Ice", artist = "AC/DC", track = 1, year = 2008, genre = "Hard Rock", coverArt = "6475", size = 7205451, contentType = "audio/mpeg", suffix = "mp3", duration = 261, bitRate = 219, path = "AC_DC/Black Ice/01 Rock 'n' Roll Train.mp3", isVideo = false, playCount = 0, discNumber = 1, created = parseDate("2016-10-23T15:31:20.000Z"), - albumId = 618L, artistId = 362L, type = "music") - songList[5] `should equal` MusicDirectoryChild(id = 6492L, parent = 6475L, isDir = false, + albumId = "618", artistId = "362", type = "music") + songList[5] `should equal` MusicDirectoryChild(id = "6492", parent = "6475", isDir = false, title = "Smash 'n' Grab", album = "Black Ice", artist = "AC/DC", track = 6, year = 2008, genre = "Hard Rock", coverArt = "6475", size = 6697204, contentType = "audio/mpeg", suffix = "mp3", duration = 246, bitRate = 216, path = "AC_DC/Black Ice/06 Smash 'n' Grab.mp3", isVideo = false, playCount = 0, discNumber = 1, created = parseDate("2016-10-23T15:31:20.000Z"), - albumId = 618L, artistId = 362L, type = "music") + albumId = "618", artistId = "362", type = "music") } } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistTest.kt index 4d7ac65b..5904ee6c 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistTest.kt @@ -14,7 +14,7 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() { @Test fun `Should parse error call`() { val response = checkErrorCallParsed(mockWebServerRule) { - client.api.getArtist(101L).execute() + client.api.getArtist("101").execute() } response.artist `should not be` null @@ -23,7 +23,7 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() { @Test fun `Should pass id param in request`() { - val id = 929L + val id = "929" mockWebServerRule.assertRequestParam(responseResourceName = "get_artist_ok.json", expectedParam = "id=$id") { @@ -35,21 +35,21 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() { fun `Should parse ok response`() { mockWebServerRule.enqueueResponse("get_artist_ok.json") - val response = client.api.getArtist(100L).execute() + val response = client.api.getArtist("100").execute() assertResponseSuccessful(response) with(response.body().artist) { - id `should equal to` 362L + id `should equal to` "362" name `should equal to` "AC/DC" coverArt `should equal to` "ar-362" albumCount `should equal to` 2 albumsList.size `should equal to` 2 - albumsList[0] `should equal` Album(id = 618L, name = "Black Ice", artist = "AC/DC", - artistId = 362L, coverArt = "al-618", songCount = 15, duration = 3331, + albumsList[0] `should equal` Album(id = "618", name = "Black Ice", artist = "AC/DC", + artistId = "362", coverArt = "al-618", songCount = 15, duration = 3331, created = parseDate("2016-10-23T15:31:22.000Z"), year = 2008, genre = "Hard Rock") - albumsList[1] `should equal` Album(id = 617L, name = "Rock or Bust", artist = "AC/DC", - artistId = 362L, coverArt = "al-617", songCount = 11, duration = 2095, + albumsList[1] `should equal` Album(id = "617", name = "Rock or Bust", artist = "AC/DC", + artistId = "362", coverArt = "al-617", songCount = 11, duration = 2095, created = parseDate("2016-10-23T15:31:23.000Z"), year = 2014, genre = "Hard Rock") } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistsTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistsTest.kt index 869011e5..ac23364d 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistsTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetArtistsTest.kt @@ -36,12 +36,12 @@ class SubsonicApiGetArtistsTest : SubsonicAPIClientTest() { indexList.size `should equal to` 2 indexList `should equal` listOf( Index(name = "A", artists = listOf( - Artist(id = 362L, name = "AC/DC", coverArt = "ar-362", albumCount = 2), - Artist(id = 254L, name = "Acceptance", coverArt = "ar-254", albumCount = 1) + Artist(id = "362", name = "AC/DC", coverArt = "ar-362", albumCount = 2), + Artist(id = "254", name = "Acceptance", coverArt = "ar-254", albumCount = 1) )), Index(name = "T", artists = listOf( - Artist(id = 516L, name = "Tangerine Dream", coverArt = "ar-516", albumCount = 1), - Artist(id = 242L, name = "Taproot", coverArt = "ar-242", albumCount = 2) + Artist(id = "516", name = "Tangerine Dream", coverArt = "ar-516", albumCount = 1), + Artist(id = "242", name = "Taproot", coverArt = "ar-242", albumCount = 2) )) ) } @@ -50,7 +50,7 @@ class SubsonicApiGetArtistsTest : SubsonicAPIClientTest() { @Test fun `Should pass param on query for get artists call`() { mockWebServerRule.enqueueResponse("get_artists_ok.json") - val musicFolderId = 101L + val musicFolderId = "101" mockWebServerRule.assertRequestParam(responseResourceName = "get_artists_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetBookmarksTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetBookmarksTest.kt index ea66eef9..a10070ee 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetBookmarksTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetBookmarksTest.kt @@ -32,7 +32,7 @@ class SubsonicApiGetBookmarksTest : SubsonicAPIClientTest() { comment `should equal to` "Look at this" created `should equal` parseDate("2017-11-18T15:22:22.144Z") changed `should equal` parseDate("2017-11-18T15:22:22.144Z") - entry `should equal` MusicDirectoryChild(id = 10349, parent = 10342, + entry `should equal` MusicDirectoryChild(id = "10349", parent = "10342", isDir = false, title = "Amerika", album = "Home of the Strange", artist = "Young the Giant", track = 1, year = 2016, genre = "Indie Rock", coverArt = "10342", size = 9628673, contentType = "audio/mpeg", @@ -40,7 +40,7 @@ class SubsonicApiGetBookmarksTest : SubsonicAPIClientTest() { path = "Young the Giant/Home of the Strange/01 Amerika.mp3", isVideo = false, playCount = 2, discNumber = 1, created = parseDate("2017-11-01T17:46:52.000Z"), - albumId = 984, artistId = 571, type = "music") + albumId = "984", artistId = "571", type = "music") } } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetIndexesTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetIndexesTest.kt index 222829d5..b9bbc34c 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetIndexesTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetIndexesTest.kt @@ -23,18 +23,18 @@ class SubsonicApiGetIndexesTest : SubsonicAPIClientTest() { lastModified `should equal` 1491069027523 ignoredArticles `should equal` "The El La Los Las Le Les" shortcutList `should equal` listOf( - Artist(id = 889L, name = "podcasts"), - Artist(id = 890L, name = "audiobooks") + Artist(id = "889", name = "podcasts"), + Artist(id = "890", name = "audiobooks") ) indexList `should equal` mutableListOf( Index("A", listOf( - Artist(id = 50L, name = "Ace Of Base", + Artist(id = "50", name = "Ace Of Base", starred = parseDate("2017-04-02T20:16:29.815Z")), - Artist(id = 379L, name = "A Perfect Circle") + Artist(id = "379", name = "A Perfect Circle") )), Index("H", listOf( - Artist(id = 299, name = "Haddaway"), - Artist(id = 297, name = "Halestorm") + Artist(id = "299", name = "Haddaway"), + Artist(id = "297", name = "Halestorm") )) ) } @@ -42,7 +42,7 @@ class SubsonicApiGetIndexesTest : SubsonicAPIClientTest() { @Test fun `Should add music folder id as a query param for getIndexes api call`() { - val musicFolderId = 9L + val musicFolderId = "9" mockWebServerRule.assertRequestParam(responseResourceName = "get_indexes_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt index 46f66ee6..b4deff6b 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicDirectoryTest.kt @@ -15,7 +15,7 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() { @Test fun `Should parse getMusicDirectory error response`() { val response = checkErrorCallParsed(mockWebServerRule) { - client.api.getMusicDirectory(1).execute() + client.api.getMusicDirectory("1").execute() } response.musicDirectory `should not be` null @@ -24,7 +24,7 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() { @Test fun `GetMusicDirectory should add directory id to query params`() { - val directoryId = 124L + val directoryId = "124" mockWebServerRule.assertRequestParam(responseResourceName = "get_music_directory_ok.json", expectedParam = "id=$directoryId") { @@ -36,34 +36,34 @@ class SubsonicApiGetMusicDirectoryTest : SubsonicAPIClientTest() { fun `Should parse get music directory ok response`() { mockWebServerRule.enqueueResponse("get_music_directory_ok.json") - val response = client.api.getMusicDirectory(1).execute() + val response = client.api.getMusicDirectory("1").execute() assertResponseSuccessful(response) response.body().musicDirectory `should not be` null with(response.body().musicDirectory) { - id `should equal to` 4836L - parent `should equal to` 300L + id `should equal to` "4836" + parent `should equal to` "300" name `should equal` "12 Stones" userRating `should equal to` 5 averageRating `should equal to` 5.0f starred `should equal` null playCount `should equal to` 1 childList.size `should be` 2 - childList[0] `should equal` MusicDirectoryChild(id = 4844L, parent = 4836L, isDir = false, + childList[0] `should equal` MusicDirectoryChild(id = "4844", parent = "4836", isDir = false, title = "Crash", album = "12 Stones", artist = "12 Stones", track = 1, year = 2002, genre = "Alternative Rock", coverArt = "4836", size = 5348318L, contentType = "audio/mpeg", suffix = "mp3", duration = 222, bitRate = 192, path = "12 Stones/12 Stones/01 Crash.mp3", isVideo = false, playCount = 0, discNumber = 1, created = parseDate("2016-10-23T15:19:10.000Z"), - albumId = 454L, artistId = 288L, type = "music") - childList[1] `should equal` MusicDirectoryChild(id = 4845L, parent = 4836L, isDir = false, + albumId = "454", artistId = "288", type = "music") + childList[1] `should equal` MusicDirectoryChild(id = "4845", parent = "4836", isDir = false, title = "Broken", album = "12 Stones", artist = "12 Stones", track = 2, year = 2002, genre = "Alternative Rock", coverArt = "4836", size = 4309043L, contentType = "audio/mpeg", suffix = "mp3", duration = 179, bitRate = 192, path = "12 Stones/12 Stones/02 Broken.mp3", isVideo = false, playCount = 0, discNumber = 1, created = parseDate("2016-10-23T15:19:09.000Z"), - albumId = 454L, artistId = 288L, type = "music") + albumId = "454", artistId = "288", type = "music") } } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicFoldersTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicFoldersTest.kt index 23071d30..c3460aed 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicFoldersTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetMusicFoldersTest.kt @@ -17,7 +17,9 @@ class SubsonicApiGetMusicFoldersTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) with(response.body()) { assertBaseResponseOk() - musicFolders `should equal` listOf(MusicFolder(0, "Music"), MusicFolder(2, "Test")) + musicFolders `should equal` listOf( + MusicFolder("0", "Music"), + MusicFolder("2", "Test")) } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistTest.kt index c9d248d7..d542d0db 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistTest.kt @@ -14,7 +14,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() { @Test fun `Should parse error response`() { val response = checkErrorCallParsed(mockWebServerRule) { - client.api.getPlaylist(10).execute() + client.api.getPlaylist("10").execute() } response.playlist `should not be` null @@ -25,11 +25,11 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() { fun `Should parse ok response`() { mockWebServerRule.enqueueResponse("get_playlist_ok.json") - val response = client.api.getPlaylist(4).execute() + val response = client.api.getPlaylist("4").execute() assertResponseSuccessful(response) with(response.body().playlist) { - id `should equal to` 0 + id `should equal to` "0" name `should equal to` "Aug 27, 2017 11:17 AM" owner `should equal to` "admin" public `should equal to` false @@ -39,7 +39,7 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() { changed `should equal` parseDate("2017-08-27T11:17:26.218Z") coverArt `should equal to` "pl-0" entriesList.size `should equal to` 2 - entriesList[1] `should equal` MusicDirectoryChild(id = 4215, parent = 4186, + entriesList[1] `should equal` MusicDirectoryChild(id = "4215", parent = "4186", isDir = false, title = "Going to Hell", album = "Going to Hell", artist = "The Pretty Reckless", track = 2, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 11089627, @@ -47,13 +47,13 @@ class SubsonicApiGetPlaylistTest : SubsonicAPIClientTest() { path = "The Pretty Reckless/Going to Hell/02 Going to Hell.mp3", isVideo = false, playCount = 0, discNumber = 1, created = parseDate("2016-10-23T21:30:41.000Z"), - albumId = 388, artistId = 238, type = "music") + albumId = "388", artistId = "238", type = "music") } } @Test fun `Should pass id as request param`() { - val playlistId = 453L + val playlistId = "453" mockWebServerRule.assertRequestParam(responseResourceName = "get_playlist_ok.json", expectedParam = "id=$playlistId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistsTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistsTest.kt index dc9794ee..f787c37c 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistsTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPlaylistsTest.kt @@ -29,7 +29,7 @@ class SubsonicApiGetPlaylistsTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) with(response.body().playlists) { size `should equal to` 1 - this[0] `should equal` Playlist(id = 0, name = "Aug 27, 2017 11:17 AM", + this[0] `should equal` Playlist(id = "0", name = "Aug 27, 2017 11:17 AM", owner = "admin", public = false, songCount = 16, duration = 3573, comment = "Some comment", created = parseDate("2017-08-27T11:17:26.216Z"), diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPodcastsTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPodcastsTest.kt index b4a8bbe7..e5ead1e3 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPodcastsTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetPodcastsTest.kt @@ -30,7 +30,7 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() { val podcastChannelsList = response.body().podcastChannels podcastChannelsList.size `should equal to` 1 with(podcastChannelsList[0]) { - id `should equal to` 2 + id `should equal to` "2" url `should equal to` "http://feeds.codenewbie.org/cnpodcast.xml" title `should equal to` "CodeNewbie" description `should equal to` "Stories and interviews from people on their coding journey." @@ -39,13 +39,13 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() { status `should equal to` "completed" errorMessage `should equal to` "" episodeList.size `should equal to` 10 - episodeList[0] `should equal` MusicDirectoryChild(id = 148, parent = 9959, isDir = false, + episodeList[0] `should equal` MusicDirectoryChild(id = "148", parent = "9959", isDir = false, title = "S1:EP3 – How to teach yourself computer science (Vaidehi Joshi)", album = "CodeNewbie", artist = "podcasts", coverArt = "9959", size = 38274221, contentType = "audio/mpeg", suffix = "mp3", duration = 2397, bitRate = 128, isVideo = false, playCount = 0, created = parseDate("2017-08-30T09:33:39.000Z"), type = "podcast", - streamId = 9982, channelId = 2, + streamId = "9982", channelId = "2", description = "Vaidehi decided to take on a year-long challenge. " + "She'd pick a computer science topic every week, do tons of research " + "and write a technical blog post explaining it in simple terms and " + @@ -72,7 +72,7 @@ class SubsonicApiGetPodcastsTest : SubsonicAPIClientTest() { @Test fun `Should pass id in request param`() { - val id = 249L + val id = "249" mockWebServerRule.assertRequestParam(responseResourceName = "get_podcasts_ok.json", expectedParam = "id=$id") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetRandomSongsTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetRandomSongsTest.kt index 9f45b8a7..8f06b174 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetRandomSongsTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetRandomSongsTest.kt @@ -27,14 +27,14 @@ class SubsonicApiGetRandomSongsTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) with(response.body().songsList) { size `should equal to` 3 - this[1] `should equal` MusicDirectoryChild(id = 3061, parent = 3050, isDir = false, + this[1] `should equal` MusicDirectoryChild(id = "3061", parent = "3050", isDir = false, title = "Sure as Hell", album = "Who Are You Now?", artist = "This Providence", track = 1, year = 2009, genre = "Indie Rock", coverArt = "3050", size = 1969692, contentType = "audio/mpeg", suffix = "mp3", duration = 110, bitRate = 142, path = "This Providence/Who Are You Now_/01 Sure as Hell.mp3", isVideo = false, playCount = 0, discNumber = 1, - created = parseDate("2016-10-23T21:32:46.000Z"), albumId = 272, - artistId = 152, type = "music") + created = parseDate("2016-10-23T21:32:46.000Z"), albumId = "272", + artistId = "152", type = "music") } } @@ -80,7 +80,7 @@ class SubsonicApiGetRandomSongsTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 4919L + val musicFolderId = "4919" mockWebServerRule.assertRequestParam(responseResourceName = "get_random_songs_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSharesTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSharesTest.kt index 8fc2dc28..6da16b43 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSharesTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSharesTest.kt @@ -27,7 +27,7 @@ class SubsonicApiGetSharesTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) response.body().shares.size `should equal to` 1 with(response.body().shares[0]) { - id `should equal to` 0 + id `should equal to` "0" url `should equal to` "https://subsonic.com/ext/share/awdwo?jwt=eyJhbGciOiJIUzI1" + "NiJ9.eyJwYXRoIjoiL2V4dC9zaGFyZS9hd2R3byIsImV4cCI6MTU0MTYyNjQzMX0.iy8dkt_ZZc8" + "hJ692UxorHdHWFU2RB-fMCmCA4IJ_dTw" @@ -38,13 +38,13 @@ class SubsonicApiGetSharesTest : SubsonicAPIClientTest() { visitCount `should equal to` 0 description `should equal to` "Awesome link!" items.size `should equal to` 1 - items[0] `should equal` MusicDirectoryChild(id = 4212, parent = 4186, isDir = false, + items[0] `should equal` MusicDirectoryChild(id = "4212", parent = "4186", isDir = false, title = "Heaven Knows", album = "Going to Hell", artist = "The Pretty Reckless", track = 3, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 9025090, contentType = "audio/mpeg", suffix = "mp3", duration = 225, bitRate = 320, path = "The Pretty Reckless/Going to Hell/03 Heaven Knows.mp3", isVideo = false, playCount = 2, discNumber = 1, created = parseDate("2016-10-23T21:30:40.000Z"), - albumId = 388, artistId = 238, type = "music") + albumId = "388", artistId = "238", type = "music") } } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSongsByGenreTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSongsByGenreTest.kt index 45c22b89..2be1b688 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSongsByGenreTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetSongsByGenreTest.kt @@ -27,21 +27,21 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) response.body().songsList.size `should equal to` 2 with(response.body().songsList) { - this[0] `should equal` MusicDirectoryChild(id = 575, parent = 576, isDir = false, + this[0] `should equal` MusicDirectoryChild(id = "575", parent = "576", isDir = false, title = "Time Machine (Vadim Zhukov Remix)", album = "668", artist = "Tasadi", year = 2008, genre = "Trance", size = 22467672, contentType = "audio/mpeg", suffix = "mp3", duration = 561, bitRate = 320, path = "Tasadi/668/00 Time Machine (Vadim Zhukov Remix).mp3", isVideo = false, playCount = 0, created = parseDate("2016-10-23T21:58:29.000Z"), - albumId = 0, artistId = 0, type = "music") - this[1] `should equal` MusicDirectoryChild(id = 621, parent = 622, isDir = false, + albumId = "0", artistId = "0", type = "music") + this[1] `should equal` MusicDirectoryChild(id = "621", parent = "622", isDir = false, title = "My Heart (Vadim Zhukov Remix)", album = "668", artist = "DJ Polyakov PPK Feat Kate Cameron", year = 2009, genre = "Trance", size = 26805932, contentType = "audio/mpeg", suffix = "mp3", duration = 670, bitRate = 320, path = "DJ Polyakov PPK Feat Kate Cameron/668/00 My Heart (Vadim Zhukov Remix).mp3", isVideo = false, playCount = 2, created = parseDate("2016-10-23T21:58:29.000Z"), - albumId = 5, artistId = 4, type = "music") + albumId = "5", artistId = "4", type = "music") } } @@ -73,7 +73,7 @@ class SubsonicApiGetSongsByGenreTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 1010L + val musicFolderId = "1010" mockWebServerRule.assertRequestParam(expectedParam = "musicFolderId=$musicFolderId") { client.api.getSongsByGenre("Trance", musicFolderId = musicFolderId).execute() diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarred2Test.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarred2Test.kt index dc61a6e0..b8409cd0 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarred2Test.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarred2Test.kt @@ -30,7 +30,7 @@ class SubsonicApiGetStarred2Test : SubsonicAPIClientTest() { with(response.body().starred2) { albumList `should equal` emptyList() artistList.size `should equal to` 1 - artistList[0] `should equal` Artist(id = 364, name = "Parov Stelar", + artistList[0] `should equal` Artist(id = "364", name = "Parov Stelar", starred = parseDate("2017-08-12T18:32:58.768Z")) songList `should equal` emptyList() } @@ -38,7 +38,7 @@ class SubsonicApiGetStarred2Test : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 441L + val musicFolderId = "441" mockWebServerRule.assertRequestParam(responseResourceName = "get_starred_2_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarredTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarredTest.kt index 589f0fff..3fd5fb9c 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarredTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetStarredTest.kt @@ -29,7 +29,7 @@ class SubsonicApiGetStarredTest : SubsonicAPIClientTest() { with(response.body().starred) { albumList `should equal` emptyList() artistList.size `should equal to` 1 - artistList[0] `should equal` Artist(id = 364, name = "Parov Stelar", + artistList[0] `should equal` Artist(id = "364", name = "Parov Stelar", starred = parseDate("2017-08-12T18:32:58.768Z")) songList `should equal` emptyList() } @@ -37,7 +37,7 @@ class SubsonicApiGetStarredTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 441L + val musicFolderId = "441" mockWebServerRule.assertRequestParam(responseResourceName = "get_starred_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetVideosListTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetVideosListTest.kt index c89b801e..1e4cb79c 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetVideosListTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiGetVideosListTest.kt @@ -27,7 +27,7 @@ class SubsonicApiGetVideosListTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) with(response.body().videosList) { size `should equal to` 1 - this[0] `should equal` MusicDirectoryChild(id = 10402, parent = 10401, isDir = false, + this[0] `should equal` MusicDirectoryChild(id = "10402", parent = "10401", isDir = false, title = "MVI_0512", album = "Incoming", size = 21889646, contentType = "video/avi", suffix = "avi", transcodedContentType = "video/x-flv", transcodedSuffix = "flv", path = "Incoming/MVI_0512.avi", isVideo = true, diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiJukeboxControlTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiJukeboxControlTest.kt index be4a96de..29244674 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiJukeboxControlTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiJukeboxControlTest.kt @@ -51,15 +51,15 @@ class SubsonicApiJukeboxControlTest : SubsonicAPIClientTest() { gain `should equal to` 0.88f position `should equal to` 2 playlistEntries.size `should equal to` 2 - playlistEntries[1] `should equal` MusicDirectoryChild(id = 4215L, parent = 4186L, + playlistEntries[1] `should equal` MusicDirectoryChild(id = "4215", parent = "4186", isDir = false, title = "Going to Hell", album = "Going to Hell", artist = "The Pretty Reckless", track = 2, year = 2014, genre = "Hard Rock", coverArt = "4186", size = 11089627, contentType = "audio/mpeg", suffix = "mp3", duration = 277, bitRate = 320, path = "The Pretty Reckless/Going to Hell/02 Going to Hell.mp3", isVideo = false, playCount = 0, discNumber = 1, - created = parseDate("2016-10-23T21:30:41.000Z"), albumId = 388, - artistId = 238, type = "music") + created = parseDate("2016-10-23T21:30:41.000Z"), albumId = "388", + artistId = "238", type = "music") } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTest.kt index 18586cc3..d3a9d69b 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTest.kt @@ -33,7 +33,7 @@ class SubsonicApiSearchTest : SubsonicAPIClientTest() { offset `should equal to` 10 totalHits `should equal to` 53 matchList.size `should equal to` 1 - matchList[0] `should equal` MusicDirectoryChild(id = 5831L, parent = 5766L, + matchList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766", isDir = false, title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted", artist = "The Prodigy", track = 17, year = 2005, genre = "Rap", coverArt = "5766", @@ -41,8 +41,8 @@ class SubsonicApiSearchTest : SubsonicAPIClientTest() { bitRate = 192, path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels.mp3", isVideo = false, playCount = 0, discNumber = 1, - created = parseDate("2016-10-23T20:09:02.000Z"), albumId = 568, - artistId = 505, type = "music") + created = parseDate("2016-10-23T20:09:02.000Z"), albumId = "568", + artistId = "505", type = "music") } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt index 26f45b3f..21ee05f6 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt @@ -32,23 +32,23 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) with(response.body().searchResult) { artistList.size `should equal to` 1 - artistList[0] `should equal` Artist(id = 505, name = "The Prodigy", coverArt = "ar-505", + artistList[0] `should equal` Artist(id = "505", name = "The Prodigy", coverArt = "ar-505", albumCount = 5) albumList.size `should equal to` 1 - albumList[0] `should equal` Album(id = 855, name = "Always Outnumbered, Never Outgunned", - artist = "The Prodigy", artistId = 505, coverArt = "al-855", songCount = 12, + albumList[0] `should equal` Album(id = "855", name = "Always Outnumbered, Never Outgunned", + artist = "The Prodigy", artistId = "505", coverArt = "al-855", songCount = 12, duration = 3313, created = parseDate("2016-10-23T20:57:27.000Z"), year = 2004, genre = "Electronic") songList.size `should equal to` 1 - songList[0] `should equal` MusicDirectoryChild(id = 5831, parent = 5766, isDir = false, + songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766", isDir = false, title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted", artist = "The Prodigy", track = 17, year = 2005, genre = "Rap", coverArt = "5766", size = 5607024, contentType = "audio/mpeg", suffix = "mp3", duration = 233, bitRate = 192, path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels.mp3", isVideo = false, playCount = 0, discNumber = 1, - created = parseDate("2016-10-23T20:09:02.000Z"), albumId = 568, - artistId = 505, type = "music") + created = parseDate("2016-10-23T20:09:02.000Z"), albumId = "568", + artistId = "505", type = "music") } } @@ -113,7 +113,7 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id as request param`() { - val musicFolderId = 43L + val musicFolderId = "43" mockWebServerRule.assertRequestParam(responseResourceName = "search3_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTwoTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTwoTest.kt index 21b02075..835ac77e 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTwoTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchTwoTest.kt @@ -31,15 +31,15 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() { assertResponseSuccessful(response) with(response.body().searchResult) { artistList.size `should equal to` 1 - artistList[0] `should equal` Artist(id = 522, name = "The Prodigy") + artistList[0] `should equal` Artist(id = "522", name = "The Prodigy") albumList.size `should equal to` 1 - albumList[0] `should equal` MusicDirectoryChild(id = 8867, parent = 522, isDir = true, + albumList[0] `should equal` MusicDirectoryChild(id = "8867", parent = "522", isDir = true, title = "Always Outnumbered, Never Outgunned", album = "Always Outnumbered, Never Outgunned", artist = "The Prodigy", year = 2004, genre = "Electronic", coverArt = "8867", playCount = 0, created = parseDate("2016-10-23T20:57:27.000Z")) songList.size `should equal to` 1 - songList[0] `should equal` MusicDirectoryChild(id = 5831, parent = 5766, isDir = false, + songList[0] `should equal` MusicDirectoryChild(id = "5831", parent = "5766", isDir = false, title = "You'll Be Under My Wheels", album = "Need for Speed Most Wanted", artist = "The Prodigy", track = 17, year = 2005, genre = "Rap", coverArt = "5766", size = 5607024, contentType = "audio/mpeg", @@ -47,7 +47,7 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() { path = "Compilations/Need for Speed Most Wanted/17 You'll Be Under My Wheels.mp3", isVideo = false, playCount = 0, discNumber = 1, created = parseDate("2016-10-23T20:09:02.000Z"), - albumId = 568, artistId = 505, type = "music") + albumId = "568", artistId = "505", type = "music") } } @@ -113,7 +113,7 @@ class SubsonicApiSearchTwoTest : SubsonicAPIClientTest() { @Test fun `Should pass music folder id in request param`() { - val musicFolderId = 565L + val musicFolderId = "565" mockWebServerRule.assertRequestParam(responseResourceName = "search2_ok.json", expectedParam = "musicFolderId=$musicFolderId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStarTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStarTest.kt index b551c8ca..12377e3d 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStarTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiStarTest.kt @@ -27,7 +27,7 @@ class SubsonicApiStarTest : SubsonicAPIClientTest() { @Test fun `Should pass id param`() { - val id = 110L + val id = "110" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "id=$id") { @@ -37,7 +37,7 @@ class SubsonicApiStarTest : SubsonicAPIClientTest() { @Test fun `Should pass artist id param`() { - val artistId = 123L + val artistId = "123" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "artistId=$artistId") { @@ -47,7 +47,7 @@ class SubsonicApiStarTest : SubsonicAPIClientTest() { @Test fun `Should pass album id param`() { - val albumId = 1001L + val albumId = "1001" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "albumId=$albumId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUnstarTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUnstarTest.kt index fc7c27a1..a47a120a 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUnstarTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUnstarTest.kt @@ -27,7 +27,7 @@ class SubsonicApiUnstarTest : SubsonicAPIClientTest() { @Test fun `Should pass id param`() { - val id = 545L + val id = "545" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "id=$id") { @@ -37,7 +37,7 @@ class SubsonicApiUnstarTest : SubsonicAPIClientTest() { @Test fun `Should pass artistId param`() { - val artistId = 644L + val artistId = "644" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "artistId=$artistId") { @@ -47,7 +47,7 @@ class SubsonicApiUnstarTest : SubsonicAPIClientTest() { @Test fun `Should pass albumId param`() { - val albumId = 3344L + val albumId = "3344" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "albumId=$albumId") { diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdatePlaylistTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdatePlaylistTest.kt index 19369665..41f43af9 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdatePlaylistTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdatePlaylistTest.kt @@ -9,7 +9,7 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.updatePlaylist(10).execute() + client.api.updatePlaylist("10").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.updatePlaylist(15).execute() + val response = client.api.updatePlaylist("15").execute() assertResponseSuccessful(response) } @Test fun `Should pass playlist id param in request`() { - val id = 5453L + val id = "5453" mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "playlistId=$id") { @@ -38,7 +38,7 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "name=$name") { - client.api.updatePlaylist(22, name = name).execute() + client.api.updatePlaylist("22", name = name).execute() } } @@ -48,7 +48,7 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "comment=$comment") { - client.api.updatePlaylist(42, comment = comment).execute() + client.api.updatePlaylist("42", comment = comment).execute() } } @@ -58,17 +58,17 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "public=$public") { - client.api.updatePlaylist(53, public = public).execute() + client.api.updatePlaylist("53", public = public).execute() } } @Test fun `Should pass song ids to update in request`() { - val songIds = listOf(45L, 81L) + val songIds = listOf("45", "81") mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "songIdToAdd=${songIds[0]}&songIdToAdd=${songIds[1]}") { - client.api.updatePlaylist(25, songIdsToAdd = songIds).execute() + client.api.updatePlaylist("25", songIdsToAdd = songIds).execute() } } @@ -79,7 +79,7 @@ class SubsonicApiUpdatePlaylistTest : SubsonicAPIClientTest() { mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json", expectedParam = "songIndexToRemove=${songIndexesToRemove[0]}&" + "songIndexToRemove=${songIndexesToRemove[1]}") { - client.api.updatePlaylist(49, songIndexesToRemove = songIndexesToRemove).execute() + client.api.updatePlaylist("49", songIndexesToRemove = songIndexesToRemove).execute() } } } diff --git a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdateShareTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdateShareTest.kt index bd2f46cd..a65d86bd 100644 --- a/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdateShareTest.kt +++ b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiUpdateShareTest.kt @@ -9,7 +9,7 @@ class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() { @Test fun `Should handle error response`() { checkErrorCallParsed(mockWebServerRule) { - client.api.updateShare(11).execute() + client.api.updateShare("11").execute() } } @@ -17,14 +17,14 @@ class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() { fun `Should handle ok response`() { mockWebServerRule.enqueueResponse("ping_ok.json") - val response = client.api.updateShare(12).execute() + val response = client.api.updateShare("12").execute() assertResponseSuccessful(response) } @Test fun `Should pass id in request params`() { - val id = 4432L + val id = "4432" mockWebServerRule.assertRequestParam(expectedParam = "id=$id") { client.api.updateShare(id = id).execute() @@ -36,7 +36,7 @@ class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() { val description = "some-description" mockWebServerRule.assertRequestParam(expectedParam = "description=$description") { - client.api.updateShare(123, description = description).execute() + client.api.updateShare("123", description = description).execute() } } @@ -45,7 +45,7 @@ class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() { val expires = 223123123L mockWebServerRule.assertRequestParam(expectedParam = "expires=$expires") { - client.api.updateShare(12, expires = expires).execute() + client.api.updateShare("12", expires = expires).execute() } } } diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapper.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapper.kt index 55bbfc36..e97ecd07 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapper.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapper.kt @@ -45,27 +45,27 @@ import retrofit2.Call internal class ApiVersionCheckWrapper( val api: SubsonicAPIDefinition, var currentApiVersion: SubsonicAPIVersions) : SubsonicAPIDefinition by api { - override fun getArtists(musicFolderId: Long?): Call { + override fun getArtists(musicFolderId: String?): Call { checkVersion(V1_8_0) return api.getArtists(musicFolderId) } - override fun star(id: Long?, albumId: Long?, artistId: Long?): Call { + override fun star(id: String?, albumId: String?, artistId: String?): Call { checkVersion(V1_8_0) return api.star(id, albumId, artistId) } - override fun unstar(id: Long?, albumId: Long?, artistId: Long?): Call { + override fun unstar(id: String?, albumId: String?, artistId: String?): Call { checkVersion(V1_8_0) return api.unstar(id, albumId, artistId) } - override fun getArtist(id: Long): Call { + override fun getArtist(id: String): Call { checkVersion(V1_8_0) return api.getArtist(id) } - override fun getAlbum(id: Long): Call { + override fun getAlbum(id: String): Call { checkVersion(V1_8_0) return api.getAlbum(id) } @@ -76,7 +76,7 @@ internal class ApiVersionCheckWrapper( albumCount: Int?, albumOffset: Int?, songCount: Int?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_4_0) checkParamVersion(musicFolderId, V1_12_0) return api.search2(query, artistCount, artistOffset, albumCount, albumOffset, songCount, @@ -89,7 +89,7 @@ internal class ApiVersionCheckWrapper( albumCount: Int?, albumOffset: Int?, songCount: Int?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_8_0) checkParamVersion(musicFolderId, V1_12_0) return api.search3(query, artistCount, artistOffset, albumCount, albumOffset, @@ -101,29 +101,29 @@ internal class ApiVersionCheckWrapper( return api.getPlaylists(username) } - override fun createPlaylist(id: Long?, + override fun createPlaylist(id: String?, name: String?, - songIds: List?): Call { + songIds: List?): Call { checkVersion(V1_2_0) return api.createPlaylist(id, name, songIds) } - override fun deletePlaylist(id: Long): Call { + override fun deletePlaylist(id: String): Call { checkVersion(V1_2_0) return api.deletePlaylist(id) } - override fun updatePlaylist(id: Long, + override fun updatePlaylist(id: String, name: String?, comment: String?, public: Boolean?, - songIdsToAdd: List?, + songIdsToAdd: List?, songIndexesToRemove: List?): Call { checkVersion(V1_8_0) return api.updatePlaylist(id, name, comment, public, songIdsToAdd, songIndexesToRemove) } - override fun getPodcasts(includeEpisodes: Boolean?, id: Long?): Call { + override fun getPodcasts(includeEpisodes: Boolean?, id: String?): Call { checkVersion(V1_6_0) checkParamVersion(includeEpisodes, V1_9_0) checkParamVersion(id, V1_9_0) @@ -147,7 +147,7 @@ internal class ApiVersionCheckWrapper( fromYear: Int?, toYear: Int?, genre: String?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_2_0) checkParamVersion(musicFolderId, V1_11_0) return api.getAlbumList(type, size, offset, fromYear, toYear, genre, musicFolderId) @@ -159,7 +159,7 @@ internal class ApiVersionCheckWrapper( fromYear: Int?, toYear: Int?, genre: String?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_8_0) checkParamVersion(musicFolderId, V1_12_0) return api.getAlbumList2(type, size, offset, fromYear, toYear, genre, musicFolderId) @@ -169,18 +169,18 @@ internal class ApiVersionCheckWrapper( genre: String?, fromYear: Int?, toYear: Int?, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_2_0) return api.getRandomSongs(size, genre, fromYear, toYear, musicFolderId) } - override fun getStarred(musicFolderId: Long?): Call { + override fun getStarred(musicFolderId: String?): Call { checkVersion(V1_8_0) checkParamVersion(musicFolderId, V1_12_0) return api.getStarred(musicFolderId) } - override fun getStarred2(musicFolderId: Long?): Call { + override fun getStarred2(musicFolderId: String?): Call { checkVersion(V1_8_0) checkParamVersion(musicFolderId, V1_12_0) return api.getStarred2(musicFolderId) @@ -225,12 +225,12 @@ internal class ApiVersionCheckWrapper( return api.createShare(idsToShare, description, expires) } - override fun deleteShare(id: Long): Call { + override fun deleteShare(id: String): Call { checkVersion(V1_6_0) return api.deleteShare(id) } - override fun updateShare(id: Long, + override fun updateShare(id: String, description: String?, expires: Long?): Call { checkVersion(V1_6_0) @@ -245,7 +245,7 @@ internal class ApiVersionCheckWrapper( override fun getSongsByGenre(genre: String, count: Int, offset: Int, - musicFolderId: Long?): Call { + musicFolderId: String?): Call { checkVersion(V1_9_0) checkParamVersion(musicFolderId, V1_12_0) return api.getSongsByGenre(genre, count, offset, musicFolderId) @@ -271,12 +271,12 @@ internal class ApiVersionCheckWrapper( return api.getBookmarks() } - override fun createBookmark(id: Int, position: Long, comment: String?): Call { + override fun createBookmark(id: String, position: Long, comment: String?): Call { checkVersion(V1_9_0) return api.createBookmark(id, position, comment) } - override fun deleteBookmark(id: Int): Call { + override fun deleteBookmark(id: String): Call { checkVersion(V1_9_0) return api.deleteBookmark(id) } diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicAPIDefinition.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicAPIDefinition.kt index 7e086af9..85887348 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicAPIDefinition.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicAPIDefinition.kt @@ -54,30 +54,30 @@ interface SubsonicAPIDefinition { fun getMusicFolders(): Call @GET("getIndexes.view") - fun getIndexes(@Query("musicFolderId") musicFolderId: Long?, + fun getIndexes(@Query("musicFolderId") musicFolderId: String?, @Query("ifModifiedSince") ifModifiedSince: Long?): Call @GET("getMusicDirectory.view") - fun getMusicDirectory(@Query("id") id: Long): Call + fun getMusicDirectory(@Query("id") id: String): Call @GET("getArtists.view") - fun getArtists(@Query("musicFolderId") musicFolderId: Long?): Call + fun getArtists(@Query("musicFolderId") musicFolderId: String?): Call @GET("star.view") - fun star(@Query("id") id: Long? = null, - @Query("albumId") albumId: Long? = null, - @Query("artistId") artistId: Long? = null): Call + fun star(@Query("id") id: String? = null, + @Query("albumId") albumId: String? = null, + @Query("artistId") artistId: String? = null): Call @GET("unstar.view") - fun unstar(@Query("id") id: Long? = null, - @Query("albumId") albumId: Long? = null, - @Query("artistId") artistId: Long? = null): Call + fun unstar(@Query("id") id: String? = null, + @Query("albumId") albumId: String? = null, + @Query("artistId") artistId: String? = null): Call @GET("getArtist.view") - fun getArtist(@Query("id") id: Long): Call + fun getArtist(@Query("id") id: String): Call @GET("getAlbum.view") - fun getAlbum(@Query("id") id: Long): Call + fun getAlbum(@Query("id") id: String): Call @GET("search.view") fun search(@Query("artist") artist: String? = null, @@ -95,7 +95,7 @@ interface SubsonicAPIDefinition { @Query("albumCount") albumCount: Int? = null, @Query("albumOffset") albumOffset: Int? = null, @Query("songCount") songCount: Int? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("search3.view") fun search3(@Query("query") query: String, @@ -104,34 +104,34 @@ interface SubsonicAPIDefinition { @Query("albumCount") albumCount: Int? = null, @Query("albumOffset") albumOffset: Int? = null, @Query("songCount") songCount: Int? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getPlaylist.view") - fun getPlaylist(@Query("id") id: Long): Call + fun getPlaylist(@Query("id") id: String): Call @GET("getPlaylists.view") fun getPlaylists(@Query("username") username: String? = null): Call @GET("createPlaylist.view") - fun createPlaylist(@Query("playlistId") id: Long? = null, + fun createPlaylist(@Query("playlistId") id: String? = null, @Query("name") name: String? = null, - @Query("songId") songIds: List? = null): Call + @Query("songId") songIds: List? = null): Call @GET("deletePlaylist.view") - fun deletePlaylist(@Query("id") id: Long): Call + fun deletePlaylist(@Query("id") id: String): Call @GET("updatePlaylist.view") fun updatePlaylist( - @Query("playlistId") id: Long, + @Query("playlistId") id: String, @Query("name") name: String? = null, @Query("comment") comment: String? = null, @Query("public") public: Boolean? = null, - @Query("songIdToAdd") songIdsToAdd: List? = null, + @Query("songIdToAdd") songIdsToAdd: List? = null, @Query("songIndexToRemove") songIndexesToRemove: List? = null): Call @GET("getPodcasts.view") fun getPodcasts(@Query("includeEpisodes") includeEpisodes: Boolean? = null, - @Query("id") id: Long? = null): Call + @Query("id") id: String? = null): Call @GET("getLyrics.view") fun getLyrics(@Query("artist") artist: String? = null, @@ -149,7 +149,7 @@ interface SubsonicAPIDefinition { @Query("fromYear") fromYear: Int? = null, @Query("toYear") toYear: Int? = null, @Query("genre") genre: String? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getAlbumList2.view") fun getAlbumList2(@Query("type") type: AlbumListType, @@ -158,20 +158,20 @@ interface SubsonicAPIDefinition { @Query("fromYear") fromYear: Int? = null, @Query("toYear") toYear: Int? = null, @Query("genre") genre: String? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getRandomSongs.view") fun getRandomSongs(@Query("size") size: Int? = null, @Query("genre") genre: String? = null, @Query("fromYear") fromYear: Int? = null, @Query("toYear") toYear: Int? = null, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getStarred.view") - fun getStarred(@Query("musicFolderId") musicFolderId: Long? = null): Call + fun getStarred(@Query("musicFolderId") musicFolderId: String? = null): Call @GET("getStarred2.view") - fun getStarred2(@Query("musicFolderId") musicFolderId: Long? = null): Call + fun getStarred2(@Query("musicFolderId") musicFolderId: String? = null): Call @Streaming @GET("getCoverArt.view") @@ -205,10 +205,10 @@ interface SubsonicAPIDefinition { @Query("expires") expires: Long? = null): Call @GET("deleteShare.view") - fun deleteShare(@Query("id") id: Long): Call + fun deleteShare(@Query("id") id: String): Call @GET("updateShare.view") - fun updateShare(@Query("id") id: Long, + fun updateShare(@Query("id") id: String, @Query("description") description: String? = null, @Query("expires") expires: Long? = null): Call @@ -220,7 +220,7 @@ interface SubsonicAPIDefinition { @Query("genre") genre: String, @Query("count") count: Int = 10, @Query("offset") offset: Int = 0, - @Query("musicFolderId") musicFolderId: Long? = null): Call + @Query("musicFolderId") musicFolderId: String? = null): Call @GET("getUser.view") fun getUser(@Query("username") username: String): Call @@ -236,12 +236,12 @@ interface SubsonicAPIDefinition { @GET("createBookmark.view") fun createBookmark( - @Query("id") id: Int, + @Query("id") id: String, @Query("position") position: Long, @Query("comment") comment: String? = null): Call @GET("deleteBookmark.view") - fun deleteBookmark(@Query("id") id: Int): Call + fun deleteBookmark(@Query("id") id: String): Call @GET("getVideos.view") fun getVideos(): Call diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Album.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Album.kt index 40119aaa..df21c658 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Album.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Album.kt @@ -4,11 +4,11 @@ import com.fasterxml.jackson.annotation.JsonProperty import java.util.Calendar data class Album( - val id: Long = -1L, + val id: String = "", val name: String = "", val coverArt: String = "", val artist: String = "", - val artistId: Long = -1L, + val artistId: String = "", val songCount: Int = 0, val duration: Int = 0, val created: Calendar? = null, diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Artist.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Artist.kt index cbbca431..709409d5 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Artist.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Artist.kt @@ -3,7 +3,7 @@ package org.moire.ultrasonic.api.subsonic.models import com.fasterxml.jackson.annotation.JsonProperty import java.util.Calendar -data class Artist(val id: Long = -1, +data class Artist(val id: String = "", val name: String = "", val coverArt: String = "", val albumCount: Int = 0, diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicDirectory.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicDirectory.kt index 2739acbe..6d445097 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicDirectory.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicDirectory.kt @@ -3,8 +3,8 @@ package org.moire.ultrasonic.api.subsonic.models import com.fasterxml.jackson.annotation.JsonProperty import java.util.Calendar -data class MusicDirectory(val id: Long = -1L, - val parent: Long = -1L, +data class MusicDirectory(val id: String = "", + val parent: String = "", val name: String = "", val userRating: Int = 0, val averageRating: Float = 0.0f, diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicDirectoryChild.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicDirectoryChild.kt index 2f1f5843..28440d82 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicDirectoryChild.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicDirectoryChild.kt @@ -2,8 +2,8 @@ package org.moire.ultrasonic.api.subsonic.models import java.util.Calendar -data class MusicDirectoryChild(val id: Long = -1L, - val parent: Long = -1L, +data class MusicDirectoryChild(val id: String = "", + val parent: String = "", val isDir: Boolean = false, val title: String = "", val album: String = "", @@ -24,12 +24,12 @@ data class MusicDirectoryChild(val id: Long = -1L, val playCount: Int = 0, val discNumber: Int = -1, val created: Calendar? = null, - val albumId: Long = -1, - val artistId: Long = -1, + val albumId: String = "", + val artistId: String = "", val type: String = "", val starred: Calendar? = null, - val streamId: Long = -1, - val channelId: Long = -1, + val streamId: String = "", + val channelId: String = "", val description: String = "", val status: String = "", val publishDate: Calendar? = null, diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicFolder.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicFolder.kt index 66c68f48..71741ae6 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicFolder.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/MusicFolder.kt @@ -1,3 +1,3 @@ package org.moire.ultrasonic.api.subsonic.models -data class MusicFolder(val id: Long = -1, val name: String = "") +data class MusicFolder(val id: String = "", val name: String = "") diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Playlist.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Playlist.kt index 04186edf..ce3c41be 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Playlist.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Playlist.kt @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import java.util.Calendar data class Playlist( - val id: Long = -1, + val id: String = "", val name: String = "", val owner: String = "", val comment: String = "", diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/PodcastChannel.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/PodcastChannel.kt index 780898bb..d2a44b83 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/PodcastChannel.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/PodcastChannel.kt @@ -3,7 +3,7 @@ package org.moire.ultrasonic.api.subsonic.models import com.fasterxml.jackson.annotation.JsonProperty data class PodcastChannel( - val id: Long = -1, + val id: String = "", val url: String = "", val title: String = "", val description: String = "", diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Share.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Share.kt index 315c1bbf..b28c480f 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Share.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/models/Share.kt @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import java.util.Calendar data class Share( - val id: Long = -1L, + val id: String = "", val url: String = "", val username: String = "", val created: Calendar? = null, diff --git a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/response/MusicFoldersResponse.kt b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/response/MusicFoldersResponse.kt index bbbda243..8e78c0d7 100644 --- a/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/response/MusicFoldersResponse.kt +++ b/subsonic-api/src/main/kotlin/org/moire/ultrasonic/api/subsonic/response/MusicFoldersResponse.kt @@ -1,33 +1,18 @@ package org.moire.ultrasonic.api.subsonic.response -import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.core.JsonToken -import com.fasterxml.jackson.databind.DeserializationContext -import com.fasterxml.jackson.databind.JsonDeserializer -import com.fasterxml.jackson.databind.JsonMappingException -import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.annotation.JsonProperty import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions import org.moire.ultrasonic.api.subsonic.SubsonicError import org.moire.ultrasonic.api.subsonic.models.MusicFolder class MusicFoldersResponse(status: Status, version: SubsonicAPIVersions, - error: SubsonicError?, - @JsonDeserialize(using = MusicFoldersDeserializer::class) - val musicFolders: List = emptyList()) : + error: SubsonicError?) : SubsonicResponse(status, version, error) { - companion object { - class MusicFoldersDeserializer() : JsonDeserializer>() { - override fun deserialize(p: JsonParser, ctxt: DeserializationContext?): List { - p.nextToken() - if (p.currentName == "musicFolder" && p.nextToken() == JsonToken.START_ARRAY) { - val mfJavaType = ctxt!!.typeFactory - .constructCollectionType(List::class.java, MusicFolder::class.java) - return ctxt.readValue(p, mfJavaType) - } + @JsonProperty("musicFolders") private val wrapper = MusicFoldersWrapper() - throw JsonMappingException(p, "Failed to parse music folders list") - } - } - } + val musicFolders get() = wrapper.musicFolders } + +internal class MusicFoldersWrapper( + @JsonProperty("musicFolder") val musicFolders: List = emptyList()) diff --git a/subsonic-api/src/test/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapperTest.kt b/subsonic-api/src/test/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapperTest.kt index d139b863..ec3d2aac 100644 --- a/subsonic-api/src/test/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapperTest.kt +++ b/subsonic-api/src/test/kotlin/org/moire/ultrasonic/api/subsonic/ApiVersionCheckWrapperTest.kt @@ -37,10 +37,10 @@ class ApiVersionCheckWrapperTest { wrapper.getAlbumList(BY_GENRE) - val throwCall = { wrapper.getAlbumList(BY_GENRE, musicFolderId = 12L) } + val throwCall = { wrapper.getAlbumList(BY_GENRE, musicFolderId = "12") } throwCall `should throw` ApiNotSupportedException::class verify(apiMock).getAlbumList(BY_GENRE) - verify(apiMock, never()).getAlbumList(BY_GENRE, musicFolderId = 12L) + verify(apiMock, never()).getAlbumList(BY_GENRE, musicFolderId = "12") } } diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/service/RESTMusicService.java b/ultrasonic/src/main/java/org/moire/ultrasonic/service/RESTMusicService.java index 18d8df3e..6b269680 100644 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/service/RESTMusicService.java +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/service/RESTMusicService.java @@ -188,7 +188,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .getIndexes(musicFolderId == null ? null : Long.valueOf(musicFolderId), null).execute(); + .getIndexes(musicFolderId, null).execute(); checkResponseSuccessful(response); Indexes indexes = APIIndexesConverter.toDomainEntity(response.body().getIndexes()); @@ -251,13 +251,9 @@ public class RESTMusicService implements MusicService { String artistId, Context context, ProgressListener progressListener) throws Exception { - Long apiId = id == null ? null : Long.valueOf(id); - Long apiAlbumId = albumId == null ? null : Long.valueOf(albumId); - Long apiArtistId = artistId == null ? null : Long.valueOf(artistId); - updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .star(apiId, apiAlbumId, apiArtistId).execute(); + .star(id, albumId, artistId).execute(); checkResponseSuccessful(response); } @@ -267,13 +263,9 @@ public class RESTMusicService implements MusicService { String artistId, Context context, ProgressListener progressListener) throws Exception { - Long apiId = id == null ? null : Long.valueOf(id); - Long apiAlbumId = albumId == null ? null : Long.valueOf(albumId); - Long apiArtistId = artistId == null ? null : Long.valueOf(artistId); - updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .unstar(apiId, apiAlbumId, apiArtistId).execute(); + .unstar(id, albumId, artistId).execute(); checkResponseSuccessful(response); } @@ -289,7 +281,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .getMusicDirectory(Long.valueOf(id)).execute(); + .getMusicDirectory(id).execute(); checkResponseSuccessful(response); return APIMusicDirectoryConverter.toDomainEntity(response.body().getMusicDirectory()); @@ -306,8 +298,7 @@ public class RESTMusicService implements MusicService { } updateProgressListener(progressListener, R.string.parser_reading); - Response response = subsonicAPIClient.getApi() - .getArtist(Long.valueOf(id)).execute(); + Response response = subsonicAPIClient.getApi().getArtist(id).execute(); checkResponseSuccessful(response); return APIArtistConverter.toMusicDirectoryDomainEntity(response.body().getArtist()); @@ -324,8 +315,7 @@ public class RESTMusicService implements MusicService { } updateProgressListener(progressListener, R.string.parser_reading); - Response response = subsonicAPIClient.getApi() - .getAlbum(Long.valueOf(id)).execute(); + Response response = subsonicAPIClient.getApi().getAlbum(id).execute(); checkResponseSuccessful(response); return APIAlbumConverter.toMusicDirectoryDomainEntity(response.body().getAlbum()); @@ -406,7 +396,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .getPlaylist(Long.valueOf(id)).execute(); + .getPlaylist(id).execute(); checkResponseSuccessful(response); MusicDirectory playlist = APIPlaylistConverter @@ -459,17 +449,16 @@ public class RESTMusicService implements MusicService { List entries, Context context, ProgressListener progressListener) throws Exception { - Long pId = id == null ? null : Long.valueOf(id); - List pSongIds = new ArrayList<>(entries.size()); + List pSongIds = new ArrayList<>(entries.size()); for (MusicDirectory.Entry entry : entries) { if (entry.getId() != null) { - pSongIds.add(Long.valueOf(entry.getId())); + pSongIds.add(entry.getId()); } } updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .createPlaylist(pId, name, pSongIds).execute(); + .createPlaylist(id, name, pSongIds).execute(); checkResponseSuccessful(response); } @@ -477,11 +466,9 @@ public class RESTMusicService implements MusicService { public void deletePlaylist(String id, Context context, ProgressListener progressListener) throws Exception { - Long pId = id == null ? null : Long.valueOf(id); - updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .deletePlaylist(pId).execute(); + .deletePlaylist(id).execute(); checkResponseSuccessful(response); } @@ -494,7 +481,7 @@ public class RESTMusicService implements MusicService { ProgressListener progressListener) throws Exception { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .updatePlaylist(Long.valueOf(id), name, comment, pub, null, null).execute(); + .updatePlaylist(id, name, comment, pub, null, null).execute(); checkResponseSuccessful(response); } @@ -521,7 +508,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .getPodcasts(true, Long.valueOf(podcastChannelId)).execute(); + .getPodcasts(true, podcastChannelId).execute(); checkResponseSuccessful(response); List podcastEntries = response.body().getPodcastChannels().get(0) @@ -668,7 +655,7 @@ public class RESTMusicService implements MusicService { Log.d(TAG, "Loading cover art for: " + entry); final String id = entry.getCoverArt(); - if (id == null) { + if (id == null || id.isEmpty()) { return null; // Can't load } @@ -947,10 +934,9 @@ public class RESTMusicService implements MusicService { if (id == null) { throw new IllegalArgumentException("Item id should not be null"); } - Integer itemId = Integer.valueOf(id); updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .createBookmark(itemId, position, null).execute(); + .createBookmark(id, position, null).execute(); checkResponseSuccessful(response); } @@ -965,7 +951,7 @@ public class RESTMusicService implements MusicService { updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .deleteBookmark(itemId).execute(); + .deleteBookmark(id).execute(); checkResponseSuccessful(response); } @@ -1008,8 +994,7 @@ public class RESTMusicService implements MusicService { Long shareId = Long.valueOf(id); updateProgressListener(progressListener, R.string.parser_reading); - Response response = subsonicAPIClient.getApi() - .deleteShare(shareId).execute(); + Response response = subsonicAPIClient.getApi().deleteShare(id).execute(); checkResponseSuccessful(response); } @@ -1027,11 +1012,9 @@ public class RESTMusicService implements MusicService { expires = null; } - Long shareId = Long.valueOf(id); - updateProgressListener(progressListener, R.string.parser_reading); Response response = subsonicAPIClient.getApi() - .updateShare(shareId, description, expires).execute(); + .updateShare(id, description, expires).execute(); checkResponseSuccessful(response); } diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIAlbumConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIAlbumConverter.kt index 2dceb692..482e7275 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIAlbumConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIAlbumConverter.kt @@ -7,12 +7,12 @@ import org.moire.ultrasonic.api.subsonic.models.Album import org.moire.ultrasonic.domain.MusicDirectory fun Album.toDomainEntity(): MusicDirectory.Entry = MusicDirectory.Entry().apply { - id = this@toDomainEntity.id.toString() + id = this@toDomainEntity.id setIsDirectory(true) title = this@toDomainEntity.name coverArt = this@toDomainEntity.coverArt artist = this@toDomainEntity.artist - artistId = this@toDomainEntity.artistId.toString() + artistId = this@toDomainEntity.artistId songCount = this@toDomainEntity.songCount.toLong() duration = this@toDomainEntity.duration created = this@toDomainEntity.created?.time diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIArtistConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIArtistConverter.kt index 9719b0c6..06e3f8ae 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIArtistConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIArtistConverter.kt @@ -8,7 +8,7 @@ import org.moire.ultrasonic.domain.MusicDirectory import org.moire.ultrasonic.api.subsonic.models.Artist as APIArtist fun APIArtist.toDomainEntity(): Artist = Artist().apply { - id = this@toDomainEntity.id.toString() + id = this@toDomainEntity.id name = this@toDomainEntity.name } diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIMusicDirectoryConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIMusicDirectoryConverter.kt index 496723d5..1ef56d4a 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIMusicDirectoryConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIMusicDirectoryConverter.kt @@ -15,14 +15,14 @@ internal val dateFormat: DateFormat by lazy { } fun MusicDirectoryChild.toDomainEntity(): MusicDirectory.Entry = MusicDirectory.Entry().apply { - id = this@toDomainEntity.id.toString() - parent = this@toDomainEntity.parent.toString() + id = this@toDomainEntity.id + parent = this@toDomainEntity.parent setIsDirectory(this@toDomainEntity.isDir) title = this@toDomainEntity.title album = this@toDomainEntity.album - albumId = this@toDomainEntity.albumId.toString() + albumId = this@toDomainEntity.albumId artist = this@toDomainEntity.artist - artistId = this@toDomainEntity.artistId.toString() + artistId = this@toDomainEntity.artistId track = this@toDomainEntity.track year = this@toDomainEntity.year genre = this@toDomainEntity.genre @@ -40,8 +40,8 @@ fun MusicDirectoryChild.toDomainEntity(): MusicDirectory.Entry = MusicDirectory. starred = this@toDomainEntity.starred != null discNumber = this@toDomainEntity.discNumber type = this@toDomainEntity.type - if (this@toDomainEntity.streamId >= 0) { - id = this@toDomainEntity.streamId.toString() + if (this@toDomainEntity.streamId.isNotBlank()) { + id = this@toDomainEntity.streamId } if (this@toDomainEntity.publishDate != null) { artist = dateFormat.format(this@toDomainEntity.publishDate!!.time) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIMusicFolderConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIMusicFolderConverter.kt index fb967263..431f139c 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIMusicFolderConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIMusicFolderConverter.kt @@ -6,7 +6,7 @@ package org.moire.ultrasonic.data import org.moire.ultrasonic.domain.MusicFolder import org.moire.ultrasonic.api.subsonic.models.MusicFolder as APIMusicFolder -fun APIMusicFolder.toDomainEntity(): MusicFolder = MusicFolder(this.id.toString(), this.name) +fun APIMusicFolder.toDomainEntity(): MusicFolder = MusicFolder(this.id, this.name) fun List.toDomainEntityList(): List = this.map { it.toDomainEntity() } diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIPlaylistConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIPlaylistConverter.kt index 28c6e678..a096fca1 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIPlaylistConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIPlaylistConverter.kt @@ -16,7 +16,7 @@ fun APIPlaylist.toMusicDirectoryDomainEntity(): MusicDirectory = MusicDirectory( addAll(this@toMusicDirectoryDomainEntity.entriesList.map { it.toDomainEntity() }) } -fun APIPlaylist.toDomainEntity(): Playlist = Playlist(this.id.toString(), this.name, this.owner, +fun APIPlaylist.toDomainEntity(): Playlist = Playlist(this.id, this.name, this.owner, this.comment, this.songCount.toString(), this.created?.let { playlistDateFormat.format(it.time) }, public.toString()) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIPodcastConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIPodcastConverter.kt index 3b79dccd..3a5d3e4b 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIPodcastConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIPodcastConverter.kt @@ -7,7 +7,7 @@ import org.moire.ultrasonic.api.subsonic.models.PodcastChannel import org.moire.ultrasonic.domain.PodcastsChannel fun PodcastChannel.toDomainEntity(): PodcastsChannel = PodcastsChannel( - this.id.toString(), this.title, this.url, this.description, this.status) + this.id, this.title, this.url, this.description, this.status) fun List.toDomainEntitiesList(): List = this .map { it.toDomainEntity() } diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIShareConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIShareConverter.kt index c0275878..a1933281 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIShareConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/data/APIShareConverter.kt @@ -17,7 +17,7 @@ fun APIShare.toDomainEntity(): Share = Share().apply { created = this@toDomainEntity.created?.let { shareTimeFormat.format(it.time) } description = this@toDomainEntity.description expires = this@toDomainEntity.expires?.let { shareTimeFormat.format(it.time) } - id = this@toDomainEntity.id.toString() + id = this@toDomainEntity.id lastVisited = this@toDomainEntity.lastVisited?.let { shareTimeFormat.format(it.time) } url = this@toDomainEntity.url username = this@toDomainEntity.username diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIAlbumConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIAlbumConverterTest.kt index 6324b480..becc7bc8 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIAlbumConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIAlbumConverterTest.kt @@ -15,19 +15,19 @@ import java.util.Calendar class APIAlbumConverterTest { @Test fun `Should convert Album to domain entity`() { - val entity = Album(id = 387L, name = "some-name", coverArt = "asdas", artist = "some-artist", - artistId = 390L, songCount = 12, duration = 841, created = Calendar.getInstance(), + val entity = Album(id = "387", name = "some-name", coverArt = "asdas", artist = "some-artist", + artistId = "390", songCount = 12, duration = 841, created = Calendar.getInstance(), year = 2017, genre = "some-genre") val convertedEntity = entity.toDomainEntity() with(convertedEntity) { - id `should equal to` entity.id.toString() + id `should equal to` entity.id title `should equal to` entity.name isDirectory `should equal to` true coverArt `should equal to` entity.coverArt artist `should equal to` entity.artist - artistId `should equal to` entity.artistId.toString() + artistId `should equal to` entity.artistId songCount `should equal to` entity.songCount.toLong() duration `should equal to` entity.duration created `should equal` entity.created?.time @@ -38,7 +38,7 @@ class APIAlbumConverterTest { @Test fun `Should convert to MusicDirectory domain entity`() { - val entity = Album(id = 101L, name = "some-album", artist = "some-artist", artistId = 54L, + val entity = Album(id = "101", name = "some-album", artist = "some-artist", artistId = "54", coverArt = "some-id", songCount = 10, duration = 456, created = Calendar.getInstance(), year = 2022, genre = "Hard Rock", songList = listOf(MusicDirectoryChild())) @@ -54,7 +54,7 @@ class APIAlbumConverterTest { @Test fun `Should convert list of Album entities to domain list entities`() { - val entityList = listOf(Album(id = 455), Album(id = 1), Album(id = 1000)) + val entityList = listOf(Album(id = "455"), Album(id = "1"), Album(id = "1000")) val convertedList = entityList.toDomainEntityList() diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIArtistConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIArtistConverterTest.kt index 3eae741b..0642c9fc 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIArtistConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIArtistConverterTest.kt @@ -10,26 +10,26 @@ import org.moire.ultrasonic.api.subsonic.models.Artist import java.util.Calendar /** - * Unit test for extension functions in [APIArtistConverter.kt] file. + * Unit test for extension functions in APIArtistConverter.kt file. */ class APIArtistConverterTest { @Test fun `Should convert artist entity`() { - val entity = Artist(id = 10, name = "artist-name", starred = Calendar.getInstance()) + val entity = Artist(id = "10", name = "artist-name", starred = Calendar.getInstance()) val convertedEntity = entity.toDomainEntity() with(convertedEntity) { - id `should equal to` entity.id.toString() + id `should equal to` entity.id name `should equal to` entity.name } } @Test fun `Should convert Artist entity to domain MusicDirectory entity`() { - val entity = Artist(id = 101L, name = "artist-name", coverArt = "some-art", albumCount = 10, - albumsList = listOf(Album(id = 562L, name = "some-name", coverArt = "zzz", - artist = "artist-name", artistId = 256L, songCount = 10, duration = 345, + val entity = Artist(id = "101", name = "artist-name", coverArt = "some-art", albumCount = 10, + albumsList = listOf(Album(id = "562", name = "some-name", coverArt = "zzz", + artist = "artist-name", artistId = "256", songCount = 10, duration = 345, created = Calendar.getInstance(), year = 2011, genre = "Math Rock"))) val convertedEntity = entity.toMusicDirectoryDomainEntity() diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIBookmarkConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIBookmarkConverterTest.kt index 3e2527b3..77a6052d 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIBookmarkConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIBookmarkConverterTest.kt @@ -16,7 +16,7 @@ class APIBookmarkConverterTest { @Test fun `Should convert to domain entity`() { val entity = Bookmark(412313L, "Awesemo", "Nice", Calendar.getInstance(), - Calendar.getInstance(), MusicDirectoryChild(id = 12333)) + Calendar.getInstance(), MusicDirectoryChild(id = "12333")) val domainEntity = entity.toDomainEntity() diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIIndexesConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIIndexesConverterTest.kt index 44eea513..6ea2b812 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIIndexesConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIIndexesConverterTest.kt @@ -16,11 +16,11 @@ class APIIndexesConverterTest { @Test fun `Should convert Indexes entity`() { val artistsA = listOf( - Artist(id =4, name = "AC/DC"), - Artist(id =45, name = "ABBA")) + Artist(id ="4", name = "AC/DC"), + Artist(id ="45", name = "ABBA")) val artistsT = listOf( - Artist(id = 10, name = "Taproot"), - Artist(id = 12, name = "Teebee")) + Artist(id = "10", name = "Taproot"), + Artist(id = "12", name = "Teebee")) val entity = Indexes(lastModified = 154, ignoredArticles = "Le Tre Ze", indexList = listOf( Index(name = "A", artists = artistsA), Index(name = "T", artists = artistsT) diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIMusicDirectoryConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIMusicDirectoryConverterTest.kt index b7eb28f5..064bf539 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIMusicDirectoryConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIMusicDirectoryConverterTest.kt @@ -10,14 +10,14 @@ import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild import java.util.Calendar /** - * Unit test for extension functions in [APIMusicDirectoryConverter.kt] file. + * Unit test for extension functions in APIMusicDirectoryConverter.kt file. */ class APIMusicDirectoryConverterTest { @Test fun `Should convert MusicDirectory entity`() { - val entity = MusicDirectory(id = 1982L, parent = 345L, name = "some-name", userRating = 3, + val entity = MusicDirectory(id = "1982", parent = "345", name = "some-name", userRating = 3, averageRating = 3.4f, starred = Calendar.getInstance(), playCount = 10, - childList = listOf(MusicDirectoryChild(1L), MusicDirectoryChild(2L))) + childList = listOf(MusicDirectoryChild("1"), MusicDirectoryChild("2"))) val convertedEntity = entity.toDomainEntity() @@ -30,8 +30,8 @@ class APIMusicDirectoryConverterTest { @Test fun `Should convert MusicDirectoryChild entity`() { - val entity = MusicDirectoryChild(id = 929L, parent = 11L, title = "some-title", - album = "some-album", albumId = 231L, artist = "some-artist", artistId = 1233L, + val entity = MusicDirectoryChild(id = "929", parent = "11", title = "some-title", + album = "some-album", albumId = "231", artist = "some-artist", artistId = "1233", track = 12, year = 2002, genre = "some-genre", coverArt = "952", size = 9418123L, contentType = "some-content-type", suffix = "some-suffix", transcodedContentType = "some-transcoded-content-type", @@ -42,14 +42,14 @@ class APIMusicDirectoryConverterTest { val convertedEntity = entity.toDomainEntity() with(convertedEntity) { - id `should equal to` entity.id.toString() - parent `should equal to` entity.parent.toString() + id `should equal to` entity.id + parent `should equal to` entity.parent isDirectory `should equal to` entity.isDir title `should equal` entity.title album `should equal` entity.album - albumId `should equal to` entity.albumId.toString() + albumId `should equal to` entity.albumId artist `should equal to` entity.artist - artistId `should equal to` entity.artistId.toString() + artistId `should equal to` entity.artistId track `should equal to` entity.track year `should equal to` entity.year!! genre `should equal to` entity.genre @@ -72,20 +72,20 @@ class APIMusicDirectoryConverterTest { @Test fun `Should convert MusicDirectoryChild podcast entity`() { - val entity = MusicDirectoryChild(id = 584, streamId = 394, + val entity = MusicDirectoryChild(id = "584", streamId = "394", artist = "some-artist", publishDate = Calendar.getInstance()) val convertedEntity = entity.toDomainEntity() with(convertedEntity) { - id `should equal to` entity.streamId.toString() + id `should equal to` entity.streamId artist `should equal to` dateFormat.format(entity.publishDate?.time) } } @Test fun `Should convert list of MusicDirectoryChild to domain entity list`() { - val entitiesList = listOf(MusicDirectoryChild(id = 45), MusicDirectoryChild(id = 34)) + val entitiesList = listOf(MusicDirectoryChild(id = "45"), MusicDirectoryChild(id = "34")) val domainList = entitiesList.toDomainEntityList() diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIMusicFolderConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIMusicFolderConverterTest.kt index ef70a69d..34b1008c 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIMusicFolderConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIMusicFolderConverterTest.kt @@ -12,27 +12,27 @@ import org.moire.ultrasonic.api.subsonic.models.MusicFolder class APIMusicFolderConverterTest { @Test fun `Should convert MusicFolder entity`() { - val entity = MusicFolder(id = 10, name = "some-name") + val entity = MusicFolder(id = "10", name = "some-name") val convertedEntity = entity.toDomainEntity() convertedEntity.name `should equal to` entity.name - convertedEntity.id `should equal to` entity.id.toString() + convertedEntity.id `should equal to` entity.id } @Test fun `Should convert list of MusicFolder entities`() { val entityList = listOf( - MusicFolder(id = 3, name = "some-name-3"), - MusicFolder(id = 4, name = "some-name-4")) + MusicFolder(id = "3", name = "some-name-3"), + MusicFolder(id = "4", name = "some-name-4")) val convertedList = entityList.toDomainEntityList() with(convertedList) { size `should equal to` entityList.size - this[0].id `should equal to` entityList[0].id.toString() + this[0].id `should equal to` entityList[0].id this[0].name `should equal to` entityList[0].name - this[1].id `should equal to` entityList[1].id.toString() + this[1].id `should equal to` entityList[1].id this[1].name `should equal to` entityList[1].name } } diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIPlaylistConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIPlaylistConverterTest.kt index 4f1be508..4ef73d00 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIPlaylistConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIPlaylistConverterTest.kt @@ -16,8 +16,8 @@ class APIPlaylistConverterTest { @Test fun `Should convert Playlist to MusicDirectory domain entity`() { val entity = Playlist(name = "some-playlist-name", entriesList = listOf( - MusicDirectoryChild(id = 10L, parent = 1393), - MusicDirectoryChild(id = 11L, parent = 1393) + MusicDirectoryChild(id = "10", parent = "1393"), + MusicDirectoryChild(id = "11", parent = "1393") )) val convertedEntity = entity.toMusicDirectoryDomainEntity() @@ -32,7 +32,7 @@ class APIPlaylistConverterTest { @Test fun `Should convert playlist to domain entity`() { - val entity = Playlist(id = 634, name = "some-name", owner = "some-owner", + val entity = Playlist(id = "634", name = "some-name", owner = "some-owner", comment = "some-comment", public = false, songCount = 256, duration = 1150, created = Calendar.getInstance(), changed = Calendar.getInstance(), coverArt = "some-art") @@ -40,7 +40,7 @@ class APIPlaylistConverterTest { val convertedEntity = entity.toDomainEntity() with(convertedEntity) { - id `should equal to` entity.id.toString() + id `should equal to` entity.id name `should equal to` entity.name comment `should equal to` entity.comment owner `should equal to` entity.owner @@ -52,7 +52,7 @@ class APIPlaylistConverterTest { @Test fun `Should convert list of playlists to list of domain entities`() { - val entitiesList = listOf(Playlist(id = 23, name = "some-name", songCount = 10)) + val entitiesList = listOf(Playlist(id = "23", name = "some-name", songCount = 10)) val convertedList = entitiesList.toDomainEntitiesList() diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIPodcastConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIPodcastConverterTest.kt index 7a0a71f6..11958239 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIPodcastConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIPodcastConverterTest.kt @@ -8,19 +8,19 @@ import org.junit.Test import org.moire.ultrasonic.api.subsonic.models.PodcastChannel /** - * Unit test for extension functions in [APIPodcastConverter.kt] file. + * Unit test for extension functions in APIPodcastConverter.kt file. */ class APIPodcastConverterTest { @Test fun `Should convert podcast channel entity to domain entity`() { - val entity = PodcastChannel(id = 452L, url = "some-url", title = "some-title", + val entity = PodcastChannel(id = "452", url = "some-url", title = "some-title", description = "some-description", coverArt = "cA", originalImageUrl = "image-url", status = "podcast-status", errorMessage = "some-error-message") val converterEntity = entity.toDomainEntity() with(converterEntity) { - id = entity.id.toString() + id = entity.id description = entity.description status = entity.status title = entity.title @@ -31,8 +31,8 @@ class APIPodcastConverterTest { @Test fun `Should convert list of podcasts channels to domain entites list`() { val entitiesList = listOf( - PodcastChannel(id = 932L, title = "title1"), - PodcastChannel(id = 12L, title = "title2")) + PodcastChannel(id = "932", title = "title1"), + PodcastChannel(id = "12", title = "title2")) val converted = entitiesList.toDomainEntitiesList() diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APISearchConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APISearchConverterTest.kt index 218cd0b1..d83bed50 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APISearchConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APISearchConverterTest.kt @@ -14,13 +14,13 @@ import org.moire.ultrasonic.api.subsonic.models.SearchThreeResult import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult /** - * Unit test for extension function in [APISearchConverter.kt] file. + * Unit test for extension function in APISearchConverter.kt file. */ class APISearchConverterTest { @Test fun `Should convert SearchResult to domain entity`() { val entity = SearchResult(offset = 10, totalHits = 3, matchList = listOf( - MusicDirectoryChild(id = 101L) + MusicDirectoryChild(id = "101") )) val convertedEntity = entity.toDomainEntity() @@ -38,11 +38,11 @@ class APISearchConverterTest { @Test fun `Should convert SearchTwoResult to domain entity`() { val entity = SearchTwoResult(listOf( - Artist(id = 82, name = "great-artist-name") + Artist(id = "82", name = "great-artist-name") ), listOf( - MusicDirectoryChild(id = 762, artist = "bzz") + MusicDirectoryChild(id = "762", artist = "bzz") ), listOf( - MusicDirectoryChild(id = 9118, parent = 112) + MusicDirectoryChild(id = "9118", parent = "112") )) val convertedEntity = entity.toDomainEntity() @@ -60,9 +60,9 @@ class APISearchConverterTest { @Test fun `Should convert SearchThreeResult to domain entity`() { val entity = SearchThreeResult( - artistList = listOf(Artist(id = 612, name = "artist1")), - albumList = listOf(Album(id = 221, name = "album1")), - songList = listOf(MusicDirectoryChild(id = 7123, title = "song1")) + artistList = listOf(Artist(id = "612", name = "artist1")), + albumList = listOf(Album(id = "221", name = "album1")), + songList = listOf(MusicDirectoryChild(id = "7123", title = "song1")) ) val convertedEntity = entity.toDomainEntity() diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIShareConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIShareConverterTest.kt index bd40d5f3..192b50b2 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIShareConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APIShareConverterTest.kt @@ -20,7 +20,7 @@ class APIShareConverterTest { val domainEntity = entity.toDomainEntity() with(domainEntity) { - id `should equal to` entity.id.toString() + id `should equal to` entity.id url `should equal to` entity.url description `should equal to` entity.description username `should equal to` entity.username @@ -33,7 +33,7 @@ class APIShareConverterTest { } private fun createFakeShare(): Share { - return Share(id = 45L, url = "some-long-url", username = "Bender", + return Share(id = "45", url = "some-long-url", username = "Bender", created = Calendar.getInstance(), expires = Calendar.getInstance(), visitCount = 24, description = "Kiss my shiny metal ass", lastVisited = Calendar.getInstance(), items = listOf(MusicDirectoryChild())) @@ -43,7 +43,7 @@ class APIShareConverterTest { fun `Should parse list of shares into domain entity list`() { val entityList = listOf( createFakeShare(), - createFakeShare().copy(id = 554L, lastVisited = null)) + createFakeShare().copy(id = "554", lastVisited = null)) val domainEntityList = entityList.toDomainEntitiesList()