From 980f0e2b2333caeeb0b9880ae24738d5bcfddbd2 Mon Sep 17 00:00:00 2001 From: "Sudha.Jallu" Date: Thu, 27 Oct 2022 14:09:15 +0100 Subject: [PATCH] Apama Analytics EPL Apps tools for --- doc/performance-testing.rst | 10 ++++---- .../apamax/eplapplications/basetest.html | 6 ++--- .../apamax/eplapplications/connection.html | 6 ++--- .../apamax/eplapplications/eplapps.html | 6 ++--- .../apamax/eplapplications/perf/basetest.html | 8 +++--- .../apamax/eplapplications/platform.html | 12 ++++----- .../apamax/eplapplications/smartrules.html | 6 ++--- .../apamax/eplapplications/tenant.html | 6 ++--- doc/pydoc/_modules/index.html | 6 ++--- doc/pydoc/_static/documentation_options.js | 2 +- .../apamax.eplapplications.basetest.html | 6 ++--- .../apamax.eplapplications.buildVersions.html | 6 ++--- .../apamax.eplapplications.connection.html | 6 ++--- .../apamax.eplapplications.eplapps.html | 6 ++--- .../autodocgen/apamax.eplapplications.html | 6 ++--- .../apamax.eplapplications.perf.basetest.html | 6 ++--- .../apamax.eplapplications.perf.html | 6 ++--- ...apamax.eplapplications.perf.publisher.html | 6 ++--- .../apamax.eplapplications.platform.html | 6 ++--- .../apamax.eplapplications.smartrules.html | 6 ++--- .../apamax.eplapplications.tenant.html | 6 ++--- doc/pydoc/autodocgen/apamax.html | 6 ++--- doc/pydoc/genindex.html | 6 ++--- doc/pydoc/index.html | 10 ++++---- doc/pydoc/objects.inv | Bin 1595 -> 1595 bytes doc/pydoc/performance-testing.html | 16 ++++++------ doc/pydoc/py-modindex.html | 6 ++--- doc/pydoc/search.html | 6 ++--- doc/pydoc/searchindex.js | 2 +- doc/pydoc/testing-epl.html | 16 ++++++------ doc/pydoc/using-eplapp.html | 6 ++--- doc/pydoc/using-pysys.html | 24 +++++++++--------- doc/testing-epl.rst | 10 ++++---- doc/using-pysys.rst | 12 ++++----- readme.rst | 18 ++++++------- scripts/eplapp.py | 2 +- .../Input/measurementCreator.py | 2 +- .../apamax/eplapplications/buildVersions.py | 2 +- .../apamax/eplapplications/perf/basetest.py | 4 +-- .../apamax/eplapplications/platform.py | 8 +++--- 40 files changed, 143 insertions(+), 147 deletions(-) diff --git a/doc/performance-testing.rst b/doc/performance-testing.rst index 6c27d74..57638c3 100644 --- a/doc/performance-testing.rst +++ b/doc/performance-testing.rst @@ -19,7 +19,7 @@ An EPL app or a smart rule can be either tested against real devices or simulate + Generating the performance reports. + Writing a test for a multi-tenant microservice. -This document demonstrates the common process involved in writing a performance test for your existing EPL apps and smart rules. The performance tests described in the document use the EPL apps SDK based on the PySys test framework. See the `PySys documentation `_ for details on the installation, and how the framework can be used and the facilities it contains. Set up the EPL apps SDK by following the steps mentioned in :ref:`Setup for testing in the Cumulocity IoT cloud `. +This document demonstrates the common process involved in writing a performance test for your existing EPL apps and smart rules. The performance tests described in the document use the EPL apps SDK based on the PySys test framework. See the `PySys documentation `_ for details on the installation, and how the framework can be used and the facilities it contains. Set up the EPL apps SDK by following the steps mentioned in `Testing in the Cumulocity IoT cloud `_. Writing a performance test =========================== @@ -72,7 +72,7 @@ Once the default value is defined with a static attribute, you can override the pysys run -XmyTestDuration=10 -XmeasurementType="MyMeasurement" -See the `PySys test options `_ in the PySys documentation for details on configuring and overriding test options. +See the `PySys test options `_ in the PySys documentation for details on configuring and overriding test options. Preparing the Cumulocity IoT tenant ------------------------------------ @@ -408,7 +408,7 @@ See the OnExplicitThresholdCreateAlarm_MultiTenant sample in the smartrules-perf Running the performance test ============================= -Performance tests can only be run using a Cumulocity IoT tenant with EPL apps and smart rules enabled. Set up the framework to use a Cumulocity IoT tenant by following the steps mentioned in :ref:`Setup for testing in the Cumulocity IoT cloud `. +Performance tests can only be run using a Cumulocity IoT tenant with EPL apps and smart rules enabled. Set up the framework to use a Cumulocity IoT tenant by following the steps mentioned in `Testing in the Cumulocity IoT cloud `_. When running a test, test options can be overridden by using the ``-X`` argument. See `Defining the test options`_ for details on defining and providing test options. @@ -418,7 +418,7 @@ For example, to change the test duration of the ``AlarmOnThreshold`` test, run t pysys run -XtestDuration=180 AlarmOnThreshold -At the end of the test, a basic validation of the test run is performed. See `PySys helpers `_ in the EPL Apps Tools documentation for details on validations performed. +At the end of the test, a basic validation of the test run is performed. See `PySys helpers `_ in the EPL Apps Tools documentation for details on validations performed. Performance report @@ -470,7 +470,7 @@ Multiple sample EPL apps and tests can be found in the samples-performance direc | +-----correctness/ | +-----performance/ -The apps directory contains multiple sample apps for performance testing. The correctness directory contains basic correctness tests of the sample apps. It is recommended to always test your EPL apps for correctness before testing them for performance. See :doc:`Using PySys to test your EPL apps ` for details on testing EPL apps for correctness. The performance directory contains performance tests for each sample app. These tests can be run as explained in `Running the performance test`_. +The apps directory contains multiple sample apps for performance testing. The correctness directory contains basic correctness tests of the sample apps. It is recommended to always test your EPL apps for correctness before testing them for performance. See `Using PySys to test your EPL apps `_ for details on testing EPL apps for correctness. The performance directory contains performance tests for each sample app. These tests can be run as explained in `Running the performance test`_. Sample smart rule performance tests =================================== diff --git a/doc/pydoc/_modules/apamax/eplapplications/basetest.html b/doc/pydoc/_modules/apamax/eplapplications/basetest.html index 2c757fd..803820e 100644 --- a/doc/pydoc/_modules/apamax/eplapplications/basetest.html +++ b/doc/pydoc/_modules/apamax/eplapplications/basetest.html @@ -4,7 +4,7 @@ - apamax.eplapplications.basetest — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.basetest — EPL Apps Tools 10.15.0.2 documentation @@ -26,7 +26,7 @@

Navigation

  • modules |
  • - + @@ -676,7 +676,7 @@

    Navigation

  • modules |
  • - + diff --git a/doc/pydoc/_modules/apamax/eplapplications/connection.html b/doc/pydoc/_modules/apamax/eplapplications/connection.html index 4cb032f..9586927 100644 --- a/doc/pydoc/_modules/apamax/eplapplications/connection.html +++ b/doc/pydoc/_modules/apamax/eplapplications/connection.html @@ -4,7 +4,7 @@ - apamax.eplapplications.connection — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.connection — EPL Apps Tools 10.15.0.2 documentation @@ -26,7 +26,7 @@

    Navigation

  • modules |
  • - + @@ -177,7 +177,7 @@

    Navigation

  • modules |
  • - + diff --git a/doc/pydoc/_modules/apamax/eplapplications/eplapps.html b/doc/pydoc/_modules/apamax/eplapplications/eplapps.html index 24e9d21..f96142e 100644 --- a/doc/pydoc/_modules/apamax/eplapplications/eplapps.html +++ b/doc/pydoc/_modules/apamax/eplapplications/eplapps.html @@ -4,7 +4,7 @@ - apamax.eplapplications.eplapps — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.eplapps — EPL Apps Tools 10.15.0.2 documentation @@ -26,7 +26,7 @@

    Navigation

  • modules |
  • - + @@ -274,7 +274,7 @@

    Navigation

  • modules |
  • - + diff --git a/doc/pydoc/_modules/apamax/eplapplications/perf/basetest.html b/doc/pydoc/_modules/apamax/eplapplications/perf/basetest.html index 45bc8a5..923562d 100644 --- a/doc/pydoc/_modules/apamax/eplapplications/perf/basetest.html +++ b/doc/pydoc/_modules/apamax/eplapplications/perf/basetest.html @@ -4,7 +4,7 @@ - apamax.eplapplications.perf.basetest — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.perf.basetest — EPL Apps Tools 10.15.0.2 documentation @@ -26,7 +26,7 @@

    Navigation

  • modules |
  • - + @@ -179,7 +179,7 @@

    Source code for apamax.eplapplications.perf.basetest

    # Stop monitoring thread if self.perfMonitorThread: # Do not stop perf monitoring thread if testing against multi-tenant microservice - # and tenant is specified explicitly, because we need to monitor all tenants at once. + # and tenant is specified explicitly. because we need to monitor all tenants at once. if not (self.platform.isMultiTenantMicroservice() and tenant is not None): self.perfMonitorThread.stop() self.perfMonitorThread.join() @@ -1157,7 +1157,7 @@

    Navigation

  • modules |
  • - +
    diff --git a/doc/pydoc/_modules/apamax/eplapplications/platform.html b/doc/pydoc/_modules/apamax/eplapplications/platform.html index f302070..ebbb9fe 100644 --- a/doc/pydoc/_modules/apamax/eplapplications/platform.html +++ b/doc/pydoc/_modules/apamax/eplapplications/platform.html @@ -4,7 +4,7 @@ - apamax.eplapplications.platform — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.platform — EPL Apps Tools 10.15.0.2 documentation @@ -26,7 +26,7 @@

    Navigation

  • modules |
  • - + @@ -123,10 +123,8 @@

    Source code for apamax.eplapplications.platform

    < instances = {} try: while len(instances) == 0: - res = self._c8yConn.do_get("/inventory/managedObjects?type=c8y_Application_%s" % self._applicationId) - if len(res["managedObjects"]) == 0: - break # this means we got the wrong one - instances = res["managedObjects"][0]["c8y_Subscriptions"][self._remoteTenantId]["instances"].keys() + applicationStatus = self._c8yConn.do_get(f"/application/applications/{self._applicationId}/status?refresh=true") + instances = applicationStatus['c8y_Status']['instances'] time.sleep(1.0) if len(instances) > 0: self._instanceName = list(instances)[0] @@ -302,7 +300,7 @@

    Navigation

  • modules |
  • - +
    diff --git a/doc/pydoc/_modules/apamax/eplapplications/smartrules.html b/doc/pydoc/_modules/apamax/eplapplications/smartrules.html index e5a26f1..ef91cc7 100644 --- a/doc/pydoc/_modules/apamax/eplapplications/smartrules.html +++ b/doc/pydoc/_modules/apamax/eplapplications/smartrules.html @@ -4,7 +4,7 @@ - apamax.eplapplications.smartrules — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.smartrules — EPL Apps Tools 10.15.0.2 documentation @@ -26,7 +26,7 @@

    Navigation

  • modules |
  • - + @@ -834,7 +834,7 @@

    Navigation

  • modules |
  • - + diff --git a/doc/pydoc/_modules/apamax/eplapplications/tenant.html b/doc/pydoc/_modules/apamax/eplapplications/tenant.html index 119b1c8..1a78619 100644 --- a/doc/pydoc/_modules/apamax/eplapplications/tenant.html +++ b/doc/pydoc/_modules/apamax/eplapplications/tenant.html @@ -4,7 +4,7 @@ - apamax.eplapplications.tenant — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.tenant — EPL Apps Tools 10.15.0.2 documentation @@ -26,7 +26,7 @@

    Navigation

  • modules |
  • - + @@ -137,7 +137,7 @@

    Navigation

  • modules |
  • - + diff --git a/doc/pydoc/_modules/index.html b/doc/pydoc/_modules/index.html index 01374a3..503a14c 100644 --- a/doc/pydoc/_modules/index.html +++ b/doc/pydoc/_modules/index.html @@ -4,7 +4,7 @@ - Overview: module code — EPL Apps Tools 10.14.0.3 documentation + Overview: module code — EPL Apps Tools 10.15.0.2 documentation @@ -26,7 +26,7 @@

    Navigation

  • modules |
  • - + @@ -82,7 +82,7 @@

    Navigation

  • modules |
  • - + @@ -137,7 +137,7 @@

    Navigation

  • previous |
  • - + diff --git a/doc/pydoc/autodocgen/apamax.eplapplications.perf.basetest.html b/doc/pydoc/autodocgen/apamax.eplapplications.perf.basetest.html index 4d01396..cca4c97 100644 --- a/doc/pydoc/autodocgen/apamax.eplapplications.perf.basetest.html +++ b/doc/pydoc/autodocgen/apamax.eplapplications.perf.basetest.html @@ -4,7 +4,7 @@ - apamax.eplapplications.perf.basetest — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.perf.basetest — EPL Apps Tools 10.15.0.2 documentation @@ -34,7 +34,7 @@

    Navigation

  • previous |
  • - + @@ -467,7 +467,7 @@

    Navigation

  • previous |
  • - + diff --git a/doc/pydoc/autodocgen/apamax.eplapplications.perf.html b/doc/pydoc/autodocgen/apamax.eplapplications.perf.html index 48e5da1..9844035 100644 --- a/doc/pydoc/autodocgen/apamax.eplapplications.perf.html +++ b/doc/pydoc/autodocgen/apamax.eplapplications.perf.html @@ -4,7 +4,7 @@ - apamax.eplapplications.perf — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.perf — EPL Apps Tools 10.15.0.2 documentation @@ -34,7 +34,7 @@

    Navigation

  • previous |
  • - + @@ -124,7 +124,7 @@

    Navigation

  • previous |
  • - + diff --git a/doc/pydoc/autodocgen/apamax.eplapplications.perf.publisher.html b/doc/pydoc/autodocgen/apamax.eplapplications.perf.publisher.html index 5c51cb7..129e417 100644 --- a/doc/pydoc/autodocgen/apamax.eplapplications.perf.publisher.html +++ b/doc/pydoc/autodocgen/apamax.eplapplications.perf.publisher.html @@ -4,7 +4,7 @@ - apamax.eplapplications.perf.publisher — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.perf.publisher — EPL Apps Tools 10.15.0.2 documentation @@ -34,7 +34,7 @@

    Navigation

  • previous |
  • - + @@ -111,7 +111,7 @@

    Navigation

  • previous |
  • - + diff --git a/doc/pydoc/autodocgen/apamax.eplapplications.platform.html b/doc/pydoc/autodocgen/apamax.eplapplications.platform.html index bd63daf..870e8da 100644 --- a/doc/pydoc/autodocgen/apamax.eplapplications.platform.html +++ b/doc/pydoc/autodocgen/apamax.eplapplications.platform.html @@ -4,7 +4,7 @@ - apamax.eplapplications.platform — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.platform — EPL Apps Tools 10.15.0.2 documentation @@ -34,7 +34,7 @@

    Navigation

  • previous |
  • - + @@ -193,7 +193,7 @@

    Navigation

  • previous |
  • - + diff --git a/doc/pydoc/autodocgen/apamax.eplapplications.smartrules.html b/doc/pydoc/autodocgen/apamax.eplapplications.smartrules.html index 07aa7a3..87a8ee7 100644 --- a/doc/pydoc/autodocgen/apamax.eplapplications.smartrules.html +++ b/doc/pydoc/autodocgen/apamax.eplapplications.smartrules.html @@ -4,7 +4,7 @@ - apamax.eplapplications.smartrules — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.smartrules — EPL Apps Tools 10.15.0.2 documentation @@ -34,7 +34,7 @@

    Navigation

  • previous |
  • - + @@ -705,7 +705,7 @@

    Navigation

  • previous |
  • - + diff --git a/doc/pydoc/autodocgen/apamax.eplapplications.tenant.html b/doc/pydoc/autodocgen/apamax.eplapplications.tenant.html index 7d719a9..811d93b 100644 --- a/doc/pydoc/autodocgen/apamax.eplapplications.tenant.html +++ b/doc/pydoc/autodocgen/apamax.eplapplications.tenant.html @@ -4,7 +4,7 @@ - apamax.eplapplications.tenant — EPL Apps Tools 10.14.0.3 documentation + apamax.eplapplications.tenant — EPL Apps Tools 10.15.0.2 documentation @@ -30,7 +30,7 @@

    Navigation

  • previous |
  • - + @@ -143,7 +143,7 @@

    Navigation

  • previous |
  • - + diff --git a/doc/pydoc/autodocgen/apamax.html b/doc/pydoc/autodocgen/apamax.html index dc57872..7618e41 100644 --- a/doc/pydoc/autodocgen/apamax.html +++ b/doc/pydoc/autodocgen/apamax.html @@ -4,7 +4,7 @@ - PySys helpers for EPL apps — EPL Apps Tools 10.14.0.3 documentation + PySys helpers for EPL apps — EPL Apps Tools 10.15.0.2 documentation @@ -34,7 +34,7 @@

    Navigation

  • previous |
  • - + @@ -105,7 +105,7 @@

    Navigation

  • previous |
  • - + @@ -517,7 +517,7 @@

    Navigation

  • modules |
  • - + @@ -47,8 +47,8 @@

    Introductionhttps://www.apamacommunity.com/docs> and <https://cumulocity.com/guides/apama> for further docs. -See apama-eplapps-tools for the main github respoitory.

    +

    See Apama Documentation and Streaming Analytics guide for further docs. +See apama-eplapps-tools for the main github respoitory.

    Contents

    @@ -151,7 +151,7 @@

    Navigation

  • next |
  • - +
    @@ -65,7 +65,7 @@

    IntroductionPySys documentation for details on the installation, and how the framework can be used and the facilities it contains. Set up the EPL apps SDK by following the steps mentioned in Setup for testing in the Cumulocity IoT cloud.

    +

    This document demonstrates the common process involved in writing a performance test for your existing EPL apps and smart rules. The performance tests described in the document use the EPL apps SDK based on the PySys test framework. See the PySys documentation for details on the installation, and how the framework can be used and the facilities it contains. Set up the EPL apps SDK by following the steps mentioned in Testing in the Cumulocity IoT cloud.

    Writing a performance test

    @@ -108,7 +108,7 @@

    Defining the test options
    pysys run -XmyTestDuration=10 -XmeasurementType="MyMeasurement"
     

    -

    See the PySys test options in the PySys documentation for details on configuring and overriding test options.

    +

    See the PySys test options in the PySys documentation for details on configuring and overriding test options.

    Preparing the Cumulocity IoT tenant

    @@ -399,13 +399,13 @@

    Writing a test for a multi-tenant microservice

    Running the performance test

    -

    Performance tests can only be run using a Cumulocity IoT tenant with EPL apps and smart rules enabled. Set up the framework to use a Cumulocity IoT tenant by following the steps mentioned in Setup for testing in the Cumulocity IoT cloud.

    +

    Performance tests can only be run using a Cumulocity IoT tenant with EPL apps and smart rules enabled. Set up the framework to use a Cumulocity IoT tenant by following the steps mentioned in Testing in the Cumulocity IoT cloud.

    When running a test, test options can be overridden by using the -X argument. See Defining the test options for details on defining and providing test options.

    For example, to change the test duration of the AlarmOnThreshold test, run the following:

    pysys run -XtestDuration=180 AlarmOnThreshold
     
    -

    At the end of the test, a basic validation of the test run is performed. See PySys helpers in the EPL Apps Tools documentation for details on validations performed.

    +

    At the end of the test, a basic validation of the test run is performed. See PySys helpers in the EPL Apps Tools documentation for details on validations performed.

    Performance report

    @@ -454,7 +454,7 @@

    Sample EPL apps and tests+—–correctness/

    +—–performance/
    -

    The apps directory contains multiple sample apps for performance testing. The correctness directory contains basic correctness tests of the sample apps. It is recommended to always test your EPL apps for correctness before testing them for performance. See Using PySys to test your EPL apps for details on testing EPL apps for correctness. The performance directory contains performance tests for each sample app. These tests can be run as explained in Running the performance test.

    +

    The apps directory contains multiple sample apps for performance testing. The correctness directory contains basic correctness tests of the sample apps. It is recommended to always test your EPL apps for correctness before testing them for performance. See Using PySys to test your EPL apps for details on testing EPL apps for correctness. The performance directory contains performance tests for each sample app. These tests can be run as explained in Running the performance test.

    Sample smart rule performance tests

    @@ -529,7 +529,7 @@

    Navigation

  • previous |
  • - +
    @@ -150,7 +150,7 @@

    Navigation

  • modules |
  • - + @@ -89,7 +89,7 @@

    Navigation

  • modules |
  • - + @@ -60,12 +60,12 @@

    IntroductionTesting the performance of your EPL apps and smart rules document for writing performance tests.

    +

    See the Testing the performance of your EPL apps and smart rules document for writing performance tests.

    Creating device simulators

    All measurements and alarms in Cumulocity IoT must be associated with a source. Devices in Cumulocity IoT are represented by managed objects, each of which has a unique identifier. When sending measurement or alarm events, the source field of these events must be set to a identifier of a managed object in Cumulocity IoT. Therefore, in order to send measurements from our test EPL app, it must create a ManagedObject device simulator to be the source of these measurements.

    -

    If you are using the PySys framework to run tests in the cloud, any devices created by your tests should be named with prefix “PYSYS_”, and have the c8y_IsDevice property. These indicators are what the framework uses to identify which devices should be deleted following a test. Note that deleting a device in Cumulocity IoT will also delete any alarms or measurements associated with that device so the cleanup from a test is done when another test is next run.

    +

    If you are using the PySys framework to run tests in the cloud, any devices created by your tests should be named with prefix “PYSYS_”, and have the c8y_IsDevice property. These indicators are what the framework uses to identify which devices should be deleted following a test. Note that deleting a device in Cumulocity IoT will also delete any alarms or measurements associated with that device so the cleanup from a test is done when another test is next run.

    To see how this can be done, have a look at the createNewDevice action below:

    action createNewDevice(string name) returns integer
     {
    @@ -101,7 +101,7 @@ 

    Introduction}

    -

    This action initializes a ManagedObject (using the “PYSYS_” naming prefix and adding the c8y_IsDevice property), before sending it using a withResponse action. It then confirms that it has been successfully created using listeners for ObjectCommitted and ObjectCommitFailed events. Whenever you are creating or updating an object in Cumulocity IoT and you want to verify that the change has been successful, it is recommended that you use the withResponse action in conjunction with ObjectCommitted and ObjectCommitFailed listeners (for more information, see the information on updating a managed object in the ‘The Cumulocity IoT Transport Connectivity Plug-in’ section of the documentation). Using this approach you can easily relay when the process has completed (which is done by sending an event, DeviceCreated, in the example above), and in the event of an error you can cause the test to exit quickly.

    +

    This action initializes a ManagedObject (using the “PYSYS_” naming prefix and adding the c8y_IsDevice property), before sending it using a withResponse action. It then confirms that it has been successfully created using listeners for ObjectCommitted and ObjectCommitFailed events. Whenever you are creating or updating an object in Cumulocity IoT and you want to verify that the change has been successful, it is recommended that you use the withResponse action in conjunction with ObjectCommitted and ObjectCommitFailed listeners (for more information, see the information on updating a managed object in the ‘The Cumulocity IoT Transport Connectivity Plug-in’ section of the documentation). Using this approach you can easily relay when the process has completed (which is done by sending an event, DeviceCreated, in the example above), and in the event of an error you can cause the test to exit quickly.

    Sending events to your EPL apps

    @@ -170,7 +170,7 @@

    Receiving events from your EPL apps

    Querying Cumulocity IoT

    -

    An alternative approach to the one demonstrated in the ‘Receiving events from your EPL apps’ section involves querying Cumulocity IoT. With this approach you are able to retrieve historical data. It is possible to query Cumulocity IoT for alarms, events, measurements, operations, and managed objects. More information on querying can be found in ‘The Cumulocity IoT Transport Connectivity Plug-in’ section of the documentation.

    +

    An alternative approach to the one demonstrated in the ‘Receiving events from your EPL apps’ section involves querying Cumulocity IoT. With this approach you are able to retrieve historical data. It is possible to query Cumulocity IoT for alarms, events, measurements, operations, and managed objects. More information on querying can be found in ‘The Cumulocity IoT Transport Connectivity Plug-in’ section of the documentation.

    Using an example of a test that checks for an alarm, this would involve subscribing to the FindAlarmResponse.SUBSCRIBE_CHANNEL and using a FindAlarm event with FindAlarmResponse and FindAlarmResponseAck listeners:

    on DeviceCreated(reqId=createNewDevice("DeviceSimulator")) as device
     {
    @@ -226,7 +226,7 @@ 

    Summary

    EPL test samples

    -

    A sample EPL app and test can be found in the samples directory of the EPL Apps Tools SDK. Most of the EPL code snippets in this document are from the sample test, AlarmOnMeasurementThresholdTest, which can be found in the Input directory of any of the samples provided. This tests the sample EPL app, AlarmOnMeasurementThreshold, which can be found in the samples/apps directory of the SDK. Information on how to run the sample test can be found in the Using PySys to test your EPL apps document.

    +

    A sample EPL app and test can be found in the samples directory of the EPL Apps Tools SDK. Most of the EPL code snippets in this document are from the sample test, AlarmOnMeasurementThresholdTest, which can be found in the Input directory of any of the samples provided. This tests the sample EPL app, AlarmOnMeasurementThreshold, which can be found in the samples/apps directory of the SDK. Information on how to run the sample test can be found in the Using PySys to test your EPL apps document.

    @@ -288,7 +288,7 @@

    Navigation

  • previous |
  • - + @@ -181,7 +181,7 @@

    Navigation

  • previous |
  • - + @@ -53,7 +53,7 @@

    Using PySys to test your EPL apps

    Introduction

    PySys is a testing framework that provides a way to test your applications.

    -

    See PySys Documentation for details on installation and how the framework can be used and the facilities it contains.

    +

    See PySys Documentation for details on installation and how the framework can be used and the facilities it contains.

    Testing in the Cumulocity IoT cloud

    @@ -74,13 +74,13 @@

    Introduction

    Creating a test

    -

    See Testing the performance of your EPL apps and smart rules for details on creating and running performance tests.

    +

    See Testing the performance of your EPL apps and smart rules for details on creating and running performance tests.

    To create a test, you can either copy an existing test (such as one of our samples) and rename it, or by running:

    pysys make TestName
     

    If you do this, the default PySys test case comes with a run.py file. For these tests, you should remove that file, it is not needed. If you do want to use it, see the ‘Advanced tests’ section below.

    -

    A PySys test case comprises a directory with a unique name, containing a pysystest.xml and an Input directory containing your test EPL monitors. These should be written according to the Writing tests for EPL apps document, for example, AlarmOnMeasurementThresholdTest.mon in the provided samples. In particular, they must terminate either by all the listeners terminating or with an explicit ‘die’ statement.

    +

    A PySys test case comprises a directory with a unique name, containing a pysystest.xml and an Input directory containing your test EPL monitors. These should be written according to the Writing tests for EPL apps document, for example, AlarmOnMeasurementThresholdTest.mon in the provided samples. In particular, they must terminate either by all the listeners terminating or with an explicit ‘die’ statement.

    The test is configured through the pysystest.xml file. This contains the title and purpose, which you should use for a description of what your test does. You must also use it to specify how to run your test. To run a test using Apama EPL Apps in your Cumulocity IoT tenant, you must add the following block:

    <data>
       <class name="EPLAppsSimpleTest" module="${EPL_TESTING_SDK}/testframework/apamax/eplapplications/basetest"/>
    @@ -116,7 +116,7 @@ 

    Running the testTesting the performance of your EPL apps and smart rules for details on running performance tests.

    +

    See Testing the performance of your EPL apps and smart rules for details on running performance tests.

    @@ -130,8 +130,8 @@

    Testing locally -

    Running the test

    +
    +

    Running the test

    To run the test using a local correlator requires the APAMA_HOME project property to be set as the path to your installation of Apama. This can be done by simply running the test in an Apama command prompt or by explicitly setting the APAMA_HOME environment variable.

    The sample for running with a local correlator is as below:

    @@ -158,8 +158,8 @@

    Running the test

    Advanced tests

    For anyone who already knows how to use PySys and wants to write Python code for their test running and validation, it is possible to also add a run.py to your test case. We provide samples of tests both running within Apama EPL Apps and with a local correlator in the advanced directory of the samples.

    -

    In order to view documentation on classes for PySys helpers for EPL Apps please see: PySys helpers

    -

    See Testing the performance of your EPL apps and smart rules for details on writing performance tests.

    +

    In order to view documentation on classes for PySys helpers for EPL Apps please see: PySys helpers

    +

    See Testing the performance of your EPL apps and smart rules for details on writing performance tests.

    To run in Apama EPL Apps, your run.py should look something like this:

    from apamax.eplapplications.basetest import ApamaC8YBaseTest
     class PySysTest(ApamaC8YBaseTest):
    @@ -240,7 +240,7 @@ 

    Table of Contents

  • Testing locally
  • Advanced tests
  • @@ -279,7 +279,7 @@

    Navigation

  • previous |
  • - +