@@ -507,6 +507,41 @@ public void testStartArchive() throws OpenTokException {
507
507
.withHeader ("User-Agent" , matching (".*Opentok-Java-SDK/" + Version .VERSION +".*" )));
508
508
}
509
509
510
+ @ Test
511
+ public void testStartArchiveWithName () throws OpenTokException {
512
+ String sessionId = "SESSIONID" ;
513
+ String name = "archive_name" ;
514
+
515
+ stubFor (post (urlEqualTo ("/v2/partner/" +this .apiKey +"/archive" ))
516
+ .willReturn (aResponse ()
517
+ .withStatus (200 )
518
+ .withHeader ("Content-Type" , "application/json" )
519
+ .withBody ("{\n " +
520
+ " \" createdAt\" : 1395183243556,\n " +
521
+ " \" duration\" : 0,\n " +
522
+ " \" id\" : \" 30b3ebf1-ba36-4f5b-8def-6f70d9986fe9\" ,\n " +
523
+ " \" name\" : \" archive_name\" ,\n " +
524
+ " \" partnerId\" : 123456,\n " +
525
+ " \" reason\" : \" \" ,\n " +
526
+ " \" sessionId\" : \" SESSIONID\" ,\n " +
527
+ " \" size\" : 0,\n " +
528
+ " \" status\" : \" started\" ,\n " +
529
+ " \" url\" : null\n " +
530
+ " }" )));
531
+
532
+ Archive archive = sdk .startArchive (sessionId , name );
533
+ assertNotNull (archive );
534
+ assertEquals (sessionId , archive .getSessionId ());
535
+ assertEquals (name , archive .getName ());
536
+ assertNotNull (archive .getId ());
537
+
538
+ verify (postRequestedFor (urlMatching ("/v2/partner/" +this .apiKey +"/archive" ))
539
+ // TODO: find a way to match JSON without caring about spacing
540
+ //.withRequestBody(matching(".*"+".*"))
541
+ .withHeader ("X-TB-PARTNER-AUTH" , matching (this .apiKey +":" +this .apiSecret ))
542
+ .withHeader ("User-Agent" , matching (".*Opentok-Java-SDK/" + Version .VERSION +".*" )));
543
+ }
544
+
510
545
@ Test
511
546
public void testStartVoiceOnlyArchive () throws OpenTokException {
512
547
String sessionId = "SESSIONID" ;
0 commit comments