@SuppressWarnings("unchecked") public static Long getBundleId(String symbolicName, Version version) throws IOException { Long result = null; cli.sendLine("/subsystem=osgi:read-resource(include-runtime=true,recursive=true)"); CLIOpResult cliresult = cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT); assertTrue(cliresult.isIsOutcomeSuccess()); Map<String, Object> bundlemap = cliresult.getNamedResultAsMap("bundle"); for (Entry<String, Object> entry : bundlemap.entrySet()) { String auxid = entry.getKey(); Map<String, Object> bundle = (Map<String, Object>) entry.getValue(); if (bundle.get("symbolic-name").equals(symbolicName)) { Version auxver = Version.parseVersion((String) bundle.get("version")); if (version == null || version.equals(auxver)) { result = Long.valueOf(auxid); break; } } } return result; }