本文整理汇总了Java中org.sonar.api.CoreProperties类的典型用法代码示例。如果您正苦于以下问题:Java CoreProperties类的具体用法?Java CoreProperties怎么用?Java CoreProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CoreProperties类属于org.sonar.api包,在下文中一共展示了CoreProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: define
import org.sonar.api.CoreProperties; //导入依赖的package包/类
@Override
public void define(Context context) {
context.addExtensions(
VersiondebtSensor.class,
VersiondebtMetrics.class,
VersiondebtDashboardWidget.class,
PropertyDefinition.builder(VERSIONDEBT_REPORT_PATH)
.category(CoreProperties.CATEGORY_JAVA)
.subCategory("Versiondebt")
.name("Report path")
.description("Path (absolute or relative) to versiondebt xml file.")
.defaultValue("target/versiondebt.xml")
.onQualifiers(Qualifiers.PROJECT)
.build()
);
}
示例2: GitLabPluginConfiguration
import org.sonar.api.CoreProperties; //导入依赖的package包/类
public GitLabPluginConfiguration(Settings settings, System2 system2) {
super();
this.settings = settings;
this.system2 = system2;
String tempBaseUrl = settings.hasKey(CoreProperties.SERVER_BASE_URL) ? settings.getString(CoreProperties.SERVER_BASE_URL) : settings.getString("sonar.host.url");
if (tempBaseUrl == null) {
tempBaseUrl = "http://localhost:9090";
}
if (!tempBaseUrl.endsWith("/")) {
tempBaseUrl += "/";
}
this.baseUrl = tempBaseUrl;
LOG.info("GlobalWorkingDir {}", settings.getString(CoreProperties.GLOBAL_WORKING_DIRECTORY));
}
示例3: prepare
import org.sonar.api.CoreProperties; //导入依赖的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));
}
示例4: testStaticValues
import org.sonar.api.CoreProperties; //导入依赖的package包/类
@Test
public void testStaticValues() {
final Settings settings = new Settings();
settings.appendProperty(ReverseProxyAuthSettings.ALLOW_NEW_USERS, "true");
settings.appendProperty(CoreProperties.CORE_AUTHENTICATOR_REALM, ReverseProxyAuthPlugin.KEY);
settings.appendProperty(CoreProperties.SERVER_BASE_URL, "http://foo.com/sonar");
final ReverseProxyAuthUsersIdentityProvider provider = new ReverseProxyAuthUsersIdentityProvider(new ReverseProxyAuthSettings(settings));
assertEquals(ReverseProxyAuthPlugin.KEY, provider.getKey());
assertNotNull(provider.getName());
final Display display = provider.getDisplay();
assertNotNull(display);
assertEquals("http://foo.com/sonar/static/reverseproxyauth/proxy.png", display.getIconPath());
assertTrue(provider.isEnabled());
assertTrue(provider.allowsUsersToSignUp());
}
示例5: testUserProvider
import org.sonar.api.CoreProperties; //导入依赖的package包/类
@Test
public void testUserProvider() {
final Settings settings = new Settings();
settings.appendProperty(CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, "true");
settings.appendProperty("reverseproxyauth.header.name",
"X-Forwarded-User");
settings.appendProperty("reverseproxyauth.localhost", "localhost");
final HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
when(httpServletRequest.getHeader("X-Forwarded-User")).thenReturn(
"[email protected]");
when(httpServletRequest.getServerName())
.thenReturn("not.localhost.com");
when(httpServletRequest.getRequestURL())
.thenReturn(new StringBuffer("/"));
when(httpServletRequest.getContextPath())
.thenReturn("/");
final ReverseProxyAuthRealm realm = new ReverseProxyAuthRealm(new ReverseProxyAuthSettings(settings));
realm.init();
final ExternalUsersProvider.Context context = new ExternalUsersProvider.Context(null, httpServletRequest);
realm.getUsersProvider().doGetUserDetails(context);
}
示例6: testUserProviderLocalhost
import org.sonar.api.CoreProperties; //导入依赖的package包/类
@Test
public void testUserProviderLocalhost() {
final Settings settings = new Settings();
settings.appendProperty(CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, "true");
settings.appendProperty("reverseproxyauth.header.name",
"X-Forwarded-User");
settings.appendProperty("reverseproxyauth.localhost", "localhost");
final HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
when(httpServletRequest.getHeader("X-Forwarded-User")).thenReturn(
"blah");
when(httpServletRequest.getServerName())
.thenReturn("localhost");
when(httpServletRequest.getRequestURL())
.thenReturn(new StringBuffer("/"));
when(httpServletRequest.getContextPath())
.thenReturn("/");
final ReverseProxyAuthRealm realm = new ReverseProxyAuthRealm(new ReverseProxyAuthSettings(settings));
realm.init();
final ExternalUsersProvider.Context context = new ExternalUsersProvider.Context(null, httpServletRequest);
assertEquals("", realm.getUsersProvider().doGetUserDetails(context).getEmail());
assertEquals("", realm.getUsersProvider().doGetUserDetails(context).getName());
assertEquals("", realm.getUsersProvider().doGetUserDetails(context).getUserId());
}
示例7: testUserProviderMissingHeader
import org.sonar.api.CoreProperties; //导入依赖的package包/类
@Test
public void testUserProviderMissingHeader() {
final Settings settings = new Settings();
settings.appendProperty(CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY, "true");
settings.appendProperty("reverseproxyauth.header.name",
"X-Forwarded-User");
settings.appendProperty("reverseproxyauth.localhost", "localhost");
final HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
when(httpServletRequest.getHeader("X-Forwarded-User")).thenReturn(
null);
when(httpServletRequest.getServerName())
.thenReturn("not.localhost.com");
when(httpServletRequest.getRequestURL())
.thenReturn(new StringBuffer("/"));
when(httpServletRequest.getContextPath())
.thenReturn("/");
final ReverseProxyAuthRealm realm = new ReverseProxyAuthRealm(new ReverseProxyAuthSettings(settings));
realm.init();
final ExternalUsersProvider.Context context = new ExternalUsersProvider.Context(null, httpServletRequest);
assertNull(realm.getUsersProvider().doGetUserDetails(context));
}
示例8: init
import org.sonar.api.CoreProperties; //导入依赖的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);
}
示例9: handleAll
import org.sonar.api.CoreProperties; //导入依赖的package包/类
@Override
protected void handleAll(char c) {
if (!alreadyLoggedInvalidCharacter && c == '\ufffd') {
LOG.warn("Invalid character encountered in file '{}' at line {} for encoding {}. Please fix file content or configure the encoding to be used using property '{}'.",
filePath,
lines, encoding, CoreProperties.ENCODING_PROPERTY);
alreadyLoggedInvalidCharacter = true;
}
}
示例10: testAnalyseWithExclusions
import org.sonar.api.CoreProperties; //导入依赖的package包/类
@Test
public void testAnalyseWithExclusions() {
File fsDir = new File("somepath");
fs = new DefaultFileSystem(fsDir);
InputFile fileA = new DefaultInputFile("a.java").setAbsolutePath("a.java");
InputFile fileB = new DefaultInputFile("b.java").setAbsolutePath("b.java");
fs.add(fileA);
fs.add(fileB);
fs.addLanguages("java");
SensorContext context = mock(SensorContext.class);
coverageProjectStore = new CoverageProjectStore();
sonarClient = mock(SonarClient.class);
mockFileCoverages(context, sonarClient, fileA, project,
100, 60,
100, 50
);
mockFileCoverages(context, sonarClient, fileB, project,
100, 70,
100, 50
);
sensor = new CoverageSensor(fs, rp, config, makeRules(true, false, null), coverageProjectStore, sonarClient);
settings.setProperty(CoreProperties.PROJECT_COVERAGE_EXCLUSIONS_PROPERTY, "a.java");
sensor.analyse(project, context);
verify(sonarClient, times(2)).getMeasureValue(any(), any(), any());
}
示例11: getExtensions
import org.sonar.api.CoreProperties; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public List getExtensions() {
return Arrays
.asList(PropertyDefinition.builder(CheckstyleConstants.CHECKER_FILTERS_KEY)
.defaultValue(CheckstyleConstants.CHECKER_FILTERS_DEFAULT_VALUE)
.category(CoreProperties.CATEGORY_JAVA)
.subCategory(CHECKSTYLE_SUB_CATEGORY_NAME)
.name("Checker Filters")
.description(CHECKER_FILTERS_DESCRIPTION)
.type(PropertyType.TEXT)
.onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE).build(),
PropertyDefinition.builder(CheckstyleConstants.TREEWALKER_FILTERS_KEY)
.defaultValue(CheckstyleConstants.TREEWALKER_FILTERS_DEFAULT_VALUE)
.category(CoreProperties.CATEGORY_JAVA)
.subCategory(CHECKSTYLE_SUB_CATEGORY_NAME)
.name("Treewalker Filters")
.description(TREEWALKER_FILTERS_DESCRIPTION)
.type(PropertyType.TEXT)
.onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE).build(),
PropertyDefinition.builder(CheckstyleConfiguration.PROPERTY_GENERATE_XML)
.defaultValue("false").category(CoreProperties.CATEGORY_JAVA)
.subCategory(CHECKSTYLE_SUB_CATEGORY_NAME)
.name("Generate XML Report").type(PropertyType.BOOLEAN).hidden()
.build(),
CheckstyleSensor.class, CheckstyleConfiguration.class,
CheckstyleExecutor.class, CheckstyleAuditListener.class,
CheckstyleProfileExporter.class, CheckstyleProfileImporter.class,
CheckstyleRulesDefinition.class);
}
示例12: encodingMatch
import org.sonar.api.CoreProperties; //导入依赖的package包/类
public boolean encodingMatch(InputFile inputFile) {
String inputFilePath = inputFile.path().toAbsolutePath().toString();
if (!roslynEncodingPerPath.containsKey(inputFilePath)) {
// When there is no entry for a file, it means it was not processed by Roslyn. So we consider encoding to be ok.
return true;
}
Charset roslynEncoding = roslynEncodingPerPath.get(inputFilePath);
if (roslynEncoding == null) {
LOG.warn("File '{}' does not have encoding information. Skip it.", inputFilePath);
return false;
}
Charset sqEncoding;
if (sonarQubeVersion.isGreaterThanOrEqual(INPUT_FILE_CHARSET)) {
sqEncoding = inputFile.charset();
} else {
// Prior to 6.1 there was only global module encoding
// can't use FileSystem::encoding since it is not yet initialized
String encoding = projectDef.properties().get(CoreProperties.ENCODING_PROPERTY);
sqEncoding = encoding != null && encoding.length() > 0 ? Charset.forName(encoding) : Charset.defaultCharset();
}
boolean sameEncoding = sqEncoding.equals(roslynEncoding);
if (!sameEncoding) {
LOG.warn("Encoding detected by Roslyn and encoding used by SonarQube do not match for file {}. "
+ "SonarQube encoding is '{}', Roslyn encoding is '{}'. File will be skipped.",
inputFilePath, sqEncoding, roslynEncoding);
}
return sameEncoding;
}
示例13: setUp
import org.sonar.api.CoreProperties; //导入依赖的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());
}
示例14: setUp
import org.sonar.api.CoreProperties; //导入依赖的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);
}
示例15: setUp
import org.sonar.api.CoreProperties; //导入依赖的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);
}