public void testReadCompressedFileAndHref() { File mdaIsHere = new File(ANDROMDA_HOME); if (mdaIsHere.exists()) { LOG.info("Begin testReadCompressedFileAndHref()"); XmiReaderImpl reader = new XmiReaderImpl(modelImplementation); reader.addSearchPath(ANDROMDA_HOME + "/andromda/xml.zips"); try { reader.parse(new InputSource(new FileInputStream(testModel)), false); } catch (Exception e) { e.printStackTrace(); fail("Exception while loading model"); } assertTrue("model is loaded", true); } }
private void setProfilePathSubdirs(XmiReaderImpl reader, File directory) { Collection<File> dirs = new ArrayList<File>(); collectSubdirs(directory, dirs); for (File dir : dirs) { reader.addSearchPath(dir.getAbsolutePath()); } }
void assertLoadModel(String modelPath, String profilesPath, String testName) { LOG.info("Begin " + testName + "()"); XmiReaderImpl reader = new XmiReaderImpl(modelImplementation); if (profilesPath != null) { String path = getClass().getResource(profilesPath).getPath(); File file = new File(path); setProfilePathSubdirs(reader, file); } try { InputSource inputSource = new InputSource(getClass().getResource(modelPath).toExternalForm()); inputSource.setPublicId(new File(modelPath).getName()); reader.parse(inputSource, false); } catch (Exception e) { e.printStackTrace(); fail("Exception while loading model: " + e.getMessage()); } assertTrue(modelPath + " model is loaded", true); }