Browse Source

Merge "UploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed"

stable-5.6
Jonathan Nieder 5 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
a48b77d782
  1. 18
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java

18
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java

@ -462,7 +462,9 @@ public class UploadPackTest {
assertThat(lines, containsInAnyOrder("ls-refs", "fetch", "server-option")); assertThat(lines, containsInAnyOrder("ls-refs", "fetch", "server-option"));
} }
private void checkUnadvertisedIfUnallowed(String fetchCapability) throws Exception { private void checkUnadvertisedIfUnallowed(String configSection,
String configName, String fetchCapability) throws Exception {
server.getConfig().setBoolean(configSection, null, configName, false);
ByteArrayInputStream recvStream = ByteArrayInputStream recvStream =
uploadPackV2Setup(null, PacketLineIn.end()); uploadPackV2Setup(null, PacketLineIn.end());
PacketLineIn pckIn = new PacketLineIn(recvStream); PacketLineIn pckIn = new PacketLineIn(recvStream);
@ -473,9 +475,9 @@ public class UploadPackTest {
String line; String line;
while (!PacketLineIn.isEnd((line = pckIn.readString()))) { while (!PacketLineIn.isEnd((line = pckIn.readString()))) {
if (line.startsWith("fetch=")) { if (line.startsWith("fetch=")) {
assertThat( List<String> fetchItems = Arrays.asList(line.substring(6).split(" "));
Arrays.asList(line.substring(6).split(" ")), assertThat(fetchItems, hasItems("shallow"));
hasItems("shallow")); assertFalse(fetchItems.contains(fetchCapability));
lines.add("fetch"); lines.add("fetch");
} else { } else {
lines.add(line); lines.add(line);
@ -487,7 +489,7 @@ public class UploadPackTest {
@Test @Test
public void testV2CapabilitiesAllowFilter() throws Exception { public void testV2CapabilitiesAllowFilter() throws Exception {
checkAdvertisedIfAllowed("uploadpack", "allowfilter", "filter"); checkAdvertisedIfAllowed("uploadpack", "allowfilter", "filter");
checkUnadvertisedIfUnallowed("filter"); checkUnadvertisedIfUnallowed("uploadpack", "allowfilter", "filter");
} }
@Test @Test
@ -497,7 +499,8 @@ public class UploadPackTest {
@Test @Test
public void testV2CapabilitiesRefInWantNotAdvertisedIfUnallowed() throws Exception { public void testV2CapabilitiesRefInWantNotAdvertisedIfUnallowed() throws Exception {
checkUnadvertisedIfUnallowed("ref-in-want"); checkUnadvertisedIfUnallowed("uploadpack", "allowrefinwant",
"ref-in-want");
} }
@Test @Test
@ -506,7 +509,8 @@ public class UploadPackTest {
true); true);
checkAdvertisedIfAllowed("uploadpack", "advertisesidebandall", checkAdvertisedIfAllowed("uploadpack", "advertisesidebandall",
"sideband-all"); "sideband-all");
checkUnadvertisedIfUnallowed("sideband-all"); checkUnadvertisedIfUnallowed("uploadpack", "advertisesidebandall",
"sideband-all");
} }
@Test @Test

Loading…
Cancel
Save