Skip to content

The Evaluate Math Expression assertion can be used to evaluate complex mathematical expressions.

License

Notifications You must be signed in to change notification settings

ca-api-gateway-extensions/evaluate-math-expression

Repository files navigation

About

Build

In order to build the modular assertion run ./gradlew clean build

This will compile, test, and create the jar file. It will be available in build/libs

Adding Libraries

In order to build the custom assertions the CA API Gateway API jar is required to be put into the lib directory.

Run

Docker version of Gateway greatly helps us to deploy assertions / RESTMAN bundles quickly. Please follow the steps below to run the container Gateway prepopulated with this example assertion and example services.

  1. Open Shell or Command Prompt and navigate to the directory where this repository is cloned.
  2. Build the Assertion
      gradle build
    
  3. Ensure your docker environment is properly setup.
  4. Provide the CA API Gateway license at docker/license.xml.
  5. Execute the below docker-compose command to run the CA API Gateway container.
      docker-compose up
    
    • Provided docker-compose.yml ensures pulling the latest CA API Gateway image from the Docker Hub public repository and deploys the assertion that was just build.
  6. Wait until the Gateway container is started and is ready to receive messages.

Usage

This assertion can evaluate a mathematical expression. The expression may contain context variables, parantheses, and common math functions. The result is stored in a context variable. The precision of the result is also adjustable. Available functions include:

  • ABS: the absolute value of the parameter
  • ACOS: arccos or cos-1 of the parameter
  • ASIN: arcsin or sin-1 of the parameter
  • ATAN: arctan or tan-1 of the parameter
  • CBRT: the cube root of the parameter
  • CEIL: the ceiling of the parameter
  • COS: cosine of the parameter
  • COSH: hyperbolic cosine of the parameter
  • EXP: raises the constant e to the power of the parameter
  • EXPM1: raises the constant e to the power of the parameter and subtracts 1
  • FLOOR: the floor of the paramter
  • LOG: the natural logarithm of the parameter
  • SIN: sine of the parameter
  • SINH: hyperbolic sine of the parameter
  • SQRT: square root of the parameter
  • TAN: tangent of the parameter
  • TANH: hyperbolic tangent of the parameter

How You Can Contribute

Contributions are welcome and much appreciated. To learn more, see the Contribution Guidelines.

License

Copyright (c) 2018 CA. All rights reserved.

This software may be modified and distributed under the terms of the MIT license. See the LICENSE file for details.

About

The Evaluate Math Expression assertion can be used to evaluate complex mathematical expressions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •