0

I have an internal Integration Test and I need to validate metadata file against an expected file, everythink works OK in my PC (Windows 10 Pro, marklogic contained into Docker, spanish language), but when executing in linux I have a slightly different file because metadata's xml file contains more blank spaces than my expected file:

For example:

Expected MetaData File (I placed dots instead of blank spaces to be more easy to see each space) first 20 lines:

<?xml version="1.0" encoding="UTF-8"?>
<com.marklogic.contentpump.DocumentMetadata>
..<format>
....<name>json</name>
..</format>
..<collectionsList class="vector"/>
..<permissionsList class="vector">
....<com.marklogic.xcc.ContentPermission>
......<capability>
........<name>update</name>
........<symbol>U</symbol>
......</capability>
......<role>app-user</role>
......<roleId>0000000000000000000</roleId>
....</com.marklogic.xcc.ContentPermission>
....<com.marklogic.xcc.ContentPermission>
......<capability>
........<name>read</name>
........<symbol>R</symbol>
......</capability>

Generated Metadata's XML with MLCP from Linux Execution:

<?xml version="1.0" encoding="UTF-8"?>
<com.marklogic.contentpump.DocumentMetadata>
..<format>
......<name>json</name>
..</format>
..<collectionsList class="vector"/>
..<permissionsList class="vector">
......<com.marklogic.xcc.ContentPermission>
.........<capability>
............<name>update</name>
............<symbol>U</symbol>
.........</capability>
.........<role>app-user</role>
.........<roleId>0000000000000000000</roleId>
......</com.marklogic.xcc.ContentPermission>
......<com.marklogic.xcc.ContentPermission>
.........<capability>
............<name>read</name>
............<symbol>R</symbol>
.........</capability>

As you may see since lines 3 and 4 there are different blank spaces: Expected File

..<format>
....<name>json</name>

Test-result file

..<format>
......<name>json</name>

There are two more blank spaces, my question is: Does somebody know if there's a kind of export metadata layout configuration or something that would change blank spaces amount from a PC to another? I supposse answer is true, but I don't find anything like that.

Thanks in advance.

  • 1
    You are comparing insignificant whitespace. I would try to find a way to ignore such whitespace in your test. It might well be that whitespace gets stripped in future, just to save on file size. (Not aware of any such plans, just saying it could..) – grtjn Oct 02 '19 at 06:51
  • I would suggest the same - ignore the whitespace in your tests, and try to make the tests XML aware - ie. is the same as for example etc. XML-aware tools such as XSLT process can also normalise space for you so you could compare the output of that instead perhaps? – Lech Rzedzicki Oct 02 '19 at 11:10
  • Yes I have thought about it, do you know a library that only compares tags, properties and content for XML/JSON files (I mean validate that the content is the same), right now I'm unable to validate my integration tests, because validation is not working on. On the other hand this kind of issue should be configurable or use a layout, right? is not possible that you don't know an exactly expected answer because blank spaces are different. :-( – Diego Arturo Barriguete Oct 02 '19 at 14:21

0 Answers0