Examples of BatchExtension


Examples of org.sonar.api.BatchExtension

    assertThat(sensors).containsOnly(sensor1, sensor2);
  }

  @Test
  public void shouldSearchInParentContainers() {
    BatchExtension a = new FakeSensor();
    BatchExtension b = new FakeSensor();
    BatchExtension c = new FakeSensor();

    ComponentContainer grandParent = new ComponentContainer();
    grandParent.addSingleton(a);

    ComponentContainer parent = grandParent.createChild();
View Full Code Here

Examples of org.sonar.api.BatchExtension

    assertThat(dictionnary.select(BatchExtension.class)).containsOnly(a, b, c);
  }

  @Test
  public void sortExtensionsByDependency() {
    BatchExtension a = new MethodDependentOf(null);
    BatchExtension b = new MethodDependentOf(a);
    BatchExtension c = new MethodDependentOf(b);

    BatchExtensionDictionnary selector = newSelector(b, c, a);
    List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true));

    assertThat(extensions).hasSize(3);
View Full Code Here

Examples of org.sonar.api.BatchExtension

    assertThat(extensions.get(2)).isEqualTo(c);
  }

  @Test
  public void useMethodAnnotationsToSortExtensions() {
    BatchExtension a = new GeneratesSomething("foo");
    BatchExtension b = new MethodDependentOf("foo");

    BatchExtensionDictionnary selector = newSelector(a, b);
    List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true));

    assertThat(extensions.size()).isEqualTo(2);
View Full Code Here

Examples of org.sonar.api.BatchExtension

    assertThat(extensions.get(1)).isEqualTo(b);
  }

  @Test
  public void methodDependsUponCollection() {
    BatchExtension a = new GeneratesSomething("foo");
    BatchExtension b = new MethodDependentOf(Arrays.asList("foo"));

    BatchExtensionDictionnary selector = newSelector(a, b);
    List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true));

    assertThat(extensions).hasSize(2);
View Full Code Here

Examples of org.sonar.api.BatchExtension

    assertThat(extensions.get(1)).isEqualTo(b);
  }

  @Test
  public void methodDependsUponArray() {
    BatchExtension a = new GeneratesSomething("foo");
    BatchExtension b = new MethodDependentOf(new String[]{"foo"});

    BatchExtensionDictionnary selector = newSelector(a, b);
    List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true));

    assertThat(extensions).hasSize(2);
View Full Code Here

Examples of org.sonar.api.BatchExtension

    assertThat(extensions.get(1)).isEqualTo(b);
  }

  @Test
  public void useClassAnnotationsToSortExtensions() {
    BatchExtension a = new ClassDependedUpon();
    BatchExtension b = new ClassDependsUpon();

    BatchExtensionDictionnary selector = newSelector(a, b);
    List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true));

    assertThat(extensions).hasSize(2);
View Full Code Here

Examples of org.sonar.api.BatchExtension

    assertThat(extensions.get(1)).isEqualTo(b);
  }

  @Test
  public void useClassAnnotationsOnInterfaces() {
    BatchExtension a = new InterfaceDependedUpon() {
    };
    BatchExtension b = new InterfaceDependsUpon() {
    };

    BatchExtensionDictionnary selector = newSelector(a, b);
    List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true));
View Full Code Here

Examples of org.sonar.api.BatchExtension

    assertThat(extensions.get(1)).isEqualTo(b);
  }

  @Test
  public void checkProject() {
    BatchExtension ok = new CheckProjectOK();
    BatchExtension ko = new CheckProjectKO();

    BatchExtensionDictionnary selector = newSelector(ok, ko);
    List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, new Project("key"), true));

    assertThat(extensions).hasSize(1);
View Full Code Here

Examples of org.sonar.api.BatchExtension

    assertThat(extensions.get(0)).isInstanceOf(CheckProjectOK.class);
  }

  @Test
  public void inheritAnnotations() {
    BatchExtension a = new SubClass("foo");
    BatchExtension b = new MethodDependentOf("foo");

    BatchExtensionDictionnary selector = newSelector(b, a);
    List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true));

    assertThat(extensions).hasSize(2);
View Full Code Here

Examples of org.sonar.api.BatchExtension

  }

  @Test(expected = IllegalStateException.class)
  public void annotatedMethodsCanNotBePrivate() {
    BatchExtensionDictionnary selector = newSelector();
    BatchExtension wrong = new BatchExtension() {
      @DependsUpon
      private Object foo() {
        return "foo";
      }
    };
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.