From 0aead11b3dfdbd9857badb5627a5c685672e330a Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Fri, 12 Jul 2024 21:36:26 -0400 Subject: [PATCH 01/12] New install messages for versionless and platforms --- .../internal/resources/InstallKernel.nlsprops | 8 ++++ .../ws/install/internal/ExceptionUtils.java | 43 ++++++++++++++++++- .../ws/install/internal/InstallKernelMap.java | 6 ++- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops index 7f8fccecdad..b02af8c8a87 100755 --- a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops +++ b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops @@ -949,3 +949,11 @@ ERROR_INAUTHENTIC_PUBLIC_KEY=CWWKF1514E: The {0} public key ID does not match th ERROR_INAUTHENTIC_PUBLIC_KEY.explanation=The public key might have changed. ERROR_INAUTHENTIC_PUBLIC_KEY.useraction=If the public key is a local file, make sure to provide the correct file. +ERROR_MISSING_PLATFORM_NAME=CWWKF1515E: The platform {0} couldn't be found, no versionless features will be installed. +ERROR_MISSING_PLATFORM_NAME.explanation=The platform name passed by the config or Env Var wasn't found. +ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name-version. + +ERROR_NO_DERIVED_PLATFORM=CWWKF1516E: Platform couldn't be determined, the following versionless features won't be installed: {0}. +ERROR_NO_DERIVED_PLATFORM.explanation=Platform was not set, or couldn't be derived from existing versioned features. +ERROR_NO_DERIVED_PLATFORM.useraction=Add platform for versionless features + diff --git a/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ExceptionUtils.java b/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ExceptionUtils.java index d80535c13b4..0861a01fce0 100755 --- a/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ExceptionUtils.java +++ b/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ExceptionUtils.java @@ -553,13 +553,22 @@ static InstallException create(RepositoryResolutionException e, Collection allRequirementsNotFound = e.getAllRequirementsResourcesNotFound(); + + String msg = createVersionlessIssues(e); + if (!msg.isEmpty()) { + InstallException ie = create(msg, e); + ie.setData(assetNames); + return ie; + } + if (allRequirementsNotFound.isEmpty()) { - String msg = checkForSingletonException(e.getFeatureConflicts()); + msg = checkForSingletonException(e.getFeatureConflicts()); if (!msg.isEmpty()) { InstallException ie = create(msg, e); ie.setData(assetNames); return ie; } + return null; } Collection dependants = new ArrayList(allRequirementsNotFound.size()); for (MissingRequirement f : allRequirementsNotFound) { @@ -695,6 +704,38 @@ static InstallException create(RepositoryResolutionException e, Collection missingFeatures) { + StringBuilder sb = new StringBuilder(); + for (String missing : missingFeatures) { + sb.append(missing).append(" "); + } + return sb.toString().trim(); + } + /** * Checks if the inputed version is newer than the newest version * diff --git a/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallKernelMap.java b/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallKernelMap.java index 6d28caa2fc9..4a6849dba5e 100755 --- a/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallKernelMap.java +++ b/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/InstallKernelMap.java @@ -1052,8 +1052,10 @@ public Collection singleFileResolve() { data.put(InstallConstants.ACTION_RESULT, ERROR); InstallException ie = ExceptionUtils.create(e, e.getTopLevelFeaturesNotResolved(), (File) data.get(InstallConstants.RUNTIME_INSTALL_DIR), false, isOpenLiberty, isFeatureUtility); - data.put(InstallConstants.ACTION_ERROR_MESSAGE, ie.getMessage()); - data.put(InstallConstants.ACTION_EXCEPTION_STACKTRACE, ExceptionUtils.stacktraceToString(ie)); + if (ie != null) { + data.put(InstallConstants.ACTION_ERROR_MESSAGE, ie.getMessage()); + data.put(InstallConstants.ACTION_EXCEPTION_STACKTRACE, ExceptionUtils.stacktraceToString(ie)); + } } catch (InstallException e) { data.put(InstallConstants.ACTION_RESULT, ERROR); data.put(InstallConstants.ACTION_ERROR_MESSAGE, e.getMessage()); From 20573741fd019bf1262fd8be220e201e36293814 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Sat, 13 Jul 2024 19:28:42 -0400 Subject: [PATCH 02/12] Add versionless tests covering new errors --- .../fat/FeatureUtilityToolTest.java | 4 +-- .../featureUtility/fat/InstallServerTest.java | 33 +++++++++++++++---- .../server.xml | 2 +- .../tmp/versionlessNoPlatform/server.xml | 9 +++++ 4 files changed, 38 insertions(+), 10 deletions(-) rename dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/{versionlessWPlatform => versionlessBadPlatform}/server.xml (82%) create mode 100644 dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessNoPlatform/server.xml diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java index 16abbcfdefa..9dfb635cdca 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java @@ -372,8 +372,8 @@ protected ProgramOutput runFeatureUtility(String testcase, String[] params) thro protected ProgramOutput runFeatureUtility(String testcase, String[] params, boolean debug) throws Exception { Properties envProps = new Properties(); - // add beta property here - // envProps.put("JVM_ARGS", "-Dbeta.property=true"); + //add beta property here + envProps.put("JVM_ARGS", "-Dbeta.property=true"); return runFeatureUtility(testcase, params, envProps); } diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java index 0d8f73f7996..9ebe5b38725 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java @@ -158,24 +158,43 @@ public void testInvalidMultiVersionFeatures() throws Exception { } /** - * Test the install of versionless servlet from maven central. Multi-version is not - * supported with installServerFeature as it cannot be installed to same - * resource. + * Test the install of versionless with bogus platform name xxx from maven central. Should throw expected platform name not found * * @throws Exception */ @Ignore @Test - public void testVersionlessWithPlatformFeatures() throws Exception { - final String METHOD_NAME = "testInvalidMultiVersionFeatures"; + public void testVersionlessWithBadPlatformFeatures() throws Exception { + final String METHOD_NAME = "testVersionlessWithBadPlatformFeatures"; + Log.entering(c, METHOD_NAME); + + copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessBadPlatform/server.xml"); + + String[] param1s = { "installServerFeatures", "serverX", "--verbose" }; + + ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); + + checkCommandOutput(po, 21, "CWWKF1515E", null); //UnKnown platform error + Log.exiting(c, METHOD_NAME); + } + + /** + * Test the install of versionless with no platform defined. Should throw expected platform can't be determined error + * + * @throws Exception + */ + @Ignore + @Test + public void testVersionlessWithNoPlatformFeatures() throws Exception { + final String METHOD_NAME = "testVersionlessWithNoPlatformFeatures"; Log.entering(c, METHOD_NAME); - copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessWPlatform/server.xml"); + copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessNoPlatform/server.xml"); String[] param1s = { "installServerFeatures", "serverX", "--verbose" }; ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); - checkCommandOutput(po, 21, "CWWKF1405E", null); + checkCommandOutput(po, 21, "CWWKF1516E", null); //Platform not determined Log.exiting(c, METHOD_NAME); } diff --git a/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWPlatform/server.xml b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessBadPlatform/server.xml similarity index 82% rename from dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWPlatform/server.xml rename to dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessBadPlatform/server.xml index c3076b4451e..914eec43ead 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWPlatform/server.xml +++ b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessBadPlatform/server.xml @@ -3,7 +3,7 @@ - jakartaee-10.0 + xxx servlet diff --git a/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessNoPlatform/server.xml b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessNoPlatform/server.xml new file mode 100644 index 00000000000..315aa08e45a --- /dev/null +++ b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessNoPlatform/server.xml @@ -0,0 +1,9 @@ + + + + + + servlet + + + From 8b558dd27da3a1f8ee14c894f47f9ec321ecfc0f Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Tue, 16 Jul 2024 10:26:42 -0400 Subject: [PATCH 03/12] Update dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops Updating ERROR_MISSING_PLATFORM_NAME=CWWKF1515E for doc review Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com> --- .../ibm/ws/install/internal/resources/InstallKernel.nlsprops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops index b02af8c8a87..b889f007d82 100755 --- a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops +++ b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops @@ -949,7 +949,7 @@ ERROR_INAUTHENTIC_PUBLIC_KEY=CWWKF1514E: The {0} public key ID does not match th ERROR_INAUTHENTIC_PUBLIC_KEY.explanation=The public key might have changed. ERROR_INAUTHENTIC_PUBLIC_KEY.useraction=If the public key is a local file, make sure to provide the correct file. -ERROR_MISSING_PLATFORM_NAME=CWWKF1515E: The platform {0} couldn't be found, no versionless features will be installed. +ERROR_MISSING_PLATFORM_NAME=CWWKF1515E: The {0} platform couldn't be found. No versionless features can be installed. ERROR_MISSING_PLATFORM_NAME.explanation=The platform name passed by the config or Env Var wasn't found. ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name-version. From ec4410929b7223030eae6f560f3d8cace62e8fb8 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Tue, 16 Jul 2024 10:27:18 -0400 Subject: [PATCH 04/12] Update dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops Doc review for ERROR_MISSING_PLATFORM_NAME.explanation Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com> --- .../ibm/ws/install/internal/resources/InstallKernel.nlsprops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops index b889f007d82..6e2433db40d 100755 --- a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops +++ b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops @@ -950,7 +950,7 @@ ERROR_INAUTHENTIC_PUBLIC_KEY.explanation=The public key might have changed. ERROR_INAUTHENTIC_PUBLIC_KEY.useraction=If the public key is a local file, make sure to provide the correct file. ERROR_MISSING_PLATFORM_NAME=CWWKF1515E: The {0} platform couldn't be found. No versionless features can be installed. -ERROR_MISSING_PLATFORM_NAME.explanation=The platform name passed by the config or Env Var wasn't found. +ERROR_MISSING_PLATFORM_NAME.explanation=The platform name that is specified by the configuration or environment variable wasn't found. ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name-version. ERROR_NO_DERIVED_PLATFORM=CWWKF1516E: Platform couldn't be determined, the following versionless features won't be installed: {0}. From 24cf1b0eee52e5d8585151424dda602254703cb5 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Tue, 16 Jul 2024 10:27:54 -0400 Subject: [PATCH 05/12] Update dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops Doc review for ERROR_MISSING_PLATFORM_NAME.useraction Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com> --- .../ibm/ws/install/internal/resources/InstallKernel.nlsprops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops index 6e2433db40d..4b70eacd408 100755 --- a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops +++ b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops @@ -951,7 +951,7 @@ ERROR_INAUTHENTIC_PUBLIC_KEY.useraction=If the public key is a local file, make ERROR_MISSING_PLATFORM_NAME=CWWKF1515E: The {0} platform couldn't be found. No versionless features can be installed. ERROR_MISSING_PLATFORM_NAME.explanation=The platform name that is specified by the configuration or environment variable wasn't found. -ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name-version. +ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name and version, for example, microProfile-6.1. ERROR_NO_DERIVED_PLATFORM=CWWKF1516E: Platform couldn't be determined, the following versionless features won't be installed: {0}. ERROR_NO_DERIVED_PLATFORM.explanation=Platform was not set, or couldn't be derived from existing versioned features. From 8cf8d93dbd78fd99123386bbebb59caf3ac78034 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Tue, 16 Jul 2024 10:28:16 -0400 Subject: [PATCH 06/12] Update dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops Doc review for ERROR_NO_DERIVED_PLATFORM=CWWKF1516E Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com> --- .../ibm/ws/install/internal/resources/InstallKernel.nlsprops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops index 4b70eacd408..e901fd3e2f7 100755 --- a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops +++ b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops @@ -953,7 +953,7 @@ ERROR_MISSING_PLATFORM_NAME=CWWKF1515E: The {0} platform couldn't be found. No v ERROR_MISSING_PLATFORM_NAME.explanation=The platform name that is specified by the configuration or environment variable wasn't found. ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name and version, for example, microProfile-6.1. -ERROR_NO_DERIVED_PLATFORM=CWWKF1516E: Platform couldn't be determined, the following versionless features won't be installed: {0}. +ERROR_NO_DERIVED_PLATFORM=CWWKF1516E: The platform couldn't be determined. The following versionless features can't be installed: {0}. ERROR_NO_DERIVED_PLATFORM.explanation=Platform was not set, or couldn't be derived from existing versioned features. ERROR_NO_DERIVED_PLATFORM.useraction=Add platform for versionless features From 4b362f80030487b4ba592cd7307dddd533ab938d Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Tue, 16 Jul 2024 10:28:36 -0400 Subject: [PATCH 07/12] Update dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops Doc review for ERROR_NO_DERIVED_PLATFORM.explanation Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com> --- .../ibm/ws/install/internal/resources/InstallKernel.nlsprops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops index e901fd3e2f7..d20d22a3715 100755 --- a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops +++ b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops @@ -954,6 +954,6 @@ ERROR_MISSING_PLATFORM_NAME.explanation=The platform name that is specified by t ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name and version, for example, microProfile-6.1. ERROR_NO_DERIVED_PLATFORM=CWWKF1516E: The platform couldn't be determined. The following versionless features can't be installed: {0}. -ERROR_NO_DERIVED_PLATFORM.explanation=Platform was not set, or couldn't be derived from existing versioned features. +ERROR_NO_DERIVED_PLATFORM.explanation= The platform was not set or couldn't be derived from existing versioned features. ERROR_NO_DERIVED_PLATFORM.useraction=Add platform for versionless features From 67fcf9fc9c8c586607b9e17e44cca7786fc6497c Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Tue, 16 Jul 2024 10:28:54 -0400 Subject: [PATCH 08/12] Update dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops Doc review for ERROR_NO_DERIVED_PLATFORM.useraction Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com> --- .../ibm/ws/install/internal/resources/InstallKernel.nlsprops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops index d20d22a3715..de2ebad5528 100755 --- a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops +++ b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops @@ -955,5 +955,5 @@ ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name a ERROR_NO_DERIVED_PLATFORM=CWWKF1516E: The platform couldn't be determined. The following versionless features can't be installed: {0}. ERROR_NO_DERIVED_PLATFORM.explanation= The platform was not set or couldn't be derived from existing versioned features. -ERROR_NO_DERIVED_PLATFORM.useraction=Add platform for versionless features +ERROR_NO_DERIVED_PLATFORM.useraction=Add a platform for versionless features. From 67a010b9c38eabfe2f232bbce4f4ae0d60651eb6 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Tue, 16 Jul 2024 11:50:04 -0400 Subject: [PATCH 09/12] Add new repo, and enabling versionless tests --- .../build.gradle | 4 +-- .../install/featureUtility/fat/FATSuite.java | 2 +- .../fat/FeatureUtilityToolTest.java | 2 +- .../featureUtility/fat/InstallServerTest.java | 26 +++++++++++++++++-- .../tmp/versionlessWithPlatform/server.xml | 10 +++++++ 5 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWithPlatform/server.xml diff --git a/dev/com.ibm.ws.install.featureUtility_fat/build.gradle b/dev/com.ibm.ws.install.featureUtility_fat/build.gradle index 50960b680f1..78558975127 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/build.gradle +++ b/dev/com.ibm.ws.install.featureUtility_fat/build.gradle @@ -1,4 +1,4 @@ -/* Copyright (c) 2021, 2023 IBM Corporation and others. +/* Copyright (c) 2021, 2024 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ addRequiredLibraries { dependencies { usrFeatures 'test.featureUtility_fat:userFeature:1.0@zip' - features 'test.featureUtility_fat:Archive:1.0@zip' + features 'test.featureUtility_fat:Archive:2.0@zip' requiredLibs project(':com.ibm.ws.org.slf4j.api'), project(':com.ibm.ws.org.slf4j.simple') } diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FATSuite.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FATSuite.java index 2756dc173d2..3acac5a98a9 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FATSuite.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FATSuite.java @@ -39,7 +39,7 @@ public class FATSuite extends TestContainerSuite { public static void beforeSuite() throws Exception { FeatureUtilityToolTest.setupEnv(); FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/userFeature/userFeature-1.0.zip")); - FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/archive/Archive-1.0.zip")); + FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/archive/Archive-2.0.zip")); } @AfterClass diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java index 9dfb635cdca..c94764b04ab 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java @@ -48,7 +48,7 @@ public abstract class FeatureUtilityToolTest { private static final Class c = FeatureUtilityToolTest.class; - protected static String libertyVersion = "23.0.0.2"; + protected static String libertyVersion = "24.0.0.8"; // ${buildDir}/publish/repo protected static String mavenLocalRepo = Paths.get("publish/repo/").toAbsolutePath().toString(); public static LibertyServer server; diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java index 9ebe5b38725..435e004e692 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java @@ -162,7 +162,7 @@ public void testInvalidMultiVersionFeatures() throws Exception { * * @throws Exception */ - @Ignore + @Test public void testVersionlessWithBadPlatformFeatures() throws Exception { final String METHOD_NAME = "testVersionlessWithBadPlatformFeatures"; @@ -183,7 +183,7 @@ public void testVersionlessWithBadPlatformFeatures() throws Exception { * * @throws Exception */ - @Ignore + @Test public void testVersionlessWithNoPlatformFeatures() throws Exception { final String METHOD_NAME = "testVersionlessWithNoPlatformFeatures"; @@ -198,6 +198,28 @@ public void testVersionlessWithNoPlatformFeatures() throws Exception { Log.exiting(c, METHOD_NAME); } + /** + * Test the install of versionless with platform name. install servlet-6.0 feature + * + * @throws Exception + */ + + @Test + public void testVersionlessWithPlatformFeatures() throws Exception { + final String METHOD_NAME = "testVersionlessWithPlatformFeatures"; + Log.entering(c, METHOD_NAME); + + copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessWithPlatform/server.xml"); + + String[] param1s = { "installServerFeatures", "serverX", "--verbose" }; + String[] filesList = { "/lib/features/com.ibm.websphere.appserver.servlet-6.0.mf" }; + + ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); + + checkCommandOutput(po, 0, null, filesList); //Should have servlet-6.0 + Log.exiting(c, METHOD_NAME); + } + /** * Install an user feature with the "--featuresBom" parameters */ diff --git a/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWithPlatform/server.xml b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWithPlatform/server.xml new file mode 100644 index 00000000000..2f703917b5c --- /dev/null +++ b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWithPlatform/server.xml @@ -0,0 +1,10 @@ + + + + + + jakartaee-10.0 + servlet + + + From 4eb0c5d6d053292a4a8637bcd4d44ca3ca0b38e6 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Wed, 17 Jul 2024 12:04:04 -0400 Subject: [PATCH 10/12] Remove versionless causes in Exception message --- .../resolver/RepositoryResolutionException.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java index a1d37a2b289..6f705c4e3e5 100755 --- a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java +++ b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java @@ -284,15 +284,6 @@ public Map> getFeatureConflicts() { public String getMessage() { StringBuilder sb = new StringBuilder(); - if (!getMissingPlatforms().isEmpty()) { - for (String missing : getMissingPlatforms()) { - sb.append("Platform: ").append(missing).append(" couldn't be found, no versionless features will be resolved").append("\n"); - } - } - if (getResolvedPlatforms().isEmpty() && getMissingPlatforms().isEmpty()) { - sb.append("Platform couldn't be determined, no versionless features will be resolved").append("\n"); - } - for (String missing : getTopLevelFeaturesNotResolved()) { sb.append("Top level feature not resolved: resource=").append(missing).append("\n"); } @@ -373,6 +364,7 @@ private String getResourceName(RepositoryResource resource) { /** * This states the target platforms that were used during the resolution + * * @return the resolvedPlatforms */ public Set getResolvedPlatforms() { @@ -381,6 +373,7 @@ public Set getResolvedPlatforms() { /** * This describes missspelled or unknown platform names, official names are collected by the feature metadata + * * @return the missingPlatforms */ public Set getMissingPlatforms() { @@ -389,6 +382,7 @@ public Set getMissingPlatforms() { /** * This describes base platforms like "jakartaee" that are not derived, either by passed platform values, or by other included versioned features + * * @return the missingBasePlatforms */ public List getMissingBasePlatforms() { From ce94a3e7cf3594245f97fd35835b7adade26dfb9 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Wed, 17 Jul 2024 17:52:16 -0400 Subject: [PATCH 11/12] Install test improvements --- .../build.gradle | 15 +- .../install/featureUtility/fat/FATSuite.java | 9 +- .../fat/FeatureUtilityToolTest.java | 39 +++--- .../fat/InstallFeatureTest.java | 58 ++++---- .../featureUtility/fat/InstallServerTest.java | 70 +--------- .../fat/InstallVersionlessServerTest.java | 130 ++++++++++++++++++ .../tmp/versionlessBadPlatform/server.xml | 2 +- .../tmp/versionlessWithPlatform/server.xml | 2 +- 8 files changed, 203 insertions(+), 122 deletions(-) create mode 100644 dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallVersionlessServerTest.java diff --git a/dev/com.ibm.ws.install.featureUtility_fat/build.gradle b/dev/com.ibm.ws.install.featureUtility_fat/build.gradle index 78558975127..ab9fafd2b72 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/build.gradle +++ b/dev/com.ibm.ws.install.featureUtility_fat/build.gradle @@ -13,12 +13,14 @@ addRequiredLibraries { configurations { usrFeatures - features + features1 + features2 } dependencies { usrFeatures 'test.featureUtility_fat:userFeature:1.0@zip' - features 'test.featureUtility_fat:Archive:2.0@zip' + features1 'test.featureUtility_fat:Archive:1.0@zip' + features2 'test.featureUtility_fat:Archive:2.0@zip' requiredLibs project(':com.ibm.ws.org.slf4j.api'), project(':com.ibm.ws.org.slf4j.simple') } @@ -29,8 +31,13 @@ addRequiredLibraries { } copy { - from configurations.features - into "publish/repo/archive" + from configurations.features1 + into "publish/repo/archive1" + } + + copy { + from configurations.features2 + into "publish/repo/archive2" } dependsOn copyTestContainers diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FATSuite.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FATSuite.java index 3acac5a98a9..8513117b1a2 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FATSuite.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FATSuite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2021 IBM Corporation and others. + * Copyright (c) 2019, 2024 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -25,7 +25,7 @@ @RunWith(Suite.class) @SuiteClasses({ - InstallFeatureTest.class, InstallServerTest.class, HelpActionTest.class + InstallFeatureTest.class, InstallServerTest.class, HelpActionTest.class, InstallVersionlessServerTest.class }) public class FATSuite extends TestContainerSuite { @@ -38,8 +38,9 @@ public class FATSuite extends TestContainerSuite { @BeforeClass public static void beforeSuite() throws Exception { FeatureUtilityToolTest.setupEnv(); - FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/userFeature/userFeature-1.0.zip")); - FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/archive/Archive-2.0.zip")); + FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/").toAbsolutePath().toString(),Paths.get("publish/repo/userFeature/userFeature-1.0.zip")); + FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/").toAbsolutePath().toString(),Paths.get("publish/repo/archive1/Archive-1.0.zip")); + FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo2/").toAbsolutePath().toString(),Paths.get("publish/repo/archive2/Archive-2.0.zip")); //New repo has versionless features } @AfterClass diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java index c94764b04ab..e977cbdcc83 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/FeatureUtilityToolTest.java @@ -48,9 +48,10 @@ public abstract class FeatureUtilityToolTest { private static final Class c = FeatureUtilityToolTest.class; - protected static String libertyVersion = "24.0.0.8"; + protected static String libertyVersion = "23.0.0.2"; // ${buildDir}/publish/repo - protected static String mavenLocalRepo = Paths.get("publish/repo/").toAbsolutePath().toString(); + protected static String mavenLocalRepo1 = Paths.get("publish/repo/").toAbsolutePath().toString(); + protected static String mavenLocalRepo2 = Paths.get("publish/repo2/").toAbsolutePath().toString(); public static LibertyServer server; private static String installRoot; static String minifiedRoot; @@ -94,7 +95,8 @@ protected static void setupEnv() throws Exception { minifiedRoot = exportWlp(installRoot, installRoot + "/../temp/wlp.zip", installRoot + relativeMinifiedRoot); Log.info(c, methodName, "minified root: " + minifiedRoot); - Log.info(c, methodName, "mavenLocalRepo : " + mavenLocalRepo.toString()); + Log.info(c, methodName, "mavenLocalRepo1 : " + mavenLocalRepo1.toString()); + Log.info(c, methodName, "mavenLocalRepo2 : " + mavenLocalRepo2.toString()); if(!new File(minifiedRoot).exists()){ throw new Exception("The minified root does not exist!"); @@ -418,8 +420,10 @@ protected static boolean deleteProps(String methodName) throws IOException { } protected static boolean deleteRepo(String methodName) throws IOException { - boolean repo = TestUtils.deleteFolder(new File(mavenLocalRepo)); - Log.info(c, methodName, "DELETED REPO : " + mavenLocalRepo + "?" + repo); + boolean repo = TestUtils.deleteFolder(new File(mavenLocalRepo1)); + Log.info(c, methodName, "DELETED REPO : " + mavenLocalRepo1 + "?" + repo); + repo = TestUtils.deleteFolder(new File(mavenLocalRepo2)); + Log.info(c, methodName, "DELETED REPO : " + mavenLocalRepo2 + "?" + repo); return repo; } @@ -507,18 +511,6 @@ protected static void checkCommandOutput(ProgramOutput po, int exitCode, String } - /* - * / Copy Maven central features and signatures to local repository - */ - protected static void constructLocalMavenRepo(Path artifactPath) throws Exception { - Log.info(c, "constructLocalMavenRepo", - "Creating local repository using " + artifactPath.toAbsolutePath().toString()); - - ZipFile zipFile = new ZipFile(artifactPath.toFile()); - TestUtils.unzipFileIntoDirectory(zipFile, Paths.get(mavenLocalRepo).toFile()); - Log.info(c, "constructLocalMavenRepo", "Unzipped to " + Paths.get(mavenLocalRepo).toAbsolutePath().toString()); - - } /** * @param METHOD_NAME @@ -542,5 +534,18 @@ protected void retryFeatureUtility(String METHOD_NAME) throws Exception { runFeatureUtility(METHOD_NAME, param1s); } + /* + * / Copy Maven central features and signatures to local repository + */ + protected static void constructLocalMavenRepo(String repoPath,Path artifactPath) throws Exception { + Log.info(c, "constructLocalMavenRepo", + "Creating local repository using " + artifactPath.toAbsolutePath().toString()); + + ZipFile zipFile = new ZipFile(artifactPath.toFile()); + TestUtils.unzipFileIntoDirectory(zipFile, Paths.get(repoPath).toFile()); + Log.info(c, "constructLocalMavenRepo", "Unzipped to " + Paths.get(repoPath).toAbsolutePath().toString()); + + } + } diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallFeatureTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallFeatureTest.java index 83736eb5c3d..33d7345b78e 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallFeatureTest.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallFeatureTest.java @@ -84,7 +84,7 @@ public static void beforeClassSetup() throws Exception { public void beforeSetUp() throws Exception { copyFileToMinifiedRoot("etc", "publish/propertyFiles/publishRepoOverrideProps/featureUtility.properties"); - writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo); + writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo1); } @After @@ -162,7 +162,7 @@ public void testInstallFeatureESA() throws Exception { String esaFile = String.format("/io/openliberty/features/json-1.0/%s/json-1.0-%s.esa", libertyVersion, libertyVersion); //copy json esa file from local Maven repo to a temporary location (wlp/tmp) - copyFileToMinifiedRoot("tmp", mavenLocalRepo + esaFile); + copyFileToMinifiedRoot("tmp", mavenLocalRepo1 + esaFile); // Begin Test String[] param1s = { "installFeature", minifiedRoot + "/tmp/" + String.format("json-1.0-%s.esa", libertyVersion), "--verbose" }; String[] filesList = { "lib/features/com.ibm.websphere.appserver.json-1.0.mf" }; @@ -589,7 +589,7 @@ public void testFeatureVerifyENFORCEnoSig() throws Exception { String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" }; //copy testesa1 esa file from local Maven repo to a temporary location (wlp/tmp) - copyFileToMinifiedRoot("tmp", mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa"); + copyFileToMinifiedRoot("tmp", mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa"); // Begin Test String[] param1s = { "installFeature", minifiedRoot + "/tmp/testesa1-19.0.0.8.esa", "json-1.0", @@ -610,7 +610,7 @@ public void testFeatureVerifyALL() throws Exception { Log.entering(c, METHOD_NAME); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa"); String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" }; @@ -632,7 +632,7 @@ public void testFeatureVerifySKIP() throws Exception { final String METHOD_NAME = "testFeatureVerifySKIP"; Log.entering(c, METHOD_NAME); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa"); String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" }; @@ -709,7 +709,7 @@ public void testFeatureVerifyALLProps() throws Exception { Log.entering(c, METHOD_NAME); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa"); String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" }; @@ -732,7 +732,7 @@ public void testFeatureVerifyALLEnv() throws Exception { envProps.put("FEATURE_VERIFY", "all"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa"); String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" }; @@ -784,15 +784,15 @@ public void testVerifyRevokedKey() throws Exception { envProps.put("FEATURE_VERIFY", "all"); // backup the valid user feature signature - Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath), - Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck")); + Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath), + Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck")); // overwrite with signature signed by revoked key - Files.copy(Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/revoked/testesa1-19.0.0.8.esa.asc"), - Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc")); + Files.copy(Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/revoked/testesa1-19.0.0.8.esa.asc"), + Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc")); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/revoked/revokedKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/revoked/revokedKey.asc"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "2CB7FEADC826EA27"); String[] param1s = { "installFeature", "testesa1", @@ -800,8 +800,8 @@ public void testVerifyRevokedKey() throws Exception { ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); // Change back to valid signature - Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"), - Paths.get(mavenLocalRepo + userFeatureSigPath), + Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"), + Paths.get(mavenLocalRepo1 + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING); checkCommandOutput(po, InstallException.SIGNATURE_VERIFICATION_FAILED, "CWWKF1510E", null); @@ -821,15 +821,15 @@ public void testVerifyExpiredKey() throws Exception { envProps.put("FEATURE_VERIFY", "all"); // backup the valid user feature signature - Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath), - Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck")); + Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath), + Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck")); // overwrite with signature signed by expired key - Files.copy(Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/expired/testesa1-19.0.0.8.esa.asc"), - Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc")); + Files.copy(Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/expired/testesa1-19.0.0.8.esa.asc"), + Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc")); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/expired/expiredKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/expired/expiredKey.asc"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "61B792CE2DAA8C02"); String[] param1s = { "installFeature", "testesa1", @@ -837,8 +837,8 @@ public void testVerifyExpiredKey() throws Exception { ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); // Change back to valid signature - Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"), - Paths.get(mavenLocalRepo + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING); + Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"), + Paths.get(mavenLocalRepo1 + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING); checkCommandOutput(po, InstallException.SIGNATURE_VERIFICATION_FAILED, "CWWKF1511E", null); Log.exiting(c, METHOD_NAME); @@ -857,7 +857,7 @@ public void testVerifyNoKeyId() throws Exception { writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); String[] param1s = { "installFeature", "testesa1", "--featuresBOM=com.ibm.ws.userFeature:features-bom:19.0.0.8", "--verbose" }; @@ -930,25 +930,25 @@ public void testVerifyBadSignature() throws Exception { envProps.put("FEATURE_VERIFY", "all"); // backup the valid user feature signature - Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath), - Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck")); + Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath), + Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck")); // overwrtie valid signature to invalid signature Files.copy( - Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/invalidSig/testesa1-19.0.0.8.esa.asc"), - Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc")); + Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/invalidSig/testesa1-19.0.0.8.esa.asc"), + Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc")); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); String[] param1s = { "installFeature", "testesa1", "--featuresBOM=com.ibm.ws.userFeature:features-bom:19.0.0.8", "--verbose" }; ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); // Change back to valid signature - Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"), - Paths.get(mavenLocalRepo + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING); + Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"), + Paths.get(mavenLocalRepo1 + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING); checkCommandOutput(po, InstallException.SIGNATURE_VERIFICATION_FAILED, "CWWKF1512E", null); diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java index 435e004e692..bcf38d7ca98 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallServerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2023 IBM Corporation and others. + * Copyright (c) 2019, 2024 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -44,7 +44,7 @@ public static void beforeClassSetup() throws Exception { @Before public void beforeSetUp() throws Exception { copyFileToMinifiedRoot("etc", "publish/propertyFiles/publishRepoOverrideProps/featureUtility.properties"); - writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo); + writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo1); } @After @@ -157,69 +157,7 @@ public void testInvalidMultiVersionFeatures() throws Exception { Log.exiting(c, METHOD_NAME); } - /** - * Test the install of versionless with bogus platform name xxx from maven central. Should throw expected platform name not found - * - * @throws Exception - */ - - @Test - public void testVersionlessWithBadPlatformFeatures() throws Exception { - final String METHOD_NAME = "testVersionlessWithBadPlatformFeatures"; - Log.entering(c, METHOD_NAME); - - copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessBadPlatform/server.xml"); - - String[] param1s = { "installServerFeatures", "serverX", "--verbose" }; - - ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); - - checkCommandOutput(po, 21, "CWWKF1515E", null); //UnKnown platform error - Log.exiting(c, METHOD_NAME); - } - - /** - * Test the install of versionless with no platform defined. Should throw expected platform can't be determined error - * - * @throws Exception - */ - - @Test - public void testVersionlessWithNoPlatformFeatures() throws Exception { - final String METHOD_NAME = "testVersionlessWithNoPlatformFeatures"; - Log.entering(c, METHOD_NAME); - - copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessNoPlatform/server.xml"); - - String[] param1s = { "installServerFeatures", "serverX", "--verbose" }; - ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); - - checkCommandOutput(po, 21, "CWWKF1516E", null); //Platform not determined - Log.exiting(c, METHOD_NAME); - } - - /** - * Test the install of versionless with platform name. install servlet-6.0 feature - * - * @throws Exception - */ - - @Test - public void testVersionlessWithPlatformFeatures() throws Exception { - final String METHOD_NAME = "testVersionlessWithPlatformFeatures"; - Log.entering(c, METHOD_NAME); - - copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessWithPlatform/server.xml"); - - String[] param1s = { "installServerFeatures", "serverX", "--verbose" }; - String[] filesList = { "/lib/features/com.ibm.websphere.appserver.servlet-6.0.mf" }; - - ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); - - checkCommandOutput(po, 0, null, filesList); //Should have servlet-6.0 - Log.exiting(c, METHOD_NAME); - } - + /** * Install an user feature with the "--featuresBom" parameters */ @@ -334,7 +272,7 @@ public void testInstallServerFeaturesUsrVerifyAll() throws Exception { copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/usrFeaturesServerXml/server.xml"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl", - mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); + mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc"); writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa"); String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" }; diff --git a/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallVersionlessServerTest.java b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallVersionlessServerTest.java new file mode 100644 index 00000000000..e6f3505f80e --- /dev/null +++ b/dev/com.ibm.ws.install.featureUtility_fat/fat/src/com/ibm/ws/install/featureUtility/fat/InstallVersionlessServerTest.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2024 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package com.ibm.ws.install.featureUtility.fat; + +import static org.junit.Assert.assertTrue; + +import java.util.Properties; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.ibm.websphere.simplicity.ProgramOutput; +import com.ibm.websphere.simplicity.log.Log; + +public class InstallVersionlessServerTest extends FeatureUtilityToolTest { + private static final Class c = InstallVersionlessServerTest.class; + + @BeforeClass + public static void beforeClassSetup() throws Exception { + final String methodName = "beforeClassSetup"; + Log.entering(c, methodName); + /* Enable tests only if running on a zOS machine, otherwise skip class */ + Assume.assumeTrue(!isZos); + deleteFeaturesAndLafilesFolders("beforeClassSetup"); + replaceWlpProperties("24.0.0.8"); + Log.exiting(c, methodName); + } + + @Before + public void beforeSetUp() throws Exception { + copyFileToMinifiedRoot("etc", "publish/propertyFiles/publishRepoOverrideProps/featureUtility.properties"); + writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo2); + } + + @After + public void afterCleanUp() throws Exception { + deleteFeaturesAndLafilesFolders("afterCleanUp"); + deleteUsrExtFolder("afterCleanUp"); + deleteEtcFolder("afterCleanUp"); + } + + @AfterClass + public static void cleanUp() throws Exception { + if (!isZos) { + resetOriginalWlpProps(); + } + } + + + /** + * Test the install of versionless with bogus platform name xxx from maven central. Should throw expected platform name not found + * + * @throws Exception + */ + @Ignore + @Test + public void testVersionlessWithBadPlatformFeatures() throws Exception { + final String METHOD_NAME = "testVersionlessWithBadPlatformFeatures"; + Log.entering(c, METHOD_NAME); + + copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessBadPlatform/server.xml"); + + String[] param1s = { "installServerFeatures", "serverX", "--verify=skip", "--verbose" }; + + ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); + + checkCommandOutput(po, 21, "CWWKF1515E", null); //UnKnown platform error + Log.exiting(c, METHOD_NAME); + } + + /** + * Test the install of versionless with no platform defined. Should throw expected platform can't be determined error + * + * @throws Exception + */ + @Ignore + @Test + public void testVersionlessWithNoPlatformFeatures() throws Exception { + final String METHOD_NAME = "testVersionlessWithNoPlatformFeatures"; + Log.entering(c, METHOD_NAME); + + copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessNoPlatform/server.xml"); + + String[] param1s = { "installServerFeatures", "serverX", "--verify=skip", "--verbose" }; + ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); + + checkCommandOutput(po, 21, "CWWKF1516E", null); //Platform not determined + Log.exiting(c, METHOD_NAME); + } + + /** + * Test the install of versionless with platform name. install servlet-6.0 feature + * + * @throws Exception + */ + @Ignore + @Test + public void testVersionlessWithPlatformFeatures() throws Exception { + final String METHOD_NAME = "testVersionlessWithPlatformFeatures"; + Log.entering(c, METHOD_NAME); + + copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessWithPlatform/server.xml"); + + String[] param1s = { "installServerFeatures", "serverX", "--verify=skip", "--verbose" }; + String[] filesList = { "/lib/features/com.ibm.websphere.appserver.servlet-6.0.mf" }; + + ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s); + + checkCommandOutput(po, 0, null, filesList); //Should have servlet-6.0 + Log.exiting(c, METHOD_NAME); + } + + + +} diff --git a/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessBadPlatform/server.xml b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessBadPlatform/server.xml index 914eec43ead..5998ea5b079 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessBadPlatform/server.xml +++ b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessBadPlatform/server.xml @@ -4,7 +4,7 @@ xxx - servlet + jsp diff --git a/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWithPlatform/server.xml b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWithPlatform/server.xml index 2f703917b5c..68068cdc782 100644 --- a/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWithPlatform/server.xml +++ b/dev/com.ibm.ws.install.featureUtility_fat/publish/tmp/versionlessWithPlatform/server.xml @@ -3,7 +3,7 @@ - jakartaee-10.0 + javaee-6.0 servlet From 48b3328c3863f59d53308a892c75f461d85e9f53 Mon Sep 17 00:00:00 2001 From: Chuck Bridgham Date: Thu, 18 Jul 2024 00:34:31 -0400 Subject: [PATCH 12/12] Fixup Result and Messages --- .../internal/resources/InstallKernel.nlsprops | 6 ++++- .../ws/install/internal/ExceptionUtils.java | 17 +++---------- .../RepositoryResolutionException.java | 10 ++++---- .../resolver/RepositoryResolver.java | 25 +++++-------------- 4 files changed, 19 insertions(+), 39 deletions(-) diff --git a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops index de2ebad5528..a855c9fb76a 100755 --- a/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops +++ b/dev/com.ibm.ws.install/resources/com/ibm/ws/install/internal/resources/InstallKernel.nlsprops @@ -949,7 +949,7 @@ ERROR_INAUTHENTIC_PUBLIC_KEY=CWWKF1514E: The {0} public key ID does not match th ERROR_INAUTHENTIC_PUBLIC_KEY.explanation=The public key might have changed. ERROR_INAUTHENTIC_PUBLIC_KEY.useraction=If the public key is a local file, make sure to provide the correct file. -ERROR_MISSING_PLATFORM_NAME=CWWKF1515E: The {0} platform couldn't be found. No versionless features can be installed. +ERROR_MISSING_PLATFORM_NAME=CWWKF1515E: The {0} platform couldn't be found. ERROR_MISSING_PLATFORM_NAME.explanation=The platform name that is specified by the configuration or environment variable wasn't found. ERROR_MISSING_PLATFORM_NAME.useraction=Check the spelling of the platform name and version, for example, microProfile-6.1. @@ -957,3 +957,7 @@ ERROR_NO_DERIVED_PLATFORM=CWWKF1516E: The platform couldn't be determined. The f ERROR_NO_DERIVED_PLATFORM.explanation= The platform was not set or couldn't be derived from existing versioned features. ERROR_NO_DERIVED_PLATFORM.useraction=Add a platform for versionless features. +LOG_INSTALL_WITH_PLATFORM=CWWKF1314I: Installing using the following platforms: {0}. +LOG_INSTALL_WITH_PLATFORM.explanation=The specified platform versions was used to resolve versionless features. +LOG_INSTALL_WITH_PLATFORM.useraction=No action is required. + diff --git a/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ExceptionUtils.java b/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ExceptionUtils.java index 0861a01fce0..015a5f6c544 100755 --- a/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ExceptionUtils.java +++ b/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ExceptionUtils.java @@ -715,27 +715,16 @@ protected static String createVersionlessIssues(RepositoryResolutionException e) sb.append(Messages.INSTALL_KERNEL_MESSAGES.getMessage("ERROR_MISSING_PLATFORM_NAME", missing)).append("\n"); } } - String missingFeatures = createMissingFeatureString(e.getTopLevelFeaturesNotResolved()); if (!e.getMissingBasePlatforms().isEmpty()) { - sb.append(Messages.INSTALL_KERNEL_MESSAGES.getMessage("ERROR_NO_DERIVED_PLATFORM", missingFeatures)).append("\n"); + for (Map.Entry> noPlatformVersionless : e.getMissingBasePlatforms().entrySet()) { + sb.append(Messages.INSTALL_KERNEL_MESSAGES.getMessage("ERROR_NO_DERIVED_PLATFORM", noPlatformVersionless.getValue())).append("\n"); + } } String msg = sb.toString(); return msg; } - /** - * @param collection - * @return - */ - protected static String createMissingFeatureString(Collection missingFeatures) { - StringBuilder sb = new StringBuilder(); - for (String missing : missingFeatures) { - sb.append(missing).append(" "); - } - return sb.toString().trim(); - } - /** * Checks if the inputed version is newer than the newest version * diff --git a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java index 6f705c4e3e5..72e6ad5cc3e 100755 --- a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java +++ b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java @@ -15,7 +15,6 @@ import java.util.Collection; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -44,7 +43,7 @@ public class RepositoryResolutionException extends RepositoryException { private final Map> featureConflicts; private Set resolvedPlatforms; private Set missingPlatforms; - private List missingBasePlatforms; + private Map> missingBasePlatforms; /** * @param cause @@ -79,7 +78,7 @@ public RepositoryResolutionException(ResolutionException cause, Collection topLevelFeaturesNotResolved, Collection allRequirementsNotFound, Collection missingProductInformation, Collection allRequirementsResourcesNotFound, Map> featureConflicts, Set resolvedPlatforms, Set missingPlatforms, - List missingBasePlatforms) { + Map> missingBasePlatforms) { super(cause); this.topLevelFeaturesNotResolved = topLevelFeaturesNotResolved; this.allRequirementsNotFound = allRequirementsNotFound; @@ -381,11 +380,12 @@ public Set getMissingPlatforms() { } /** - * This describes base platforms like "jakartaee" that are not derived, either by passed platform values, or by other included versioned features + * This describes a Map of base platforms like "jakartaee" (associated with versionless features) that are not derived, either by passed platform values, or by other included + * versioned features * * @return the missingBasePlatforms */ - public List getMissingBasePlatforms() { + public Map> getMissingBasePlatforms() { return missingBasePlatforms; } 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 8d823ad7b5a..ae766e4bce8 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 @@ -149,6 +149,10 @@ public class RepositoryResolver { * returns if versionless features are part of the resolution - used to skip extra processing */ boolean includesVersionless; + /** + * Map of unresolved base platforms, and the associated passed versionless features + */ + Map> missingBasePlatforms; /** *

@@ -501,6 +505,7 @@ void initResolve() { missingRequirements = new ArrayList<>(); resolverRepository = null; featureConflicts = new HashMap<>(); + missingBasePlatforms = new HashMap<>(); resolvedPlatforms = new HashSet<>(); missingPlatforms = new HashSet<>(); includesVersionless = false; @@ -572,6 +577,7 @@ void resolveFeaturesAsSet() { includesVersionless = true; resolvedPlatforms = result.getResolvedPlatforms(); missingPlatforms = result.getMissingPlatforms(); + missingBasePlatforms = result.getNoPlatformVersionless(); } for (String name : result.getResolvedFeatures()) { @@ -999,25 +1005,6 @@ private void reportErrors() throws RepositoryResolutionException { return; } - List missingBasePlatforms = new ArrayList(); - - // Versionless features can't be resolved if a corresponding platform is not derived, making the choice ambiguous, and the feature won't be included in the resolved list. - will gather the associated platform unable to target. - if (includesVersionless) { - for (String name : missingTopLevelRequirements) { - ProvisioningFeatureDefinition feature = resolverRepository.getFeature(name); - if (feature != null && feature.isVersionless()) { - List featureChildren = resolverRepository.findAllPossibleVersions(feature); - if (!featureChildren.isEmpty()) { - ProvisioningFeatureDefinition firstChild = featureChildren.get(0); - String plat = firstChild.getPlatformName(); - if (plat != null) {//This will add just the platform name without version - missingBasePlatforms.add(resolverRepository.getFeatureBaseName(plat)); - } - } - } - } - } - Set missingProductInformation = new HashSet<>(); for (ApplicableToProduct esa : resourcesWrongProduct) {