public static File getTestOutputFile(String directory, String subDirectory, String subSubDirectory, String filename) { return getTestOutputFile(directory + File.separator + subDirectory + File.separator + subSubDirectory, filename); }
public static File getTransferredTestInputFile(String directory, String filename) throws IOException, FileNotFoundException { return getTransferredTestInputFile( getTestInputFile(directory, filename), getTestOutputFile(directory, filename)); }
public static File getTransferredTestInputFile(String directory, String subDirectory, String filename) throws IOException, FileNotFoundException { return getTransferredTestInputFile( getTestInputFile(directory, subDirectory, filename), getTestOutputFile(directory, subDirectory, filename)); }
protected void createEncryptedFile(String in_name, String out_name) throws IOException { // create encrypted dummy file File in_file = TestFileUtils.getTransferredTestInputFile(testdataDirectory, in_name); File out_file = TestFileUtils.getTestOutputFile(testdataDirectory, out_name); EncryptionUtils.encrypt(in_file, out_file); }
@Test public void testWriteToWriter() throws IOException { prepareTopicMap(); tmfile = TestFileUtils.getTestOutputFile("xtm", "io-w.xtm"); new XTMTopicMapWriter(new FileWriter(tmfile), "utf-8").write(topicmap); Assert.assertTrue(Files.size(tmfile.toPath()) > 0); }
@Test public void testWriteToOutputStream() throws IOException { builder.makeTopic(); File file = TestFileUtils.getTestOutputFile("jtm", "io-o.jtm"); new JTMTopicMapWriter(new FileOutputStream(file)).write(tm); Assert.assertTrue(Files.size(file.toPath()) > 0); }
@Test public void testWriteXTM21ToWriter() throws IOException { prepareTopicMap(); tmfile = TestFileUtils.getTestOutputFile("xtm21", "io-w.xtm"); new XTM21TopicMapWriter(new FileWriter(tmfile), "utf-8").write(topicmap); Assert.assertTrue(Files.size(tmfile.toPath()) > 0); }
@Test public void testWriteToOutputStream() throws IOException { builder.makeTopic(); File file = TestFileUtils.getTestOutputFile("tmxml", "io-o.xtm"); new TMXMLWriter(new FileOutputStream(file), "utf-8").write(topicmap); Assert.assertTrue(Files.size(file.toPath()) > 0); }
@Test public void testWriteToWriter() throws IOException { builder.makeTopic(); File file = TestFileUtils.getTestOutputFile("tmxml", "io-w.xtm"); new TMXMLWriter(new FileWriter(file), "utf-8").write(topicmap); Assert.assertTrue(Files.size(file.toPath()) > 0); }
@Test public void testWriteToWriter() throws IOException { builder.makeTopic(); File file = TestFileUtils.getTestOutputFile("jtm", "io-w.jtm"); new JTMTopicMapWriter(new FileWriter(file)).write(tm); Assert.assertTrue(Files.size(file.toPath()) > 0); } }
@Test public void testWriteXTM2ToWriter() throws IOException { prepareTopicMap(); tmfile = TestFileUtils.getTestOutputFile("xtm2", "io-w.xtm"); new XTM2TopicMapWriter(new FileWriter(tmfile), "utf-8").write(topicmap); Assert.assertTrue(Files.size(tmfile.toPath()) > 0); }
@Test public void testWriteToOutputStream() throws IOException { builder.makeTopic(); File file = TestFileUtils.getTestOutputFile("ltm", "io-o.ltm"); new LTMTopicMapWriter(new FileOutputStream(file)).write(tm); Assert.assertTrue(Files.size(file.toPath()) > 0); }
@Test public void testWriteXTM21ToFile() throws IOException { prepareTopicMap(); tmfile = TestFileUtils.getTestOutputFile("xtm21", "io-f.xtm"); new XTM21TopicMapWriter(tmfile).write(topicmap); Assert.assertTrue(Files.size(tmfile.toPath()) > 0); }
@Test public void testWriteToFile() throws IOException { builder.makeTopic(); File file = TestFileUtils.getTestOutputFile("tmxml", "io-f.xtm"); new TMXMLWriter(file).write(topicmap); Assert.assertTrue(Files.size(file.toPath()) > 0); }
@Test public void testDuplicateIDs() throws IOException { // importing and exporting this file causes duplicate IDs // these are detected on re-import tmfile = TestFileUtils.getTestOutputFile(testdataDirectory, "out", "duplicate-ids.xtm"); topicmap = load("various", "duplicate-ids.xtm"); reload(); }
@Test public void testWriteToFile() throws IOException { builder.makeTopic(); File file = TestFileUtils.getTestOutputFile("ltm", "io-f.ltm"); new LTMTopicMapWriter(file).write(tm); Assert.assertTrue(Files.size(file.toPath()) > 0); }
@Test public void testWriteXTM2ToFile() throws IOException { prepareTopicMap(); tmfile = TestFileUtils.getTestOutputFile("xtm2", "io-f.xtm"); new XTM2TopicMapWriter(tmfile).write(topicmap); Assert.assertTrue(Files.size(tmfile.toPath()) > 0); }
@Test public void testWriteToFile() throws IOException { prepareTopicMap(); tmfile = TestFileUtils.getTestOutputFile("xtm", "io-f.xtm"); new XTMTopicMapWriter(tmfile).write(topicmap); Assert.assertTrue(Files.size(tmfile.toPath()) > 0); }
@Test public void testOutputStream() throws IOException { String baseline = TestFileUtils.getTestInputFile(testdataDirectory, "baseline", "outputstream.cxtm"); File out = TestFileUtils.getTestOutputFile(testdataDirectory, "out", "outputstream.cxtm"); FileOutputStream outs = new FileOutputStream(out); new CanonicalXTMWriter(outs).write(topicmap); outs.close(); Assert.assertTrue("OutputStream export gives incorrect output", TestFileUtils.compareFileToResource(out, baseline)); }
protected void prepareTopicMap() throws IOException { tmfile = TestFileUtils.getTestOutputFile("canonical", "out", "tmid.xtm"); tmbase = new URILocator(tmfile); sourceLoc = tmbase.resolveAbsolute("#id"); InMemoryTopicMapStore store = new InMemoryTopicMapStore(); store.setBaseAddress(tmbase); topicmap = store.getTopicMap(); builder = topicmap.getBuilder(); }