public static ModuleImpl loadModule(String resource) throws IOException, CoreException { URL url = ModuleSyncRunnerTest.class.getResource(resource); if (url == null) { Assert.fail("resource not found: " + resource); } ModuleImpl module = new ModuleManifestParser().parse(url.openStream()); module.setLocation(url); return module; }
private static ModuleImpl newModuleImpl(String name, String version, ModuleState state) throws CoreException { ModuleImpl module = null; String resource = "xml/" + name + ".xml"; try { module = loadModule(resource); } catch (IOException e) { e.printStackTrace(); Assert.fail(resource + ": " + e.getMessage()); } module.setVersion(Version.parseVersion(version)); module.setState(state); return module; }