public void testBundleUpdatePartition(String[] expVersions1, String[] expVersions2, String impVersion1, String impVersion2) throws IOException, BundleException {
        Bundle b = m_bu.installBundle(m_bu.createBundleSpecifier("b")
            .addImport(m_bu.createImportPackage(fooPackage)));

        BundleSpecifier as1 = m_bu.createBundleSpecifier("a1").pack(FooImpl1).pack(Foo);
        if (expVersions1.length == 0) {
            as1.addExport(m_bu.createExportPackage(fooPackage));
        }
        else {
            for (String s : expVersions1) {
                as1.addExport(m_bu.createExportPackage(fooPackage).setVersion(s));
            }
        }
        if (impVersion1 != null) {
            as1.addImport(m_bu.createImportPackage(fooPackage).setVersion(impVersion1));
        }
        Bundle a1 = m_bu.installBundle(as1);

        a1.start();
        m_bu.registerService(FooImpl1, Foo, a1);

        b.start();

        assert a1.getBundleId() == m_bu.getWiredPackageExporter(fooPackage, b).getBundleId() : "Bundle b should be wired to a1 after both are started.";

        assert m_bu.seesService(Foo, b) : "Bundle b should see a service for Foo from a.";
        assert m_bu.canUseService(Foo, b) : "Bundle b should be able to use a service using Foo.";

        BundleSpecifier as2 = m_bu.createBundleSpecifier("a1").pack(FooImpl2).pack(Foo);
        if (expVersions2.length == 0) {
            as2.addExport(m_bu.createExportPackage(fooPackage));
        }
        else {
            for (String s : expVersions2) {
                as2.addExport(m_bu.createExportPackage(fooPackage).setVersion(s));
            }
        }
        if (impVersion2 != null) {
            as2.addImport(m_bu.createImportPackage(fooPackage).setVersion(impVersion2));
        }
        a1.update(m_bu.generateBundle(as2));
        // a1 gets stopped and started automatically.
        m_bu.registerService(FooImpl2, Foo, a1);

        assert !m_bu.seesService(Foo, b) : "Bundle b should no longer see a service for Foo after update of a.";
        assert a1.getBundleId() == m_bu.getWiredPackageExporter(fooPackage, b).getBundleId() : "Bundle b should still be wired to a1 after update.";

        m_bu.refreshFrameworkAndWait(null);
        //re-register the service after refresh.
        m_bu.registerService(FooImpl2, Foo, a1);

        assert a1.getBundleId() == m_bu.getWiredPackageExporter(fooPackage, b).getBundleId() : "Bundle b should still be wired to a1 after update and refresh.";
        assert m_bu.seesService(Foo, b) : "Bundle b should see a service using Foo after refresh.";
        assert m_bu.canUseService(Foo, b) : "Bundle b should be still able to use a service using Foo after refresh.";

    }