use of org.sonar.api.config.MapSettings 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.MapSettings in project sonarqube by SonarSource.
the class DefaultHttpDownloaderTest method readStringWithDefaultTimeout.
@Test
public void readStringWithDefaultTimeout() throws URISyntaxException {
String text = new DefaultHttpDownloader(new MapSettings()).readString(new URI(baseUrl + "/timeout/"), StandardCharsets.UTF_8);
assertThat(text.length()).isGreaterThan(10);
}
use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class DefaultHttpDownloaderTest method userAgent_is_static_value_when_server_is_not_provided.
@Test
public void userAgent_is_static_value_when_server_is_not_provided() throws URISyntaxException, IOException {
InputStream stream = new DefaultHttpDownloader(new MapSettings()).openStream(new URI(baseUrl));
Properties props = new Properties();
props.load(stream);
stream.close();
assertThat(props.getProperty("agent")).isEqualTo("SonarQube");
}
use of org.sonar.api.config.MapSettings 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.MapSettings in project sonarqube by SonarSource.
the class DefaultHttpDownloaderTest method downloadBytes.
@Test
public void downloadBytes() throws URISyntaxException {
byte[] bytes = new DefaultHttpDownloader(new MapSettings()).readBytes(new URI(baseUrl));
assertThat(bytes.length).isGreaterThan(10);
}
Aggregations