private static List<IInstallableUnit> toInstallableUnitList(
      Collection<DependencySeed> seeds,
      IMetadataRepository sourceRepository,
      RepositoryReferences sourceRepositoryNames)
      throws FacadeException {
    List<IInstallableUnit> result = new ArrayList<IInstallableUnit>(seeds.size());

    for (DependencySeed seed : seeds) {
      if (seed.getInstallableUnit() == null) {
        // TODO 372780 drop this when getInstallableUnit can no longer be null
        String unitId =
            seed.getId()
                + (ArtifactType.TYPE_ECLIPSE_FEATURE.equals(seed.getType())
                    ? ".feature.group"
                    : "");
        result.addAll(
            querySourceIus(
                Collections.singletonList(new IUDescription(unitId, null)),
                sourceRepository,
                sourceRepositoryNames));
      } else {
        result.add((IInstallableUnit) seed.getInstallableUnit());
      }
    }

    if (result.isEmpty()) {
      throw new IllegalArgumentException(
          "List of seed units for repository aggregation must not be empty");
    }
    return result;
  }
예제 #2
0
 /**
  * Returns the installable units from the given dependency seeds, indexed by the installable
  * units's IDs.
  */
 private static Map<String, IInstallableUnit> unitsById(Collection<DependencySeed> seeds) {
   Map<String, IInstallableUnit> result = new HashMap<String, IInstallableUnit>();
   for (DependencySeed seed : seeds) {
     IInstallableUnit iu = (IInstallableUnit) seed.getInstallableUnit();
     result.put(iu.getId(), iu);
   }
   return result;
 }
예제 #3
0
  @Test
  public void testCategoryPublishing() throws Exception {
    File categoryDefinition = resourceFile("publishers/category.xml");

    Collection<DependencySeed> seeds = subject.publishCategories(categoryDefinition);

    assertThat(seeds.size(), is(1));
    DependencySeed seed = seeds.iterator().next();

    Set<Object> publishedUnits = outputRepository.getInstallableUnits();
    assertThat(publishedUnits, hasItem(seed.getInstallableUnit()));
  }