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


Java MapSettings类代码示例

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


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

示例1: testSettings

import org.sonar.api.config.internal.MapSettings; //导入依赖的package包/类
@Test
public void testSettings() {
	final MapSettings settings = new MapSettings();
	final SensorContextTester sensorContext = SensorContextTester.create(new File(""));
	sensorContext.setSettings(settings);
	assertNull(SensorUtil.geReportFile(sensorContext));

	settings.setProperty(XanitizerSonarQubePlugin.XAN_XML_REPORT_FILE, "");
	assertNull(SensorUtil.geReportFile(sensorContext));

	settings.setProperty(XanitizerSonarQubePlugin.XAN_XML_REPORT_FILE, "/doesNotExist.xml");
	assertNull(SensorUtil.geReportFile(sensorContext));

	final String reportFileString = getClass()
			.getResource("/webgoat/webgoat-Findings-List-all.xml").getFile();
	settings.setProperty(XanitizerSonarQubePlugin.XAN_XML_REPORT_FILE, reportFileString);
	final File reportFile = SensorUtil.geReportFile(sensorContext);
	assertNotNull(reportFile);
	assertTrue(reportFile.isFile());
	assertEquals(new File(reportFileString), reportFile);
}
 
开发者ID:RIGS-IT,项目名称:sonar-xanitizer,代码行数:22,代码来源:PluginTest.java

示例2: sanityCheck

import org.sonar.api.config.internal.MapSettings; //导入依赖的package包/类
@Test
public void sanityCheck() throws Exception {
  Settings settings = new MapSettings(new PropertyDefinitions(SvnConfiguration.getProperties()));
  SvnConfiguration config = new SvnConfiguration(settings);

  assertThat(config.username()).isNull();
  assertThat(config.password()).isNull();

  settings.setProperty(SvnConfiguration.USER_PROP_KEY, "foo");
  assertThat(config.username()).isEqualTo("foo");

  settings.setProperty(SvnConfiguration.PASSWORD_PROP_KEY, "pwd");
  assertThat(config.password()).isEqualTo("pwd");

  settings.setProperty(SvnConfiguration.PASSPHRASE_PROP_KEY, "pass");
  assertThat(config.passPhrase()).isEqualTo("pass");

  assertThat(config.privateKey()).isNull();
  File fakeKey = temp.newFile();
  settings.setProperty(SvnConfiguration.PRIVATE_KEY_PATH_PROP_KEY, fakeKey.getAbsolutePath());
  assertThat(config.privateKey()).isEqualTo(fakeKey);

  settings.setProperty(SvnConfiguration.PRIVATE_KEY_PATH_PROP_KEY, "/not/exists");
  try {
    config.privateKey();
    fail("Expected exception");
  } catch (Exception e) {
    assertThat(e).hasMessageContaining("Unable to read private key from ");
  }
}
 
开发者ID:SonarSource,项目名称:sonar-scm-svn,代码行数:31,代码来源:SvnConfigurationTest.java


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