本文整理汇总了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);
}
示例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 ");
}
}