Search in sources :

Example 1 with ScmConfiguration

use of org.sonar.scanner.scm.ScmConfiguration in project sonarqube by SonarSource.

the class MetadataPublisherTest method createPublisher.

private void createPublisher(ProjectDefinition def) throws IOException {
    Path rootBaseDir = temp.newFolder().toPath();
    Path moduleBaseDir = rootBaseDir.resolve("moduleDir");
    Files.createDirectory(moduleBaseDir);
    DefaultInputModule rootModule = new DefaultInputModule(def.setBaseDir(rootBaseDir.toFile()).setKey("root").setWorkDir(temp.newFolder()), TestInputFileBuilder.nextBatchId());
    InputModuleHierarchy inputModuleHierarchy = mock(InputModuleHierarchy.class);
    when(inputModuleHierarchy.root()).thenReturn(rootModule);
    DefaultInputModule child = new DefaultInputModule(ProjectDefinition.create().setKey("module").setBaseDir(moduleBaseDir.toFile()).setWorkDir(temp.newFolder()), TestInputFileBuilder.nextBatchId());
    when(inputModuleHierarchy.children(rootModule)).thenReturn(Collections.singletonList(child));
    when(inputModuleHierarchy.relativePathToRoot(child)).thenReturn("modulePath");
    when(inputModuleHierarchy.relativePathToRoot(rootModule)).thenReturn("");
    branches = mock(BranchConfiguration.class);
    scmConfiguration = mock(ScmConfiguration.class);
    when(scmConfiguration.provider()).thenReturn(scmProvider);
    underTest = new MetadataPublisher(projectInfo, inputModuleHierarchy, qProfiles, cpdSettings, pluginRepository, branches, scmRevision, componentStore, scmConfiguration);
}
Also used : Path(java.nio.file.Path) BranchConfiguration(org.sonar.scanner.scan.branch.BranchConfiguration) InputModuleHierarchy(org.sonar.scanner.fs.InputModuleHierarchy) DefaultInputModule(org.sonar.api.batch.fs.internal.DefaultInputModule) ScmConfiguration(org.sonar.scanner.scm.ScmConfiguration)

Aggregations

Path (java.nio.file.Path)1 DefaultInputModule (org.sonar.api.batch.fs.internal.DefaultInputModule)1 InputModuleHierarchy (org.sonar.scanner.fs.InputModuleHierarchy)1 BranchConfiguration (org.sonar.scanner.scan.branch.BranchConfiguration)1 ScmConfiguration (org.sonar.scanner.scm.ScmConfiguration)1