use of org.sonar.api.batch.fs.internal.DefaultInputProject in project sonarqube by SonarSource.
the class ProjectLockTest method setUp.
@Before
public void setUp() throws IOException {
baseDir = tempFolder.newFolder();
worDir = new File(baseDir, ".sonar");
lock = new ProjectLock(new DefaultInputProject(ProjectDefinition.create().setBaseDir(baseDir).setWorkDir(worDir)));
}
use of org.sonar.api.batch.fs.internal.DefaultInputProject in project sonarqube by SonarSource.
the class DefaultInputProjectTest method testGetters.
@Test
public void testGetters() throws IOException {
ProjectDefinition def = ProjectDefinition.create();
def.setKey("projectKey");
def.setName("projectName");
File baseDir = temp.newFolder();
def.setBaseDir(baseDir);
def.setDescription("desc");
File workDir = temp.newFolder();
def.setWorkDir(workDir);
def.setSources("file1");
def.setTests("test1");
AbstractProjectOrModule project = new DefaultInputProject(def);
assertThat(project.key()).isEqualTo("projectKey");
assertThat(project.getName()).isEqualTo("projectName");
assertThat(project.getOriginalName()).isEqualTo("projectName");
assertThat(project.definition()).isEqualTo(def);
assertThat(project.getBaseDir()).isEqualTo(baseDir.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS));
assertThat(project.getDescription()).isEqualTo("desc");
assertThat(project.getWorkDir()).isEqualTo(workDir.toPath());
assertThat(project.getEncoding()).isEqualTo(Charset.defaultCharset());
assertThat(project.properties()).hasSize(5);
assertThat(project.isFile()).isFalse();
}
use of org.sonar.api.batch.fs.internal.DefaultInputProject in project sonarqube by SonarSource.
the class InputProjectProvider method provide.
@Bean("DefaultInputProject")
public DefaultInputProject provide(ProjectBuildersExecutor projectBuildersExecutor, ProjectReactorValidator validator, ProjectReactor projectReactor, ScannerComponentIdGenerator scannerComponentIdGenerator, WorkDirectoriesInitializer workDirectoriesInit) {
// 1 Apply project builders
projectBuildersExecutor.execute(projectReactor);
// 2 Validate final reactor
validator.validate(projectReactor);
// 3 Create project
DefaultInputProject project = new DefaultInputProject(projectReactor.getRoot(), scannerComponentIdGenerator.getAsInt());
workDirectoriesInit.execute(project);
LOG.info("Project key: {}", project.key());
LOG.info("Base dir: {}", project.getBaseDir().toAbsolutePath().toString());
LOG.info("Working dir: {}", project.getWorkDir().toAbsolutePath().toString());
LOG.debug("Project global encoding: {}, default locale: {}", project.getEncoding().displayName(), Locale.getDefault());
return project;
}
use of org.sonar.api.batch.fs.internal.DefaultInputProject in project sonarqube by SonarSource.
the class CpdExecutorTest method setUp.
@Before
public void setUp() throws IOException {
File outputDir = temp.newFolder();
baseDir = temp.newFolder();
when(publisher.getWriter()).thenReturn(new ScannerReportWriter(outputDir));
DefaultInputProject project = TestInputFileBuilder.newDefaultInputProject("foo", baseDir);
componentStore = new InputComponentStore(mock(BranchConfiguration.class), sonarRuntime);
executor = new CpdExecutor(settings, index, publisher, componentStore, executorService);
reader = new ScannerReportReader(outputDir);
batchComponent1 = createComponent("src/Foo.php", 5);
batchComponent2 = createComponent("src/Foo2.php", 5);
batchComponent3 = createComponent("src/Foo3.php", 5);
}
Aggregations