Search in sources :

Example 1 with FileCache

use of org.sonar.home.cache.FileCache in project sonarqube by SonarSource.

the class ScannerPluginJarExploderTest method setUp.

@Before
public void setUp() throws IOException {
    userHome = temp.newFolder();
    FileCache fileCache = new FileCacheBuilder(new Slf4jLogger()).setUserHome(userHome).build();
    underTest = new ScannerPluginJarExploder(fileCache);
}
Also used : FileCacheBuilder(org.sonar.home.cache.FileCacheBuilder) ScannerPluginJarExploder(org.sonar.scanner.bootstrap.ScannerPluginJarExploder) Slf4jLogger(org.sonar.scanner.bootstrap.Slf4jLogger) FileCache(org.sonar.home.cache.FileCache) Before(org.junit.Before)

Example 2 with FileCache

use of org.sonar.home.cache.FileCache in project sonarqube by SonarSource.

the class FileCacheProviderTest method honor_sonarUserHome.

@Test
public void honor_sonarUserHome() throws IOException {
    FileCacheProvider provider = new FileCacheProvider();
    Settings settings = new MapSettings();
    File f = temp.newFolder();
    settings.appendProperty("sonar.userHome", f.getAbsolutePath());
    FileCache cache = provider.provide(settings);
    assertThat(cache.getDir()).isEqualTo(new File(f, "cache"));
}
Also used : MapSettings(org.sonar.api.config.MapSettings) File(java.io.File) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) FileCache(org.sonar.home.cache.FileCache) Test(org.junit.Test)

Example 3 with FileCache

use of org.sonar.home.cache.FileCache in project sonarqube by SonarSource.

the class FileCacheProviderTest method keep_singleton_instance.

@Test
public void keep_singleton_instance() {
    FileCacheProvider provider = new FileCacheProvider();
    Settings settings = new MapSettings();
    FileCache cache1 = provider.provide(settings);
    FileCache cache2 = provider.provide(settings);
    assertThat(cache1).isSameAs(cache2);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) FileCache(org.sonar.home.cache.FileCache) Test(org.junit.Test)

Example 4 with FileCache

use of org.sonar.home.cache.FileCache in project sonarqube by SonarSource.

the class FileCacheProviderTest method provide.

@Test
public void provide() {
    FileCacheProvider provider = new FileCacheProvider();
    FileCache cache = provider.provide(new MapSettings());
    assertThat(cache).isNotNull();
    assertThat(cache.getDir()).isNotNull().exists();
}
Also used : MapSettings(org.sonar.api.config.MapSettings) FileCache(org.sonar.home.cache.FileCache) Test(org.junit.Test)

Aggregations

FileCache (org.sonar.home.cache.FileCache)4 Test (org.junit.Test)3 MapSettings (org.sonar.api.config.MapSettings)3 Settings (org.sonar.api.config.Settings)2 File (java.io.File)1 Before (org.junit.Before)1 FileCacheBuilder (org.sonar.home.cache.FileCacheBuilder)1 ScannerPluginJarExploder (org.sonar.scanner.bootstrap.ScannerPluginJarExploder)1 Slf4jLogger (org.sonar.scanner.bootstrap.Slf4jLogger)1