com.tibco.cep.runtime.service.tester.beunit

## Class TestDataHelper

- java.lang.Object
- - com.tibco.cep.runtime.service.tester.beunit.TestDataHelper

-     public class TestDataHelper
      extends java.lang.Object

  Helper class used in the BEUnit test framework to assist in the creation of Concepts and Events. This supports JSON formatted strings as well as standard Test Data files created through BusinessEvents Studio.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TestDataHelper(BETestEngine engine)` Create a new instance of TestDataHelper
    `TestDataHelper(java.lang.String projPath, TypeManager mgr)` Create a new instance of TestDataHelper

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Concept` | `createConceptFromJSON(java.lang.String instanceURI, java.lang.String json)`
    `java.util.List` | `createConceptsFromTestData(java.lang.String resourcePath)` Creates a List of Concept instances from the specified test data file.
    `Event` | `createEventFromJSON(java.lang.String eventURI, java.lang.String json)`
    `java.util.List` | `createEventsFromTestData(java.lang.String resourcePath)` Creates a List of Event instances from the specified test data file.
    `java.util.List` | `createScorecardsFromTestData(java.lang.String resourcePath)` Creates a List of Concept (Scorecard) instances from the specified test data file.

- - ### Constructor Detail

    - #### TestDataHelper

          public TestDataHelper(java.lang.String projPath,
                                TypeManager mgr)

      Create a new instance of TestDataHelper
      Parameters:
        `projPath` - The path to the project
        `mgr` - The TypeManager from the BETestEngine

    - #### TestDataHelper

          public TestDataHelper(BETestEngine engine)

      Create a new instance of TestDataHelper
      Parameters:
        `engine` - The BETestEngine used during the unit test run

  - ### Method Detail

    - #### createEventFromJSON

          public Event createEventFromJSON(java.lang.String eventURI,
                                           java.lang.String json)

      Parameters:
        `eventURI` - The URI of the Event being created (i.e. '/Events/PromotionalEvent')
        `json` - The JSON string describing the Event's properties.
        For example:
        `"{\"PromotionalEvent\":{\"PriceAdjustment\":-250.0,\"SKU\":1234}}"`
      Returns:
        a newly created Event instance populated from the JSON string
      Throws:
        `java.lang.Exception`

    - #### createConceptFromJSON

          public Concept createConceptFromJSON(java.lang.String instanceURI,
                                               java.lang.String json)

      Parameters:
        `instanceURI` - The URI of the Concept being created (i.e. '/Concepts/Person')
        `json` - The JSON string describing the Concept's properties.
        For example:
        `"{\"Person\":{\"Age\":30,\"Name\":\"Jon\"}}"`
      Returns:
        a newly created Concept instance populated from the JSON string
      Throws:
        `java.lang.Exception`

    - #### createConceptsFromTestData

          public java.util.List createConceptsFromTestData(java.lang.String resourcePath)

      Creates a List of Concept instances from the specified test data file. If 'Use' is not selected for the test data row, the row will be ignored
      Parameters:
        `resourcePath` - The project relative path of the Concept data file (i.e. '/TestData/InventoryItem')
      Returns:
        The List of Concept instances created
      Throws:
        `java.lang.Exception`

    - #### createScorecardsFromTestData

          public java.util.List createScorecardsFromTestData(java.lang.String resourcePath)

      Creates a List of Concept (Scorecard) instances from the specified test data file. If 'Use' is not selected for the test data row, the row will be ignored
      Parameters:
        `resourcePath` - The project relative path of the Concept/Scorecard data file (i.e. '/TestData/InventoryItem')
      Returns:
        The List of Concept (Scorecard) instances created
      Throws:
        `java.lang.Exception`

    - #### createEventsFromTestData

          public java.util.List createEventsFromTestData(java.lang.String resourcePath)

      Creates a List of Event instances from the specified test data file. If 'Use' is not selected for the test data row, the row will be ignored
      Parameters:
        `resourcePath` - The project relative path of the Event data file (i.e. '/TestData/PromotionalEvent')
      Returns:
        The List of Event instances created
      Throws:
        `java.lang.Exception`