Skip to content

Add module with typed input functionality and tests#684

Open
ThijmenL98 wants to merge 5 commits into
replay-framework:mainfrom
ThijmenL98:main
Open

Add module with typed input functionality and tests#684
ThijmenL98 wants to merge 5 commits into
replay-framework:mainfrom
ThijmenL98:main

Conversation

@ThijmenL98

Copy link
Copy Markdown

No description provided.

@xabolcs

xabolcs commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

Extending ActionInvoker.findActionMethod() with .startsWith I got match that postfixed parameter ... and got the "generic userid missing" BadRequest as you already wrote on gitter. 🤷

... 8< ...
14:25:14,155 TRACE [play.server.javanet.PlayHandler] ~ parseRequest: begin :GET:/typedinput/generic/2
14:25:14,156 TRACE [play.server.javanet.PlayHandler] ~ parseRequest: end :GET:/typedinput/generic/2
14:25:14,156 TRACE [play.server.javanet.PlayHandler$JavaNetInvocation] ~ run: begin :GET:/typedinput/generic/2
14:25:14,156 TRACE [play.server.javanet.PlayHandler$JavaNetInvocation] ~ init: begin :GET:/typedinput/generic/2
14:25:14,156 TRACE [play.mvc.Router] ~ Route: /typedinput/generic/2 - null
14:25:14,156 TRACE [play.mvc.ActionInvoker] ~ no matching method for printGeneric: printForced
14:25:14,156 TRACE [play.mvc.ActionInvoker] ~ ------- public final play.mvc.results.Result controllers.TypedInputController.printGeneric-vOED-Mk(model.Identifier)
14:25:14,156 TRACE [play.server.javanet.PlayHandler$JavaNetInvocation] ~ init: end true :GET:/typedinput/generic/2
14:25:14,156 WARN  [play.mvc.ActionInvoker] ~ It seems you did not compile with the '-parameters' flag.
14:25:14,156 TRACE [play.mvc.ActionInvoker] ~ getActionMethodArgs name [arg0] annotation []
... 8< ...

@ThijmenL98 you got the same warning about missing -parameters flag? 🤔

The same warning is there too for the forced way:

14:30:16,669 TRACE [play.server.javanet.PlayHandler] ~ parseRequest: begin :GET:/typedinput/forced/2
14:30:16,669 TRACE [play.server.javanet.PlayHandler] ~ parseRequest: end :GET:/typedinput/forced/2
14:30:16,669 TRACE [play.server.javanet.PlayHandler$JavaNetInvocation] ~ run: begin :GET:/typedinput/forced/2
14:30:16,669 TRACE [play.server.javanet.PlayHandler$JavaNetInvocation] ~ init: begin :GET:/typedinput/forced/2
14:30:16,669 TRACE [play.mvc.Router] ~ Route: /typedinput/forced/2 - null
14:30:16,670 TRACE [play.mvc.ActionInvoker] ~ ------- public final play.mvc.results.Result controllers.TypedInputController.printForced(java.lang.Long)
14:30:16,670 TRACE [play.server.javanet.PlayHandler$JavaNetInvocation] ~ init: end true :GET:/typedinput/forced/2
14:30:16,670 WARN  [play.mvc.ActionInvoker] ~ It seems you did not compile with the '-parameters' flag.
14:30:16,670 TRACE [play.mvc.ActionInvoker] ~ getActionMethodArgs name [arg0] annotation []

Interestingly those TRACE messages about finding the method is missing if I run the tests manually - the above outputs are from running from IDEA.

@asolntsev any hint?

@xabolcs

xabolcs commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

Btw, I'm unable to force push this PR. 😕

@ThijmenL98

Copy link
Copy Markdown
Author

Extending ActionInvoker.findActionMethod() with .startsWith I got match that postfixed parameter ... and got the "generic userid missing" BadRequest as you already wrote on gitter. 🤷

Oh that's neat! Yeah personally i locally changed the function matcher to be startswith as well, but didn't want to push this change as it is quite a difference compared to equals, and wasn't sure what this could break elsewhere.

@ThijmenL98 you got the same warning about missing -parameters flag? 🤔

Yes I indeed got the parameters warning as well, I assumed it was a "my machine" issue, as i merely copied an existing test suite and mutated it with the desired generic identifier value class, but perhaps it indeed is related to this change.

@xabolcs

xabolcs commented Nov 5, 2025

Copy link
Copy Markdown
Collaborator
14:30:16,670 WARN  [play.mvc.ActionInvoker] ~ It seems you did not compile with the '-parameters' flag.
14:30:16,670 TRACE [play.mvc.ActionInvoker] ~ getActionMethodArgs name [arg0] annotation []

The "userid missing" BadRequest is caused by the fact that RePlay got these arg0 method arguments.
Looks like the Kotlin compiler needs -java-parameters flag!
Let me try!

@xabolcs

xabolcs commented Nov 5, 2025

Copy link
Copy Markdown
Collaborator

It seems you did not compile with the '-parameters' flag.
...
-java-parameters

Configuring the Kotlin compiler options like below in replay-tests/helloworld-kotlin/build.gradle, makes the -parameters warning gone!

kotlin {
  compilerOptions {
    javaParameters = true
  }
}

Running the helloworld-kotlin test application with IDEA, the forced URL work nicely:

Hello, User 1 with identifier type N/A and value type Long!

But the generic URL is still wrong:

generic userId missing

And running the test itself is still wrong for both tests. 🤷

@xabolcs

xabolcs commented Nov 6, 2025

Copy link
Copy Markdown
Collaborator

I'm still unable to force push this PR so I pushed my changes to my own branch.

@ThijmenL98: I added two binder, one (a Global one) for the model.User and the another (which only works with As(binder = ...)) for module.Identifier!
Please check if they work for you!

@asolntsev: my fix looks good to me, but I just don't know how to pass that -parameters / -java-parameters to hellowrold-kotlin ui tests. So I can't verify! 🤷
Please take a look!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants