Skip to content

Commit

Permalink
Updates to versionless tests
Browse files Browse the repository at this point in the history
- Update to remove conditional and fix up test now that we support
jakartaee-8.0 in addition to javaee-8.0
- Update mpVersion detection logic to correctly detect when mpVersion
tolerates is missing
  • Loading branch information
jhanders34 committed Dec 23, 2024
1 parent e40234f commit a15419b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023 IBM Corporation and others.
* Copyright (c) 2023, 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
Expand Down Expand Up @@ -286,12 +286,6 @@ public void validatePlatformSettings() {
List<String> cohort = cohorts.get(featureBaseName);
//loops through each version of a platform
for (String version : cohort) {
// We are only doing javaee-8.0 platform and not doing jakartaee-8.0 platform
// If that changes this condition should be removed.
if (baseName.equals("jakartaee") && version.equals("8.0")) {
continue;
}

boolean isMP = baseName.equals("microProfile");
String featureName = featureBaseName + "-" + version;
String featureShortName = baseName + "-" + version;
Expand Down Expand Up @@ -336,6 +330,8 @@ public void validatePlatformSettings() {
// jdbc is special
featureToPlatformMapping.get("com.ibm.websphere.appserver.jdbc-4.1").remove("javaee-8.0");
featureToPlatformMapping.get("com.ibm.websphere.appserver.jdbc-4.2").add("javaee-8.0");
featureToPlatformMapping.get("com.ibm.websphere.appserver.jdbc-4.1").remove("jakartaee-8.0");
featureToPlatformMapping.get("com.ibm.websphere.appserver.jdbc-4.2").add("jakartaee-8.0");
featureToPlatformMapping.get("com.ibm.websphere.appserver.jdbc-4.2").remove("jakartaee-11.0");
Set<String> jdbc43Platform = new HashSet<>();
jdbc43Platform.add("jakartaee-11.0");
Expand All @@ -356,9 +352,6 @@ public void validatePlatformSettings() {
if (featurePlatform.equals("javaee-6.0")) {
continue;
}
if(featurePlatform.equals("jakartaee-8.0") && platforms.contains("javaee-8.0")){
continue;
}
if (platforms.contains(featurePlatform)) {
matches++;
} else {
Expand All @@ -373,9 +366,6 @@ public void validatePlatformSettings() {
}
}
}
if(platforms.contains("javaee-8.0") && !featurePlatforms.contains("jakartaee-8.0")){
errorMessage.append(featureName).append(" is missing platform jakartaee-8.0\n");
}
}

// Special private features that also should have platforms listed in them
Expand Down Expand Up @@ -548,7 +538,7 @@ public void listSelectorDetails() {

String errorOutput = "There are versionless features that need to be created. " +
"Templates for the needed features have been created in the 'build/versionless' directory.\n" +
"Keep in mind the templates are not guarenteed to be correct and are solely meant to " +
"Keep in mind the templates are not guaranteed to be correct and are solely meant to " +
"act as a helpful starting point for creating a versionless feature.\n" +
"Verify the data inside the feature files are correct, then copy the features from 'build/versionless' into 'visibility'.\n" + createdFeatures;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*******************************************************************************
* Copyright (c) 2023, 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
*******************************************************************************/
package com.ibm.ws.feature.utils;

import java.io.BufferedWriter;
Expand Down Expand Up @@ -326,15 +335,15 @@ private boolean validatePrivateLinkingFeature(String featureName, String feature
}

File featureFile = feature.getFeatureFile();
boolean checkForMpVersion = (mpVersionBase != null && mpVersionTolerates != null);
boolean checkForMpVersion = (mpVersionBase != null);
boolean containsVersionedFeature = false;
boolean containsMpVersion = false;
try {
Scanner myReader = new Scanner(featureFile);
while (myReader.hasNextLine()) {
String s = myReader.nextLine();

if(checkForMpVersion && s.trim().equals(mpVersionBase + "-" + mpVersionTolerates + ", \\")){
if(checkForMpVersion && s.trim().equals(mpVersionTolerates == null ? mpVersionBase : (mpVersionBase + "-" + mpVersionTolerates) + ", \\")){
containsMpVersion = true;
}
else if(s.trim().equals(versionedFeatureName)){
Expand Down

0 comments on commit a15419b

Please sign in to comment.