I 139: evaluating a composition structure for mocks - #141
Conversation
|
@jordanpadams @nutjob4life @tloubrieu-jpl This version of sonar does not understand the new java candy "record". You need a newer version of sonar that does. |
|
@al-niessner TIL about Java "records" 🤯 It's about time! Java's renowned for being one of the most verbose languages. This "record" concept can really cut down on the lines of code. |
It is, but I never cared because eclipse will add nearly all of the boilerplate (auto typing version of scala). Now we need to teach sonar about them so that it too can appreciate going from MOST verbose language to Most Verbose language. |
|
@jordanpadams @nutjob4life @tloubrieu-jpl Okay, this is in a pretty good place now. There is a small JUnit like set of tests to show that mock.Standard works as expected. The cucumber feature file works as well. Pushed the mock.Standard far enough that can run "registry-loader-manager create-registry" and the Java SDK 2 cannot tell it is talking to the mock.Standard. So, I think this done enough to merge it and let me start on a fresh branch to do the next items. While I wait for the conscensus on if this is good enough - understandable and can train others to use it, going to start trying to figure out @alexdunnjpl request from 6 months ago as my first regression check on top of the simple stuff. Meaning, there might be changes but hopefully not big ones. |
|
@al-niessner wrote:
Agreed! Thanks so much for taking this on. I left 4 or so interspersed comments in the deltas (c.f.), but especially take a peek at the Cucumber tests not being run. |
|
Ready for review. |
There was a problem hiding this comment.
Revised delta: ✓
Tests: ✓
Approval: ✅
Questions: the only one is on line 12 of RunTest.java (see above)
Maven details:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] -----------< gov.nasa.pds.registry-loader:registry-manager >------------
[INFO] Building PDS Registry Manager 1.4.0-SNAPSHOT [4/5]
[INFO] from manager/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ registry-manager ---
[INFO] Deleting /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/manager/target
[INFO]
[INFO] --- resources:3.4.0:resources (default-resources) @ registry-manager ---
[INFO] Copying 9 resources from src/main/resources to target/classes
[INFO] Copying 1 resource from src/main/resources/app to target/classes
[INFO]
[INFO] --- compiler:3.8.1:compile (default-compile) @ registry-manager ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 34 source files to /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/manager/target/classes
[INFO] /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/manager/src/main/java/gov/nasa/pds/registry/mgr/cmd/reg/FetchRegistryCmd.java: /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/manager/src/main/java/gov/nasa/pds/registry/mgr/cmd/reg/FetchRegistryCmd.java uses or overrides a deprecated API.
[INFO] /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/manager/src/main/java/gov/nasa/pds/registry/mgr/cmd/reg/FetchRegistryCmd.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- resources:3.4.0:testResources (default-testResources) @ registry-manager ---
[INFO] skip non existing resourceDirectory /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/manager/src/test/resources
[INFO]
[INFO] --- compiler:3.8.1:testCompile (default-testCompile) @ registry-manager ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/manager/target/test-classes
[INFO]
[INFO] --- surefire:3.5.2:test (default-test) @ registry-manager ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --------< gov.nasa.pds.registry-loader:registry-loader-testing >--------
[INFO] Building PDS Registry Loader Testing 1.4.0-SNAPSHOT [5/5]
[INFO] from testing/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ registry-loader-testing ---
[INFO] Deleting /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/testing/target
[INFO]
[INFO] --- resources:3.4.0:resources (default-resources) @ registry-loader-testing ---
[INFO] skip non existing resourceDirectory /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/testing/src/main/resources
[INFO] skip non existing resourceDirectory /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/testing/src/main/resources/app
[INFO]
[INFO] --- compiler:3.8.1:compile (default-compile) @ registry-loader-testing ---
[INFO] No sources to compile
[INFO]
[INFO] --- resources:3.4.0:testResources (default-testResources) @ registry-loader-testing ---
[INFO] Copying 2 resources from src/test/resources to target/test-classes
[INFO]
[INFO] --- compiler:3.8.1:testCompile (default-testCompile) @ registry-loader-testing ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to /Users/kelly/Documents/Clients/JPL/PDS/Development/nasa-pds/registry-loader/testing/target/test-classes
[INFO]
[INFO] --- surefire:3.5.2:test (default-test) @ registry-loader-testing ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
Aug 28, 2026 12:36:30 PM org.junit.platform.launcher.core.DiscoveryIssueNotifier logIssues
WARNING: TestEngine with ID 'cucumber' encountered a non-critical issue during test discovery:
(1) [WARNING] Discovering tests using the cucumber.features property. Other discovery selectors are ignored!
This is a work around for the limited JUnit 5 support in Maven and Gradle. Please request/upvote/sponsor/ect better support for JUnit 5 discovery selectors. For details see: https://github.com/cucumber/cucumber-jvm/pull/2498
If you are using the JUnit 5 Suite Engine, Platform Launcher API or Console Launcher you should not use this property. Please consult the JUnit 5 documentation on test selection.
[INFO] Running io.cucumber.junit.platform.engine.CucumberTestEngine
SLF4J(W): Class path contains multiple SLF4J providers.
SLF4J(W): Found provider [org.slf4j.simple.SimpleServiceProvider@c055c54]
SLF4J(W): Found provider [org.slf4j.nop.NOPServiceProvider@25e2ab5a]
SLF4J(W): See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J(I): Actual provider is of type [org.slf4j.simple.SimpleServiceProvider@c055c54]
[main] INFO io.javalin.Javalin - Starting Javalin ...
[main] INFO org.eclipse.jetty.server.Server - jetty-12.1.8; built: 2026-04-01T01:09:18.991Z; git: c9cdc9aaa434a3665b8a53b4d1cc3684992da649; jvm 25.0.3+9-LTS-195
[main] INFO org.eclipse.jetty.session.DefaultSessionIdManager - Session workerName=node0
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started oeje10s.ServletContextHandler@ba17be6{ROOT,/,b=null,a=AVAILABLE,h=oeje10s.SessionHandler@6f798482{STARTED}}
[main] INFO org.eclipse.jetty.ee10.servlet.ServletContextHandler - Started oeje10s.ServletContextHandler@ba17be6{ROOT,/,b=null,a=AVAILABLE,h=oeje10s.SessionHandler@6f798482{STARTED}}
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started oejs.ServerConnector@5031bedf{SSL, (ssl, alpn, h2, http/1.1)}{127.0.0.1:19022}
[main] INFO org.eclipse.jetty.server.Server - Started oejs.Server@329548d0{STARTING}[12.1.8,sto=0] @48ms
[main] INFO io.javalin.Javalin -
__ ___ _____
/ /___ __ ______ _/ (_)___ /__ /
__ / / __ `/ | / / __ `/ / / __ \ / /
/ /_/ / /_/ /| |/ / /_/ / / / / / / / /
\____/\__,_/ |___/\__,_/_/_/_/ /_/ /_/
https://javalin.io/documentation
[main] INFO io.javalin.Javalin - Javalin started in 212ms \o/
[main] INFO io.javalin.Javalin - Listening on https://127.0.0.1:19022/
[main] INFO io.javalin.Javalin - You are running Javalin 7.2.2 (released May 14, 2026).
@1.4.x
Scenario Outline: NASA-PDS/registry-loader#139-0 # classpath:features//1.4.x.feature:11
✔ Given registry-loader issue 139, test 0, and opensearch mocks "mock.osf.Standard,mock.osf.JUnitish" # cucumber.StepDefs.construct(java.lang.Integer,java.lang.Integer,java.lang.String)
running sanity
mocks: [mock.osf.Standard@70025b99, mock.osf.JUnitish@7efa3f63]
running junitish
[main] INFO mock.OpensearchEngine - Method name: authorize
[main] INFO mock.OpensearchEngine - Context:
[main] INFO mock.OpensearchEngine - index: test
[main] INFO mock.OpensearchEngine - body: body
[main] INFO mock.OpensearchEngine - header: {authorization=Basic fakekey, content-type=application/json; charset=UTF-8, user-agent=opensearch-java/3.2.0 (Java/21.0.11), accept=application/json; charset=UTF-8}
[main] INFO mock.OpensearchEngine - query: null
[main] INFO mock.OpensearchEngine - params: null
[main] INFO mock.OpensearchEngine - Method name: putMappingsSettings
[main] INFO mock.OpensearchEngine - Context:
[main] INFO mock.OpensearchEngine - index: test
[main] INFO mock.OpensearchEngine - body: body
[main] INFO mock.OpensearchEngine - header: null
[main] INFO mock.OpensearchEngine - query: null
[main] INFO mock.OpensearchEngine - params: null
✔ When test suite "suite.Sanity" is executed with CLI arguments "" # cucumber.StepDefs.execute(java.lang.String,java.lang.String)
✔ Then compare to the expected outcome "expect.Sane". # cucumber.StepDefs.compare(java.lang.String)
[main] INFO io.javalin.Javalin - Stopping Javalin ...
[main] INFO org.eclipse.jetty.server.Server - Stopped oejs.Server@329548d0{STOPPING}[12.1.8,sto=0]
[main] INFO org.eclipse.jetty.server.AbstractConnector - Stopped oejs.ServerConnector@5031bedf{SSL, (ssl, alpn, h2, http/1.1)}{127.0.0.1:19022}
[main] INFO org.eclipse.jetty.ee10.servlet.ServletContextHandler - Stopped oeje10s.ServletContextHandler@ba17be6{ROOT,/,b=null,a=AVAILABLE,h=oeje10s.SessionHandler@6f798482{STOPPED}}
[main] INFO io.javalin.Javalin - Javalin has stopped
1 scenarios (1 passed)
4 steps (4 passed)
0m 1.57s
Aug 28, 2026 12:36:31 PM org.junit.platform.launcher.core.DiscoveryIssueNotifier logIssues
WARNING: TestEngine with ID 'cucumber' encountered a non-critical issue during test discovery:
(1) [WARNING] Discovering tests using the cucumber.features property. Other discovery selectors are ignored!
This is a work around for the limited JUnit 5 support in Maven and Gradle. Please request/upvote/sponsor/ect better support for JUnit 5 discovery selectors. For details see: https://github.com/cucumber/cucumber-jvm/pull/2498
If you are using the JUnit 5 Suite Engine, Platform Launcher API or Console Launcher you should not use this property. Please consult the JUnit 5 documentation on test selection.
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.071 s -- in io.cucumber.junit.platform.engine.CucumberTestEngine
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for gov.nasa.pds:registry-loader 1.4.0-SNAPSHOT:
[INFO]
[INFO] gov.nasa.pds:registry-loader ....................... SUCCESS [ 0.062 s]
[INFO] PDS Registry Common ................................ SUCCESS [ 6.457 s]
[INFO] Harvest Tool ....................................... SUCCESS [ 0.695 s]
[INFO] PDS Registry Manager ............................... SUCCESS [ 0.555 s]
[INFO] PDS Registry Loader Testing ........................ SUCCESS [ 1.988 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
|



🗒️ Summary
Proof of concept
🤖 AI Assistance Disclosure
Estimated % of code influenced by AI: ___ %
⚙️ Test Data and/or Report
NA
♻️ Related Issues
fixes #139
fixes #148
🤓 Reviewer Checklist
Reviewers: Please verify the following before approving this pull request.
Documentation and PR Content
Security & Quality
Testing & Validation
Maintenance