Package org.sonar.api.scan.filesystem

Examples of org.sonar.api.scan.filesystem.PathResolver


import static org.mockito.Mockito.mock;

public class InputFileBuilderFactoryTest {
  @Test
  public void create_builder() throws Exception {
    PathResolver pathResolver = new PathResolver();
    LanguageDetectionFactory langDetectionFactory = mock(LanguageDetectionFactory.class, Mockito.RETURNS_MOCKS);
    StatusDetectionFactory statusDetectionFactory = mock(StatusDetectionFactory.class, Mockito.RETURNS_MOCKS);
    DefaultModuleFileSystem fs = mock(DefaultModuleFileSystem.class);
    AnalysisMode analysisMode = mock(AnalysisMode.class);
View Full Code Here


      }
      return dir;
    }

    public File resolvePath(String path) {
      return new PathResolver().relativeFile(getBasedir(), path);
    }
View Full Code Here

    // status
    when(statusDetection.status("foo", "src/main/java/foo/Bar.java", "6c1d64c0b3555892fe7273e954f6fb5a"))
      .thenReturn(InputFile.Status.ADDED);

    InputFileBuilder builder = new InputFileBuilder("struts", new PathResolver(),
      langDetection, statusDetection, fs, analysisMode);
    DeprecatedDefaultInputFile inputFile = builder.create(srcFile);
    inputFile = builder.complete(inputFile, InputFile.Type.MAIN);

    assertThat(inputFile.type()).isEqualTo(InputFile.Type.MAIN);
View Full Code Here

    File otherDir = temp.newFolder();
    File srcFile = new File(otherDir, "src/main/java/foo/Bar.java");
    FileUtils.touch(srcFile);
    when(fs.baseDir()).thenReturn(basedir);

    InputFileBuilder builder = new InputFileBuilder("struts", new PathResolver(),
      langDetection, statusDetection, fs, analysisMode);
    DeprecatedDefaultInputFile inputFile = builder.create(srcFile);

    assertThat(inputFile).isNull();
  }
View Full Code Here

    when(fs.encoding()).thenReturn(Charsets.UTF_8);

    // lang
    when(langDetection.language(any(InputFile.class))).thenReturn(null);

    InputFileBuilder builder = new InputFileBuilder("struts", new PathResolver(),
      langDetection, statusDetection, fs, analysisMode);
    DeprecatedDefaultInputFile inputFile = builder.create(srcFile);
    inputFile = builder.complete(inputFile, InputFile.Type.MAIN);

    assertThat(inputFile).isNull();
View Full Code Here

    // status
    when(statusDetection.status("foo", "src/main/java/foo/Bar.java", "6c1d64c0b3555892fe7273e954f6fb5a"))
      .thenReturn(InputFile.Status.ADDED);

    InputFileBuilder builder = new InputFileBuilder("struts", new PathResolver(),
      langDetection, statusDetection, fs, analysisMode);
    DeprecatedDefaultInputFile inputFile = builder.create(srcFile);
    inputFile = builder.complete(inputFile, InputFile.Type.MAIN);

    assertThat(inputFile.pathRelativeToSourceDir()).isEqualTo("foo/Bar.java");
View Full Code Here

    // status
    when(statusDetection.status("foo", "src/Bar.php", "6c1d64c0b3555892fe7273e954f6fb5a"))
      .thenReturn(InputFile.Status.ADDED);

    InputFileBuilder builder = new InputFileBuilder("struts", new PathResolver(),
      langDetection, statusDetection, fs, analysisMode);
    DeprecatedDefaultInputFile inputFile = builder.create(srcFile);
    inputFile = builder.complete(inputFile, InputFile.Type.MAIN);

    assertThat(inputFile.pathRelativeToSourceDir()).isEqualTo("foo/Bar.php");
View Full Code Here

  }

  @Test
  public void selectImplem() {
    GitBlameCommand blameCommand = new GitBlameCommand();
    JGitBlameCommand jblameCommand = new JGitBlameCommand(new PathResolver());
    Settings settings = new Settings(new PropertyDefinitions(new GitPlugin().getExtensions()));
    GitScmProvider gitScmProvider = new GitScmProvider(settings, blameCommand, jblameCommand);

    assertThat(gitScmProvider.blameCommand()).isEqualTo(jblameCommand);
View Full Code Here

  @Test
  public void testBlame() throws IOException {
    File projectDir = temp.newFolder();
    javaUnzip(new File("test-repos/dummy-git.zip"), projectDir);

    JGitBlameCommand jGitBlameCommand = new JGitBlameCommand(new PathResolver());

    File baseDir = new File(projectDir, "dummy-git");
    fs.setBaseDir(baseDir);
    DefaultInputFile inputFile = new DefaultInputFile("foo", DUMMY_JAVA)
      .setFile(new File(baseDir, DUMMY_JAVA));
View Full Code Here

  @Test
  public void testBlameOnNestedModule() throws IOException {
    File projectDir = temp.newFolder();
    javaUnzip(new File("test-repos/dummy-git-nested.zip"), projectDir);

    JGitBlameCommand jGitBlameCommand = new JGitBlameCommand(new PathResolver());

    File baseDir = new File(projectDir, "dummy-git-nested/dummy-project");
    fs.setBaseDir(baseDir);
    DefaultInputFile inputFile = new DefaultInputFile("foo", DUMMY_JAVA)
      .setFile(new File(baseDir, DUMMY_JAVA));
View Full Code Here

TOP

Related Classes of org.sonar.api.scan.filesystem.PathResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.