@ -264,25 +264,26 @@ public class ProtocolV2ParserTest {
@Test
@Test
public void testFetchMustNotHaveMultipleFilters ( ) throws IOException {
public void testFetchMustNotHaveMultipleFilters ( ) throws IOException {
thrown . expect ( PackProtocolException . class ) ;
PacketLineIn pckIn = formatAsPacketLine ( PacketLineIn . DELIM ,
PacketLineIn pckIn = formatAsPacketLine ( PacketLineIn . DELIM ,
"filter blob:none" ,
"filter blob:none" ,
"filter blob:limit=12" ,
"filter blob:limit=12" ,
PacketLineIn . END ) ;
PacketLineIn . END ) ;
ProtocolV2Parser parser = new ProtocolV2Parser (
ProtocolV2Parser parser = new ProtocolV2Parser (
ConfigBuilder . start ( ) . allowFilter ( ) . done ( ) ) ;
ConfigBuilder . start ( ) . allowFilter ( ) . done ( ) ) ;
FetchV2Request request = parser . parseFetchRequest ( pckIn ,
thrown . expect ( PackProtocolException . class ) ;
parser . parseFetchRequest ( pckIn ,
testRepo . getRepository ( ) . getRefDatabase ( ) ) ;
testRepo . getRepository ( ) . getRefDatabase ( ) ) ;
assertEquals ( 0 , request . getFilterBlobLimit ( ) ) ;
}
}
@Test
@Test
public void testFetchFilterWithoutAllowFilter ( ) throws IOException {
public void testFetchFilterWithoutAllowFilter ( ) throws IOException {
thrown . expect ( PackProtocolException . class ) ;
PacketLineIn pckIn = formatAsPacketLine ( PacketLineIn . DELIM ,
PacketLineIn pckIn = formatAsPacketLine ( PacketLineIn . DELIM ,
"filter blob:limit=12" , PacketLineIn . END ) ;
"filter blob:limit=12" , PacketLineIn . END ) ;
ProtocolV2Parser parser = new ProtocolV2Parser (
ProtocolV2Parser parser = new ProtocolV2Parser (
ConfigBuilder . getDefault ( ) ) ;
ConfigBuilder . getDefault ( ) ) ;
thrown . expect ( PackProtocolException . class ) ;
parser . parseFetchRequest ( pckIn ,
parser . parseFetchRequest ( pckIn ,
testRepo . getRepository ( ) . getRefDatabase ( ) ) ;
testRepo . getRepository ( ) . getRefDatabase ( ) ) ;
}
}
@ -315,9 +316,6 @@ public class ProtocolV2ParserTest {
@Test
@Test
public void testFetchWithRefInWantUnknownRef ( ) throws Exception {
public void testFetchWithRefInWantUnknownRef ( ) throws Exception {
thrown . expect ( PackProtocolException . class ) ;
thrown . expectMessage ( containsString ( "refs/heads/branchC" ) ) ;
PacketLineIn pckIn = formatAsPacketLine ( PacketLineIn . DELIM ,
PacketLineIn pckIn = formatAsPacketLine ( PacketLineIn . DELIM ,
"want e4980cdc48cfa1301493ca94eb70523f6788b819" ,
"want e4980cdc48cfa1301493ca94eb70523f6788b819" ,
"want-ref refs/heads/branchC" ,
"want-ref refs/heads/branchC" ,
@ -330,6 +328,8 @@ public class ProtocolV2ParserTest {
testRepo . update ( "branchA" , one ) ;
testRepo . update ( "branchA" , one ) ;
testRepo . update ( "branchB" , two ) ;
testRepo . update ( "branchB" , two ) ;
thrown . expect ( PackProtocolException . class ) ;
thrown . expectMessage ( containsString ( "refs/heads/branchC" ) ) ;
parser . parseFetchRequest ( pckIn ,
parser . parseFetchRequest ( pckIn ,
testRepo . getRepository ( ) . getRefDatabase ( ) ) ;
testRepo . getRepository ( ) . getRefDatabase ( ) ) ;
}
}