Search in sources :

Example 11 with StateObjectFactory

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

the class TestOptional_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();
}
Also used : State(org.eclipse.osgi.service.resolver.State) StateObjectFactory(org.eclipse.osgi.service.resolver.StateObjectFactory)

Example 12 with StateObjectFactory

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

the class TestPropagation_003 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);
    bundle_3 = create_bundle_3(sof);
    bundle_4 = create_bundle_4(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();
}
Also used : State(org.eclipse.osgi.service.resolver.State) StateObjectFactory(org.eclipse.osgi.service.resolver.StateObjectFactory)

Example 13 with StateObjectFactory

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

the class TestRFC79_006 method testTest_006.

public void testTest_006() {
    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);
    bundle_4 = create_bundle_4(sof);
    bundle_5 = create_bundle_5(sof);
    bundle_6 = create_bundle_6(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();
}
Also used : State(org.eclipse.osgi.service.resolver.State) StateObjectFactory(org.eclipse.osgi.service.resolver.StateObjectFactory)

Example 14 with StateObjectFactory

use of org.eclipse.osgi.service.resolver.StateObjectFactory in project tycho by eclipse.

the class SourcesBundleDependencyMetadataGenerator method getPublisherActions.

@Override
protected List<IPublisherAction> getPublisherActions(IArtifactFacade artifact, List<TargetEnvironment> environments, OptionalResolutionAction optionalAction) {
    ArrayList<IPublisherAction> actions = new ArrayList<>();
    String id = artifact.getArtifactId();
    String version = toCanonicalVersion(artifact.getVersion());
    try {
        // generated source bundle is not available at this point in filesystem yet, need to create
        // in-memory BundleDescription instead
        Dictionary<String, String> manifest = new Hashtable<>();
        manifest.put("Manifest-Version", "1.0");
        manifest.put("Bundle-ManifestVersion", "2");
        String sourceBundleSymbolicName = id + ".source";
        manifest.put("Bundle-SymbolicName", sourceBundleSymbolicName);
        manifest.put("Bundle-Version", version);
        manifest.put("Eclipse-SourceBundle", id + ";version=" + version + ";roots:=\".\"");
        StateObjectFactory factory = StateObjectFactory.defaultFactory;
        BundleDescription bundleDescription = factory.createBundleDescription(factory.createState(false), manifest, artifact.getLocation().getAbsolutePath(), createId(sourceBundleSymbolicName, version));
        bundleDescription.setUserObject(manifest);
        actions.add(new BundlesAction(new BundleDescription[] { bundleDescription }) {

            @Override
            protected void createAdviceFileAdvice(BundleDescription bundleDescription, IPublisherInfo publisherInfo) {
            // 367255 p2.inf is not applicable to sources bundles
            }
        });
    } catch (BundleException e) {
        throw new RuntimeException(e);
    }
    return actions;
}
Also used : IPublisherAction(org.eclipse.equinox.p2.publisher.IPublisherAction) BundlesAction(org.eclipse.equinox.p2.publisher.eclipse.BundlesAction) Hashtable(java.util.Hashtable) BundleDescription(org.eclipse.osgi.service.resolver.BundleDescription) ArrayList(java.util.ArrayList) IPublisherInfo(org.eclipse.equinox.p2.publisher.IPublisherInfo) StateObjectFactory(org.eclipse.osgi.service.resolver.StateObjectFactory) BundleException(org.osgi.framework.BundleException)

Example 15 with StateObjectFactory

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

the class TestDynamic_006 method testTest_005.

public void testTest_005() {
    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, "p.b");
    assertNotNull("Package [p.b] is not wired when it should be ", exp);
    assertEquals("Package [p.b] is wired incorrectly ", exp.getExporter(), bundle_3);
}
Also used : State(org.eclipse.osgi.service.resolver.State) ExportPackageDescription(org.eclipse.osgi.service.resolver.ExportPackageDescription) StateObjectFactory(org.eclipse.osgi.service.resolver.StateObjectFactory)

Aggregations

StateObjectFactory (org.eclipse.osgi.service.resolver.StateObjectFactory)28 State (org.eclipse.osgi.service.resolver.State)27 ExportPackageDescription (org.eclipse.osgi.service.resolver.ExportPackageDescription)6 ArrayList (java.util.ArrayList)1 Hashtable (java.util.Hashtable)1 IPublisherAction (org.eclipse.equinox.p2.publisher.IPublisherAction)1 IPublisherInfo (org.eclipse.equinox.p2.publisher.IPublisherInfo)1 BundlesAction (org.eclipse.equinox.p2.publisher.eclipse.BundlesAction)1 BundleDescription (org.eclipse.osgi.service.resolver.BundleDescription)1 BundleException (org.osgi.framework.BundleException)1