Submitting a collection of events from a set of files
You can submit events that are defined in XML or JSON by using the test driver createFileEventSource(DataFormat format, String path) and submitEvents(Iterator<Event> events) methods.
About this task
You can convert data into events from XML or JSON files. You can use either the TYPED_XML, GENERIC_XML, or JSON data formats to submit events. XML files are read and converted into an event by using the event definitions in your business model definition, but you must use manually convert event data into the JSON format.
You can specify a name pattern to select the XML files that you want to be converted. When you create the EventSource, you can specify a regular expression, such as .*event, to select the files that you want from a directory. For more information about regular expressions, see the Java™ Tutorials Lesson: Regular Expressions.
You can also configure the EventSource implementation to take a specific action when an event type is not recognized. The following fields can be specified:
- SKIP_NO_FAILURE
-
If data is not recognized when processing an XML file, throw an exception. When data is not recognized, the event delivery is stopped and the submitEvents method throws the exception. Use this command field when you expect your solution to recognize all data in the files as events.
- SKIP_UNRECOGNIZED_EVENTS
-
If data is not recognized when processing an XML file, skip the file and process the next. Use this field when you expect the directory to contain files have both recognizable and unrecognizable data. When this field is used, event submission is not interrupted by an unexpected variation in event types.
Procedure
Results
Events are submitted in an order that is based on the implementation of the standard comparator for the Java File class. For more information, refer to the Java File class documentation.