Test Resource Management

A shared collection of EPCIS 1.2 and 2.0 documents and events in XML, JSON and JSON-LD for testing EPCIS applications.

The source code of the test resources is on GitHub:

• Test Resources application code: https://github.com/openepcis/openepcis-test-resources

Introduction

OpenEPCIS keeps its EPCIS test documents and events in one central repository, covering versions 1.2 and 2.0 in XML, JSON and JSON-LD. Applications that implement the EPCIS standard have to be tested against many documents, versions and formats, and keeping those files organized becomes laborious once several projects use them. A single shared collection lets every project draw on the same set of files.

Project Structure and Usage

The resources are grouped by version and format:

  • 1.2 XML Documents: A collection of sample 1.2 EPCIS events and documents in XML format.
  • 2.0 XML Documents: A collection of sample 2.0 EPCIS events and documents in XML format.
  • JSON/JSON-LD Documents: Equivalent resources in JSON and JSON-LD.

ResourceFinder: programmatic access

In code, the ResourceFinder class gives access to the resources through its searchResource method, which returns the resources that match three criteria:

  • EPCIS Version: The EPCIS version (e.g., "1.2", "2.0").
  • EPCIS Format: The desired data format (e.g., "xml", "json"). An empty string ("") retrieves resources of all formats.
  • Keyword: A keyword to filter resources based on their content or filename (e.g., "error", "aggregation"). A null keyword retrieves all resources.

The method returns a List<URL> with the URLs of the matching files. The following examples show typical queries.

  1. Retrieving EPCIS 2.0 JSON documents with "errorDeclaration":
final List<URL> filesList=ResourceFinder.searchResource("2.0","json","error");

This returns all EPCIS 2.0 documents in JSON format that contain the keyword "error" in their filename or content.

  1. Retrieving all EPCIS 1.2 documents:
final List<URL> filesList=ResourceFinder.searchResource("1.2","",null);

This returns all EPCIS 1.2 documents in any format and with any content.

  1. Retrieving all EPCIS 2.0 JSON documents:
final List<URL> filesList=ResourceFinder.searchResource("2.0","json","");

This returns all EPCIS 2.0 documents in JSON format.

Because the lookup is a plain method call, ResourceFinder fits into existing test frameworks and applications, which can then load EPCIS test resources automatically.

Contribution

Contributions from the community help the collection grow. You can add new EPCIS documents and events, improve existing resources, add test cases that validate the documents, or send feedback and suggestions.