headers.put(Constants.BUNDLE_SYMBOLICNAME, "test");
headers.put(Constants.BUNDLE_VERSION, "0.0.0");
when(bundle.getHeaders()).thenReturn(headers);
//exported packages
ExportedPackage exported = mock(ExportedPackage.class);
when(exported.getName()).thenReturn("org.apache.aries.jmx");
when(exported.getVersion()).thenReturn(new Version("1.0.0"));
when(packageAdmin.getExportedPackages(bundle)).thenReturn(new ExportedPackage[] { exported });
//imported packages
ExportedPackage ep1 = mock(ExportedPackage.class);
when(ep1.getImportingBundles()).thenReturn(new Bundle[] { bundle, b2, b3 });
when(ep1.getName()).thenReturn("org.apache.aries.jmx.b1");
when(ep1.getVersion()).thenReturn(Version.emptyVersion);
ExportedPackage ep2 = mock(ExportedPackage.class);
when(ep2.getImportingBundles()).thenReturn(new Bundle[] { bundle, b3 });
when(ep2.getName()).thenReturn("org.apache.aries.jmx.b2");
when(ep2.getVersion()).thenReturn(Version.parseVersion("2.0.1"));
headers.put(Constants.DYNAMICIMPORT_PACKAGE, "*");
when(packageAdmin.getExportedPackages(b1)).thenReturn(new ExportedPackage[] { ep1 });
when(packageAdmin.getExportedPackages(b2)).thenReturn(new ExportedPackage[] { ep2 });
when(packageAdmin.getExportedPackages(b3)).thenReturn(null);