Skip to content

Commit

Permalink
adapt ITs to produced plugin jar
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohops committed Nov 2, 2015
1 parent a489145 commit 2780774
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 11 additions & 1 deletion its/plugin/src/test/java/com/sonar/groovy/it/Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@
*/
package com.sonar.groovy.it;

import com.google.common.collect.Iterables;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.MavenBuild;
import com.sonar.orchestrator.locator.FileLocation;
import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import java.io.File;
import java.io.FilenameFilter;
import java.util.Arrays;

@RunWith(Suite.class)
@Suite.SuiteClasses({
GroovyTest.class,
Expand All @@ -38,7 +43,12 @@ public class Tests {

@ClassRule
public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
.addPlugin(FileLocation.of("../../sonar-groovy-plugin/target/sonar-groovy-plugin.jar"))
.addPlugin(FileLocation.of(Iterables.getOnlyElement(Arrays.asList(new File("../../sonar-groovy-plugin/target/").listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".jar") && !name.endsWith("-sources.jar");
}
}))).getAbsolutePath()))
.addPlugin("java")
.restoreProfileAtStartup(FileLocation.of("src/test/resources/default.xml"))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.sonarqube.groovy.it;

import com.google.common.collect.Iterables;
import com.google.common.io.Files;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarRunner;
Expand All @@ -27,15 +28,22 @@
import org.junit.Test;

import java.io.File;
import java.io.FilenameFilter;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

import static org.fest.assertions.Assertions.assertThat;

public class GroovyRulingTest {

@ClassRule
public static Orchestrator orchestrator = Orchestrator.builderEnv()
.addPlugin(FileLocation.of("../../sonar-groovy-plugin/target/sonar-groovy-plugin.jar"))
.addPlugin(FileLocation.of(Iterables.getOnlyElement(Arrays.asList(new File("../../sonar-groovy-plugin/target/").listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".jar") && !name.endsWith("-sources.jar");
}
}))).getAbsolutePath()))
.setOrchestratorProperty("litsVersion", "0.5")
.addPlugin("lits")
.restoreProfileAtStartup(FileLocation.of("src/test/resources/profile.xml"))
Expand Down

0 comments on commit 2780774

Please sign in to comment.