当前位置: 首页>>代码示例>>Java>>正文


Java FileLocation类代码示例

本文整理汇总了Java中com.sonar.orchestrator.locator.FileLocation的典型用法代码示例。如果您正苦于以下问题:Java FileLocation类的具体用法?Java FileLocation怎么用?Java FileLocation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FileLocation类属于com.sonar.orchestrator.locator包,在下文中一共展示了FileLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
@Test
public void test() throws Exception {
  File litsDifferencesFile = FileLocation.of("target/differences").getFile();
  orchestrator.getServer().provisionProject("project", "project");
  orchestrator.getServer().associateProjectToQualityProfile("project", "css", "rules");
  orchestrator.getServer().associateProjectToQualityProfile("project", "less", "rules");
  orchestrator.getServer().associateProjectToQualityProfile("project", "scss", "rules");
  SonarScanner build = SonarScanner.create(FileLocation.of("../projects").getFile())
    .setProjectKey("project")
    .setProjectName("project")
    .setProjectVersion("1.0")
    .setSourceDirs("./")
    .setSourceEncoding("UTF-8")
    .setProperty("sonar.import_unknown_files", "true")
    .setProperty("sonar.analysis.mode", "preview")
    .setProperty("sonar.issuesReport.html.enable", "true")
    .setProperty("dump.old", FileLocation.of("src/test/expected").getFile().getAbsolutePath())
    .setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath())
    .setProperty("lits.differences", litsDifferencesFile.getAbsolutePath())
    .setProperty("sonar.cpd.skip", "true");
  orchestrator.executeBuild(build);

  assertThat(Files.toString(litsDifferencesFile, StandardCharsets.UTF_8)).isEmpty();
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:25,代码来源:CssTest.java

示例2: setupSonarQube

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
@Before
public void setupSonarQube() {
    System.getProperties().setProperty("sonar.runtimeVersion", sonarQubeVersion);

    orchestrator = Orchestrator.builderEnv()
            .addPlugin(FileLocation.byWildcardMavenFilename(new File("target"), "sonar-jdepend-plugin-*.jar"))
            .setOrchestratorProperty("javaVersion", javaVersion).addPlugin("java")
            .restoreProfileAtStartup(FileLocation.of(new File("target/it", "profile.xml"))).build();

    orchestrator.start();

    // Provision project
    orchestrator.getServer().adminWsClient().projectClient()
            .create(NewProject.create().key("nl.future-edge.sonarqube.plugins:sonar-jdepend-plugin-it")
                    .name("Test project for Integration Test"));
    orchestrator.getServer().associateProjectToQualityProfile(
            "nl.future-edge.sonarqube.plugins:sonar-jdepend-plugin-it", "java", "test");
}
 
开发者ID:willemsrb,项目名称:sonar-jdepend-plugin,代码行数:19,代码来源:PluginIT.java

示例3: createScanner

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
private SonarScanner createScanner(String projectKey, String encoding) {
  return SonarScanner.create(FileLocation.of("../projects/" + projectKey).getFile())
    .setProjectKey(projectKey)
    .setProjectName(projectKey)
    .setProjectVersion("1.0")
    .setLanguage("jproperties")
    .setSourceDirs("./")
    .setSourceEncoding(encoding)
    .setProperty("sonar.analysis.mode", "preview")
    .setProperty("sonar.issuesReport.html.enable", "true")
    .setProperty("dump.old", FileLocation.of("src/test/expected/" + projectKey).getFile().getAbsolutePath())
    .setProperty("dump.new", FileLocation.of("target/actual-" + projectKey).getFile().getAbsolutePath())
    .setProperty("lits.differences", FileLocation.of("target/differences-" + projectKey).getFile().getAbsolutePath())
    .setProperty("sonar.cpd.skip", "true")
    .setProperty("sonar.jproperties.sourceEncoding", encoding);
}
 
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:17,代码来源:JavaPropertiesRulingTest.java

示例4: test

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
@Test
public void test() throws Exception {
  File litsDifferencesFile = FileLocation.of("target/differences").getFile();
  orchestrator.getServer().provisionProject("project", "project");
  orchestrator.getServer().associateProjectToQualityProfile("project", "json", "rules");
  SonarScanner build = SonarScanner.create(FileLocation.of("../projects").getFile())
    .setProjectKey("project")
    .setProjectName("project")
    .setProjectVersion("1.0")
    .setLanguage("json")
    .setSourceDirs("./")
    .setSourceEncoding("UTF-8")
    .setProperty("sonar.analysis.mode", "preview")
    .setProperty("sonar.issuesReport.html.enable", "true")
    .setProperty("dump.old", FileLocation.of("src/test/expected").getFile().getAbsolutePath())
    .setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath())
    .setProperty("lits.differences", litsDifferencesFile.getAbsolutePath())
    .setProperty("sonar.cpd.skip", "true");
  orchestrator.executeBuild(build);

  assertThat(Files.toString(litsDifferencesFile, StandardCharsets.UTF_8)).isEmpty();
}
 
开发者ID:racodond,项目名称:sonar-json-plugin,代码行数:23,代码来源:JsonRulingTest.java

示例5: ruling

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
@Test
public void ruling() throws Exception {
  File litsDifferencesFile = FileLocation.of("target/differences").getFile();
  String projectKey = "project";
  orchestrator.getServer().provisionProject(projectKey, projectKey);
  orchestrator.getServer().associateProjectToQualityProfile(projectKey, "web", "rules");
  SonarScanner build = SonarScanner.create()
    .setProjectDir(FileLocation.of("../sources").getFile())
    .setProjectKey(projectKey)
    .setProjectName(projectKey)
    .setProjectVersion("1")
    .setSourceDirs(".")
    .setSourceEncoding("UTF-8")
    .setProperty("sonar.web.file.suffixes", "xhtml,jspf,jsp,html,php,erb")
    .setProperty("sonar.analysis.mode", "preview")
    .setProperty("sonar.issuesReport.html.enable", "true")
    .setProperty("dump.old", FileLocation.of("src/test/resources/expected").getFile().getAbsolutePath())
    .setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath())
    .setProperty("lits.differences", litsDifferencesFile.getAbsolutePath())
    .setProperty("sonar.cpd.skip", "true")
    .setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Xmx1024m");
  orchestrator.executeBuild(build);

  assertThat(Files.toString(litsDifferencesFile, StandardCharsets.UTF_8)).isEmpty();
}
 
开发者ID:SonarSource,项目名称:sonar-web,代码行数:26,代码来源:WebRulingTest.java

示例6: setupSonarQube

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
@Before
public void setupSonarQube() {
	System.getProperties().setProperty("sonar.runtimeVersion", sonarQubeVersion);

	final OrchestratorBuilder builder = Orchestrator.builderEnv();
	builder.addPlugin(FileLocation.byWildcardMavenFilename(new File("target"), "sonar-issueresolver-plugin-*.jar"));
	builder.setOrchestratorProperty("javaVersion", "4.2.1").addPlugin("java");

	// Enable debug logging for web components
	builder.setServerProperty("sonar.log.level.web", "DEBUG");

	orchestrator = builder.build();
	orchestrator.start();
}
 
开发者ID:willemsrb,项目名称:sonar-issueresolver-plugin,代码行数:15,代码来源:PluginIT.java

示例7: orchestratorBuilderFor

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
private static OrchestratorBuilder orchestratorBuilderFor(String version) {
    FileLocation sonarPluginJar = FileLocation.byWildcardMavenFilename(new File("../../sonar-perl-plugin/build/libs"),
            "sonar-perl-plugin-*.jar");
    OrchestratorBuilder orchestratorBuilder = Orchestrator.builderEnv()
            .setSonarVersion(version)
            .addPlugin(sonarPluginJar);
    return orchestratorBuilder;
}
 
开发者ID:sonar-perl,项目名称:sonar-perl,代码行数:9,代码来源:IntegrationTests.java

示例8: setupSonarQube

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
@Before
public void setupSonarQube() {
    System.getProperties().setProperty("sonar.runtimeVersion", sonarQubeVersion);

    orchestrator = Orchestrator.builderEnv()
            .addPlugin(FileLocation.byWildcardMavenFilename(new File("target"), "sonar-rci-plugin-*.jar"))
            .setOrchestratorProperty("javaVersion", "4.2.1").addPlugin("java").build();

    orchestrator.start();
}
 
开发者ID:willemsrb,项目名称:sonar-rci-plugin,代码行数:11,代码来源:PluginIT.java

示例9: test

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
@Test
public void test() throws Exception {
  File litsDifferencesFile = FileLocation.of("target/differences").getFile();
  orchestrator.getServer().provisionProject("project", "project");
  orchestrator.getServer().associateProjectToQualityProfile("project", "gherkin", "rules");
  SonarScanner build = SonarScanner.create(FileLocation.of("../projects").getFile())
    .setProjectKey("project")
    .setProjectName("project")
    .setProjectVersion("1.0")
    .setLanguage("gherkin")
    .setSourceDirs("./")
    .setSourceEncoding("UTF-8")
    .setProperty("sonar.analysis.mode", "preview")
    .setProperty("sonar.issuesReport.html.enable", "true")
    .setProperty("dump.old", FileLocation.of("src/test/expected").getFile().getAbsolutePath())
    .setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath())
    .setProperty("lits.differences", litsDifferencesFile.getAbsolutePath())
    .setProperty("sonar.cpd.skip", "true")

    .setProperty("sonar.exclusions",
      "custom/spelling/spelling-fr.feature,"
        + "custom/indentation/indentation-custom-ok.feature,"
        + "custom/indentation/indentation-custom-ko.feature"
    );
  orchestrator.executeBuild(build);

  assertThat(Files.toString(litsDifferencesFile, StandardCharsets.UTF_8)).isEmpty();
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:29,代码来源:GherkinRulingTest.java

示例10: testProject

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
private void testProject(String projectKey, String encoding) throws Exception {
  orchestrator.getServer().provisionProject(projectKey, projectKey);
  orchestrator.getServer().associateProjectToQualityProfile(projectKey, "jproperties", "rules");

  SonarScanner build = createScanner(projectKey, encoding);
  orchestrator.executeBuild(build);

  assertThat(Files.asCharSource(FileLocation.of("target/differences-" + projectKey).getFile(), StandardCharsets.UTF_8).read()).isEmpty();
}
 
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:10,代码来源:JavaPropertiesRulingTest.java

示例11: prepare

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
@BeforeClass
public static void prepare() throws Exception {
  StandaloneGlobalConfiguration sonarLintConfig = StandaloneGlobalConfiguration.builder()
    .addPlugin(FileLocation.byWildcardMavenFilename(new File("../../sonar-web-plugin/target"), "sonar-web-plugin-*.jar").getFile().toURI().toURL())
    .setSonarLintUserHome(temp.newFolder().toPath())
    .setLogOutput((formattedMessage, level) -> {
      /* Don't pollute logs */ })
    .build();
  sonarlintEngine = new StandaloneSonarLintEngineImpl(sonarLintConfig);
  baseDir = temp.newFolder();
}
 
开发者ID:SonarSource,项目名称:sonar-web,代码行数:12,代码来源:SonarLintTest.java

示例12: generateProfile

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
public static void generateProfile(Orchestrator orchestrator, String language) {
  try {
    StringBuilder sb = new StringBuilder()
      .append("<profile>")
      .append("<name>rules</name>")
      .append("<language>").append(language).append("</language>")
      .append("<rules>");

    Set<String> ruleKeys = getRuleKeysFromRepository(orchestrator, language);

    for (String key : ruleKeys) {
      sb.append("<rule>")
        .append("<repositoryKey>").append(language).append("</repositoryKey>")
        .append("<key>").append(key).append("</key>")
        .append("<priority>INFO</priority>");

      Collection<Parameter> parameters = ProfileGenerator.parameters.get(key);
      if (!parameters.isEmpty()) {
        sb.append("<parameters>");
        for (Parameter parameter : parameters) {
          sb.append("<parameter>")
            .append("<key>").append(parameter.parameterKey).append("</key>")
            .append("<value>").append(parameter.parameterValue).append("</value>")
            .append("</parameter>");
        }
        sb.append("</parameters>");
      }

      sb.append("</rule>");
    }
    sb.append("</rules>")
      .append("</profile>");

    File file = File.createTempFile("profile", ".xml");
    Files.write(sb, file, Charsets.UTF_8);
    orchestrator.getServer().restoreProfile(FileLocation.of(file));
    file.delete();
  } catch (IOException e) {
    throw Throwables.propagate(e);
  }
}
 
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:42,代码来源:ProfileGenerator.java

示例13: generateProfile

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
public static void generateProfile(Orchestrator orchestrator) {
  try {
    StringBuilder sb = new StringBuilder()
      .append("<profile>")
      .append("<name>rules</name>")
      .append("<language>gherkin</language>")
      .append("<rules>");

    Set<String> ruleKeys = getRuleKeysFromRepository(orchestrator);

    for (String key : ruleKeys) {
      sb.append("<rule>")
        .append("<repositoryKey>gherkin</repositoryKey>")
        .append("<key>").append(key).append("</key>")
        .append("<priority>INFO</priority>");

      Collection<Parameter> parameters = ProfileGenerator.parameters.get(key);
      if (!parameters.isEmpty()) {
        sb.append("<parameters>");
        for (Parameter parameter : parameters) {
          sb.append("<parameter>")
            .append("<key>").append(parameter.parameterKey).append("</key>")
            .append("<value>").append(parameter.parameterValue).append("</value>")
            .append("</parameter>");
        }
        sb.append("</parameters>");
      }

      sb.append("</rule>");
    }
    sb.append("</rules>")
      .append("</profile>");

    File file = File.createTempFile("profile", ".xml");
    Files.write(sb, file, Charsets.UTF_8);
    orchestrator.getServer().restoreProfile(FileLocation.of(file));
    file.delete();
  } catch (IOException e) {
    throw Throwables.propagate(e);
  }
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:42,代码来源:ProfileGenerator.java

示例14: generateProfile

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
public static void generateProfile(Orchestrator orchestrator) {

    List<String> repositories = ImmutableList.of("jproperties", "sonarscanner");

    try {
      StringBuilder sb = new StringBuilder()
        .append("<profile>")
        .append("<name>rules</name>")
        .append("<language>jproperties</language>")
        .append("<rules>");

      for (String repository : repositories) {
        Set<String> ruleKeys = getRuleKeysFromRepository(repository, orchestrator);

        for (String key : ruleKeys) {
          sb.append("<rule>")
            .append("<repositoryKey>").append(repository).append("</repositoryKey>")
            .append("<key>").append(key).append("</key>")
            .append("<priority>INFO</priority>");

          Collection<Parameter> parameters = ProfileGenerator.parameters.get(key);
          if (!parameters.isEmpty()) {
            sb.append("<parameters>");
            for (Parameter parameter : parameters) {
              sb.append("<parameter>")
                .append("<key>").append(parameter.parameterKey).append("</key>")
                .append("<value>").append(parameter.parameterValue).append("</value>")
                .append("</parameter>");
            }
            sb.append("</parameters>");
          }

          sb.append("</rule>");
        }
      }
      sb.append("</rules>")
        .append("</profile>");

      File file = File.createTempFile("profile", ".xml");
      Files.asCharSink(file, Charsets.UTF_8).write(sb);
      orchestrator.getServer().restoreProfile(FileLocation.of(file));
      file.delete();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
 
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:47,代码来源:ProfileGenerator.java

示例15: generateProfile

import com.sonar.orchestrator.locator.FileLocation; //导入依赖的package包/类
public static void generateProfile(Orchestrator orchestrator) {
  try {
    StringBuilder sb = new StringBuilder()
      .append("<profile>")
      .append("<name>rules</name>")
      .append("<language>json</language>")
      .append("<rules>");

    Set<String> ruleKeys = getRuleKeysFromRepository(orchestrator);

    for (String key : ruleKeys) {
      sb.append("<rule>")
        .append("<repositoryKey>json</repositoryKey>")
        .append("<key>").append(key).append("</key>")
        .append("<priority>INFO</priority>");

      Collection<Parameter> parameters = ProfileGenerator.parameters.get(key);
      if (!parameters.isEmpty()) {
        sb.append("<parameters>");
        for (Parameter parameter : parameters) {
          sb.append("<parameter>")
            .append("<key>").append(parameter.parameterKey).append("</key>")
            .append("<value>").append(parameter.parameterValue).append("</value>")
            .append("</parameter>");
        }
        sb.append("</parameters>");
      }

      sb.append("</rule>");
    }
    sb.append("</rules>")
      .append("</profile>");

    File file = File.createTempFile("profile", ".xml");
    Files.write(sb, file, Charsets.UTF_8);
    orchestrator.getServer().restoreProfile(FileLocation.of(file));
    file.delete();
  } catch (IOException e) {
    throw Throwables.propagate(e);
  }
}
 
开发者ID:racodond,项目名称:sonar-json-plugin,代码行数:42,代码来源:ProfileGenerator.java


注:本文中的com.sonar.orchestrator.locator.FileLocation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。