use of com.xenoage.utils.filter.AllFilter in project Zong by Xenoage.
the class OpusFileInputTest method test.
@Test
public void test() throws Exception {
OpusFileInput opusInput = new OpusFileInput();
String dir = "data/test/scores/MxlOpusFileInputTest";
Opus opus = opusInput.readOpusFile(jsePlatformUtils().openFile(dir + "/SomeOpus.xml"));
// must contain one score, one opus and one opus-link
assertTrue(opus.getItems().get(0) instanceof com.xenoage.zong.io.musicxml.opus.Score);
assertTrue(opus.getItems().get(1) instanceof com.xenoage.zong.io.musicxml.opus.Opus);
assertTrue(opus.getItems().get(2) instanceof com.xenoage.zong.io.musicxml.opus.OpusLink);
// resolve links
opus = sync(new OpusLinkResolver(opus, null, dir));
// check flattened list of scores and load the files
List<String> scores = opus.getScoreFilenames();
assertEquals(4, scores.size());
String[] scoresExpected = new String[] { "BeetAnGeSample.xml", "BrahWiMeSample.mxl", "DebuMandSample.xml", "SchbAvMaSample.xml" };
for (String scoreExpected : scoresExpected) {
try {
assertTrue(scoreExpected + " not found", scores.contains(scoreExpected));
String filePath = dir + "/" + scoreExpected;
sync(new MusicXmlFileReader(jsePlatformUtils().openFile(filePath), filePath, new AllFilter<>()));
} catch (Exception ex) {
throw new Exception("Failed to load " + scoreExpected, ex);
}
}
}