Sonarqube version: Enterprise Edition Version 7.8 (build 26217)
Sonar Scanner: 4.3.0.2102-windows
SonarXML (plugin): 2.0.1
Hej,
I (new to sonarqube) am adding XML coding rules directly via the web interface and am running into a strange problem. I have a sonarqube project for capturing the results. The project is configured to use a quality profile. The quality profile in turn has my xml rule (activated).
Problem Statement (Scenario 1)
The rule evaluation on sonarqube does not work with the xml payload (shown below). There are no errors reported, its just that the evaluation does not flag anything. The same however works only when I remove the namespace xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
from the payload. I find this strange because the xml message as you can see does not have any extended elements (using prefixes).
XML Payload:
<?xml version = "1.0" encoding = "UTF-8" ?>
<process name="SyncTestG3SRCProvABCSProcess"
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension">
<sequence name="Global_Sequence">
<scope name="MainScope">
<faultHandlers>
<catch faultName="bpelx:remoteFaultS" faultVariable="SystemFaultVar" faultMessageType="bpelx:RuntimeFaultMessage">
<sequence name="RemoteFault_Sequence">
</sequence>
</catch>
</faultHandlers>
<sequence name="Main_Sequence">
<scope name="Init">
<sequence name="Init_Sequence">
<assign name="GetTitle">
<copy>
<from>'OK'</from>
<to>$Title</to>
</copy>
</assign>
</sequence>
</scope>
</sequence>
</scope>
</sequence>
</process>
Xpath Expression:
/process/sequence/scope/faultHandlers[not(count(catch[@faultName=‘bpelx:remoteFault’])=1)]
Problem Statement (Scenario 2)
Consider the following XML payload along with the Xpath expression. This works as expected with the xml namespace.
<?xml version = "1.0" encoding = "UTF-8" ?>
<process name="SyncTestG3SRCProvABCSProcess"
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension">
<sequence name="Global_Sequence">
<scope name="MainScope">
<faultHandlers>
<catch faultName="bpelx:remoteFault" faultVariable="SystemFaultVar" faultMessageType="bpelx:RuntimeFaultMessage">
<sequence name="RemoteFault_Sequence">
</sequence>
</catch>
</faultHandlers>
<sequence name="Main_Sequence">
<scope name="Init">
<sequence name="Init_Sequence">
<assign name="GetTitle">
<copy>
<from>'To Do'</from>
<to>$Title</to>
</copy>
</assign>
</sequence>
</scope>
</sequence>
</scope>
</sequence>
</process>
Xpath Expression:
/process/sequence/scope/sequence/scope/sequence/assign[contains(@name,‘GetTitle’) and count(copy[to/text()=’$Title’]/from[contains(text(),‘To Do’)])=1]
I run tests using SonarScanner (windows version) to analyse a project I have on my local computer. We however plan to use jenkins on the long run. It would be great if someone can point out why this happens.
I have verified the xpath expression along with the paylaod using an online tool