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


Java PropertyDefinitions类代码示例

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


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

示例1: getCheckstyleConfiguration

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void getCheckstyleConfiguration() throws Exception {
    fileSystem.setEncoding(StandardCharsets.UTF_8);
    final Settings settings = new Settings(new PropertyDefinitions(
            new CheckstylePlugin().getExtensions()));
    settings.setProperty(CheckstyleConstants.CHECKER_FILTERS_KEY,
            CheckstyleConstants.CHECKER_FILTERS_DEFAULT_VALUE);

    final RulesProfile profile = RulesProfile.create("sonar way", "java");

    final Rule rule = Rule.create("checkstyle", "CheckStyleRule1", "checkstyle rule one");
    rule.setConfigKey("checkstyle/rule1");
    profile.activateRule(rule, null);

    final CheckstyleConfiguration configuration = new CheckstyleConfiguration(settings,
            new CheckstyleProfileExporter(settings), profile, fileSystem);
    final Configuration checkstyleConfiguration = configuration.getCheckstyleConfiguration();
    assertThat(checkstyleConfiguration).isNotNull();
    assertThat(checkstyleConfiguration.getAttribute("charset")).isEqualTo("UTF-8");
    final File xmlFile = new File("checkstyle.xml");
    assertThat(xmlFile.exists()).isTrue();

    FileUtils.forceDelete(xmlFile);
}
 
开发者ID:checkstyle,项目名称:sonar-checkstyle,代码行数:26,代码来源:CheckstyleConfigurationTest.java

示例2: prepare

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Before
public void prepare() throws Exception {
  pullRequestFacade = mock(PullRequestFacade.class);
  Settings settings = new Settings(new PropertyDefinitions(PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL)
    .name("Server base URL")
    .description("HTTP URL of this SonarQube server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.")
    .category(CoreProperties.CATEGORY_GENERAL)
    .defaultValue(CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE)
    .build()));
  GitHubPluginConfiguration config = new GitHubPluginConfiguration(settings, new System2());
  context = mock(PostJobContext.class);

  settings.setProperty("sonar.host.url", "http://192.168.0.1");
  settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver");
  pullRequestIssuePostJob = new PullRequestIssuePostJob(config, pullRequestFacade, new MarkDownUtils(settings));
}
 
开发者ID:SonarSource,项目名称:sonar-github,代码行数:17,代码来源:PullRequestIssuePostJobTest.java

示例3: testAnnotateParams

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Test
public void testAnnotateParams() throws IOException {
  DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo")
    .setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath())
    .setLines(7);

  CvsCommandExecutor commandExecutor = mock(CvsCommandExecutor.class);
  Settings settings = new Settings(new PropertyDefinitions(CvsConfiguration.getProperties()));
  TempFolder tempFolder = mock(TempFolder.class);
  File tmp = new File("tmpcvs");
  when(tempFolder.newDir("cvs")).thenReturn(tmp);
  CvsBlameCommand cvsBlameCommand = new CvsBlameCommand(new CvsConfiguration(settings), tempFolder, commandExecutor);

  assertThat(cvsBlameCommand.buildAnnotateArguments(inputFile)).containsExactly("src/foo.xoo");

  settings.setProperty(CvsConfiguration.REV_PROP_KEY, "my-branch");
  assertThat(cvsBlameCommand.buildAnnotateArguments(inputFile)).containsExactly("-r", "my-branch", "src/foo.xoo");
}
 
开发者ID:SonarSource,项目名称:sonar-scm-cvs,代码行数:19,代码来源:CvsBlameCommandTest.java

示例4: init

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Before
public void init() throws Exception {
  sonarIssue = new DefaultIssue()
    .setKey("ABCD")
    .setMessage("The Cyclomatic Complexity of this method is 14 which is greater than 10 authorized.")
    .setSeverity("MINOR")
    .setRuleKey(RuleKey.of("squid", "CycleBetweenPackages"));

  ruleFinder = mock(RuleFinder.class);
  when(ruleFinder.findByKey(RuleKey.of("squid", "CycleBetweenPackages"))).thenReturn(org.sonar.api.rules.Rule.create().setName("Avoid cycle between java packages"));

  settings = new Settings(new PropertyDefinitions(JiraIssueCreator.class, JiraPlugin.class));
  settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://my.sonar.com");
  settings.setProperty(JiraConstants.SERVER_URL_PROPERTY, "http://my.jira.com");
  settings.setProperty(JiraConstants.USERNAME_PROPERTY, "foo");
  settings.setProperty(JiraConstants.PASSWORD_PROPERTY, "bar");
  settings.setProperty(JiraConstants.JIRA_PROJECT_KEY_PROPERTY, "TEST");

  jiraIssueCreator = new JiraIssueCreator(ruleFinder);
}
 
开发者ID:aifraenkel,项目名称:caltec-tools,代码行数:21,代码来源:JiraIssueCreatorTest.java

示例5: ComponentContainer

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
protected ComponentContainer(MutablePicoContainer picoContainer) {
  this.parent = null;
  this.pico = picoContainer;
  this.componentKeys = new ComponentKeys();
  propertyDefinitions = new PropertyDefinitions();
  addSingleton(propertyDefinitions);
  addSingleton(this);
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:9,代码来源:ComponentContainer.java

示例6: shouldDeclareComponentProperties

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Test
public void shouldDeclareComponentProperties() {
  ComponentContainer container = new ComponentContainer();
  container.addSingleton(ComponentWithProperty.class);

  PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class);
  assertThat(propertyDefinitions.get("foo")).isNotNull();
  assertThat(propertyDefinitions.get("foo").defaultValue()).isEqualTo("bar");
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:10,代码来源:ComponentContainerTest.java

示例7: shouldDeclareExtensionWithoutAddingIt

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Test
public void shouldDeclareExtensionWithoutAddingIt() {
  ComponentContainer container = new ComponentContainer();
  PluginInfo plugin = mock(PluginInfo.class);
  container.declareExtension(plugin, ComponentWithProperty.class);

  PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class);
  assertThat(propertyDefinitions.get("foo")).isNotNull();
  assertThat(container.getComponentByType(ComponentWithProperty.class)).isNull();
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:11,代码来源:ComponentContainerTest.java

示例8: shouldDeclareExtensionWhenAdding

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Test
public void shouldDeclareExtensionWhenAdding() {
  ComponentContainer container = new ComponentContainer();
  PluginInfo plugin = mock(PluginInfo.class);
  container.addExtension(plugin, ComponentWithProperty.class);

  PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class);
  assertThat(propertyDefinitions.get("foo")).isNotNull();
  assertThat(container.getComponentByType(ComponentWithProperty.class)).isNotNull();
  assertThat(container.getComponentByKey(ComponentWithProperty.class)).isNotNull();
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:12,代码来源:ComponentContainerTest.java

示例9: prepare

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void prepare() {
    settings = new Settings(new PropertyDefinitions(new CheckstylePlugin().getExtensions()));
    System.setProperty("javax.xml.transform.TransformerFactory",
            "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
}
 
开发者ID:checkstyle,项目名称:sonar-checkstyle,代码行数:8,代码来源:CheckstyleProfileExporterTest.java

示例10: setUp

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Before
public void setUp() {
    settings = new Settings(new PropertyDefinitions(PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL).name("Server base URL")
            .description("HTTP URL of this SonarQube server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.")
            .category(CoreProperties.CATEGORY_GENERAL).defaultValue(CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE).build()).addComponents(GitLabPlugin.definitions()));

    settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver");
    settings.setProperty(GitLabPlugin.GITLAB_COMMIT_SHA, "abc123");

    config = new GitLabPluginConfiguration(settings, new System2());
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:12,代码来源:InlineCommentBuilderTest.java

示例11: setUp

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Before
public void setUp() {
    settings = new Settings(new PropertyDefinitions(PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL).name("Server base URL")
            .description("HTTP URL of this SonarQube server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.")
            .category(CoreProperties.CATEGORY_GENERAL).defaultValue(CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE).build()).addComponents(GitLabPlugin.definitions()));

    settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver");
    settings.setProperty(GitLabPlugin.GITLAB_COMMIT_SHA, "abc123");

    config = new GitLabPluginConfiguration(settings, new System2());

    settings.setProperty(GitLabPlugin.GITLAB_GLOBAL_TEMPLATE, TEMPLATE);
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:14,代码来源:GlobalTemplateTest.java

示例12: setUp

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Settings settings = new Settings(new PropertyDefinitions(PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL).name("Server base URL")
            .description("HTTP URL of this SonarQube server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.")
            .category(CoreProperties.CATEGORY_GENERAL).defaultValue(CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE).build()).addComponents(GitLabPlugin.definitions()));

    settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver");

    MarkDownUtils markDownUtils = new MarkDownUtils();

    printTemplateMethodModelEx = new PrintTemplateMethodModelEx(markDownUtils);
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:13,代码来源:PrintTemplateMethodModelExTest.java

示例13: setUp

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Settings settings = new Settings(new PropertyDefinitions(PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL).name("Server base URL")
            .description("HTTP URL of this SonarQube server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.")
            .category(CoreProperties.CATEGORY_GENERAL).defaultValue(CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE).build()).addComponents(GitLabPlugin.definitions()));

    settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver");

    MarkDownUtils markDownUtils = new MarkDownUtils();

    emojiSeverityTemplateMethodModelEx = new EmojiSeverityTemplateMethodModelEx(markDownUtils);
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:13,代码来源:EmojiSeverityTemplateMethodModelExTest.java

示例14: setUp

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Settings settings = new Settings(new PropertyDefinitions(PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL).name("Server base URL")
            .description("HTTP URL of this SonarQube server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.")
            .category(CoreProperties.CATEGORY_GENERAL).defaultValue(CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE).build()).addComponents(GitLabPlugin.definitions()));

    settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver");

    MarkDownUtils markDownUtils = new MarkDownUtils();

    imageSeverityTemplateMethodModelEx = new ImageSeverityTemplateMethodModelEx(markDownUtils);
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:13,代码来源:ImageSeverityTemplateMethodModelExTest.java

示例15: setUp

import org.sonar.api.config.PropertyDefinitions; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Settings settings = new Settings(new PropertyDefinitions(PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL).name("Server base URL")
            .description("HTTP URL of this SonarQube server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.")
            .category(CoreProperties.CATEGORY_GENERAL).defaultValue(CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE).build()).addComponents(GitLabPlugin.definitions()));

    settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver");

    GitLabPluginConfiguration gitLabPluginConfiguration = new GitLabPluginConfiguration(settings,new System2());

    ruleLinkTemplateMethodModelEx = new RuleLinkTemplateMethodModelEx(gitLabPluginConfiguration);
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:13,代码来源:RuleLinkTemplateMethodModelExTest.java


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