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..952490f5 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") } 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..06224182 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 @@ -39,10 +39,10 @@ class SubsonicApiGetAlbumTest : SubsonicAPIClientTest() { 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 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 02258a5d..47bd3387 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 @@ -44,12 +44,12 @@ class SubsonicApiGetArtistTest : SubsonicAPIClientTest() { 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/SubsonicApiSearchThreeTest.kt b/subsonic-api/src/integrationTest/kotlin/org/moire/ultrasonic/api/subsonic/SubsonicApiSearchThreeTest.kt index bee289f7..167791ec 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 @@ -35,8 +35,8 @@ class SubsonicApiSearchThreeTest : SubsonicAPIClientTest() { 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 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/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/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 aa0bb74d..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,7 +10,7 @@ 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 @@ -20,7 +20,7 @@ class APIArtistConverterTest { 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 } } @@ -28,8 +28,8 @@ class APIArtistConverterTest { @Test fun `Should convert Artist entity to domain MusicDirectory entity`() { val entity = Artist(id = "101", 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, + 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/APISearchConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APISearchConverterTest.kt index 27c2a5ea..367e5cd7 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APISearchConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/data/APISearchConverterTest.kt @@ -14,7 +14,7 @@ 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 @@ -61,7 +61,7 @@ class APISearchConverterTest { fun `Should convert SearchThreeResult to domain entity`() { val entity = SearchThreeResult( artistList = listOf(Artist(id = "612", name = "artist1")), - albumList = listOf(Album(id = 221, name = "album1")), + albumList = listOf(Album(id = "221", name = "album1")), songList = listOf(MusicDirectoryChild(id = 7123, title = "song1")) )