@Test public void throw_ISE_if_fail_to_load_version() throws Exception { expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Can not load /sonar-api-version.txt from classpath"); System2 system = spy(System2.class); when(system.getResource(anyString())).thenReturn(new File("target/unknown").toURI().toURL()); ApiVersion.load(system); }
private SensorContextTester(Path moduleBaseDir) { this.settings = new MapSettings(); this.fs = new DefaultFileSystem(moduleBaseDir).setEncoding(Charset.defaultCharset()); this.activeRules = new ActiveRulesBuilder().build(); this.sensorStorage = new InMemorySensorStorage(); this.project = new DefaultInputProject(ProjectDefinition.create().setKey("projectKey").setBaseDir(moduleBaseDir.toFile()).setWorkDir(moduleBaseDir.resolve(".sonar").toFile())); this.module = new DefaultInputModule(ProjectDefinition.create().setKey("projectKey").setBaseDir(moduleBaseDir.toFile()).setWorkDir(moduleBaseDir.resolve(".sonar").toFile())); this.runtime = SonarRuntimeImpl.forSonarQube(ApiVersion.load(System2.INSTANCE), SonarQubeSide.SCANNER); }
@Test public void load_version_from_file_in_classpath() { Version version = ApiVersion.load(System2.INSTANCE); assertThat(version).isNotNull(); assertThat(version.major()).isGreaterThanOrEqualTo(5); }
private static void populateLevel1(ComponentContainer container, Props props, ComputeEngineStatus computeEngineStatus) { Version apiVersion = ApiVersion.load(System2.INSTANCE); container.add( props.rawProperties(), new ConfigurationProvider(), new SonarQubeVersion(apiVersion), SonarRuntimeImpl.forSonarQube(ApiVersion.load(System2.INSTANCE), SonarQubeSide.COMPUTE_ENGINE), CeProcessLogging.class, UuidFactoryImpl.INSTANCE,
private void addBootstrapComponents() { Version apiVersion = ApiVersion.load(System2.INSTANCE); add( // plugins ScannerPluginRepository.class, PluginLoader.class, PluginClassloaderFactory.class, ScannerPluginJarExploder.class, ScannerPluginPredicate.class, ExtensionInstaller.class, new SonarQubeVersion(apiVersion), SonarRuntimeImpl.forSonarQube(apiVersion, SonarQubeSide.SCANNER), StoragesManager.class, new GlobalServerSettingsProvider(), new GlobalConfigurationProvider(), new ScannerWsClientProvider(), DefaultServer.class, new GlobalTempFolderProvider(), DefaultHttpDownloader.class, UriReader.class, PluginFiles.class, System2.INSTANCE, Clock.systemDefaultZone(), new MetricsRepositoryProvider(), UuidFactoryImpl.INSTANCE); addIfMissing(ScannerPluginInstaller.class, PluginInstaller.class); add(CoreExtensionRepositoryImpl.class, CoreExtensionsLoader.class, ScannerCoreExtensionsInstaller.class); addIfMissing(DefaultSettingsLoader.class, SettingsLoader.class); addIfMissing(DefaultMetricsRepositoryLoader.class, MetricsRepositoryLoader.class); }
add(platform, properties); addExtraRootComponents(); Version apiVersion = ApiVersion.load(System2.INSTANCE); add( new SonarQubeVersion(apiVersion),
private SensorContextTester(Path moduleBaseDir) { this.settings = new MapSettings(); this.fs = new DefaultFileSystem(moduleBaseDir).setEncoding(Charset.defaultCharset()); this.activeRules = new ActiveRulesBuilder().build(); this.sensorStorage = new InMemorySensorStorage(); this.project = new DefaultInputProject(ProjectDefinition.create().setKey("projectKey").setBaseDir(moduleBaseDir.toFile()).setWorkDir(moduleBaseDir.resolve(".sonar").toFile())); this.module = new DefaultInputModule(ProjectDefinition.create().setKey("projectKey").setBaseDir(moduleBaseDir.toFile()).setWorkDir(moduleBaseDir.resolve(".sonar").toFile())); this.runtime = SonarRuntimeImpl.forSonarQube(ApiVersion.load(System2.INSTANCE), SonarQubeSide.SCANNER); }
@Override protected void doBeforeStart() { Version version = ApiVersion.load(System2.INSTANCE); add( StandalonePluginIndex.class, PluginRepository.class, PluginVersionChecker.class, PluginCacheLoader.class, PluginLoader.class, PluginClassloaderFactory.class, DefaultPluginJarExploder.class, GlobalSettings.class, new GlobalConfigurationProvider(), ExtensionInstaller.class, new SonarQubeVersion(version), SonarRuntimeImpl.forSonarLint(version), new GlobalTempFolderProvider(), UriReader.class, new PluginCacheProvider(), System2.INSTANCE); }
private static void populateLevel1(ComponentContainer container, Props props, ComputeEngineStatus computeEngineStatus) { Version apiVersion = ApiVersion.load(System2.INSTANCE); container.add( props.rawProperties(), new ConfigurationProvider(), new SonarQubeVersion(apiVersion), SonarRuntimeImpl.forSonarQube(ApiVersion.load(System2.INSTANCE), SonarQubeSide.COMPUTE_ENGINE), CeProcessLogging.class, UuidFactoryImpl.INSTANCE,
@Override protected void doBeforeStart() { Version version = ApiVersion.load(System2.INSTANCE); add( StorageContainerHandler.class,
private void addBootstrapComponents() { Version apiVersion = ApiVersion.load(System2.INSTANCE); add( // plugins ScannerPluginRepository.class, PluginLoader.class, PluginClassloaderFactory.class, ScannerPluginJarExploder.class, ScannerPluginPredicate.class, ExtensionInstaller.class, new SonarQubeVersion(apiVersion), SonarRuntimeImpl.forSonarQube(apiVersion, SonarQubeSide.SCANNER), StoragesManager.class, new GlobalServerSettingsProvider(), new GlobalConfigurationProvider(), new ScannerWsClientProvider(), DefaultServer.class, new GlobalTempFolderProvider(), DefaultHttpDownloader.class, UriReader.class, PluginFiles.class, System2.INSTANCE, Clock.systemDefaultZone(), new MetricsRepositoryProvider(), UuidFactoryImpl.INSTANCE); addIfMissing(ScannerPluginInstaller.class, PluginInstaller.class); add(CoreExtensionRepositoryImpl.class, CoreExtensionsLoader.class, ScannerCoreExtensionsInstaller.class); addIfMissing(DefaultSettingsLoader.class, SettingsLoader.class); addIfMissing(DefaultMetricsRepositoryLoader.class, MetricsRepositoryLoader.class); }
add(platform, properties); addExtraRootComponents(); Version apiVersion = ApiVersion.load(System2.INSTANCE); add( new SonarQubeVersion(apiVersion),