@@ -719,6 +719,8 @@ public void testPmdReportResolveRulesets()
719
719
final String sonarExportRulesetUrl = "http://localhost:" + mockServer .port () + sonarProfileUrl ;
720
720
final String myRulesetBaseUrl = "/config/my-ruleset.xml" ;
721
721
final String myRulesetUrl = "http://localhost:" + mockServer .port () + myRulesetBaseUrl ;
722
+ final String notAInternalRulesetBaseUrl = "/projects/OURPROJECT/repos/ourproject-pmd/raw/InProgressRuleset.xml?at=refs%2Fheads%2Fmaster" ;
723
+ final String notAInternalRulesetUrl = "http://localhost:" + mockServer .port () + notAInternalRulesetBaseUrl ;
722
724
723
725
WireMock .configureFor ( "localhost" , port );
724
726
WireMock .stubFor ( WireMock .get ( WireMock .urlEqualTo ( sonarProfileUrl ) )
@@ -727,6 +729,9 @@ public void testPmdReportResolveRulesets()
727
729
WireMock .stubFor ( WireMock .get ( WireMock .urlEqualTo ( myRulesetBaseUrl ) )
728
730
.willReturn ( WireMock .aResponse ().withStatus ( 200 ).withHeader ( "Content-Type" ,
729
731
"text/xml" ).withBody ( sonarRuleset ) ) );
732
+ WireMock .stubFor ( WireMock .get ( WireMock .urlEqualTo ( notAInternalRulesetBaseUrl ) )
733
+ .willReturn ( WireMock .aResponse ().withStatus ( 200 ).withHeader ( "Content-Type" ,
734
+ "text/xml" ).withBody ( sonarRuleset ) ) );
730
735
731
736
FileUtils .copyDirectoryStructure ( new File ( getBasedir (),
732
737
"src/test/resources/unit/default-configuration/jxr-files" ),
@@ -738,6 +743,7 @@ public void testPmdReportResolveRulesets()
738
743
PmdReport mojo = (PmdReport ) lookupMojo ( "pmd" , testPom );
739
744
mojo .rulesets [3 ] = sonarExportRulesetUrl ;
740
745
mojo .rulesets [4 ] = myRulesetUrl ;
746
+ mojo .rulesets [5 ] = notAInternalRulesetUrl ;
741
747
mojo .execute ();
742
748
743
749
// these are the rulesets, that have been copied to target/pmd/rulesets
@@ -756,6 +762,9 @@ public void testPmdReportResolveRulesets()
756
762
generatedFile = new File ( getBasedir (), "target/test/unit/default-configuration/target/pmd/rulesets/my-ruleset.xml" );
757
763
assertTrue ( FileUtils .fileExists ( generatedFile .getAbsolutePath () ) );
758
764
765
+ generatedFile = new File ( getBasedir (), "target/test/unit/default-configuration/target/pmd/rulesets/InProgressRuleset.xml_at_refs_2Fheads_2Fmaster.xml" );
766
+ assertTrue ( FileUtils .fileExists ( generatedFile .getAbsolutePath () ) );
767
+
759
768
mockServer .stop ();
760
769
}
761
770
0 commit comments