Repository navigation
Created 2 new modules; integration-testing and testing - #24
cmoulliard wants to merge 9 commits into
Conversation
…e checks using an ACP agent installed AND testing packaging classes to Mock and ACP Agent Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
|
On it. Give me a little! |
|
Charles, I read the changes, but I haven't checked it out and tested it. So this is only from the diff. The direction looks like what we talked about. AcpTransport lets the client talk without starting a process, MockAcpAgent answers on a pipe so you can check the JSON-RPC messages, and AcpAgentProcess is the JUnit piece for a real agent when the binary is there. A few things I saw while reading. AcpAgentProcess builds the client in beforeAll, and then each test calls connect(), which starts a new process every time. A second test can leave the first agent running. The JBang scripts are a separate runner, and they don't use either of those fixtures. The check named initialize still sends a prompt and waits for the turn to finish, so a slow answer is a failed handshake, right? If a mock handler throws, nothing is sent back and the client just waits for the timeout. The permission test only watches the callback and doesn't show that the reply went back on the pipe. Add two helpers on MockAcpAgent. The README already shows sendNotification with a nested Map.of, and that is the example people will copy. Keep sendNotification and sendRequest for the odd cases. sessionUpdate can take the session id, the update type, and the record. ContentChunk has no sessionUpdate field, and the client uses that field to choose the record type, so the helper has to put it on the JSON before the line goes on the pipe. requestPermission can take the RequestPermissionRequest and return the client's reply. The test then waits on that future, and the JSON-RPC id stays inside the fixture. Hope this makes sense. |
Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
aureamunoz
left a comment
There was a problem hiding this comment.
+1 for renaming using only 'test'.
| client.closeGracefully().get(10, TimeUnit.SECONDS); | ||
| } catch (Exception e) { | ||
| if (transport != null) { | ||
| transport.closeGracefully(); |
There was a problem hiding this comment.
transport is not closed in happy path, isn't it?
There was a problem hiding this comment.
Good catch. I reviewed the logic: 7c7e465
Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
…va`) - Fix handler exceptions swallowed silently (`test/.../MockAcpAgent.java`) - Add `sessionUpdate()` helper (`test/.../MockAcpAgent.java`) - Add `requestPermission()` helper (`test/.../MockAcpAgent.java`) - Updated tests (`test/.../MockAcpAgentTest.java`) Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
….smallrye.agentclientprotocol.sdk.test Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
I addressed your remark part of this commit: b9ce916 1. Fix process leak in
|
Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
Signed-off-by: Charles Moulliard <cmoulliard@ibm.com>
xstefank
left a comment
There was a problem hiding this comment.
ok with me, just a small comment
| * | ||
| * @return the configured mapper | ||
| */ | ||
| ObjectMapper getMapper(); |
There was a problem hiding this comment.
maybe should default to defaultMapper?
There was a problem hiding this comment.
or maybe a mistake with defaultMapper method?
There was a problem hiding this comment.
Yes, it makes sense to have both as they serve different purposes.
StdioAcpClientTransport has two constructors:
// Uses the shared default mapper
public StdioAcpClientTransport(AgentParameters params)
// Uses a custom mapper (e.g. for testing or special serialization)
public StdioAcpClientTransport(AgentParameters params, ObjectMapper mapper)
getMapper() returns whichever mapper was configured for that specific transport instance — it could be the default or a custom one. Callers like AcpAsyncClient use transport.getMapper() to serialize requests with the same mapper the transport uses internally.
AcpTransport.defaultMapper() is just the static factory for the shared singleton — it's the default value, not the only possible value.
If we remove getMapper(), there'd be no way for consumers to get the mapper from a transport that was constructed with a custom one.
Make sense ? @xstefank
What changed
MockAcpAgent(pipe-based mock) andAcpAgentProcess(real-agent JUnit 5 extension)Interested to review: @myfear ?
Fix: #4