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