summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2016-08-26 14:44:44 -0700
committerShawn Pearce <spearce@spearce.org>2016-08-26 14:53:54 -0700
commitc2e2326a436d02aa94dcc566cbec96df1d0930cb (patch)
tree8ed1803d433760677544161653cb32423c7b6816 /org.eclipse.jgit.test
parent36cf4fe580a2b771331e0b9bcaea5505b3b7e27a (diff)
downloadjgit-c2e2326a436d02aa94dcc566cbec96df1d0930cb.tar.gz
jgit-c2e2326a436d02aa94dcc566cbec96df1d0930cb.zip
ReceivePack: refactor push option parsing
Refactor all of the push option support code to allocate the list immediately before parsing the options section off the stream. Move option support down to ReceivePack instead of BaseReceivePack. Push options are specific to the ReceivePack protocol and are not likely to appear in the 4 year old subscription proposal. These changes are OK before JGit 4.5 ships as no consumer should be relying on these new APIs. Change-Id: Ib07d18c877628aba07da07cd91875f918d509c49
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java
index 8ff0226183..c346d7904c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java
@@ -84,7 +84,7 @@ public class PushOptionsTest extends RepositoryTestCase {
private InMemoryRepository client;
private ObjectId obj1;
private ObjectId obj2;
- private BaseReceivePack baseReceivePack;
+ private ReceivePack receivePack;
@Before
public void setUp() throws Exception {
@@ -96,13 +96,12 @@ public class PushOptionsTest extends RepositoryTestCase {
testProtocol = new TestProtocol<>(null,
new ReceivePackFactory<Object>() {
@Override
- public ReceivePack create(Object req, Repository database)
+ public ReceivePack create(Object req, Repository git)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
- ReceivePack receivePack = new ReceivePack(database);
+ receivePack = new ReceivePack(git);
receivePack.setAllowPushOptions(true);
receivePack.setAtomic(true);
- baseReceivePack = receivePack;
return receivePack;
}
});
@@ -118,7 +117,6 @@ public class PushOptionsTest extends RepositoryTestCase {
@After
public void tearDown() {
- baseReceivePack = null;
Transport.unregister(testProtocol);
}
@@ -176,7 +174,7 @@ public class PushOptionsTest extends RepositoryTestCase {
assertSame(RemoteRefUpdate.Status.OK, one.getStatus());
assertSame(RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED,
two.getStatus());
- assertEquals(pushOptions, baseReceivePack.getPushOptions());
+ assertEquals(pushOptions, receivePack.getPushOptions());
}
@Test
@@ -197,7 +195,7 @@ public class PushOptionsTest extends RepositoryTestCase {
assertSame(RemoteRefUpdate.Status.OK, one.getStatus());
assertSame(RemoteRefUpdate.Status.OK, two.getStatus());
- assertEquals(pushOptions, baseReceivePack.getPushOptions());
+ assertEquals(pushOptions, receivePack.getPushOptions());
}
@Test
@@ -220,7 +218,7 @@ public class PushOptionsTest extends RepositoryTestCase {
one.getStatus());
assertSame(RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED,
two.getStatus());
- assertNull(baseReceivePack.getPushOptions());
+ assertNull(receivePack.getPushOptions());
}
@Test
@@ -241,7 +239,7 @@ public class PushOptionsTest extends RepositoryTestCase {
assertSame(RemoteRefUpdate.Status.OK, one.getStatus());
assertSame(RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED,
two.getStatus());
- assertEquals(pushOptions, baseReceivePack.getPushOptions());
+ assertEquals(pushOptions, receivePack.getPushOptions());
}
@Test
@@ -360,4 +358,4 @@ public class PushOptionsTest extends RepositoryTestCase {
fail("should already have thrown TransportException");
}
}
-} \ No newline at end of file
+}