@Override
  protected void setUp() throws Exception {
    super.setUp();
    sdk =
        createIU(
            "SDK",
            PublisherHelper.fromOSGiVersion(new org.osgi.framework.Version("1.0.0")),
            createRequiredCapabilities(
                IInstallableUnit.NAMESPACE_IU_ID, "SDKPart", new VersionRange("[1.0.0, 1.0.0]")));
    IInstallableUnit sdkPart =
        createIU(
            "SDKPart",
            PublisherHelper.fromOSGiVersion(new org.osgi.framework.Version("1.0.0")),
            true);
    IInstallableUnit sdkPart2 =
        createIU(
            "SDKPart",
            PublisherHelper.fromOSGiVersion(new org.osgi.framework.Version("2.0.0")),
            true);

    createTestMetdataRepository(new IInstallableUnit[] {sdk, sdkPart, sdkPart2});

    profile = createProfile("TestProfile." + getName());
    planner = createPlanner();
    engine = createEngine();

    ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
    pcr.addInstallableUnits(new IInstallableUnit[] {sdk});
    engine.perform(planner.getProvisioningPlan(pcr, null, null), null);
  }
Exemplo n.º 2
0
 protected void setUp() throws Exception {
   super.setUp();
   a1 =
       createIU(
           "A",
           Version.create("1.0.0"),
           createRequiredCapabilities(
               IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.0.0]")));
   createTestMetdataRepository(new IInstallableUnit[] {a1});
   profile = createProfile(NoRequirements.class.getName());
   planner = createPlanner();
 }
  protected void setUp() throws Exception {
    super.setUp();
    b1 = createIU("B", Version.create("1.0.0"), false);
    b2 = createIU("B", Version.create("2.0.0"), false);
    b3 = createIU("B", Version.create("3.0.0"), false);
    b4 = createIU("B", Version.create("4.0.0"), false);

    // B's dependency is missing
    IRequirement[] reqA = new IRequirement[4];
    reqA[0] =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "B",
            new VersionRange("[1.0.0,1.0.0]"),
            null,
            true,
            false,
            true);
    reqA[1] =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "B",
            new VersionRange("[2.0.0,2.0.0]"),
            null,
            true,
            false,
            true);
    reqA[2] =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "B",
            new VersionRange("[3.0.0,3.0.0]"),
            null,
            true,
            false,
            true);
    reqA[3] =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "B",
            new VersionRange("[4.0.0,4.0.0]"),
            null,
            true,
            false,
            true);
    a1 = createIU("A", Version.create("1.0.0"), reqA);

    createTestMetdataRepository(new IInstallableUnit[] {a1, b1, b2, b3, b4});

    profile = createProfile("TestProfile." + getName());
    planner = createPlanner();
  }
Exemplo n.º 4
0
 /* (non-Javadoc)
  * @see junit.framework.TestCase#setUp()
  */
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   extractRootCause =
       MirrorRequest.class.getDeclaredMethod("extractRootCause", new Class[] {IStatus.class});
   extractRootCause.setAccessible(true);
   transferSingle =
       MirrorRequest.class.getDeclaredMethod(
           "transferSingle",
           new Class[] {
             IArtifactDescriptor.class, IArtifactDescriptor.class, IProgressMonitor.class
           });
   transferSingle.setAccessible(true);
 }
Exemplo n.º 5
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    a1 = createIU("A", Version.create("2.0.0"));
    IUpdateDescriptor update =
        MetadataFactory.createUpdateDescriptor(
            "A", new VersionRange("[2.0.0, 2.0.0]"), 0, "update description");
    updateOfA =
        createIU(
            "UpdateA",
            Version.createOSGi(1, 0, 0),
            null,
            NO_REQUIRES,
            NO_PROVIDES,
            NO_PROPERTIES,
            null,
            NO_TP_DATA,
            false,
            update,
            NO_REQUIRES);
    a11 = createIUUpdate();
  }
Exemplo n.º 6
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
    iud.setId("A");
    iud.setVersion(Version.create("1.0.0"));

    String orExpression =
        "providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'B' || pc.name == 'C'))";
    IExpression expr = ExpressionUtil.parse(orExpression);
    IMatchExpression matchExpression = ExpressionUtil.getFactory().matchExpression(expr);

    Collection<IMatchExpression<IInstallableUnit>> updateExpression =
        new ArrayList<IMatchExpression<IInstallableUnit>>();
    updateExpression.add(matchExpression);
    iud.setUpdateDescriptor(
        MetadataFactory.createUpdateDescriptor(
            updateExpression, IUpdateDescriptor.HIGH, (String) null, (URI) null));
    iua = MetadataFactory.createInstallableUnit(iud);

    Collection<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
    ius.add(iua);
    URI repoURI = getTempFolder().toURI();
    createMetadataRepository(repoURI, null).addInstallableUnits(ius);
    getMetadataRepositoryManager().removeRepository(repoURI);

    x =
        getMetadataRepositoryManager()
            .loadRepository(repoURI, null)
            .query(QueryUtil.ALL_UNITS, null)
            .iterator()
            .next()
            .getUpdateDescriptor()
            .getIUsBeingUpdated();
    assertEquals(matchExpression, x.iterator().next());
  }
  protected void setUp() throws Exception {
    super.setUp();
    a1 = createIU("A", Version.create("1.0.0"), true);

    createIU(
        "A",
        Version.create("2.0.0"),
        null,
        NO_REQUIRES,
        NO_PROVIDES,
        NO_PROPERTIES,
        ITouchpointType.NONE,
        NO_TP_DATA,
        true,
        MetadataFactory.createUpdateDescriptor("A", VersionRange.emptyRange, 0, "foo bar"),
        null);
    a2 = createIU("A", Version.create("2.0.0"), true);

    createTestMetdataRepository(new IInstallableUnit[] {a1, a2});

    profile = createProfile("TestProfile." + getName());
    planner = createPlanner();
    engine = createEngine();
  }
 protected void tearDown() throws Exception {
   super.tearDown();
   if (equinox != null) equinox.shutdown();
 }
 protected void setUp() throws Exception {
   super.setUp();
 }
Exemplo n.º 10
0
 protected void tearDown() throws Exception {
   super.tearDown();
   engine = null;
 }
Exemplo n.º 11
0
  protected void setUp() throws Exception {
    super.setUp();
    a1 = createIU("A", Version.createOSGi(1, 0, 0), true);
    a2 = createIU("A", Version.create("2.0.0"), true);
    b1 = createIU("B", Version.create("1.0.0"), true);
    b2 = createIU("B", Version.create("2.0.0"), true);
    c2 = createIU("C", Version.create("2.0.0"), true);

    IRequirement[] req = new IRequirement[3];
    req[0] =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "A",
            new VersionRange("[1.0.0, 1.1.0)"),
            null,
            false,
            true);
    req[1] =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "B",
            new VersionRange("[1.0.0, 1.1.0)"),
            null,
            false,
            true);
    req[2] =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "C",
            new VersionRange("[2.0.0, 3.1.0)"),
            null,
            false,
            true);
    f1 = createIU("F", Version.createOSGi(1, 0, 0), req);

    IRequirementChange changeA =
        MetadataFactory.createRequirementChange(
            MetadataFactory.createRequirement(
                IInstallableUnit.NAMESPACE_IU_ID,
                "A",
                VersionRange.emptyRange,
                null,
                false,
                false,
                false),
            MetadataFactory.createRequirement(
                IInstallableUnit.NAMESPACE_IU_ID,
                "A",
                new VersionRange("[2.0.0, 3.0.0)"),
                null,
                false,
                false,
                true));
    IRequirement[][] scope =
        new IRequirement[][] {
          {
            MetadataFactory.createRequirement(
                IInstallableUnit.NAMESPACE_IU_ID,
                "F",
                VersionRange.emptyRange,
                null,
                false,
                false,
                false)
          }
        };
    p1 =
        createIUPatch(
            "P",
            Version.create("1.0.0"),
            null,
            NO_REQUIRES,
            NO_PROVIDES,
            NO_PROPERTIES,
            ITouchpointType.NONE,
            NO_TP_DATA,
            false,
            null,
            new IRequirementChange[] {changeA},
            scope,
            null,
            new IRequirement[0]);

    IRequirementChange changeB =
        MetadataFactory.createRequirementChange(
            MetadataFactory.createRequirement(
                IInstallableUnit.NAMESPACE_IU_ID,
                "B",
                VersionRange.emptyRange,
                null,
                false,
                false,
                false),
            MetadataFactory.createRequirement(
                IInstallableUnit.NAMESPACE_IU_ID,
                "B",
                new VersionRange("[2.0.0, 3.0.0)"),
                null,
                false,
                false,
                true));
    IRequirement[][] scopePP =
        new IRequirement[][] {
          {
            MetadataFactory.createRequirement(
                IInstallableUnit.NAMESPACE_IU_ID,
                "F",
                VersionRange.emptyRange,
                null,
                false,
                false,
                false)
          }
        };
    r1 =
        createIUPatch(
            "R",
            Version.create("1.0.0"),
            null,
            NO_REQUIRES,
            NO_PROVIDES,
            NO_PROPERTIES,
            ITouchpointType.NONE,
            NO_TP_DATA,
            false,
            null,
            new IRequirementChange[] {changeB},
            scopePP,
            null,
            new IRequirement[0]);

    createTestMetdataRepository(new IInstallableUnit[] {a1, a2, b1, b2, c2, f1, p1, r1});

    profile1 = createProfile("TestProfile." + getName());
    planner = createPlanner();
    engine = createEngine();
  }