Package org.sonar.api.resources

Examples of org.sonar.api.resources.Project


  }

  @Test
  public void shouldReturnDefaultJavaVersion() {
    Settings configuration = new Settings();
    Project project = new Project("").setSettings(configuration);

    assertThat(JavaUtils.getSourceVersion(project), is("1.5"));
    assertThat(JavaUtils.getTargetVersion(project), is("1.5"));
  }
View Full Code Here


  }

  @Test
  public void shouldReturnSpecifiedJavaVersion() {
    Settings configuration = new Settings();
    Project project = new Project("").setSettings(configuration);
    configuration.setProperty(JavaUtils.JAVA_SOURCE_PROPERTY, "1.4");
    configuration.setProperty(JavaUtils.JAVA_TARGET_PROPERTY, "1.6");

    assertThat(JavaUtils.getSourceVersion(project), is("1.4"));
    assertThat(JavaUtils.getTargetVersion(project), is("1.6"));
View Full Code Here

    settings.setProperty("sonar.cpd.php.minimumTokens", "33");
    assertThat(engine.getMinimumTokens("php")).isEqualTo(33);
  }

  private static Project newProject(String key) {
    return new Project(key).setAnalysisType(Project.AnalysisType.DYNAMIC);
  }
View Full Code Here

  Logger logger;
  private AnalysisMode analysisMode;

  @Before
  public void setUp() {
    project = new Project("foo");
    settings = new Settings();
    analysisMode = mock(AnalysisMode.class);
    factory = new IndexFactory(analysisMode, settings, mock(ResourcePersister.class), mock(DuplicationDao.class));
    logger = mock(Logger.class);
  }
View Full Code Here

  }

  @Test
  public void should_index() throws Exception {
    DefaultModuleFileSystem fs = new DefaultModuleFileSystem(moduleInputFileCache,
      new Project("foo"), settings, fileIndexer, initializer, componentIndexer);

    verifyZeroInteractions(fileIndexer);

    fs.index();
    verify(fileIndexer).index(fs);
View Full Code Here

  @Test
  public void shouldComputeVariations() {
    TimeMachineConfiguration timeMachineConfiguration = mock(TimeMachineConfiguration.class);
    VariationDecorator decorator = new VariationDecorator(mock(PastMeasuresLoader.class), mock(MetricFinder.class), timeMachineConfiguration, mock(RuleFinder.class));

    assertThat(decorator.shouldComputeVariation(new Project("foo"))).isTrue();
    assertThat(decorator.shouldComputeVariation(new File("foo/bar.c"))).isFalse();
  }
View Full Code Here

  public TemporaryFolder temp = new TemporaryFolder();

  @Test
  public void should_wrap_module_file_system() {
    DefaultModuleFileSystem target = mock(DefaultModuleFileSystem.class, Mockito.RETURNS_SMART_NULLS);
    ProjectFileSystemAdapter adapter = new ProjectFileSystemAdapter(target, new Project("my-project"));

    assertThat(adapter.getBasedir()).isNotNull();
    verify(target).baseDir();

    assertThat(adapter.getSourceDirs()).isNotNull();
View Full Code Here

  @Test
  public void should_create_default_build_dir() throws IOException {
    File workingDir = temp.newFile("work");
    DefaultModuleFileSystem target = mock(DefaultModuleFileSystem.class);
    when(target.workingDir()).thenReturn(workingDir);
    ProjectFileSystemAdapter adapter = new ProjectFileSystemAdapter(target, new Project("my-project"));

    File buildDir = adapter.getBuildDir();
    assertThat(buildDir.getParentFile().getCanonicalPath()).isEqualTo(workingDir.getCanonicalPath());
  }
View Full Code Here

    verifyZeroInteractions(sensorContext);
  }

  @Test
  public void store_file_hashes_for_branches() throws Exception {
    project = new Project("struts", "branch-2.x", "Struts 2.x");
    when(fileCache.filesByModule("struts:branch-2.x")).thenReturn(Lists.<InputFile>newArrayList(
      new DeprecatedDefaultInputFile("foo", "src/Foo.java").setFile(temp.newFile()).setHash("ABC"),
      new DeprecatedDefaultInputFile("foo", "src/Bar.java").setFile(temp.newFile()).setHash("DEF")));

    SensorContext sensorContext = mock(SensorContext.class);
View Full Code Here

  @Before
  public void prepare() throws IOException {
    baseDir = temp.newFolder();
    sonarIndex = mock(SonarIndex.class);
    sourcePersister = mock(SourcePersister.class);
    project = new Project("myProject");
    cobolLanguage = new AbstractLanguage("cobol") {
      @Override
      public String[] getFileSuffixes() {
        return new String[] {"cbl"};
      }
View Full Code Here

TOP

Related Classes of org.sonar.api.resources.Project

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.