}
private String projectUrlOf(Project project) {
- return format("%s/project/dashboard?id=%s", server.getPublicRootUrl(), encode(project.getKey()));
+ return format("%s/dashboard?id=%s", server.getPublicRootUrl(), encode(project.getKey()));
}
private String branchUrlOf(Project project, Branch branch) {
if (branch.isMain()) {
return projectUrlOf(project);
}
- return format("%s/project/dashboard?branch=%s&id=%s",
+ return format("%s/dashboard?branch=%s&id=%s",
server.getPublicRootUrl(), encode(branch.getName().orElse("")), encode(project.getKey()));
} else {
return format("%s/project/issues?branch=%s&id=%s&resolved=false",
" \"project\": {" +
" \"key\": \"P1\"," +
" \"name\": \"Project One\"," +
- " \"url\": \"http://foo/project/dashboard?id=P1\"" +
+ " \"url\": \"http://foo/dashboard?id=P1\"" +
" }," +
" \"qualityGate\": {" +
" \"name\": \"Gate One\"," +
" \"project\": {" +
" \"key\": \"P1\"," +
" \"name\": \"Project One\"," +
- " \"url\": \"http://foo/project/dashboard?id=P1\"" +
+ " \"url\": \"http://foo/dashboard?id=P1\"" +
" }," +
" \"qualityGate\": {" +
" \"name\": \"Gate One\"," +
" \"project\": {" +
" \"key\": \"P1\"," +
" \"name\": \"Project One\"," +
- " \"url\": \"http://foo/project/dashboard?id=P1\"" +
+ " \"url\": \"http://foo/dashboard?id=P1\"" +
" }," +
" \"qualityGate\": {" +
" \"name\": \"Gate One\"," +
" \"project\": {" +
" \"key\": \"P1\"," +
" \"name\": \"Project One\"," +
- " \"url\": \"http://foo/project/dashboard?id=P1\"" +
+ " \"url\": \"http://foo/dashboard?id=P1\"" +
" }," +
" \"properties\": {" +
" }" +
" \"name\": \"feature/foo\"" +
" \"type\": \"LONG\"" +
" \"isMain\": false," +
- " \"url\": \"http://foo/project/dashboard?branch=feature%2Ffoo&id=P1\"" +
+ " \"url\": \"http://foo/dashboard?branch=feature%2Ffoo&id=P1\"" +
"}" +
"}");
}
"\"branch\": {" +
" \"type\": \"LONG\"" +
" \"isMain\": true," +
- " \"url\": \"http://foo/project/dashboard?id=P1\"" +
+ " \"url\": \"http://foo/dashboard?id=P1\"" +
"}" +
"}");
}
package org.sonarqube.tests.webhook;
import com.sonar.orchestrator.Orchestrator;
-import org.sonarqube.tests.Category3Suite;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
+import org.sonarqube.tests.Category3Suite;
import org.sonarqube.ws.Webhooks;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.WsClient;
Map<String, String> project = (Map<String, String>) payload.get("project");
assertThat(project.get("key")).isEqualTo(PROJECT_KEY);
assertThat(project.get("name")).isEqualTo(PROJECT_NAME);
+ assertThat(project.get("url")).isEqualTo(orchestrator.getServer().getUrl() + "/dashboard?id=" + PROJECT_KEY);
Map<String, Object> gate = (Map<String, Object>) payload.get("qualityGate");
assertThat(gate.get("name")).isEqualTo("SonarQube way");
assertThat(gate.get("status")).isEqualTo("OK");