DBZ-2282 additional assertions in IT, minor README update
This commit is contained in:
parent
35d40f1524
commit
26ed1bc67c
@ -28,7 +28,7 @@ Create an [Event Hubs namespace](https://docs.microsoft.com/azure/event-hubs/eve
|
||||
|
||||
### Create an Event Hub
|
||||
|
||||
Create an Event Hub (equivalent to a topic). Check the documentation for options on how do this using the [Azure Portal](https://docs.microsoft.com/azure/event-hubs/event-hubs-create?WT.mc_id=debezium-docs-abhishgu#create-an-event-hub), [Azure CLI](https://docs.microsoft.com/azure/event-hubs/event-hubs-quickstart-cli?WT.mc_id=debezium-docs-abhishgu#create-an-event-hub) etc.
|
||||
Create an Event Hub (equivalent to a topic) with `one` partition. Check the documentation for options on how do this using the [Azure Portal](https://docs.microsoft.com/azure/event-hubs/event-hubs-create?WT.mc_id=debezium-docs-abhishgu#create-an-event-hub), [Azure CLI](https://docs.microsoft.com/azure/event-hubs/event-hubs-quickstart-cli?WT.mc_id=debezium-docs-abhishgu#create-an-event-hub) etc.
|
||||
|
||||
### Build the module
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
*/
|
||||
package io.debezium.server.eventhubs;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -105,5 +107,19 @@ public void testEventHubs() throws Exception {
|
||||
events.forEach(event -> expected.add(event));
|
||||
return expected.size() >= MESSAGE_COUNT;
|
||||
});
|
||||
|
||||
// check whether the event data contains expected id i.e. 1001, 1002, 1003 and
|
||||
// 1004
|
||||
String eventBody = null;
|
||||
String expectedID = null;
|
||||
final String idPart = "\"id\":100";
|
||||
|
||||
// since all messages go to same partition, ordering will be maintained
|
||||
// (assuming no errors)
|
||||
for (int i = 0; i < MESSAGE_COUNT; i++) {
|
||||
eventBody = expected.get(i).getData().getBodyAsString();
|
||||
expectedID = idPart + String.valueOf(i + 1);
|
||||
assertTrue(eventBody.contains(expectedID), expectedID + " not found in payload");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user