@Override
  public void setupPublisherResult() {
    super.setupPublisherResult();

    InstallableUnitDescription iuDescription = new InstallableUnitDescription();
    iuDescription.setId(ORG_ECLIPSE_CORE_COMMANDS);
    iuDescription.setVersion(Version.create(BUNDLE_VERSION));
    IInstallableUnit iu = MetadataFactory.createInstallableUnit(iuDescription);

    publisherResult.addIU(iu, IPublisherResult.NON_ROOT);
  }
示例#2
0
 private IInstallableUnit createIdIU(String id) {
   InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription();
   String time = Long.toString(System.currentTimeMillis());
   iu.setId("toast.id");
   iu.setVersion(Version.createOSGi(0, 0, 0, time));
   Map touchpointData = new HashMap();
   String data = "addJvmArg(jvmArg:-D" + ICoreConstants.ID_PROPERTY + "=" + id + ");";
   touchpointData.put("configure", data);
   data = "removeJvmArg(jvmArg:-D" + ICoreConstants.ID_PROPERTY + "=" + id + ");";
   touchpointData.put("unconfigure", data);
   iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
   ITouchpointType touchpoint =
       MetadataFactory.createTouchpointType(
           "org.eclipse.equinox.p2.osgi", Version.createOSGi(1, 0, 0));
   iu.setTouchpointType(touchpoint);
   return MetadataFactory.createInstallableUnit(iu);
 }
  @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());
  }