Class PluginContextImpl


  • public class PluginContextImpl
    extends org.sonar.api.Plugin.Context
    Implementation of Plugin.Context that plugins could use in their unit tests. Example:
       import org.sonar.api.internal.SonarRuntimeImpl;
       import org.sonar.api.config.internal.MapSettings;
    
       ...
    
       SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(7, 1), SonarQubeSide.SCANNER);
       MapSettings settings = new MapSettings().setProperty("foo", "bar");
       Plugin.Context context = new PluginContextImpl.Builder()
         .setSonarRuntime(runtime)
         .setBootConfiguration(settings.asConfig());
         .build();
     
    Since:
    7.1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.sonar.api.config.Configuration getBootConfiguration()  
      • Methods inherited from class org.sonar.api.Plugin.Context

        addExtension, addExtensions, addExtensions, getExtensions, getRuntime, getSonarQubeVersion
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getBootConfiguration

        public org.sonar.api.config.Configuration getBootConfiguration()
        Overrides:
        getBootConfiguration in class org.sonar.api.Plugin.Context