wearefrank / ladybug

Enable users of your application to debug and test it
Apache License 2.0
13 stars 8 forks source link

Ladybug creates separate reports for each iteration of ForEachChildElementPipe #193

Closed mhdirkse closed 4 weeks ago

mhdirkse commented 1 year ago

I have an adapter that has a <ForEachChildElementPipe>. The iterations do not appear inside the same report, but a new report is created for each iteration. image One call to adapter BrowseShare resulted in three messages. The calls to IngestDocument appear as separate report. Instead, the logic of IngestDocument should appear inside the BrowseShare report.

Here is my adapter:

<Configuration
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../FrankConfig.xsd">
    <Adapter name="BrowseShare">
        <Receiver>
            <JavaListener name="BrowseShare" />
        </Receiver>
        <Pipeline>
            <Exits>
                <Exit name="success" state="SUCCESS" />
                <Exit name="notOk" state="ERROR" />
            </Exits>
            <FixedResultPipe name="getShareSearchPattern" returnString="${share}/input">
                <Forward name="success" path="pollShare" />
            </FixedResultPipe>
            <LocalFileSystemPipe name="pollShare" action="list" wildcard="*.txt">
                <Forward name="success" path="handleFiles" />
            </LocalFileSystemPipe>
            <!-- substring-before -->
            <ForEachChildElementPipe name="handleFiles" elementXPathExpression="/directory/file" ignoreExceptions="true">
                <IbisLocalSender javaListener="IngestDocument" />
                <Forward name="success" path="success" />
                <Forward name="exception" path="notOk" />
            </ForEachChildElementPipe>
        </Pipeline>
    </Adapter>
    <Adapter name="IngestDocument">
        <Receiver>
            <!-- Receive a file name base -->
            <JavaListener name="IngestDocument" />
        </Receiver>
        <Pipeline>
            <Exits>
                <Exit name="success" state="SUCCESS" />
                <Exit name="notOk" state="ERROR" />
            </Exits>
            <PutInSessionPipe name="saveBase">
                <!-- Store the input message -->
                <Param name="basename" />
                <Forward name="success" path="readXmlFile" />
            </PutInSessionPipe>
            <LocalFileSystemPipe name="readXmlFile" action="read">
                <Param name="filename" pattern="{basename}.xml"/>
                <Forward name="success" path="checkXml" />
                <Forward name="exception" path="notOk" />
            </LocalFileSystemPipe>
            <XmlValidatorPipe name="checkXml" schema="xmlInput.xsd" root="document" storeResultInSessionKey="xmlData">
                <Forward name="success" path="readTxtFile" />
                <Forward name="failure" path="notOk" />
            </XmlValidatorPipe>
            <LocalFileSystemPipe name="readTxtFile" action="read">
                <Param name="filename" pattern="{basename}.txt" />
                <Forward name="success" path="encodeBody" />
                <Forward name="exception" path="notOk" />
            </LocalFileSystemPipe>
            <Base64Pipe name="encodeBody" direction="ENCODE" storeResultInSessionKey="body">
                <Forward name="success" path="composeMundoMessage" />
                <Forward name="exception" path="notOk" />
            </Base64Pipe>
            <XsltPipe name="composeMundoMessage" styleSheetName="conclusion2mundo.xslt" xsltVersion="2" getInputFromSessionKey="xmlData">
                <Param name="body" sessionKey="body" />
                <Forward name="success" path="sendToMundo" />
                <Forward name="exception" path="notOk" />
            </XsltPipe>
            <SenderPipe name="sendToMundo">
                <HttpSender name="sendToMundo" methodType="POST" url="${mundoUrl}" />
                <Forward name="success" path="success" />
                <Forward name="exception" path="notOk" />
            </SenderPipe>
        </Pipeline>
    </Adapter>
</Configuration>

Steps to reproduce:

  1. Check out commit 26a63da1ba9021c66bbbcf005b5e132f9b6d3901 of https://github.com/ibissource/frank-manual.
  2. Open directory srcSteps/exercise/v500 in VSCode.
  3. In the root in VSCode, (directory v500), create a file config.properties. Add a property file there with property share. Create some directory where this adapter is allowed to edit files. Set the full path of the directory as the value of the property.
  4. As a subdirectory of the share directory, create directory input.
  5. In the subdirectory input, create a few files with extension .txt. Each file should result in an iteration of the <ForEachChildElementPipe>.
  6. Test adapter BrowseShare by starting the restart-DEV job. Do Test a Pipeline with adapter BrowseShare with some dummy input.

Here is the version information of the F!F:

FF! 7.9-20230530.190019: v500
Running on LAPTOP-R1SK28C using Apache Tomcat/9.0.74
Java Version: OpenJDK Runtime Environment (1.8.0_292-b10)
Heap size: 177M, total JVM memory: 815M
Free disk space: 182GB, total disk space: 464GB
Up since: 2023-06-02 15:21:50 (32m)
mhdirkse commented 1 year ago

Sorry, the figure is not as I intended it to be. I hope my story is clear nevertheless.

tnleeuw commented 1 year ago

I believe this screenshot shows that PR #5015 fixes the issue (for master branch at least):

image

jacodg commented 4 months ago

@mhdirkse can this issue be closed?

mhdirkse commented 4 weeks ago

I close it now because it has been fixed, see: image

Within the same Pipeline you see three executions of the same sender. To the right you see the name of an input file I supplied. The other two nodes show the names of the other input files.

mhdirkse commented 4 weeks ago

Added to ladybug user story 1048.