assertTrue(found);
}
public void testTenantProvisionedNotification() throws Exception {
Tenant newTenant =
ApplicationServiceRegistry
.identityApplicationService()
.provisionTenant(
new ProvisionTenantCommand(
"All-Star Tenant",
"An all-star company.",
"Frank", "Oz",
"frank@allstartcompany.com",
"212-555-1211",
"212-555-1212",
"123 5th Avenue",
"New York",
"NY",
"11201",
"US"));
assertNotNull(newTenant);
String url = "http://localhost:" + PORT + "/notifications";
ClientRequest request = new ClientRequest(url);
ClientResponse<String> response = request.get(String.class);
String serializedNotifications = response.getEntity();
System.out.println(serializedNotifications);
NotificationLogReader log =
new NotificationLogReader(serializedNotifications);
assertFalse(log.isArchived());
assertNotNull(log.id());
boolean found = false;
for (NotificationReader notification : log) {
String typeName = notification.typeName();
if (typeName.endsWith("TenantProvisioned")) {
String tenantId = notification.eventStringValue("tenantId.id");
assertEquals(newTenant.tenantId().id(), tenantId);
found = true;
}
}