Skip to Main Content
Integration


This is an IBM Automation portal for Integration products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.


Status Delivered
Workspace App Connect
Created by Guest
Created on Apr 21, 2018

Better test framework for IBM IIB/ACE 11

Currently, there is no possibility to work with IBM Integration bus or the new ACE 11 in a test-driven process.

For example in java you can use a test framework like JUNIT and write your tests first, run them (they will fail), add code and make them pass step by step until all the tests are finished.

Simply put, the tests can then be seen as specification of the problem. It also helps to ensure that new code doesn't break the existing solution. It also helps when you try to refactor existing code.

A similar framework would be extremely beneficial in IBM IIB or ACE 11.

In essence, what I would like to use is a JUNIT style framework for integration built-in to the product.

Idea priority High
RFE ID 119156
RFE URL
RFE Product IBM App Connect Enterprise (formerly IBM Integration Bus)
  • Admin
    Ben Thompson
    Reply
    |
    Aug 3, 2021

    Idea / RFE Review. This capability has now been provided in ACE 12.0.1.0 ... Status is updated to Delivered.

  • Guest
    Reply
    |
    Aug 14, 2020

    Thank you for raising this RFE. ACEv11 has moved the product's capabilities in this area further forward, but it is acknowledged that there is much more we could do. In fact we have plans for this area which have been shared under Non-Disclosure Agreement as part of our Early Experience Program. Status of the RFE is updated to Planned for Future Release. Meanwhile we also intend to publish more collateral advertising the art of what is possible already in ACEv11. In the interim, until a more suitable publication location is exploited, the code snippet below may also be helpful to some users:

    package com.ibm.dev;

    import java.io.*;
    import java.text.DateFormat;
    import java.util.Base64;
    import java.util.Date;
    import java.util.Iterator;
    import java.util.Locale;
    import java.util.Map;

    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.xpath.XPath;
    import javax.xml.xpath.XPathConstants;
    import javax.xml.xpath.XPathExpressionException;
    import javax.xml.xpath.XPathFactory;

    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;

    import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
    import com.fasterxml.jackson.core.JsonFactory;
    import com.fasterxml.jackson.databind.DeserializationFeature;
    import com.fasterxml.jackson.databind.JsonNode;
    import com.fasterxml.jackson.databind.ObjectMapper;
    import com.ibm.integration.admin.http.HttpClient;
    import com.ibm.integration.admin.http.HttpResponse;
    import com.ibm.broker.config.common.XMLHelper;

    public class UnitTestingACE {

    public static void main(String[] args) {
    log("=============================================================================================");
    log("This v11 admin program uses the REST API across local comms to a local integration node");
    log("=============================================================================================");

    try {
    String nodeName = "NODEFP7";
    HttpClient httpClient = new HttpClient(nodeName);
    // Start injection mode
    HttpResponse httpResponse1 = httpClient.postMethod("/apiv2/servers/default/applications/ExampleApplication/messageflows/ExampleFlow/start-recording", "");
    log("URL: "+ httpResponse1.getUrlPath());
    log("StatusCode: "+ httpResponse1.getStatusCode());
    log("ReasonCode: "+ httpResponse1.getReason());
    HttpResponse httpResponse2 = httpClient.postMethod("/apiv2/servers/default/applications/ExampleApplication/messageflows/ExampleFlow/start-injection", "");
    log("URL: "+ httpResponse2.getUrlPath());
    log("StatusCode: "+ httpResponse2.getStatusCode());
    log("ReasonCode: "+ httpResponse2.getReason());
    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DAwMDAwMDAwMDwvUmVxdWVzdElkZW50aWZpZXI+PC9IVFRQPjwvRGVzdGluYXRpb24+PC9sb2NhbEVudmlyb25tZW50Pg==\",\"environment\":\"\",\"exceptionList\":\"\"}}";
    HttpResponse httpResponse3 = httpClient.postMethod("/apiv2/servers/default/applications/ExampleApplication/messageflows/ExampleFlow/nodes/HTTPInput/inject", testData);
    log("URL: "+ httpResponse3.getUrlPath());
    log("StatusCode: "+ httpResponse3.getStatusCode());
    log("ReasonCode: "+ httpResponse3.getReason());
    HttpResponse httpResponse4 = httpClient.getMethod("/apiv2/servers/default/data/recorded-test-data?messageFlow=ExampleFlow");
    log("URL: "+ httpResponse4.getUrlPath());
    log("StatusCode: "+ httpResponse4.getStatusCode());
    log("ReasonCode: "+ httpResponse4.getReason());
    // ======================================================================================================
    // === This section shows a simple way of checking the recorded test data ...
    JsonFactory factory = new JsonFactory();
    ObjectMapper mapper = new ObjectMapper(factory);
    JsonNode node = mapper.readValue(httpResponse4.getBody().toString(), JsonNode.class);
    JsonNode array = node.get("recordedTestData");
    log("Number of objects in the array of recordedTestData is "+Integer.toString(array.size()));
    JsonNode testData1 = array.get(1).get("testData");
    JsonNode message = testData1.get("message");
    byte[] decodedBytes = Base64.getDecoder().decode(message.asText());
    String decodedString = new String(decodedBytes);
    log("Decoded message is "+decodedString);
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
    StringBuilder xmlStringBuilder = new StringBuilder();
    xmlStringBuilder.append(decodedString);
    ByteArrayInputStream input = new ByteArrayInputStream(xmlStringBuilder.toString().getBytes("UTF-8"));
    Document logicalTree = builder.parse(input);
    Element logicalTreeRoot = logicalTree.getDocumentElement();
    // This is the message injected into the map node ...
    // String xPathAssertion = "/message/BLOB/BLOB[.='7b7d']";
    // This is the message expected to come out of the map node ...
    String xPathAssertion = "/message/BLOB/BLOB[.='5468697320697320616e206578616d706c65206f6620612068617264636f646564206f7574707574206d657373616765']";
    XPath xPath = XPathFactory.newInstance().newXPath();
    NodeList nodes = (NodeList)xPath.evaluate(xPathAssertion, logicalTreeRoot, XPathConstants.NODESET);
    if (nodes.getLength() > 0) {
    log("PASSED ASSERTION! Value of node was "+nodes.item(0).getTextContent()+" which matched the assertion "+xPathAssertion);
    } else {
    log("ASSERTION FAILED! Assertion was "+xPathAssertion);
    }
    // ======================================================================================================
    HttpResponse httpResponse5 = httpClient.deleteMethod("/apiv2/servers/default/data/recorded-test-data");
    log("URL: "+ httpResponse5.getUrlPath());
    log("StatusCode: "+ httpResponse5.getStatusCode());
    log("ReasonCode: "+ httpResponse5.getReason());
    // ^^ Get clear injection working!
    HttpResponse httpResponse6 = httpClient.postMethod("/apiv2/servers/default/applications/ExampleApplication/messageflows/ExampleFlow/stop-injection", "");
    log("URL: "+ httpResponse6.getUrlPath());
    log("StatusCode: "+ httpResponse6.getStatusCode());
    log("ReasonCode: "+ httpResponse6.getReason());
    HttpResponse httpResponse7 = httpClient.postMethod("/apiv2/servers/default/applications/ExampleApplication/messageflows/ExampleFlow/stop-recording", "");
    log("URL: "+ httpResponse7.getUrlPath());
    log("StatusCode: "+ httpResponse7.getStatusCode());
    log("ReasonCode: "+ httpResponse7.getReason());

    } catch (IOException | InterruptedException | XPathExpressionException e) {
    e.printStackTrace();
    } catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (ParserConfigurationException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    }

    private static void log(String string) {
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, Locale.getDefault());
    String formattedDate = df.format(new Date());
    System.out.println("("+formattedDate+") "+string);
    }

    }