on 2021 May 25 8:20 AM
I want to compare the two metadata XML Files from the SuccessFactors System and return the difference tags as a output using SAP CPI Integration tool.
I am using the below groovy script to achieve this but getting an error.
code1:
XMLUnit.setIgnoreWhitespace(true)
XMLUnit.setIgnoreComments(true)
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true)
XMLUnit.setNormalizeWhitespace(true)
XMLUnit.compareXML(expectedXml, actualXml)
Error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: compareXML__Script.groovy: 27: unable to resolve class Diff @ line 27, column 6. Diff myDiff = new Diff(request, response) ^ compareXML__Script.groovy: 27: unable to resolve class Diff @ line 27, column 15. Diff myDiff = new Diff(request, response) ^ compareXML__Script.groovy: 28: unable to resolve class DetailedDiff @ line 28, column 14. DetailedDiff diff = new DetailedDiff(myDiff) ^ compareXML__Script.groovy: 28: unable to resolve class DetailedDiff @ line 28, column 21. DetailedDiff diff = new DetailedDiff(myDiff) ^
Code2:
import org.custommonkey.xmlunit.* import org.xml.sax.SAXException // Get XML documents def request = context.expand( '${MetadataCurrent}' ) def response = context.expand( '${PreviousMetadata}' ) // Create a list of elements to ignore Set<String> ignoreList = new HashSet<String>() ignoreList.add("dateTime") ignoreList.add("packageId") // Create an object with differences between documents Diff myDiff = new Diff(request, response) DetailedDiff diff = new DetailedDiff(myDiff) // Get a list of all differences List allDifferences = diff.getAllDifferences() // Loop through all differences and find their node names for (int i = 0; i < allDifferences.size(); i++) { diffNodeName ="" // Check the node type to get the right node name nodeType = allDifferences.get(i).getTestNodeDetail().getNode().getNodeType() if (nodeType == 1) { // Get the name of the node if the difference is in the comment diffNodeName = allDifferences.get(i).getTestNodeDetail().getNode().getNodeName() } else { // Get the name of the parent node if the difference is not in the comment diffNodeName = allDifferences.get(i).getControlNodeDetail().getNode().getParentNode().getNodeName() } // Make sure that the node with a difference is not on the list of nodes to ignore if (!ignoreList.contains(diffNodeName)) { // Fail assertion assert false } } assert true
Error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: compareXML__Script.groovy: 14: unable to resolve class Diff @ line 14, column 6. Diff myDiff = new Diff(request, response) ^ compareXML__Script.groovy: 14: unable to resolve class Diff @ line 14, column 15. Diff myDiff = new Diff(request, response).
Could you please help us..
Thank you in advance.
Request clarification before answering.
User | Count |
---|---|
74 | |
30 | |
9 | |
8 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.