mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-24 12:50:58 +03:00
Convert JukeboxStatus domain entity to kotlin.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
3dd7e531b9
commit
21b3fcc77c
ultrasonic/src
main
java/org/moire/ultrasonic/domain
kotlin/org/moire/ultrasonic/domain
test/kotlin/org/moire/ultrasonic/domain
@ -1,72 +0,0 @@
|
||||
/*
|
||||
This file is part of Subsonic.
|
||||
|
||||
Subsonic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Subsonic is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2009 (C) Sindre Mehus
|
||||
*/
|
||||
package org.moire.ultrasonic.domain;
|
||||
|
||||
/**
|
||||
* @author Sindre Mehus
|
||||
* @version $Id$
|
||||
*/
|
||||
public class JukeboxStatus
|
||||
{
|
||||
|
||||
private Integer positionSeconds;
|
||||
private Integer currentPlayingIndex;
|
||||
private Float gain;
|
||||
private boolean playing;
|
||||
|
||||
public Integer getPositionSeconds()
|
||||
{
|
||||
return positionSeconds;
|
||||
}
|
||||
|
||||
public void setPositionSeconds(Integer positionSeconds)
|
||||
{
|
||||
this.positionSeconds = positionSeconds;
|
||||
}
|
||||
|
||||
public Integer getCurrentPlayingIndex()
|
||||
{
|
||||
return currentPlayingIndex;
|
||||
}
|
||||
|
||||
public void setCurrentIndex(Integer currentPlayingIndex)
|
||||
{
|
||||
this.currentPlayingIndex = currentPlayingIndex;
|
||||
}
|
||||
|
||||
public boolean isPlaying()
|
||||
{
|
||||
return playing;
|
||||
}
|
||||
|
||||
public void setPlaying(boolean playing)
|
||||
{
|
||||
this.playing = playing;
|
||||
}
|
||||
|
||||
public Float getGain()
|
||||
{
|
||||
return gain;
|
||||
}
|
||||
|
||||
public void setGain(float gain)
|
||||
{
|
||||
this.gain = gain;
|
||||
}
|
||||
}
|
@ -4,9 +4,9 @@ package org.moire.ultrasonic.domain
|
||||
|
||||
import org.moire.ultrasonic.api.subsonic.models.JukeboxStatus as ApiJukeboxStatus
|
||||
|
||||
fun ApiJukeboxStatus.toDomainEntity(): JukeboxStatus = JukeboxStatus().apply {
|
||||
positionSeconds = this@toDomainEntity.position
|
||||
setCurrentIndex(this@toDomainEntity.currentIndex)
|
||||
isPlaying = this@toDomainEntity.playing
|
||||
fun ApiJukeboxStatus.toDomainEntity(): JukeboxStatus = JukeboxStatus(
|
||||
positionSeconds = this@toDomainEntity.position,
|
||||
currentPlayingIndex = this@toDomainEntity.currentIndex,
|
||||
isPlaying = this@toDomainEntity.playing,
|
||||
gain = this@toDomainEntity.gain
|
||||
}
|
||||
)
|
||||
|
@ -0,0 +1,8 @@
|
||||
package org.moire.ultrasonic.domain
|
||||
|
||||
data class JukeboxStatus(
|
||||
var positionSeconds: Int? = null,
|
||||
var currentPlayingIndex: Int? = null,
|
||||
var gain: Float? = null,
|
||||
var isPlaying: Boolean = false
|
||||
)
|
@ -3,6 +3,7 @@
|
||||
package org.moire.ultrasonic.domain
|
||||
|
||||
import org.amshove.kluent.`should equal to`
|
||||
import org.amshove.kluent.`should equal`
|
||||
import org.junit.Test
|
||||
import org.moire.ultrasonic.api.subsonic.models.JukeboxStatus
|
||||
|
||||
@ -17,10 +18,10 @@ class APIJukeboxConverterTest {
|
||||
val convertedEntity = entity.toDomainEntity()
|
||||
|
||||
with(convertedEntity) {
|
||||
currentPlayingIndex `should equal to` entity.currentIndex
|
||||
gain `should equal to` entity.gain
|
||||
currentPlayingIndex `should equal` entity.currentIndex
|
||||
gain `should equal` entity.gain
|
||||
isPlaying `should equal to` entity.playing
|
||||
positionSeconds `should equal to` entity.position
|
||||
positionSeconds `should equal` entity.position
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user