use of io.gravitee.management.model.EventEntity in project gravitee-management-rest-api by gravitee-io.
the class ApiService_StartTest method mockEvent.
private EventEntity mockEvent(EventType eventType) throws Exception {
final JsonNodeFactory factory = JsonNodeFactory.instance;
ObjectNode node = factory.objectNode();
node.set("id", factory.textNode(API_ID));
Map<String, String> properties = new HashMap<>();
properties.put(Event.EventProperties.API_ID.getValue(), API_ID);
properties.put(Event.EventProperties.USER.getValue(), USER_NAME);
Api api = new Api();
api.setId(API_ID);
EventEntity event = new EventEntity();
event.setType(eventType);
event.setId(UUID.randomUUID().toString());
event.setPayload(objectMapper.writeValueAsString(api));
event.setCreatedAt(new Date());
event.setUpdatedAt(event.getCreatedAt());
event.setProperties(properties);
return event;
}
Aggregations