Test Resource Management

Collection of EPCIS 1.2/2.0 documents/events in XML/JSON/JSON-LD formats, intended for various testing purposes

Please find below the links to the OpenEPCIS tools and codes referenced on this documentation page:

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

Introduction

Developing applications that adhere to the EPCIS standard requires testing with a range of EPCIS documents, version and formats. However, managing and organizing these resources, particularly when used across multiple projects, can be a complex and time-consuming.

To address this challenge and enhance the efficiency of EPCIS application development, the OpenEPCIS has created a centralized repository of EPCIS test resources. This repository provides a comprehensive collection of EPCIS documents and events in versions 1.2/2.0 and in XML/JSON/JSON-LD formats.

Project Structure and Usage

The repository is organized to facilitate quick access to the resources:

  • 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

For programmatic access to the test resources, the ResourceFinder class provides the searchResource method. This method allows users to retrieve a list of matching resources based on specific 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 searchResource method returns a List<URL> containing the URLs of the matching files.

Usage Examples:

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

This code snippet retrieves a list of 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 example retrieves all EPCIS 1.2 documents, regardless of their format or content.

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

This example retrieves all EPCIS 2.0 documents that are in JSON format.

Integration:

Developers can easily integrate the ResourceFinder class into their testing frameworks or applications to automate the retrieval of EPCIS test resources.

Contribution

The OpenEPCIS project encourages community contributions to expand and improve the test resource repository. Developers can contribute by:

  • Adding new EPCIS documents and events.
  • Improving existing resources.
  • Providing feedback and suggestions.
  • Adding test cases that validate the documents.

By centralizing and standardizing EPCIS test resources, this project helps developers and users to develop and test various EPCIS applications more efficiently in less time.