use of org.libresonic.player.domain.Transcoding 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.Transcoding 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());
}
use of org.libresonic.player.domain.Transcoding in project libresonic by Libresonic.
the class PlayerService method createPlayer.
/**
* Creates the given player, and activates all transcodings.
*
* @param player The player to create.
*/
public void createPlayer(Player player) {
playerDao.createPlayer(player);
List<Transcoding> transcodings = transcodingService.getAllTranscodings();
List<Transcoding> defaultActiveTranscodings = new ArrayList<Transcoding>();
for (Transcoding transcoding : transcodings) {
if (transcoding.isDefaultActive()) {
defaultActiveTranscodings.add(transcoding);
}
}
transcodingService.setTranscodingsForPlayer(player, defaultActiveTranscodings);
}
use of org.libresonic.player.domain.Transcoding in project libresonic by Libresonic.
the class TranscodingDaoTestCase method testPlayerTranscoding.
@Test
public void testPlayerTranscoding() {
Player player = new Player();
playerDao.createPlayer(player);
transcodingDao.createTranscoding(new Transcoding(null, "name", "sourceFormats", "targetFormat", "step1", "step2", "step3", false));
transcodingDao.createTranscoding(new Transcoding(null, "name", "sourceFormats", "targetFormat", "step1", "step2", "step3", false));
transcodingDao.createTranscoding(new Transcoding(null, "name", "sourceFormats", "targetFormat", "step1", "step2", "step3", false));
Transcoding transcodingA = transcodingDao.getAllTranscodings().get(0);
Transcoding transcodingB = transcodingDao.getAllTranscodings().get(1);
Transcoding transcodingC = transcodingDao.getAllTranscodings().get(2);
List<Transcoding> activeTranscodings = transcodingDao.getTranscodingsForPlayer(player.getId());
assertEquals("Wrong number of transcodings.", 0, activeTranscodings.size());
transcodingDao.setTranscodingsForPlayer(player.getId(), new int[] { transcodingA.getId() });
activeTranscodings = transcodingDao.getTranscodingsForPlayer(player.getId());
assertEquals("Wrong number of transcodings.", 1, activeTranscodings.size());
assertTranscodingEquals(transcodingA, activeTranscodings.get(0));
transcodingDao.setTranscodingsForPlayer(player.getId(), new int[] { transcodingB.getId(), transcodingC.getId() });
activeTranscodings = transcodingDao.getTranscodingsForPlayer(player.getId());
assertEquals("Wrong number of transcodings.", 2, activeTranscodings.size());
assertTranscodingEquals(transcodingB, activeTranscodings.get(0));
assertTranscodingEquals(transcodingC, activeTranscodings.get(1));
transcodingDao.setTranscodingsForPlayer(player.getId(), new int[0]);
activeTranscodings = transcodingDao.getTranscodingsForPlayer(player.getId());
assertEquals("Wrong number of transcodings.", 0, activeTranscodings.size());
}
use of org.libresonic.player.domain.Transcoding in project libresonic by Libresonic.
the class TranscodingDaoTestCase method testCreateTranscoding.
@Test
public void testCreateTranscoding() {
Transcoding transcoding = new Transcoding(null, "name", "sourceFormats", "targetFormat", "step1", "step2", "step3", false);
transcodingDao.createTranscoding(transcoding);
Transcoding newTranscoding = transcodingDao.getAllTranscodings().get(0);
assertTranscodingEquals(transcoding, newTranscoding);
}
Aggregations