@@ -364,6 +364,7 @@ private void backgroundTest(String target) throws Exception {
364364 .build ();
365365
366366 backgroundTest (
367+ SignatureType .BACKGROUND ,
367368 fullTarget (target ),
368369 ImmutableList .of (gcfTestCase , cloudEventsStructuredTestCase , cloudEventsBinaryTestCase ));
369370 }
@@ -401,6 +402,7 @@ public void nativeCloudEvent() throws Exception {
401402 .build ();
402403
403404 backgroundTest (
405+ SignatureType .CLOUD_EVENT ,
404406 fullTarget ("CloudEventSnoop" ),
405407 ImmutableList .of (cloudEventsStructuredTestCase , cloudEventsBinaryTestCase ));
406408 }
@@ -472,7 +474,9 @@ public void classpathOptionHttp() throws Exception {
472474 .setUrl ("/?class=" + INTERNAL_CLASS .getName ())
473475 .setExpectedResponseText ("OK" )
474476 .build ();
475- testHttpFunction ("com.example.functionjar.Foreground" ,
477+ testFunction (
478+ SignatureType .HTTP ,
479+ "com.example.functionjar.Foreground" ,
476480 ImmutableList .of ("--classpath" , functionJarString ()),
477481 ImmutableList .of (testCase ));
478482 }
@@ -487,7 +491,9 @@ public void classpathOptionBackground() throws Exception {
487491 JsonObject json = gson .fromJson (originalJson , JsonObject .class );
488492 JsonObject jsonData = json .getAsJsonObject ("data" );
489493 jsonData .addProperty ("class" , INTERNAL_CLASS .getName ());
490- testBackgroundFunction ("com.example.functionjar.Background" ,
494+ testFunction (
495+ SignatureType .BACKGROUND ,
496+ "com.example.functionjar.Background" ,
491497 ImmutableList .of ("--classpath" , functionJarString ()),
492498 ImmutableList .of (TestCase .builder ().setRequestText (json .toString ()).build ()));
493499 }
@@ -497,11 +503,13 @@ public void classpathOptionBackground() throws Exception {
497503 // event. We start with a fixed body and insert into its JSON an extra property that tells the
498504 // function where to write what it received. We have to do this since background functions, by
499505 // design, don't return a value.
500- private void backgroundTest (String functionTarget , List <TestCase > testCases ) throws Exception {
506+ private void backgroundTest (
507+ SignatureType signatureType , String functionTarget , List <TestCase > testCases )
508+ throws Exception {
501509 for (TestCase testCase : testCases ) {
502510 File snoopFile = testCase .snoopFile ().get ();
503511 snoopFile .delete ();
504- testBackgroundFunction ( functionTarget , ImmutableList .of (testCase ));
512+ testFunction ( signatureType , functionTarget , ImmutableList . of () , ImmutableList .of (testCase ));
505513 String snooped = new String (Files .readAllBytes (snoopFile .toPath ()), StandardCharsets .UTF_8 );
506514 Gson gson = new Gson ();
507515 JsonObject snoopedJson = gson .fromJson (snooped , JsonObject .class );
@@ -522,23 +530,7 @@ private void checkSnoopFile(TestCase testCase) throws IOException {
522530 }
523531
524532 private void testHttpFunction (String target , List <TestCase > testCases ) throws Exception {
525- testHttpFunction (target , ImmutableList .of (), testCases );
526- }
527-
528- private void testHttpFunction (
529- String target , ImmutableList <String > extraArgs , List <TestCase > testCases ) throws Exception {
530- testFunction (SignatureType .HTTP , target , extraArgs , testCases );
531- }
532-
533- private void testBackgroundFunction (String target , List <TestCase > testCases )
534- throws Exception {
535- testBackgroundFunction (target , ImmutableList .of (), testCases );
536- }
537-
538- private void testBackgroundFunction (
539- String target , ImmutableList <String > extraArgs , List <TestCase > testCases )
540- throws Exception {
541- testFunction (SignatureType .BACKGROUND , target , extraArgs , testCases );
533+ testFunction (SignatureType .HTTP , target , ImmutableList .of (), testCases );
542534 }
543535
544536 private void testFunction (
@@ -584,7 +576,8 @@ private void testFunction(
584576
585577 private enum SignatureType {
586578 HTTP ("http" ),
587- BACKGROUND ("event" );
579+ BACKGROUND ("event" ),
580+ CLOUD_EVENT ("cloudevent" );
588581
589582 private final String name ;
590583
0 commit comments