diff --git a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java index 141fe8ccd5a..8baedf57852 100755 --- a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java +++ b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java @@ -82,6 +82,8 @@ public class RepositoryResolver { /** * Map from symbolic name to feature for all features returned as resolved by the kernel resolver + *

+ * Keyset is mutually exclusive with {@link #featuresMissing} and {@link #requirementsFoundForOtherProducts} */ Map resolvedFeatures; @@ -89,6 +91,8 @@ public class RepositoryResolver { * List of requested features that were reported missing by the kernel resolver and weren't found in the repository applicable to another product. *

* May include sample names if they were missing + *

+ * Mutually exclusive with {@link #resolvedFeatures} and {@link #requirementsFoundForOtherProducts} */ List featuresMissing; @@ -101,6 +105,8 @@ public class RepositoryResolver { * List of requirements which couldn't be resolved but for which we found a solution that applied to the wrong product *

* Each requirement will be a symbolic name, feature name or sample name + *

+ * Mutually exclusive with {@link #resolvedFeatures} and {@link #featuresMissing} */ Set requirementsFoundForOtherProducts; @@ -547,7 +553,7 @@ List createInstallList(SampleResource resource) { if (feature == null) { allDependenciesResolved = false; // Unless we know it exists but applies to another product, note the missing requirement as well - if (!requirementsFoundForOtherProducts.contains(featureName) && featuresMissing.contains(featureName)) { + if (featuresMissing.contains(featureName)) { missingRequirements.add(new MissingRequirement(featureName, resource)); } } else { @@ -593,7 +599,7 @@ List createInstallList(String featureName) { if (feature == null) { // Feature missing missingTopLevelRequirements.add(featureName); - if (!requirementsFoundForOtherProducts.contains(featureName) && featuresMissing.contains(featureName)) { + if (featuresMissing.contains(featureName)) { missingRequirements.add(new MissingRequirement(featureName, null)); } return Collections.emptyList(); @@ -701,7 +707,7 @@ boolean populateMaxDistanceMap(Map maxDistanceMap, String featu // We found the dependency, continue populating the distance map result &= populateMaxDistanceMap(maxDistanceMap, resolvedFeatureName, currentDistance + 1, currentStack, missingRequirements); } else { - if (!requirementsFoundForOtherProducts.contains(featureName) && featuresMissing.contains(dependency.getSymbolicName())) { + if (featuresMissing.contains(dependency.getSymbolicName())) { // The dependency was totally missing, add it to the list of missing requirements missingRequirements.add(new MissingRequirement(dependency.getSymbolicName(), getResource(feature))); } diff --git a/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/RepositoryResolverTest.java b/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/RepositoryResolverTest.java index a0966bfc1f8..2f099bb82ca 100644 --- a/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/RepositoryResolverTest.java +++ b/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/RepositoryResolverTest.java @@ -263,7 +263,6 @@ public void testCreateInstallListAutoFeature() { */ @Test public void testCreateInstallListToleratesPartiallyInstalled() { - @SuppressWarnings("unused") MockFeature base10 = new MockFeature("com.example.base-1.0"); MockFeature base20 = new MockFeature("com.example.base-2.0"); @@ -282,6 +281,7 @@ public void testCreateInstallListToleratesPartiallyInstalled() { featureB.addRequireFeatureWithTolerates("com.example.base-2.0", Collections.emptyList()); RepositoryResolver resolver = testResolver().withResolvedInstalledFeature(base20, featureA) + .withInstalledFeature(base10, internalA10) .withResolvedFeature(internalA20, featureB) .build(); @@ -321,6 +321,11 @@ public ResolverBuilder withResolvedFeature(EsaResource... esas) { return this; } + public ResolverBuilder withInstalledFeature(ProvisioningFeatureDefinition... definitions) { + installedFeatures.addAll(Arrays.asList(definitions)); + return this; + } + public ResolverBuilder withResolvedInstalledFeature(ProvisioningFeatureDefinition... definitions) { installedFeatures.addAll(Arrays.asList(definitions)); for (ProvisioningFeatureDefinition feature : definitions) { diff --git a/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/internal/kernel/FeatureResolverTest.java b/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/internal/kernel/FeatureResolverTest.java index 58eafeb2971..b881e47514b 100644 --- a/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/internal/kernel/FeatureResolverTest.java +++ b/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/internal/kernel/FeatureResolverTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2019 IBM Corporation and others. + * Copyright (c) 2018, 2022 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverResultMatcher.java b/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverResultMatcher.java index df228612b6e..167f6a8999b 100644 --- a/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverResultMatcher.java +++ b/dev/com.ibm.ws.repository.resolver/test/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverResultMatcher.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 IBM Corporation and others. + * Copyright (c) 2018, 2022 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at