Search in sources :

Example 46 with ExportPackageDescription

use of org.eclipse.osgi.service.resolver.ExportPackageDescription in project rt.equinox.framework by eclipse.

the class TestDynamic_001 method testTest_001.

public void testTest_001() {
    State state = buildEmptyState();
    StateObjectFactory sof = StateObjectFactory.defaultFactory;
    bundle_1 = create_bundle_1(sof);
    bundle_2 = create_bundle_2(sof);
    // ***************************************************
    // stage a
    // expect to pass =true
    // ***************************************************
    addBundlesToState_a(state);
    // ***************************************************
    try {
        state.resolve();
    } catch (Throwable t) {
        fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage());
        return;
    }
    checkBundlesResolved_a();
    checkWiring_a();
    // Dynamics
    ExportPackageDescription exp = state.linkDynamicImport(bundle_1, "p");
    assertNotNull("Package [p] is not wired when it should be ", exp);
    assertEquals("Package [p] is wired incorrectly ", exp.getExporter(), bundle_2);
}
Also used : State(org.eclipse.osgi.service.resolver.State) ExportPackageDescription(org.eclipse.osgi.service.resolver.ExportPackageDescription) StateObjectFactory(org.eclipse.osgi.service.resolver.StateObjectFactory)

Example 47 with ExportPackageDescription

use of org.eclipse.osgi.service.resolver.ExportPackageDescription in project rt.equinox.framework by eclipse.

the class TestDynamic_003 method checkWiringState_1.

// end of method
public void checkWiringState_1() {
    ExportPackageDescription[] exports = bundle_1.getResolvedImports();
    assertNotNull("export array is unexpectedly null", exports);
    assertTrue("export array is unexpectedly empty", exports.length > 0);
    for (int i = 0; i < exports.length; i++) {
        ExportPackageDescription exp = exports[i];
        String exportPackageName = exp.getName();
        assertNotNull("package name is null", exportPackageName);
        if (exportPackageName.equals("p")) {
            assertNotNull("Package [p] is not wired when it should be ", exp.getExporter());
            assertEquals("Package [p] is wired incorrectly ", exp.getExporter(), bundle_3);
        } else if (exportPackageName.equals("q")) {
            assertNotNull("Package [q] is not wired when it should be ", exp.getExporter());
            assertEquals("Package [q] is wired incorrectly ", exp.getExporter(), bundle_3);
        }
    }
// end for
}
Also used : ExportPackageDescription(org.eclipse.osgi.service.resolver.ExportPackageDescription)

Example 48 with ExportPackageDescription

use of org.eclipse.osgi.service.resolver.ExportPackageDescription in project rt.equinox.framework by eclipse.

the class TestGenerated_001 method checkWiringState_6.

// end method
public void checkWiringState_6() {
    ExportPackageDescription[] exports = null;
    exports = null;
    exports = bundle_6.getResolvedImports();
    assertNotNull("export array is unexpectedly null", exports);
    assertTrue("export array is unexpectedly empty", exports.length > 0);
    for (int i = 0; i < exports.length; i++) {
        ExportPackageDescription exp = exports[i];
        String exportPackageName = exp.getName();
        assertNotNull("package name is null", exportPackageName);
        if (exportPackageName.equals("a2")) {
            assertNotNull("Package [a2] is not wired when it should  be ", exp.getExporter());
            assertEquals("Package [a2] is  wired incorrectly ", exp.getExporter(), bundle_8);
        } else if (exportPackageName.equals("a1")) {
            assertNotNull("Package [a1] is not wired when it should  be ", exp.getExporter());
            assertEquals("Package [a1] is  wired incorrectly ", exp.getExporter(), bundle_3);
        } else if (exportPackageName.equals("a3")) {
            assertNotNull("Package [a3] is not wired when it should  be ", exp.getExporter());
            assertEquals("Package [a3] is  wired incorrectly ", exp.getExporter(), bundle_6);
        }
    }
// end for
}
Also used : ExportPackageDescription(org.eclipse.osgi.service.resolver.ExportPackageDescription)

Example 49 with ExportPackageDescription

use of org.eclipse.osgi.service.resolver.ExportPackageDescription in project rt.equinox.framework by eclipse.

the class TestOptional_001 method checkWiringState_1.

// end of method
public void checkWiringState_1() {
    ExportPackageDescription[] exports = bundle_1.getResolvedImports();
    assertNotNull("export array is unexpectedly null", exports);
    assertTrue("export array is unexpectedly empty", exports.length > 0);
    for (int i = 0; i < exports.length; i++) {
        ExportPackageDescription exp = exports[i];
        String exportPackageName = exp.getName();
        assertNotNull("package name is null", exportPackageName);
        if (exportPackageName.equals("q")) {
            assertNotNull("Package [q] is not wired when it should be ", exp.getExporter());
            assertEquals("Package [q] is wired incorrectly ", exp.getExporter(), bundle_3);
        } else if (exportPackageName.equals("r")) {
            assertNotNull("Package [r] is not wired when it should be ", exp.getExporter());
            assertEquals("Package [r] is wired incorrectly ", exp.getExporter(), bundle_3);
        } else if (exportPackageName.equals("p")) {
            assertNull("Package [p] is wired when it should not be ", exp);
        }
    }
// end for
}
Also used : ExportPackageDescription(org.eclipse.osgi.service.resolver.ExportPackageDescription)

Example 50 with ExportPackageDescription

use of org.eclipse.osgi.service.resolver.ExportPackageDescription in project rt.equinox.framework by eclipse.

the class TestDynamic_002 method testTest_002.

public void testTest_002() {
    State state = buildEmptyState();
    StateObjectFactory sof = StateObjectFactory.defaultFactory;
    bundle_1 = create_bundle_1(sof);
    bundle_2 = create_bundle_2(sof);
    bundle_3 = create_bundle_3(sof);
    // ***************************************************
    // stage a
    // expect to pass =true
    // ***************************************************
    addBundlesToState_a(state);
    // ***************************************************
    try {
        state.resolve();
    } catch (Throwable t) {
        fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage());
        return;
    }
    checkBundlesResolved_a();
    checkWiring_a();
    // Dynamics
    ExportPackageDescription exp = state.linkDynamicImport(bundle_1, "r");
    assertNull("Package [r] is wired when it should not be ", exp);
}
Also used : State(org.eclipse.osgi.service.resolver.State) ExportPackageDescription(org.eclipse.osgi.service.resolver.ExportPackageDescription) StateObjectFactory(org.eclipse.osgi.service.resolver.StateObjectFactory)

Aggregations

ExportPackageDescription (org.eclipse.osgi.service.resolver.ExportPackageDescription)61 State (org.eclipse.osgi.service.resolver.State)22 BundleDescription (org.eclipse.osgi.service.resolver.BundleDescription)21 Hashtable (java.util.Hashtable)15 ArrayList (java.util.ArrayList)6 StateObjectFactory (org.eclipse.osgi.service.resolver.StateObjectFactory)6 VersionConstraint (org.eclipse.osgi.service.resolver.VersionConstraint)5 BundleSpecification (org.eclipse.osgi.service.resolver.BundleSpecification)4 ImportPackageSpecification (org.eclipse.osgi.service.resolver.ImportPackageSpecification)4 GenericDescription (org.eclipse.osgi.service.resolver.GenericDescription)3 ExportPackageDescriptionImpl (org.eclipse.osgi.internal.resolver.ExportPackageDescriptionImpl)2 BaseDescription (org.eclipse.osgi.service.resolver.BaseDescription)2 GenericSpecification (org.eclipse.osgi.service.resolver.GenericSpecification)2 StateWire (org.eclipse.osgi.service.resolver.StateWire)2 AccessRule (org.eclipse.tycho.classpath.ClasspathEntry.AccessRule)2 DefaultAccessRule (org.eclipse.tycho.core.osgitools.DefaultClasspathEntry.DefaultAccessRule)2 Dictionary (java.util.Dictionary)1 HashMap (java.util.HashMap)1 List (java.util.List)1 GenericDescriptionImpl (org.eclipse.osgi.internal.resolver.GenericDescriptionImpl)1