Run OpenFM unit tests and fix NotCondition.equals reflexivity#1071
Open
vharseko wants to merge 3 commits into
Open
Run OpenFM unit tests and fix NotCondition.equals reflexivity#1071vharseko wants to merge 3 commits into
vharseko wants to merge 3 commits into
Conversation
OpenFM carried a blanket <skipTests>true</skipTests> since 2013, hiding all 178 of its tests. The property was there because the OpenSSO-era tests need a live in-container OpenAM and abort the whole TestNG suite when they cannot be instantiated. Replace it with an explicit exclude list for the 53 server-dependent classes, so the 48 unit tests now run by default. Restore six test fixtures that were left behind in the OpenSSO tree during the Maven migration, and make ResourceNameSplitTest's methods void so TestNG stops ignoring them. Once running, NotConditionTest surfaced a real defect: LogicalCondition.equals read this.eConditions directly but called object.getEConditions(). NotCondition overrides that getter and keeps its condition in a separate field, so equals always returned false -- including n.equals(n), breaking List.contains/remove. Read both sides through the accessors. Update CreateSoapSTSDeploymentTest for the retry params added in OPENAM-8772 and ConfigureSocialAuthNTest for the crypto value removed in OPENAM-5851.
The test built classpath resource names with Paths.get(), which yields backslash separators on Windows. getResourceAsStream() then returns null and the test dies with "NPE: in is null". These are resource names, not filesystem paths, so use plain string constants that keep '/' on every platform. Latent since 2015 and only visible now that the module's tests actually run.
The class validated PrivilegeManager.isNameValid() -- letters, digits,
underscore, dash, and rejection of special characters -- but a typo in its
name ("Priivlege", and no Test suffix) kept it outside surefire's default
patterns, so its six tests had never run. Rename to
PrivilegeNameValidationTest.
Also fix withSpecialChar reporting itself as withDash on failure.
OpenFM: 48 -> 54 tests.
maximthomas
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenFM has carried a blanket
<skipTests>true</skipTests>since 2bbaf3849b (2013), hiding all 178 of its tests.mvn teston the module now runs 48 tests, all green.Why the flag was there
The OpenSSO-era tests obtain an Application SSO token via
AdminTokenActionand driveServiceManager/IdRepodirectly. Outside a configured server they fail in the constructor or@BeforeClass, and TestNG aborts the entire suite when one class cannot be instantiated — so a single server-dependent test hid all the others.CreateSoapSTSDeploymentTestdocumented this in a comment.This replaces the blanket flag with an explicit surefire exclude list for the 53 server-dependent classes.
excludesrather thanincludesis deliberate: a newly added test is still picked up by the default patterns, instead of silently not running — the trap that created this situation.A real defect in openam-core
Once running,
NotConditionTestcaught exactly what it was written for in 2014.LogicalCondition.equalsreadthis.eConditionsdirectly but calledobject.getEConditions().NotConditionoverrides that getter and keeps its condition in a separate field, which is alwaysnullin the parent — so the comparison always failed:This violates the reflexivity contract of
Object.equals.HashSethappened to work only because it compares references first.AndCondition/OrConditionare unaffected — they do not override the getter. Present since 2012, invisible because the test never ran.Test-side fixes
resourceNameIndex*,resourceNameSplit*,eUnitTest.data).ResourceNameSplitTestdeclared@Test public boolean testHost(); TestNG silently ignores non-void methods — a leftover from the OpenSSO harness wheretruemeant pass. Made themvoid.resourceNameSplitHost.propertiesexpected scheme-carrying host indexes (http://www.sun.com), but every implementation in history emits scheme-agnostic://www.sun.com. The fixture was stale before it was ever run; updated to the real contract.CreateSoapSTSDeploymentTest: supply the retry params added in OPENAM-8772 (2016).ConfigureSocialAuthNTest: the crypto value was intentionally removed in OPENAM-5851 (2015) — the same commit documented "If client_secret entered, entry is ignored". The product is right here; the test expectation was stale.Verification
mvn test, no flags)Not in scope
The 53 excluded classes were designed to run inside a deployed OpenAM:
TestHarness.execute(HttpServletResponse, String)was invoked by a servlet in the webapp and ran TestNG in-container. That servlet no longer exists —TestHarnessis an orphan with no caller. Reviving them needs a new harness (rebuild the in-container entry point, rewrite as black-box REST/Selenium, or bootstrap the server stack in-JVM) and is a separate project. The exclude list is the inventory to work from.