Package org.sonar.api.batch.sensor.dependency.internal

Examples of org.sonar.api.batch.sensor.dependency.internal.DefaultDependency


    this.inputPathCache = inputPathCache;
  }

  @Override
  public void put(Value value, Object object, CoderContext context) {
    DefaultDependency dep = (DefaultDependency) object;
    value.putUTF(((DefaultInputFile) dep.from()).moduleKey());
    value.putUTF(((DefaultInputFile) dep.from()).relativePath());
    value.putUTF(((DefaultInputFile) dep.to()).moduleKey());
    value.putUTF(((DefaultInputFile) dep.to()).relativePath());
    value.put(dep.weight());
  }
View Full Code Here


    InputFile to = inputPathCache.getFile(toModuleKey, toRelativePath);
    if (to == null) {
      throw new IllegalStateException("Unable to load InputFile " + toModuleKey + ":" + toRelativePath);
    }
    int weight = value.getInt();
    return new DefaultDependency()
      .from(from)
      .to(to)
      .weight(weight);
  }
View Full Code Here

    File foo = File.create("src/Foo.java");
    File bar = File.create("src/Bar.java");
    when(sensorContext.getResource(foo)).thenReturn(foo);
    when(sensorContext.getResource(bar)).thenReturn(bar);

    adaptor.store(new DefaultDependency()
      .from(new DefaultInputFile("foo", "src/Foo.java").setType(Type.MAIN))
      .to(new DefaultInputFile("foo", "src/Bar.java").setType(Type.MAIN))
      .weight(3));

    ArgumentCaptor<Dependency> argumentCaptor = ArgumentCaptor.forClass(Dependency.class);
View Full Code Here

    when(sonarIndex.getEdge(foo, bar)).thenReturn(new Dependency(foo, bar));

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("Dependency between [moduleKey=foo, relative=src/Foo.java, abs=null] and [moduleKey=foo, relative=src/Bar.java, abs=null] was already saved.");

    adaptor.store(new DefaultDependency()
      .from(new DefaultInputFile("foo", "src/Foo.java").setType(Type.MAIN))
      .to(new DefaultInputFile("foo", "src/Bar.java").setType(Type.MAIN))
      .weight(3));
  }
View Full Code Here

    File foo = File.create("src1/Foo.java");
    File bar = File.create("src2/Bar.java");
    when(sensorContext.getResource(foo)).thenReturn(foo);
    when(sensorContext.getResource(bar)).thenReturn(bar);

    adaptor.store(new DefaultDependency()
      .from(new DefaultInputFile("foo", "src1/Foo.java").setType(Type.MAIN))
      .to(new DefaultInputFile("foo", "src2/Bar.java").setType(Type.MAIN))
      .weight(3));

    ArgumentCaptor<Dependency> argumentCaptor = ArgumentCaptor.forClass(Dependency.class);
View Full Code Here

    when(sensorContext.getResource(foo)).thenReturn(foo);
    when(sensorContext.getResource(bar)).thenReturn(bar);
    Dependency parentDep = new Dependency(src1, src2).setWeight(4);
    when(sonarIndex.getEdge(src1, src2)).thenReturn(parentDep);

    adaptor.store(new DefaultDependency()
      .from(new DefaultInputFile("foo", "src1/Foo.java").setType(Type.MAIN))
      .to(new DefaultInputFile("foo", "src2/Bar.java").setType(Type.MAIN))
      .weight(3));

    ArgumentCaptor<Dependency> argumentCaptor = ArgumentCaptor.forClass(Dependency.class);
View Full Code Here

    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);
      }
    });

    sensor.execute(context);

    verify(sensorStorage).store(new DefaultDependency()
      .from(inputFile1)
      .to(inputFile2)
      .weight(2));
    verify(sensorStorage).store(new DefaultDependency()
      .from(inputFile1)
      .to(inputFile3)
      .weight(6));
  }
View Full Code Here

    return new DefaultTestCaseCoverage(this);
  }

  @Override
  public Dependency newDependency() {
    return new DefaultDependency(this);
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.sensor.dependency.internal.DefaultDependency

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.