How to build a new JAR file for Evaluate Math Expression Assertion?
search cancel

How to build a new JAR file for Evaluate Math Expression Assertion?

book

Article ID: 268231

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

The Evaluate Math Expression assertion was a tactical assertion but now it is available as open source in GitHub. You can build the new JAR file for the latest supported Gateway versions.

https://github.com/ca-api-gateway-extensions/evaluate-math-expression

The existing (or older) assertion may have the file named:

EvaluateMathExpressionAssertion-*.jar

EvaluateMathExpressionAssertion-sdk80-1.0-*.jar

EvaluateMathExpressionAssertion-sdk80-1.0-2383.jar

 

Environment

Release : 10.1 and above

Resolution

Prerequisites:

  • As Gateway 10.1 and above supports Java 11, make sure you have JDK 11 installed and available
  • Gradle is installed and available
  • Download CA_API_Gateway_Development_Tools_10.1.00.zip from the  support site and extract the CustomAssertion_dev_kit-10.1.00.11620.zip file

 

Here are the steps to build a new JAR file:

  • Clone the Git project
    • C:\gradle-test>git clone https://github.com/ca-api-gateway-extensions/evaluate-math-expression
      Cloning into 'evaluate-math-expression'...
      remote: Enumerating objects: 204, done.
      remote: Total 204 (delta 0), reused 0 (delta 0), pack-reused 204
      Receiving objects: 100% (204/204), 29.81 KiB | 726.00 KiB/s, done.
      Resolving deltas: 100% (46/46), done.
  • Copy the file layer7-api-8.11.01.jar from CustomAssertion_dev_kit-10.1.00.11620.zip file and place it in C:\gradle-test\evaluate-math-expression\lib folder
  • Rename it as layer7-api.jar
  • Run Gradle build
    • C:\gradle-test\evaluate-math-expression>gradle build

       

      BUILD SUCCESSFUL in 5s
      5 actionable tasks: 2 executed, 3 up-to-date

  • The new (EvaluateMathExpressionAssertion-1.0.0.jar) JAR file is available in C:\gradle-test\evaluate-math-expression\build\libs folder

 

Deploying the new file:

  • Copy this new file to the Gateway server and place it in the same folder as the old file
  • Stop the Gateway
  • Remove the old file (delete or move the file to the temp folder)
  • Start the Gateway

Additional Information

If you get any error as shown below then you must edit the build.gradle file in evaluate-math-expression folder.

 

Error:

C:\gradle-test\evaluate-math-expression>gradle build

> Task :test

com.l7tech.external.custom.evaluatemathexpression.EvaluateMathExpressionServiceInvocationTest > classMethod FAILED
    org.mockito.exceptions.base.MockitoException at DefaultInternalRunner.java:39
        Caused by: java.lang.UnsupportedOperationException at ClassInjector.java:821
            Caused by: java.lang.IllegalStateException at ClassInjector.java:1357
                Caused by: java.lang.NoSuchMethodException at Class.java:2108

1 test completed, 1 failed

> Task :test FAILED

FAILURE: Build failed with an exception.

 

Solution:

Edit the build.gradle file and change this

testCompile group: 'org.mockito', name: 'mockito-core', version: '2.15.0'
to
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.22.0'