Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP test event id
  • Loading branch information
attilakreiner committed Mar 13, 2024
commit e1c05429591d0c72d1c88872ec54c10d91ab3df5
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ telemetry:
options:
events:
- qname: test.catalog0
id: catalog.schema.registry.remote.access.rejected
message: REMOTE_ACCESS_REJECTED GET http://localhost:8081/schemas/ids/0 0
catalogs:
catalog0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ private void handleEvent(
{
final EventFW event = eventRO.wrap(buffer, index, index + length);
String qname = context.supplyQName(event.namespacedId());
String id = context.supplyLocalName(event.id());
String message = formatter.format(msgTypeId, buffer, index, length);
if (options.events != null && eventIndex < options.events.size())
{
TestExporterOptionsConfig.Event e = options.events.get(eventIndex);
if (!e.qName.equals(qname) || !e.message.equals(message))
if (!qname.equals(e.qName) || !id.equals(e.id) || !message.equals(e.message))
{
throw new IllegalStateException(String.format("event mismatch, expected: %s %s, got: %s %s",
e.qName, e.message, qname, message));
throw new IllegalStateException(String.format("event mismatch, expected: %s %s %s, got: %s %s %s",
e.qName, e.id, e.message, qname, id, message));
}
eventIndex++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ public static <T> TestExporterOptionsConfigBuilder<T> builder(
public static final class Event
{
public final String qName;
public final String id;
public final String message;

public Event(
String qName,
String id,
String message)
{
this.qName = qName;
this.id = id;
this.message = message;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public final class TestExporterOptionsConfigAdapter implements OptionsConfigAdap
private static final String MODE_NAME = "mode";
private static final String EVENTS_NAME = "events";
private static final String QNAME_NAME = "qname";
private static final String ID_NAME = "id";
private static final String MESSAGE_NAME = "message";

@Override
Expand Down Expand Up @@ -66,6 +67,7 @@ public JsonObject adaptToJson(
{
JsonObjectBuilder event = Json.createObjectBuilder();
event.add(QNAME_NAME, e.qName);
event.add(ID_NAME, e.id);
event.add(MESSAGE_NAME, e.message);
events.add(event);
}
Expand Down Expand Up @@ -96,7 +98,7 @@ public OptionsConfig adaptFromJson(
JsonObject e0 = e.asJsonObject();
if (e0.containsKey(QNAME_NAME) && e0.containsKey(MESSAGE_NAME))
{
testOptions.event(e0.getString(QNAME_NAME), e0.getString(MESSAGE_NAME));
testOptions.event(e0.getString(QNAME_NAME), e0.getString(ID_NAME), e0.getString(MESSAGE_NAME));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ public TestExporterOptionsConfigBuilder<T> mode(

public TestExporterOptionsConfigBuilder<T> event(
String qName,
String id,
String message)
{
if (this.events == null)
{
this.events = new LinkedList<>();
}
this.events.add(new TestExporterOptionsConfig.Event(qName, message));
this.events.add(new TestExporterOptionsConfig.Event(qName, id, message));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ telemetry:
options:
events:
- qname: test.net0
id: binding.http.request.accepted
message: REQUEST_ACCEPTED - http GET localhost:8080 /
bindings:
net0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ telemetry:
options:
events:
- qname: test.net0
id: binding.http.request.accepted
message: REQUEST_ACCEPTED - http GET localhost:8080 /
bindings:
net0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ telemetry:
options:
events:
- qname: test.app0
id: binding.kafka.api.version.rejected
message: API_VERSION_REJECTED 32 0
bindings:
app0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ telemetry:
options:
events:
- qname: test.app0
id: binding.tcp.dns.failed
message: DNS_FAILED localhost
bindings:
app0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ telemetry:
options:
events:
- qname: test.app0
id: binding.tls.handshake.failed
message: HANDSHAKE_FAILED
vaults:
client:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ telemetry:
options:
events:
- qname: test.net0
id: binding.tls.handshake.failed
message: HANDSHAKE_FAILED
vaults:
server:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ telemetry:
options:
events:
- qname: test.net0
id: binding.tls.tls.failed
message: TLS_FAILED
vaults:
server:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ telemetry:
options:
events:
- qname: test.net0
message: test event message
id: binding.test.connected
message: test event message
bindings:
net0:
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@
"type": "object",
"properties":
{
"timestamp":
"qname":
{
"type": "integer"
"type": "string"
},
"id":
{
"type": "string"
},
"message":
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ telemetry:
options:
events:
- qname: test.net0
id: guard.jwt.authorization.failed
message: AUTHORIZATION_FAILED user
guards:
jwt0:
Expand Down