From ad20064d79a7ea2dd20efc654e3ffe5a05b3ac3d Mon Sep 17 00:00:00 2001 From: Yahor Berdnikau Date: Sat, 16 Dec 2017 20:54:43 +0100 Subject: [PATCH] Change Share id type to String. Signed-off-by: Yahor Berdnikau --- .../ultrasonic/api/subsonic/SubsonicApiCreateShareTest.kt | 2 +- .../ultrasonic/api/subsonic/SubsonicApiGetSharesTest.kt | 2 +- .../org/moire/ultrasonic/api/subsonic/models/Share.kt | 2 +- .../kotlin/org/moire/ultrasonic/data/APIShareConverter.kt | 2 +- .../org/moire/ultrasonic/data/APIShareConverterTest.kt | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) 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..55dd3383 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" 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..6c57de24 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" 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/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/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()