Package org.sonar.api.batch.sensor

Examples of org.sonar.api.batch.sensor.SensorStorage


    DefaultFileSystem fs = new DefaultFileSystem();
    DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).setLines(10);
    fs.add(inputFile);

    SensorContext context = mock(SensorContext.class);
    final SensorStorage sensorStorage = mock(SensorStorage.class);
    when(context.settings()).thenReturn(new Settings());
    when(context.fileSystem()).thenReturn(fs);
    when(context.newIssue()).thenAnswer(new Answer<Issue>() {
      @Override
      public Issue answer(InvocationOnMock invocation) throws Throwable {
View Full Code Here


    DefaultFileSystem fs = new DefaultFileSystem();
    DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).setLines(10);
    fs.add(inputFile);

    SensorContext context = mock(SensorContext.class);
    final SensorStorage sensorStorage = mock(SensorStorage.class);
    Settings settings = new Settings();
    settings.setProperty(OneIssuePerLineSensor.FORCE_SEVERITY_PROPERTY, "MINOR");
    when(context.settings()).thenReturn(settings);
    when(context.fileSystem()).thenReturn(fs);
    when(context.newIssue()).thenAnswer(new Answer<Issue>() {
View Full Code Here

    DefaultInputFile inputFile3 = new DefaultInputFile("foo", "src2/foo3.xoo").setAbsolutePath(new File(baseDir, "src2/foo3.xoo").getAbsolutePath()).setLanguage("xoo");
    fileSystem.add(inputFile1);
    fileSystem.add(inputFile2);
    fileSystem.add(inputFile3);

    final SensorStorage sensorStorage = mock(SensorStorage.class);

    when(context.newDependency()).thenAnswer(new Answer<Dependency>() {
      @Override
      public Dependency answer(InvocationOnMock invocation) throws Throwable {
        return new DefaultDependency(sensorStorage);
View Full Code Here

    FileUtils.write(testPlan, "test1:UNIT:OK:::10\ntest2:INTEGRATION:ERROR:message:stack:15\n\n#comment");
    DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setAbsolutePath(new File(baseDir, "test/fooTest.xoo").getAbsolutePath()).setLanguage("xoo")
      .setType(Type.TEST);
    fileSystem.add(testFile);

    final SensorStorage sensorStorage = mock(SensorStorage.class);

    when(context.newTestCaseExecution()).thenAnswer(new Answer<TestCaseExecution>() {
      @Override
      public TestCaseExecution answer(InvocationOnMock invocation) throws Throwable {
        return new DefaultTestCaseExecution(sensorStorage);
View Full Code Here

    DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setAbsolutePath(new File(baseDir, "test/fooTest.xoo").getAbsolutePath()).setLanguage("xoo")
      .setType(Type.TEST);
    fileSystem.add(inputFile);
    fileSystem.add(testFile);

    final SensorStorage sensorStorage = mock(SensorStorage.class);

    when(context.newTestCaseCoverage()).thenAnswer(new Answer<TestCaseCoverage>() {
      @Override
      public TestCaseCoverage answer(InvocationOnMock invocation) throws Throwable {
        return new DefaultTestCaseCoverage(sensorStorage);
View Full Code Here

    assertThat(coverage.type()).isEqualTo(CoverageType.UNIT);
  }

  @Test
  public void testSaveLines() {
    SensorStorage storage = mock(SensorStorage.class);
    new DefaultCoverage(storage)
      .onFile(main)
      .ofType(CoverageType.UNIT)
      .lineHits(1, 2)
      .lineHits(2, 5)
View Full Code Here

    verifyNoMoreInteractions(storage);
  }

  @Test
  public void testSaveConditions() {
    SensorStorage storage = mock(SensorStorage.class);
    new DefaultCoverage(storage)
      .onFile(main)
      .ofType(CoverageType.UNIT)
      .conditions(1, 2, 1)
      .save();
View Full Code Here

    verifyNoMoreInteractions(storage);
  }

  @Test
  public void testSaveLinesAndConditions() {
    SensorStorage storage = mock(SensorStorage.class);
    new DefaultCoverage(storage)
      .onFile(main)
      .ofType(CoverageType.UNIT)
      .lineHits(1, 2)
      .lineHits(2, 5)
View Full Code Here

    verifyNoMoreInteractions(storage);
  }

  @Test
  public void dontSaveTwice() {
    SensorStorage storage = mock(SensorStorage.class);
    DefaultCoverage coverage = new DefaultCoverage(storage)
      .onFile(main)
      .ofType(CoverageType.UNIT)
      .lineHits(1, 2)
      .lineHits(2, 5)
View Full Code Here

  @Rule
  public ExpectedException thrown = ExpectedException.none();

  @Test
  public void build_file_issue() {
    SensorStorage storage = mock(SensorStorage.class);
    DefaultIssue issue = new DefaultIssue(storage)
      .onFile(new DefaultInputFile("foo", "src/Foo.php"))
      .ruleKey(RuleKey.of("repo", "rule"))
      .atLine(1)
      .effortToFix(10.0)
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.sensor.SensorStorage

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.