Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-8135] Profile activation based on OS properties is no longer case insensitive #1561

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ private boolean determineVersionMatch(String expectedVersion, String actualVersi
reverse = true;
test = test.substring(1);
}
result = actualVersion.equals(test);
result = actualVersion.equalsIgnoreCase(test);
}

return reverse != result;
}

private boolean determineArchMatch(String expectedArch, String actualArch) {
String test = expectedArch;
String test = expectedArch.toLowerCase(Locale.ENGLISH);
boolean reverse = false;

if (test.startsWith("!")) {
Expand All @@ -130,7 +130,7 @@ private boolean determineArchMatch(String expectedArch, String actualArch) {
}

private boolean determineNameMatch(String expectedName, String actualName) {
String test = expectedName;
String test = expectedName.toLowerCase(Locale.ENGLISH);
boolean reverse = false;

if (test.startsWith("!")) {
Expand All @@ -144,7 +144,7 @@ private boolean determineNameMatch(String expectedName, String actualName) {
}

private boolean determineFamilyMatch(String family, String actualName) {
String test = family;
String test = family.toLowerCase(Locale.ENGLISH);
boolean reverse = false;

if (test.startsWith("!")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,18 @@ public void testAllOsConditions() {
assertActivation(false, profile, newContext(null, newProperties("windows", "99", "amd64")));
assertActivation(true, profile, newContext(null, newProperties("windows", "99", "aarch64")));
}

public void testCapitalOsName() {
ActivationOS os = new ActivationOS();
os.setFamily("Mac");
os.setName("Mac OS X");
os.setArch("aarch64");
os.setVersion("14.5");
Profile profile = newProfile(os);

assertActivation(false, profile, newContext(null, newProperties("linux", "6.5.0-1014-aws", "amd64")));
assertActivation(false, profile, newContext(null, newProperties("windows", "1", "aarch64")));
assertActivation(false, profile, newContext(null, newProperties("windows", "99", "amd64")));
assertActivation(true, profile, newContext(null, newProperties("Mac OS X", "14.5", "aarch64")));
}
}