use of org.sonar.api.utils.internal.DefaultTempFolder in project sonarqube by SonarSource.
the class GlobalTempFolderProvider method provide.
public TempFolder provide(GlobalProperties bootstrapProps) {
if (tempFolder == null) {
String workingPathName = StringUtils.defaultIfBlank(bootstrapProps.property(CoreProperties.GLOBAL_WORKING_DIRECTORY), CoreProperties.GLOBAL_WORKING_DIRECTORY_DEFAULT_VALUE);
Path workingPath = Paths.get(workingPathName);
if (!workingPath.isAbsolute()) {
Path home = findSonarHome(bootstrapProps);
workingPath = home.resolve(workingPath).normalize();
}
try {
cleanTempFolders(workingPath);
} catch (IOException e) {
LOG.error(String.format("failed to clean global working directory: %s", workingPath), e);
}
Path tempDir = createTempFolder(workingPath);
tempFolder = new DefaultTempFolder(tempDir.toFile(), true);
}
return tempFolder;
}
use of org.sonar.api.utils.internal.DefaultTempFolder in project sonarlint-core by SonarSource.
the class PartialUpdaterTest method update_file_issues_by_module.
@Test
public void update_file_issues_by_module() throws IOException {
ServerIssue issue = ServerIssue.newBuilder().setKey("issue1").build();
List<ServerIssue> issues = Collections.singletonList(issue);
String moduleKey = "dummy";
when(storagePaths.getServerIssuesPath(moduleKey)).thenReturn(temp.newFolder().toPath());
when(downloader.apply(moduleKey)).thenReturn(issues);
updater.updateFileIssues(moduleKey, new DefaultTempFolder(temp.newFolder()));
verify(issueStore).save(issues);
}
Aggregations