コード例 #1
0
 @Test
 public void testProfilePublishing() throws Exception {
   File customProfile = resourceFile("publishers/virgo-1.6.profile");
   Collection<DependencySeed> seeds = subject.publishEEProfile(customProfile);
   assertThat(seeds.size(), is(2));
   IInstallableUnit virgoProfileIU = unitsById(seeds).get("a.jre.virgo");
   assertThat(virgoProfileIU, not(nullValue()));
   Collection<IProvidedCapability> provided = virgoProfileIU.getProvidedCapabilities();
   boolean customJavaxActivationVersionFound = false;
   Version version_1_1_1 = Version.create("1.1.1");
   for (IProvidedCapability capability : provided) {
     if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(capability.getNamespace())) {
       if ("javax.activation".equals(capability.getName())) {
         if (version_1_1_1.equals(capability.getVersion())) {
           customJavaxActivationVersionFound = true;
           break;
         }
       }
     }
   }
   assertTrue(
       "did not find capability for package javax.activation with custom version " + version_1_1_1,
       customJavaxActivationVersionFound);
   assertThat(unitsById(seeds).keySet(), hasItem("config.a.jre.virgo"));
 }
コード例 #2
0
  private List<IProvidedCapability> getPackageCapabilities(IInstallableUnit unit) {
    Collection<IProvidedCapability> allCapabilities = unit.getProvidedCapabilities();
    List<IProvidedCapability> packageCapabilities =
        new ArrayList<IProvidedCapability>(allCapabilities.size());

    for (IProvidedCapability capability : allCapabilities) {
      if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(capability.getNamespace())) {
        packageCapabilities.add(capability);
      }
    }
    return packageCapabilities;
  }