Package org.sonar.core.component

Examples of org.sonar.core.component.ScanGraph.addComponent()


  }

  @Test
  public void should_cover_multiple_testables() {
    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = graph.createAdjacentVertex(file1, DefaultTestable.class, "testable");
    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = graph.createAdjacentVertex(file2, DefaultTestable.class, "testable");
    DefaultTestCase testCase = graph.createVertex(DefaultTestCase.class);
View Full Code Here


  @Test
  public void should_cover_multiple_testables() {
    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = graph.createAdjacentVertex(file1, DefaultTestable.class, "testable");
    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = graph.createAdjacentVertex(file2, DefaultTestable.class, "testable");
    DefaultTestCase testCase = graph.createVertex(DefaultTestCase.class);

    testCase.setCoverageBlock(testable1, Arrays.asList(10, 11, 12));
    testCase.setCoverageBlock(testable2, Arrays.asList(12, 13, 14));
View Full Code Here

  @Test
  public void should_return_cover_of_testable() {
    BeanGraph beanGraph = BeanGraph.createInMemory();

    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = beanGraph.createAdjacentVertex(file1, DefaultTestable.class, "testable");

    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = beanGraph.createAdjacentVertex(file2, DefaultTestable.class, "testable");
View Full Code Here

    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = beanGraph.createAdjacentVertex(file1, DefaultTestable.class, "testable");

    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = beanGraph.createAdjacentVertex(file2, DefaultTestable.class, "testable");

    DefaultTestCase testCase = beanGraph.createVertex(DefaultTestCase.class);
    testCase.setCoverageBlock(testable1, Arrays.asList(10, 11, 12));
View Full Code Here

  public void should_fail_if_coverage_block_already_exits() {
    thrown.expect(CoverageAlreadyExistsException.class);

    ScanGraph graph = ScanGraph.create();

    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable = graph.createAdjacentVertex(file, DefaultTestable.class, "testable");

    DefaultTestCase testCase = graph.createVertex(DefaultTestCase.class);
    testCase.setCoverageBlock(testable, Arrays.asList(10, 11, 12));
View Full Code Here

  @Test
  public void should_not_load_missing_perspective() {
    ScanGraph graph = ScanGraph.create();
    TestablePerspectiveLoader loader = new TestablePerspectiveLoader();
    TestableBuilder builder = new TestableBuilder(graph, loader);
    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));

    assertThat(builder.getPerspectiveLoader().load(file)).isNull();
  }

  @Test
View Full Code Here

  @Test
  public void should_create_perspective() {
    ScanGraph graph = ScanGraph.create();
    TestablePerspectiveLoader loader = new TestablePerspectiveLoader();
    TestableBuilder builder = new TestableBuilder(graph, loader);
    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));

    MutableTestable testable = builder.create(file);
    assertThat(testable).isNotNull();
    assertThat(testable.component()).isSameAs(file);
    assertThat(builder.getPerspectiveLoader().load(file)).isSameAs(testable);
View Full Code Here

  @Test
  public void return_cover_of_testCase(){
    BeanGraph beanGraph = BeanGraph.createInMemory();

    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = beanGraph.createAdjacentVertex(file1, DefaultTestable.class, "testable");

    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = beanGraph.createAdjacentVertex(file2, DefaultTestable.class, "testable");
View Full Code Here

    ScanGraph graph = ScanGraph.create();
    ComponentVertex file1 = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));
    DefaultTestable testable1 = beanGraph.createAdjacentVertex(file1, DefaultTestable.class, "testable");

    ComponentVertex file2 = graph.addComponent(MockSourceFile.createMain("org.foo.File"));
    DefaultTestable testable2 = beanGraph.createAdjacentVertex(file2, DefaultTestable.class, "testable");

    DefaultTestPlan plan = beanGraph.createVertex(DefaultTestPlan.class);
    plan.addTestCase("T1");
View Full Code Here

  @Test
  public void should_not_load_missing_perspective() {
    ScanGraph graph = ScanGraph.create();
    TestPlanPerspectiveLoader loader = new TestPlanPerspectiveLoader();
    TestPlanBuilder builder = new TestPlanBuilder(graph, loader);
    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));

    assertThat(builder.getPerspectiveLoader().load(file)).isNull();
  }

  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.