use of org.libresonic.player.domain.Player in project libresonic by Libresonic.
the class PlayerDaoTestCase method testGetPlayersForUserAndClientId.
@Test
public void testGetPlayersForUserAndClientId() {
Player player = new Player();
player.setUsername("sindre");
playerDao.createPlayer(player);
player = playerDao.getAllPlayers().get(0);
List<Player> players = playerDao.getPlayersForUserAndClientId("sindre", null);
assertFalse("Error in getPlayersForUserAndClientId().", players.isEmpty());
assertPlayerEquals(player, players.get(0));
assertTrue("Error in getPlayersForUserAndClientId().", playerDao.getPlayersForUserAndClientId("sindre", "foo").isEmpty());
player.setClientId("foo");
playerDao.updatePlayer(player);
players = playerDao.getPlayersForUserAndClientId("sindre", null);
assertTrue("Error in getPlayersForUserAndClientId().", players.isEmpty());
players = playerDao.getPlayersForUserAndClientId("sindre", "foo");
assertFalse("Error in getPlayersForUserAndClientId().", players.isEmpty());
assertPlayerEquals(player, players.get(0));
}
use of org.libresonic.player.domain.Player in project libresonic by Libresonic.
the class PlayerDaoTestCase method testIdentity.
@Test
public void testIdentity() {
Player player = new Player();
playerDao.createPlayer(player);
assertEquals("Wrong ID", "1", player.getId());
assertEquals("Wrong number of players.", 1, playerDao.getAllPlayers().size());
playerDao.createPlayer(player);
assertEquals("Wrong ID", "2", player.getId());
assertEquals("Wrong number of players.", 2, playerDao.getAllPlayers().size());
playerDao.createPlayer(player);
assertEquals("Wrong ID", "3", player.getId());
assertEquals("Wrong number of players.", 3, playerDao.getAllPlayers().size());
playerDao.deletePlayer("3");
playerDao.createPlayer(player);
assertEquals("Wrong ID", "3", player.getId());
assertEquals("Wrong number of players.", 3, playerDao.getAllPlayers().size());
playerDao.deletePlayer("2");
playerDao.createPlayer(player);
assertEquals("Wrong ID", "4", player.getId());
assertEquals("Wrong number of players.", 3, playerDao.getAllPlayers().size());
}
use of org.libresonic.player.domain.Player in project libresonic by Libresonic.
the class PlayerDaoTestCase method testPlaylist.
@Test
public void testPlaylist() {
Player player = new Player();
playerDao.createPlayer(player);
PlayQueue playQueue = player.getPlayQueue();
assertNotNull("Missing playlist.", playQueue);
playerDao.deletePlayer(player.getId());
playerDao.createPlayer(player);
assertNotSame("Wrong playlist.", playQueue, player.getPlayQueue());
}
use of org.libresonic.player.domain.Player in project libresonic by Libresonic.
the class TranscodingDaoTestCase method testCascadingDeleteTranscoding.
@Test
public void testCascadingDeleteTranscoding() {
Player player = new Player();
playerDao.createPlayer(player);
transcodingDao.createTranscoding(new Transcoding(null, "name", "sourceFormats", "targetFormat", "step1", "step2", "step3", true));
Transcoding transcoding = transcodingDao.getAllTranscodings().get(0);
transcodingDao.setTranscodingsForPlayer(player.getId(), new int[] { transcoding.getId() });
List<Transcoding> activeTranscodings = transcodingDao.getTranscodingsForPlayer(player.getId());
assertEquals("Wrong number of transcodings.", 1, activeTranscodings.size());
transcodingDao.deleteTranscoding(transcoding.getId());
activeTranscodings = transcodingDao.getTranscodingsForPlayer(player.getId());
assertEquals("Wrong number of transcodings.", 0, activeTranscodings.size());
}
use of org.libresonic.player.domain.Player in project libresonic by Libresonic.
the class TranscodingDaoTestCase method testCascadingDeletePlayer.
@Test
public void testCascadingDeletePlayer() {
Player player = new Player();
playerDao.createPlayer(player);
transcodingDao.createTranscoding(new Transcoding(null, "name", "sourceFormats", "targetFormat", "step1", "step2", "step3", true));
Transcoding transcoding = transcodingDao.getAllTranscodings().get(0);
transcodingDao.setTranscodingsForPlayer(player.getId(), new int[] { transcoding.getId() });
List<Transcoding> activeTranscodings = transcodingDao.getTranscodingsForPlayer(player.getId());
assertEquals("Wrong number of transcodings.", 1, activeTranscodings.size());
playerDao.deletePlayer(player.getId());
activeTranscodings = transcodingDao.getTranscodingsForPlayer(player.getId());
assertEquals("Wrong number of transcodings.", 0, activeTranscodings.size());
}
Aggregations