Skip to content

Conversation

@markieww
Copy link
Contributor

See #485

Sorry, I was not able to write a test for this change. I played around in org.openas2.app.OpenAS2ServerTest#verifyMessageDelivery but I had no access to the msgheaders directory. There was no getter in TestPartner nor TestMessage to access the file with the header information which I liked to check.

So I tested manually and it was successful. (I used a internal config.xml and partnership.xml which I am not allowed to share, but you get the idea how it works)

# Partnership without configuration
echo "EMPTY" > /opt/openas2/data/outbox/AAAA/empty.txt
# Partnership with quotes = true
echo "TRUE" >  /opt/openas2/data/outbox/BBBB/true.txt
# Partnership with quotes = false
echo "FALSE" > /opt/openas2/data/outbox/CCCC/false.txt

cat /opt/openas2/data/pendingMDN3/* | grep -a "Attachment"

Content-Disposition: Attachment; filename="empty.txt"
Content-Disposition: Attachment; filename="empty.txt"
Content-Disposition: Attachment; filename="true.txt"
Content-Disposition: Attachment; filename="true.txt"
Content-Disposition: Attachment; filename=false.txt
Content-Disposition: Attachment; filename=false.txt

Copy link
Contributor

@uhurusurfa uhurusurfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR - it works as expected for me.

To add a test for this, make a copy of the Server/src/test/java/org/openas2/message/DynamicContentTypeTest.java test class and strip out all the stuff related to content-type testing and insert your code to test content-disposition instead.

That test class sets up a simple AS2 message (simpleTestMsg) and provides you access to a poller (this.poller).
You can set the partnership attribute using this:
simpleTestMsg.getPartnership().setAttribute(Partnership.PA_QUOTE_SEND_FILE_NAME , "false");

Then you can simply invoke the "setAdditionalMetaData" method in the MessageBuilderModule class from the poller:

MimeBodyPart body = new MimeBodyPart();
this.poller.setAdditionalMetaData(simpleTestMsg, body);

You can then check what the content disposition looks like using this:
this.simpleTestMsg.getContentDisposition()

RELEASE-NOTES.md Outdated
Comment on lines 36 to 39
<module classname="org.openas2.processor.receiver.AS2DirectoryPollingModule"
...
sendfilename="true"
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer how the poller works by default. It is only true if you want to use the generic poller that supports identifying the partnership credentials based on the file name.

Sending the file name is controlled by the system property in the config.xml:
pollerConfigBase.sendfilename="true"
The recommended approach to changing it is to set the property in a properties file that is configured to override the config.xml property defaults.

Or it can be overridden on a per partner basis in the partnerships.xml file in the pollerConfig element:
<pollerConfig enabled="true" sendfilename="true"/>

-->
<!--
Example for disabling the quoting of the sent filename at partnership-level.
Works only in combination with sendfilename="true" at module-level of AS2DirectoryPollingModule in config.xml.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as earlier comment about how the sendfilename attribute is used.

@markieww
Copy link
Contributor Author

markieww commented Oct 27, 2025

@uhurusurfa : I added a test and updated the documentation. Please have a look.

I noticed some failing tests too

[ERROR] RestApiTest.start_A_Server:84 org.openas2.WrappedException: Error creating component: org.openas2.cmd.processor.RestCommandProcessor
[ERROR] DynamicContentTypeTest.setUp:67->BaseServerSetup.setup:82 » org.openas2.WrappedException: Error creating component: org.openas2.cmd.processor.RestCommandProcessor

But I guess that has nothing to do with my change.

@uhurusurfa
Copy link
Contributor

I have checked the maven log from your PR CI?CD run in Github and the RestApi test is passing so their may be an issue on your local system with that test.

Copy link
Contributor

@uhurusurfa uhurusurfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 - thanks, nice work.

@uhurusurfa uhurusurfa merged commit c0ff08b into OpenAS2:master Oct 27, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants