aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-11-30 16:44:05 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2020-11-30 16:54:16 +0100
commit85ac3c599616e1ebdb55b0169eb3734f8006f52b (patch)
tree3fc5c30a87080b31f6faff74a0ed2c4a8c507e25
parent180dfdefa4d0cb561efda7df22f95403c1875bdc (diff)
downloadjgit-85ac3c599616e1ebdb55b0169eb3734f8006f52b.tar.gz
jgit-85ac3c599616e1ebdb55b0169eb3734f8006f52b.zip
Use new protocol version constants
Change-Id: Icd6b876e392c55a7322a990ac7f618250b732b4b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java38
1 files changed, 25 insertions, 13 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
index cdf9d661d0..5045e9464e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
@@ -437,8 +437,9 @@ public class UploadPackTest {
Consumer<UploadPack> postConstructionSetup,
String... inputLines)
throws Exception {
- ByteArrayInputStream recvStream =
- uploadPackSetup("2", postConstructionSetup, inputLines);
+ ByteArrayInputStream recvStream = uploadPackSetup(
+ TransferConfig.ProtocolVersion.V2.version(),
+ postConstructionSetup, inputLines);
PacketLineIn pckIn = new PacketLineIn(recvStream);
// drain capabilities
@@ -478,9 +479,11 @@ public class UploadPackTest {
@Test
public void testV2Capabilities() throws Exception {
TestV2Hook hook = new TestV2Hook();
- ByteArrayInputStream recvStream = uploadPackSetup( "2",
- (UploadPack up) -> {up.setProtocolV2Hook(hook);},
- PacketLineIn.end());
+ ByteArrayInputStream recvStream = uploadPackSetup(
+ TransferConfig.ProtocolVersion.V2.version(),
+ (UploadPack up) -> {
+ up.setProtocolV2Hook(hook);
+ }, PacketLineIn.end());
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(hook.capabilitiesRequest, notNullValue());
assertThat(pckIn.readString(), is("version 2"));
@@ -500,8 +503,9 @@ public class UploadPackTest {
private void checkAdvertisedIfAllowed(String configSection, String configName,
String fetchCapability) throws Exception {
server.getConfig().setBoolean(configSection, null, configName, true);
- ByteArrayInputStream recvStream =
- uploadPackSetup("2", null, PacketLineIn.end());
+ ByteArrayInputStream recvStream = uploadPackSetup(
+ TransferConfig.ProtocolVersion.V2.version(), null,
+ PacketLineIn.end());
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is("version 2"));
@@ -524,8 +528,9 @@ public class UploadPackTest {
private void checkUnadvertisedIfUnallowed(String configSection,
String configName, String fetchCapability) throws Exception {
server.getConfig().setBoolean(configSection, null, configName, false);
- ByteArrayInputStream recvStream =
- uploadPackSetup("2", null, PacketLineIn.end());
+ ByteArrayInputStream recvStream = uploadPackSetup(
+ TransferConfig.ProtocolVersion.V2.version(), null,
+ PacketLineIn.end());
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is("version 2"));
@@ -576,8 +581,9 @@ public class UploadPackTest {
public void testV2CapabilitiesRefInWantNotAdvertisedIfAdvertisingForbidden() throws Exception {
server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true);
server.getConfig().setBoolean("uploadpack", null, "advertiserefinwant", false);
- ByteArrayInputStream recvStream =
- uploadPackSetup("2", null, PacketLineIn.end());
+ ByteArrayInputStream recvStream = uploadPackSetup(
+ TransferConfig.ProtocolVersion.V2.version(), null,
+ PacketLineIn.end());
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is("version 2"));
@@ -741,7 +747,10 @@ public class UploadPackTest {
PacketLineIn.end() };
TestV2Hook testHook = new TestV2Hook();
- uploadPackSetup("2", (UploadPack up) -> {up.setProtocolV2Hook(testHook);}, lines);
+ uploadPackSetup(TransferConfig.ProtocolVersion.V2.version(),
+ (UploadPack up) -> {
+ up.setProtocolV2Hook(testHook);
+ }, lines);
LsRefsV2Request req = testHook.lsRefsRequest;
assertEquals(2, req.getServerOptions().size());
@@ -1561,7 +1570,10 @@ public class UploadPackTest {
PacketLineIn.end() };
TestV2Hook testHook = new TestV2Hook();
- uploadPackSetup("2", (UploadPack up) -> {up.setProtocolV2Hook(testHook);}, lines);
+ uploadPackSetup(TransferConfig.ProtocolVersion.V2.version(),
+ (UploadPack up) -> {
+ up.setProtocolV2Hook(testHook);
+ }, lines);
FetchV2Request req = testHook.fetchRequest;
assertNotNull(req);