Skip to content

Commit

Permalink
Adapt to SonarQube 10.4 breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyTeardrop committed Feb 15, 2024
1 parent 4ac07c2 commit df4dc8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public void testClassloaderReturnedOnHappyPath() throws ReflectiveOperationExcep
public void testLoadClass() throws ClassNotFoundException, MalformedURLException {
ClassloaderBuilder builder = new ClassloaderBuilder();
builder.newClassloader("_api_", getClass().getClassLoader());
builder.setMask("_api_", new Mask().addInclusion("java/").addInclusion("org/sonar/api/"));
builder.setMask("_api_", Mask.builder().include("java/", "org/sonar/api/").build());

builder.newClassloader("_customPlugin");
builder.setParent("_customPlugin", "_api_", new Mask());
builder.setParent("_customPlugin", "_api_", Mask.ALL);
builder.setLoadingOrder("_customPlugin", ClassloaderBuilder.LoadingOrder.SELF_FIRST);

for (URL pluginUrl : findSonarqubePluginJars()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @author Michael Clarke
*/
public class ReflectiveElevatedClassLoaderFactoryTest {

private static final String TARGET_PLUGIN_CLASS = "org.sonar.plugins.java.JavaPlugin";
private static final String BUNDLED_PLUGINS_DIRECTORY = "lib/extensions";
private static final String SONARQUBE_LIB_DIRECTORY = "sonarqube-lib/";
Expand All @@ -54,10 +54,10 @@ public ExpectedException expectedException() {
public void testLoadClass() throws ClassNotFoundException, MalformedURLException {
ClassloaderBuilder builder = new ClassloaderBuilder();
builder.newClassloader("_api_", getClass().getClassLoader());
builder.setMask("_api_", new Mask().addInclusion("java/").addInclusion("org/sonar/api/"));
builder.setMask("_api_", Mask.builder().include("java/", "org/sonar/api/").build());

builder.newClassloader("_customPlugin");
builder.setParent("_customPlugin", "_api_", new Mask());
builder.setParent("_customPlugin", "_api_", Mask.ALL);
builder.setLoadingOrder("_customPlugin", ClassloaderBuilder.LoadingOrder.SELF_FIRST);

File[] sonarQubeDistributions = new File(SONARQUBE_LIB_DIRECTORY).listFiles();
Expand All @@ -84,10 +84,10 @@ public void testLoadClass() throws ClassNotFoundException, MalformedURLException
public void testLoadClassInvalidClassRealmKey() throws ClassNotFoundException, MalformedURLException {
ClassloaderBuilder builder = new ClassloaderBuilder();
builder.newClassloader("_xxx_", getClass().getClassLoader());
builder.setMask("_xxx_", new Mask().addInclusion("java/").addInclusion("org/sonar/api/"));
builder.setMask("_xxx_", Mask.builder().include("java/", "org/sonar/api/").build());

builder.newClassloader("_customPlugin");
builder.setParent("_customPlugin", "_xxx_", new Mask());
builder.setParent("_customPlugin", "_xxx_", Mask.ALL);
builder.setLoadingOrder("_customPlugin", ClassloaderBuilder.LoadingOrder.SELF_FIRST);

File[] sonarQubeDistributions = new File(SONARQUBE_LIB_DIRECTORY).listFiles();
Expand Down Expand Up @@ -115,7 +115,7 @@ public void testLoadClassInvalidClassRealmKey() throws ClassNotFoundException, M
public void testLoadClassNoParentRef() throws ClassNotFoundException, MalformedURLException {
ClassloaderBuilder builder = new ClassloaderBuilder();
builder.newClassloader("_xxx_", getClass().getClassLoader());
builder.setMask("_xxx_", new Mask());
builder.setMask("_xxx_", Mask.ALL);

File[] sonarQubeDistributions = new File(SONARQUBE_LIB_DIRECTORY).listFiles();

Expand All @@ -141,7 +141,7 @@ public void testLoadClassNoParentRef() throws ClassNotFoundException, MalformedU
public void testLoadClassInvalidApiClassloader() throws ClassNotFoundException, MalformedURLException {
ClassloaderBuilder builder = new ClassloaderBuilder();
builder.newClassloader("_customPlugin");
builder.setParent("_customPlugin", new URLClassLoader(new URL[0]), new Mask());
builder.setParent("_customPlugin", new URLClassLoader(new URL[0]), Mask.ALL);
builder.setLoadingOrder("_customPlugin", ClassloaderBuilder.LoadingOrder.SELF_FIRST);

File[] sonarQubeDistributions = new File(SONARQUBE_LIB_DIRECTORY).listFiles();
Expand Down

0 comments on commit df4dc8d

Please sign in to comment.