@Test public void headers() throws Exception { Bundle bundle = mock(Bundle.class); BundleModel model = new BundleModel(bundle); Dictionary<String, String> headers = new Hashtable<>(); headers.put("k1", "v1"); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.IMPORT_PACKAGE, "org.osgi.framework"); when(bundle.getHeaders()).thenReturn(headers); assertThat(model.getHeaders()) .containsEntry(Constants.BUNDLE_MANIFESTVERSION, "2") .containsEntry(Constants.IMPORT_PACKAGE, "org.osgi.framework") .containsEntry("k1", "v1"); }
public Map<String, String> getHeaders() { Map<String, String> map = new TreeMap<>(); Enumeration<String> enumeration = bundle.getHeaders().keys(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); map.put(key, bundle.getHeaders().get(key)); } return map; }
BundleModel { public Map<String, String> getHeaders() { Map<String, String> map = new TreeMap<>(); Enumeration<String> enumeration = bundle.getHeaders().keys(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); map.put(key, bundle.getHeaders().get(key)); } return map; } }
BundleModel { public Map<String, String> getHeaders() { Map<String, String> map = new TreeMap<>(); Enumeration<String> enumeration = bundle.getHeaders().keys(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); map.put(key, bundle.getHeaders().get(key)); } return map; } BundleModel(Bundle bundle); }
BundleModel { public Map<String, String> getHeaders() { Map<String, String> map = new TreeMap<>(); Enumeration<String> enumeration = bundle.getHeaders().keys(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); map.put(key, bundle.getHeaders().get(key)); } return map; } BundleModel(Bundle bundle); static List<BundleModel> bundles(BundleContext context); String getState(); long getId(); String getName(); Map<String, String> getHeaders(); }
BundleModel { public Map<String, String> getHeaders() { Map<String, String> map = new TreeMap<>(); Enumeration<String> enumeration = bundle.getHeaders().keys(); while (enumeration.hasMoreElements()) { String key = enumeration.nextElement(); map.put(key, bundle.getHeaders().get(key)); } return map; } BundleModel(Bundle bundle); static List<BundleModel> bundles(BundleContext context); String getState(); long getId(); String getName(); Map<String, String> getHeaders();  }