|
|
@ -211,8 +211,7 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
assertEquals("http", remoteURI.getScheme()); |
|
|
|
assertEquals("http", remoteURI.getScheme()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Ref> map; |
|
|
|
Map<String, Ref> map; |
|
|
|
Transport t = Transport.open(dst, remoteURI); |
|
|
|
try (Transport t = Transport.open(dst, remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
// I didn't make up these public interface names, I just
|
|
|
|
// I didn't make up these public interface names, I just
|
|
|
|
// approved them for inclusion into the code base. Sorry.
|
|
|
|
// approved them for inclusion into the code base. Sorry.
|
|
|
|
// --spearce
|
|
|
|
// --spearce
|
|
|
@ -226,8 +225,6 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
c.close(); |
|
|
|
c.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertNotNull("have map of refs", map); |
|
|
|
assertNotNull("have map of refs", map); |
|
|
@ -257,8 +254,7 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
public void testListRemote_BadName() throws IOException, URISyntaxException { |
|
|
|
public void testListRemote_BadName() throws IOException, URISyntaxException { |
|
|
|
Repository dst = createBareRepository(); |
|
|
|
Repository dst = createBareRepository(); |
|
|
|
URIish uri = new URIish(this.remoteURI.toString() + ".invalid"); |
|
|
|
URIish uri = new URIish(this.remoteURI.toString() + ".invalid"); |
|
|
|
Transport t = Transport.open(dst, uri); |
|
|
|
try (Transport t = Transport.open(dst, uri)) { |
|
|
|
try { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
t.openFetch(); |
|
|
|
t.openFetch(); |
|
|
|
fail("fetch connection opened"); |
|
|
|
fail("fetch connection opened"); |
|
|
@ -266,8 +262,6 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
assertEquals(uri + ": Git repository not found", |
|
|
|
assertEquals(uri + ": Git repository not found", |
|
|
|
notFound.getMessage()); |
|
|
|
notFound.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<AccessEvent> requests = getRequests(); |
|
|
|
List<AccessEvent> requests = getRequests(); |
|
|
@ -288,11 +282,8 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
Repository dst = createBareRepository(); |
|
|
|
Repository dst = createBareRepository(); |
|
|
|
assertFalse(dst.hasObject(A_txt)); |
|
|
|
assertFalse(dst.hasObject(A_txt)); |
|
|
|
|
|
|
|
|
|
|
|
Transport t = Transport.open(dst, remoteURI); |
|
|
|
try (Transport t = Transport.open(dst, remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(dst.hasObject(A_txt)); |
|
|
|
assertTrue(dst.hasObject(A_txt)); |
|
|
@ -331,11 +322,8 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
// Bootstrap by doing the clone.
|
|
|
|
// Bootstrap by doing the clone.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
TestRepository dst = createTestRepository(); |
|
|
|
TestRepository dst = createTestRepository(); |
|
|
|
Transport t = Transport.open(dst.getRepository(), remoteURI); |
|
|
|
try (Transport t = Transport.open(dst.getRepository(), remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
assertEquals(B, dst.getRepository().exactRef(master).getObjectId()); |
|
|
|
assertEquals(B, dst.getRepository().exactRef(master).getObjectId()); |
|
|
|
List<AccessEvent> cloneRequests = getRequests(); |
|
|
|
List<AccessEvent> cloneRequests = getRequests(); |
|
|
@ -352,11 +340,8 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
|
|
|
|
|
|
|
|
// Now incrementally update.
|
|
|
|
// Now incrementally update.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
t = Transport.open(dst.getRepository(), remoteURI); |
|
|
|
try (Transport t = Transport.open(dst.getRepository(), remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
assertEquals(Z, dst.getRepository().exactRef(master).getObjectId()); |
|
|
|
assertEquals(Z, dst.getRepository().exactRef(master).getObjectId()); |
|
|
|
|
|
|
|
|
|
|
@ -394,11 +379,8 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
// Bootstrap by doing the clone.
|
|
|
|
// Bootstrap by doing the clone.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
TestRepository dst = createTestRepository(); |
|
|
|
TestRepository dst = createTestRepository(); |
|
|
|
Transport t = Transport.open(dst.getRepository(), remoteURI); |
|
|
|
try (Transport t = Transport.open(dst.getRepository(), remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
assertEquals(B, dst.getRepository().exactRef(master).getObjectId()); |
|
|
|
assertEquals(B, dst.getRepository().exactRef(master).getObjectId()); |
|
|
|
List<AccessEvent> cloneRequests = getRequests(); |
|
|
|
List<AccessEvent> cloneRequests = getRequests(); |
|
|
@ -418,11 +400,8 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
|
|
|
|
|
|
|
|
// Now incrementally update.
|
|
|
|
// Now incrementally update.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
t = Transport.open(dst.getRepository(), remoteURI); |
|
|
|
try (Transport t = Transport.open(dst.getRepository(), remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
assertEquals(Z, dst.getRepository().exactRef(master).getObjectId()); |
|
|
|
assertEquals(Z, dst.getRepository().exactRef(master).getObjectId()); |
|
|
|
|
|
|
|
|
|
|
@ -474,8 +453,7 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
Repository dst = createBareRepository(); |
|
|
|
Repository dst = createBareRepository(); |
|
|
|
assertFalse(dst.hasObject(A_txt)); |
|
|
|
assertFalse(dst.hasObject(A_txt)); |
|
|
|
|
|
|
|
|
|
|
|
Transport t = Transport.open(dst, brokenURI); |
|
|
|
try (Transport t = Transport.open(dst, brokenURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); |
|
|
|
fail("fetch completed despite upload-pack being broken"); |
|
|
|
fail("fetch completed despite upload-pack being broken"); |
|
|
@ -485,8 +463,6 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
+ " received Content-Type text/plain; charset=UTF-8"; |
|
|
|
+ " received Content-Type text/plain; charset=UTF-8"; |
|
|
|
assertEquals(exp, err.getMessage()); |
|
|
|
assertEquals(exp, err.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<AccessEvent> requests = getRequests(); |
|
|
|
List<AccessEvent> requests = getRequests(); |
|
|
@ -517,12 +493,10 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
final RevCommit Q = src.commit().add("Q", Q_txt).create(); |
|
|
|
final RevCommit Q = src.commit().add("Q", Q_txt).create(); |
|
|
|
final Repository db = src.getRepository(); |
|
|
|
final Repository db = src.getRepository(); |
|
|
|
final String dstName = Constants.R_HEADS + "new.branch"; |
|
|
|
final String dstName = Constants.R_HEADS + "new.branch"; |
|
|
|
Transport t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// push anonymous shouldn't be allowed.
|
|
|
|
// push anonymous shouldn't be allowed.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
t = Transport.open(db, remoteURI); |
|
|
|
try (Transport t = Transport.open(db, remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
final String srcExpr = Q.name(); |
|
|
|
final String srcExpr = Q.name(); |
|
|
|
final boolean forceUpdate = false; |
|
|
|
final boolean forceUpdate = false; |
|
|
|
final String localName = null; |
|
|
|
final String localName = null; |
|
|
@ -538,8 +512,6 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
+ JGitText.get().authenticationNotSupported; |
|
|
|
+ JGitText.get().authenticationNotSupported; |
|
|
|
assertEquals(exp, e.getMessage()); |
|
|
|
assertEquals(exp, e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<AccessEvent> requests = getRequests(); |
|
|
|
List<AccessEvent> requests = getRequests(); |
|
|
@ -560,12 +532,10 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
final RevCommit Q = src.commit().add("Q", Q_txt).create(); |
|
|
|
final RevCommit Q = src.commit().add("Q", Q_txt).create(); |
|
|
|
final Repository db = src.getRepository(); |
|
|
|
final Repository db = src.getRepository(); |
|
|
|
final String dstName = Constants.R_HEADS + "new.branch"; |
|
|
|
final String dstName = Constants.R_HEADS + "new.branch"; |
|
|
|
Transport t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enableReceivePack(); |
|
|
|
enableReceivePack(); |
|
|
|
|
|
|
|
|
|
|
|
t = Transport.open(db, remoteURI); |
|
|
|
try (Transport t = Transport.open(db, remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
final String srcExpr = Q.name(); |
|
|
|
final String srcExpr = Q.name(); |
|
|
|
final boolean forceUpdate = false; |
|
|
|
final boolean forceUpdate = false; |
|
|
|
final String localName = null; |
|
|
|
final String localName = null; |
|
|
@ -574,8 +544,6 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
RemoteRefUpdate u = new RemoteRefUpdate(src.getRepository(), |
|
|
|
RemoteRefUpdate u = new RemoteRefUpdate(src.getRepository(), |
|
|
|
srcExpr, dstName, forceUpdate, localName, oldId); |
|
|
|
srcExpr, dstName, forceUpdate, localName, oldId); |
|
|
|
t.push(NullProgressMonitor.INSTANCE, Collections.singleton(u)); |
|
|
|
t.push(NullProgressMonitor.INSTANCE, Collections.singleton(u)); |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(remoteRepository.hasObject(Q_txt)); |
|
|
|
assertTrue(remoteRepository.hasObject(Q_txt)); |
|
|
@ -633,7 +601,6 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
final RevCommit Q = src.commit().add("Q", Q_bin).create(); |
|
|
|
final RevCommit Q = src.commit().add("Q", Q_bin).create(); |
|
|
|
final Repository db = src.getRepository(); |
|
|
|
final Repository db = src.getRepository(); |
|
|
|
final String dstName = Constants.R_HEADS + "new.branch"; |
|
|
|
final String dstName = Constants.R_HEADS + "new.branch"; |
|
|
|
Transport t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enableReceivePack(); |
|
|
|
enableReceivePack(); |
|
|
|
|
|
|
|
|
|
|
@ -642,8 +609,7 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
cfg.setInt("http", null, "postbuffer", 8 * 1024); |
|
|
|
cfg.setInt("http", null, "postbuffer", 8 * 1024); |
|
|
|
cfg.save(); |
|
|
|
cfg.save(); |
|
|
|
|
|
|
|
|
|
|
|
t = Transport.open(db, remoteURI); |
|
|
|
try (Transport t = Transport.open(db, remoteURI)) { |
|
|
|
try { |
|
|
|
|
|
|
|
final String srcExpr = Q.name(); |
|
|
|
final String srcExpr = Q.name(); |
|
|
|
final boolean forceUpdate = false; |
|
|
|
final boolean forceUpdate = false; |
|
|
|
final String localName = null; |
|
|
|
final String localName = null; |
|
|
@ -652,8 +618,6 @@ public class SmartClientSmartServerTest extends HttpTestCase { |
|
|
|
RemoteRefUpdate u = new RemoteRefUpdate(src.getRepository(), |
|
|
|
RemoteRefUpdate u = new RemoteRefUpdate(src.getRepository(), |
|
|
|
srcExpr, dstName, forceUpdate, localName, oldId); |
|
|
|
srcExpr, dstName, forceUpdate, localName, oldId); |
|
|
|
t.push(NullProgressMonitor.INSTANCE, Collections.singleton(u)); |
|
|
|
t.push(NullProgressMonitor.INSTANCE, Collections.singleton(u)); |
|
|
|
} finally { |
|
|
|
|
|
|
|
t.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(remoteRepository.hasObject(Q_bin)); |
|
|
|
assertTrue(remoteRepository.hasObject(Q_bin)); |
|
|
|