use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class ProjectSettingsFactoryTest method project_settings_override_global_settings.
@Test
public void project_settings_override_global_settings() {
settings.setProperty("key", "value");
when(dbClient.propertiesDao().selectProjectProperties(PROJECT_KEY)).thenReturn(newArrayList(new PropertyDto().setKey("key").setValue("value2")));
Settings projectSettings = underTest.newProjectSettings(PROJECT_KEY);
assertThat(projectSettings.getString("key")).isEqualTo("value2");
}
use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class ProjectSettingsFactoryTest method return_global_settings.
@Test
public void return_global_settings() {
settings.setProperty("key", "value");
Settings projectSettings = underTest.newProjectSettings(PROJECT_KEY);
assertThat(projectSettings.getProperties()).hasSize(1);
assertThat(projectSettings.getString("key")).isEqualTo("value");
}
use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class DeleteActionTest method setUp.
@Before
public void setUp() {
defaultGroup = db.users().insertGroup(db.getDefaultOrganization(), CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE);
Settings settings = new MapSettings().setProperty(CoreProperties.CORE_DEFAULT_GROUP, CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE);
ws = new WsTester(new UserGroupsWs(new DeleteAction(db.getDbClient(), userSession, newGroupWsSupport(), settings, defaultOrganizationProvider)));
}
use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class DefaultHttpDownloaderTest method configure_http_proxy_credentials.
@Test
public void configure_http_proxy_credentials() {
DefaultHttpDownloader.AuthenticatorFacade system = mock(DefaultHttpDownloader.AuthenticatorFacade.class);
Settings settings = new MapSettings();
settings.setProperty("https.proxyHost", "1.2.3.4");
settings.setProperty("http.proxyUser", "the_login");
settings.setProperty("http.proxyPassword", "the_passwd");
new DefaultHttpDownloader.BaseHttpDownloader(system, settings, null);
verify(system).setDefaultAuthenticator(argThat(new TypeSafeMatcher<Authenticator>() {
@Override
protected boolean matchesSafely(Authenticator authenticator) {
DefaultHttpDownloader.ProxyAuthenticator a = (DefaultHttpDownloader.ProxyAuthenticator) authenticator;
PasswordAuthentication authentication = a.getPasswordAuthentication();
return authentication.getUserName().equals("the_login") && new String(authentication.getPassword()).equals("the_passwd");
}
@Override
public void describeTo(Description description) {
}
}));
}
use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class SensorContextTesterTest method testSettings.
@Test
public void testSettings() {
Settings settings = new MapSettings();
settings.setProperty("foo", "bar");
tester.setSettings(settings);
assertThat(tester.settings().getString("foo")).isEqualTo("bar");
}
Aggregations