use of org.sonar.server.plugins.ServerPlugin in project sonarqube by SonarSource.
the class DownloadActionTest method return_uncompressed_jar_if_client_does_not_accept_compression.
@Test
public void return_uncompressed_jar_if_client_does_not_accept_compression() throws Exception {
ServerPlugin plugin = newCompressedPlugin();
when(serverPluginRepository.findPlugin(plugin.getPluginInfo().getKey())).thenReturn(Optional.of(plugin));
TestResponse response = tester.newRequest().setParam("plugin", plugin.getPluginInfo().getKey()).execute();
assertThat(response.getHeader("Sonar-MD5")).isEqualTo(plugin.getJar().getMd5());
assertThat(response.getHeader("Sonar-Compression")).isNull();
assertThat(response.getHeader("Sonar-UncompressedMD5")).isNull();
assertThat(response.getMediaType()).isEqualTo("application/java-archive");
verifySameContent(response, plugin.getJar().getFile());
}
use of org.sonar.server.plugins.ServerPlugin in project sonarqube by SonarSource.
the class DownloadActionTest method newCompressedPlugin.
private ServerPlugin newCompressedPlugin() throws IOException {
FileAndMd5 jar = new FileAndMd5(temp.newFile());
FileAndMd5 compressedJar = new FileAndMd5(temp.newFile());
return new ServerPlugin(new PluginInfo("foo"), PluginType.BUNDLED, null, jar, compressedJar, null);
}
Aggregations