[
https://issues.apache.org/jira/browse/KAFKA-12989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
David Jacot updated KAFKA-12989:
--------------------------------
Description:
The `MockClient` offers the possibility to prepare an unsupported version
response with `MockClient#prepareUnsupportedVersionResponse`. That method
accepts a `RequestMatcher` but it is never applied. It should be or we should
remove the matcher from the method.
{code:java}
UnsupportedVersionException unsupportedVersionException = null;
if (futureResp.isUnsupportedRequest) {
unsupportedVersionException = new UnsupportedVersionException(
"Api " + request.apiKey() + " with version " + version);
} else {
AbstractRequest abstractRequest =
request.requestBuilder().build(version);
if (!futureResp.requestMatcher.matches(abstractRequest))
throw new IllegalStateException("Request matcher did not
match next-in-line request "
+ abstractRequest + " with prepared response " +
futureResp.responseBody);
}
ClientResponse resp = new
ClientResponse(request.makeHeader(version), request.callback(),
request.destination(),
request.createdTimeMs(), time.milliseconds(),
futureResp.disconnected,
unsupportedVersionException, null, futureResp.responseBody);
{code}
was:
The `MockClient` offers the possibility to prepare an unsupported version
response with `MockClient#prepareUnsupportedVersionResponse`. That method
accepts a `RequestMatcher` but it is never applied. It should be.
{code:java}
UnsupportedVersionException unsupportedVersionException = null;
if (futureResp.isUnsupportedRequest) {
unsupportedVersionException = new UnsupportedVersionException(
"Api " + request.apiKey() + " with version " + version);
} else {
AbstractRequest abstractRequest =
request.requestBuilder().build(version);
if (!futureResp.requestMatcher.matches(abstractRequest))
throw new IllegalStateException("Request matcher did not
match next-in-line request "
+ abstractRequest + " with prepared response " +
futureResp.responseBody);
}
ClientResponse resp = new
ClientResponse(request.makeHeader(version), request.callback(),
request.destination(),
request.createdTimeMs(), time.milliseconds(),
futureResp.disconnected,
unsupportedVersionException, null, futureResp.responseBody);
{code}
> `MockClient` should respect the request matcher passed to
> `prepareUnsupportedVersionResponse`
> ---------------------------------------------------------------------------------------------
>
> Key: KAFKA-12989
> URL: https://issues.apache.org/jira/browse/KAFKA-12989
> Project: Kafka
> Issue Type: Bug
> Reporter: David Jacot
> Priority: Major
>
> The `MockClient` offers the possibility to prepare an unsupported version
> response with `MockClient#prepareUnsupportedVersionResponse`. That method
> accepts a `RequestMatcher` but it is never applied. It should be or we should
> remove the matcher from the method.
> {code:java}
> UnsupportedVersionException unsupportedVersionException = null;
> if (futureResp.isUnsupportedRequest) {
> unsupportedVersionException = new UnsupportedVersionException(
> "Api " + request.apiKey() + " with version " +
> version);
> } else {
> AbstractRequest abstractRequest =
> request.requestBuilder().build(version);
> if (!futureResp.requestMatcher.matches(abstractRequest))
> throw new IllegalStateException("Request matcher did not
> match next-in-line request "
> + abstractRequest + " with prepared response " +
> futureResp.responseBody);
> }
> ClientResponse resp = new
> ClientResponse(request.makeHeader(version), request.callback(),
> request.destination(),
> request.createdTimeMs(), time.milliseconds(),
> futureResp.disconnected,
> unsupportedVersionException, null,
> futureResp.responseBody);
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)