/* * Return a boolean value indicating whether or not the IU with the given ID and version * is installed. We do this by loading the profile registry and seeing if it is there. */ public boolean isInstalled(String id, String version) { File location = new File(output, getRootFolder() + "/p2/org.eclipse.equinox.p2.engine/profileRegistry"); SimpleProfileRegistry registry = new SimpleProfileRegistry( getAgent(), location, new SurrogateProfileHandler(getAgent()), false); IProfile[] profiles = registry.getProfiles(); assertEquals("1.0 Should only be one profile in registry.", 1, profiles.length); IQueryResult queryResult = profiles[0].query(QueryUtil.createIUQuery(id, Version.create(version)), null); return !queryResult.isEmpty(); }
public IInstallableUnit getRemoteIU(String id, String version) { File location = new File(output, getRootFolder() + "/p2/org.eclipse.equinox.p2.engine/profileRegistry"); SimpleProfileRegistry registry = new SimpleProfileRegistry( getAgent(), location, new SurrogateProfileHandler(getAgent()), false); IProfile[] profiles = registry.getProfiles(); assertEquals("1.0 Should only be one profile in registry.", 1, profiles.length); IQueryResult queryResult = profiles[0].query(QueryUtil.createIUQuery(id, Version.create(version)), null); assertEquals( "1.1 Should not have more than one IU wth the same ID and version.", 1, queryResultSize(queryResult)); return (IInstallableUnit) queryResult.iterator().next(); }