Compiling a test project and creating a BAR file by using the command line

You can compile a test project and create a BAR file by using the App Connect Enterprise command line.

Before you begin

Read the following topics:

About this task

The ibmint generate tests command creates the build.gradle and settings.gradle files required to compile the test project, so that it can be packaged into a BAR file or copied directly into the run directory of an integration server, ready for the tests to be run.

The Gradle application is not supplied with App Connect Enterprise, but you can install it from https://gradle.org/install/.

Procedure

  1. At the command prompt, change to the directory that contains your test project and then start Gradle, as shown in the following example:
    
    # cd /tmp/MyIntegrationTestProject
    # gradle
    Starting a Gradle Daemon (subsequent builds will be faster)
    BUILD SUCCESSFUL in 15s
    2 actionable tasks: 2 executed
    When the command finishes, the tests in the integration test project (in this example, MyIntegrationTestProject) are ready to be run.
  2. Optional: Build a BAR file containing the test project by using the ibmint package command, as shown in the following example:
    ibmint package --input-path /tmp/MyIntegrationTestProject --output-bar-file /tmp/MyIntegrationTestProject.bar --do-not-compile-java
  3. Optional: Run the tests by copying the output directory (which has the same name as the test project) to the run directory of your integration server. The application that contains the message flows required by the test project must also be deployed; if it has not yet been deployed, copy the application BAR file into the integration server's run directory.
    1. Create an integration server work directory if you have not done so already.
      For example:
      # mqsicreateworkdir /tmp/work-dir
      mqsicreateworkdir: Copying sample server.config.yaml to work directory
      1 file(s) copied.
      Successful command completion.
      
    2. Copy the compiled test project to the run directory:
      # cp -r /tmp/MyIntegrationTestProject /tmp/work-dir/run
    3. Copy the application BAR file to the integration server run directory, if it is not already deployed:
      # cp ../MyApplication.bar /tmp/work-dir/run
    4. Run the IntegrationServer command to start the integration server, specifying the name of the test project by using the --test-project parameter, as shown in the following example:
      
      # IntegrationServer –work-dir /tmp/work-dir --test-project MyIntegrationTestProject 
      --start-msgflows false
      .......2021-01-25 12:16:16.457748: [Thread 44425] (Msg 1/1) BIP9901I: Messages are
      now being recorded and stored at '/tmp/recorded_messages'.
      .............2021-01-25 12:16:20.274600: [Thread 44425] (Msg 1/1) BIP2155I: About to
      'Initialize' the deployed resource 'App1' of type 'Application'.
      ..2021-01-25 12:16:21.016478: [Thread 44501] (Msg 1/1) BIP2866I: IBM App Connect
      Enterprise administration security is inactive.
      2021-01-25 12:16:21.040458: [Thread 44501] (Msg 1/1) BIP3132I: The HTTP Listener
      has started listening on port '7600' for 'RestAdmin http' connections.
      2021-01-25 12:16:21.459 1 STARTING
      TEST:App1_Flow1_Pass_through_TestCase_001()
      2021-01-25 12:16:21.528 1 FINISHED
      TEST:App1_Flow1_Pass_through_TestCase_001() SUCCESSFUL
      2021-01-25 12:16:21.542 1
      TEST RESULTS:
       com.ibm.mytests.MyIntegrationTestClass:
       App1_Flow1_Pass_through_TestCase_001():SUCCESSFUL
      TOTALS:
       PASSED :1
       FAILED :0
       ABORTED :0
       TIME(secs):0.157

      In this example, the --start-msgflows false parameter prevents the deployed message flows from starting and accepting requests through their input nodes, but still allows the tests to run.