Fix peer review issues

This commit is contained in:
René Pfeuffer
2018-10-01 15:02:23 +02:00
parent 67d68a5bc2
commit d14d029919
6 changed files with 16 additions and 16 deletions

View File

@@ -27,14 +27,14 @@ public class SvnConfigInIndexResource extends JsonEnricherBase {
@Override
public void enrich(JsonEnricherContext context) {
if (resultHasMediaType(INDEX, context) && ConfigurationPermissions.list().isPermitted()) {
String gitConfigUrl = new LinkBuilder(scmPathInfoStore.get().get(), SvnConfigResource.class)
String svnConfigUrl = new LinkBuilder(scmPathInfoStore.get().get(), SvnConfigResource.class)
.method("get")
.parameters()
.href();
JsonNode gitConfigRefNode = createObject(singletonMap("href", value(gitConfigUrl)));
JsonNode svnConfigRefNode = createObject(singletonMap("href", value(svnConfigUrl)));
addPropertyNode(context.getResponseEntity().get("_links"), "svnConfig", gitConfigRefNode);
addPropertyNode(context.getResponseEntity().get("_links"), "svnConfig", svnConfigRefNode);
}
}
}

View File

@@ -14,6 +14,7 @@ import javax.ws.rs.core.MediaType;
import java.net.URI;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@SubjectAware(configuration = "classpath:sonia/scm/configuration/shiro.ini")
public class SvnConfigInIndexResourceTest {
@@ -39,7 +40,6 @@ public class SvnConfigInIndexResourceTest {
svnConfigInIndexResource.enrich(context);
System.out.println(root);
assertEquals("/v2/config/svn", root.get("_links").get("svnConfig").get("href").asText());
}
@@ -50,7 +50,7 @@ public class SvnConfigInIndexResourceTest {
svnConfigInIndexResource.enrich(context);
System.out.println(root);
assertFalse(root.get("_links").iterator().hasNext());
}
@Test
@@ -59,6 +59,6 @@ public class SvnConfigInIndexResourceTest {
svnConfigInIndexResource.enrich(context);
System.out.println(root);
assertFalse(root.get("_links").iterator().hasNext());
}
}