public static DefaultInputDir newDefaultInputDir(AbstractProjectOrModule module, String relativePath) throws IOException { Path basedir = module.getBaseDir().resolve(relativePath); Files.createDirectory(basedir); return new DefaultInputDir(module.key(), relativePath) .setModuleBaseDir(module.getBaseDir()); }
@Test public void testCreateInputModule() throws IOException { File baseDir = temp.newFolder(); AbstractProjectOrModule module = TestInputFileBuilder.newDefaultInputModule("key", baseDir); assertThat(module.key()).isEqualTo("key"); assertThat(module.getBaseDir()).isEqualTo(baseDir.toPath()); } }
public static DefaultInputFile newDefaultInputFile(Path projectBaseDir, AbstractProjectOrModule module, String relativePath) { return new TestInputFileBuilder(module.key(), relativePath) .setStatus(InputFile.Status.SAME) .setProjectBaseDir(projectBaseDir) .setModuleBaseDir(module.getBaseDir()) .build(); } }
@Test public void testGetters() throws IOException { ProjectDefinition def = ProjectDefinition.create(); def.setKey("projectKey"); def.setName("projectName"); File baseDir = temp.newFolder(); def.setBaseDir(baseDir); def.setVersion("version"); 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.getBranch()).isNull(); assertThat(project.getBaseDir()).isEqualTo(baseDir.toPath()); assertThat(project.getKeyWithBranch()).isEqualTo("projectKey"); assertThat(project.getVersion()).isEqualTo("version"); assertThat(project.getOriginalVersion()).isEqualTo("version"); assertThat(project.getDescription()).isEqualTo("desc"); assertThat(project.getWorkDir()).isEqualTo(workDir.toPath()); assertThat(project.getEncoding()).isEqualTo(Charset.defaultCharset()); assertThat(project.properties()).hasSize(6); assertThat(project.isFile()).isFalse(); }
private void store(ServerIssue issue) { String moduleKeyWithBranch = issue.getModuleKey(); AbstractProjectOrModule moduleOrProject = componentStore.getModule(moduleKeyWithBranch); if (moduleOrProject != null) { String componentKeyWithoutBranch = ComponentKeys.createEffectiveKey(moduleOrProject.key(), issue.hasPath() ? issue.getPath() : null); DefaultInputComponent r = (DefaultInputComponent) componentStore.getByKey(componentKeyWithoutBranch); if (r != null) { issuesCache.put(r.scannerId(), issue.getKey(), issue); return; } } // Deleted resource issuesCache.put(0, issue.getKey(), issue); }
.setAnalysisDate(projectAnalysisInfo.analysisDate().getTime()) .setProjectKey(rootProject.key()) .setCrossProjectDuplicationActivated(cpdSettings.isCrossProjectDuplicationEnabled()) .setRootComponentRef(rootProject.scannerId());
public static DefaultInputDir newDefaultInputDir(AbstractProjectOrModule module, String relativePath) throws IOException { Path basedir = module.getBaseDir().resolve(relativePath); Files.createDirectory(basedir); return new DefaultInputDir(module.key(), relativePath) .setModuleBaseDir(module.getBaseDir()); }
public static DefaultInputFile newDefaultInputFile(Path projectBaseDir, AbstractProjectOrModule module, String relativePath) { return new TestInputFileBuilder(module.key(), relativePath) .setStatus(InputFile.Status.SAME) .setProjectBaseDir(projectBaseDir) .setModuleBaseDir(module.getBaseDir()) .build(); } }
.setAnalysisDate(projectAnalysisInfo.analysisDate().getTime()) .setProjectKey(rootProject.key()) .setCrossProjectDuplicationActivated(cpdSettings.isCrossProjectDuplicationEnabled()) .setRootComponentRef(rootProject.scannerId());
private void store(ServerIssue issue) { String moduleKeyWithBranch = issue.getModuleKey(); AbstractProjectOrModule moduleOrProject = componentStore.getModule(moduleKeyWithBranch); if (moduleOrProject != null) { String componentKeyWithoutBranch = ComponentKeys.createEffectiveKey(moduleOrProject.key(), issue.hasPath() ? issue.getPath() : null); DefaultInputComponent r = (DefaultInputComponent) componentStore.getByKey(componentKeyWithoutBranch); if (r != null) { issuesCache.put(r.scannerId(), issue.getKey(), issue); return; } } // Deleted resource issuesCache.put(0, issue.getKey(), issue); }