Skip to content

I 139: evaluating a composition structure for mocks - #141

Open
al-niessner wants to merge 27 commits into
mainfrom
i-139
Open

I 139: evaluating a composition structure for mocks#141
al-niessner wants to merge 27 commits into
mainfrom
i-139

Conversation

@al-niessner

@al-niessner al-niessner commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🗒️ Summary

Proof of concept

🤖 AI Assistance Disclosure

  • No AI assistance used
  • AI used for light assistance (e.g., suggestions, refactoring, documentation help, minor edits)
  • AI used for moderate content generation (AI generated some code or logic, but the developer authored or heavily revised the majority)
  • AI generated substantial portions of this code

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

  • Documentation: README, Wiki, or inline documentation (Sphinx, Javadoc, Docstrings) have been updated to reflect these changes.
  • Issue Traceability: The PR is linked to a valid GitHub Issue
  • PR Title: The PR title is "user-friendly" clearly identifying what is being fixed or the new feature being added, that if you saw it in the Release Notes for a tool, you would be able to get the gist of what was done.

Security & Quality

  • SonarCloud: Confirmed no new High or Critical security findings.
  • Secrets Detection: Verified that the Secrets Detection scan passed and no sensitive information (keys, tokens, PII) is exposed.
  • Code Quality: Code follows organization style guidelines and best practices for the specific language (e.g., PEP 8, Google Java Style).

Testing & Validation

  • Test Accuracy: Verified that test data is accurate, representative of real-world PDS4 scenarios, and sufficient for the logic being tested.
  • Coverage: Automated tests cover new logic and edge cases.
  • Local Verification: (If applicable) Successfully built and ran the changes in a local or staging environment.

Maintenance

  • Backward Compatibility: Confirmed that these changes do not break existing downstream dependencies or API contracts (or that breaking changes are clearly documented).

@al-niessner

Copy link
Copy Markdown
Contributor Author

@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.

@nutjob4life

Copy link
Copy Markdown
Member

@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.

@al-niessner

Copy link
Copy Markdown
Contributor Author

@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.

@al-niessner

Copy link
Copy Markdown
Contributor Author

@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.

Comment thread testing/pom.xml
Comment thread testing/pom.xml Outdated
Comment thread testing/src/test/java/mock/OpensearchEngine.java Outdated
Comment thread testing/src/test/java/mock/OpensearchEngine.java
@nutjob4life

Copy link
Copy Markdown
Member

@al-niessner wrote:

Okay, this is in a pretty good place now.

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.

@al-niessner
al-niessner marked this pull request as ready for review August 28, 2026 16:16
@al-niessner

Copy link
Copy Markdown
Contributor Author

@jordanpadams @nutjob4life

Ready for review.

@nutjob4life
nutjob4life self-requested a review August 28, 2026 17:35
Comment thread testing/src/test/java/cucumber/RunTest.java Outdated

@nutjob4life nutjob4life left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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] ------------------------------------------------------------------------

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to Java 21, Java 17 is EOL Evaluate and select HTTP mock and Cucumber BDD framework for registry-loader integration tests

3 participants