Skip to content

Commit 26bb41d

Browse files
committed
add old startArchive method signature to be backwards compatible
1 parent 4729eca commit 26bb41d

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ notifications:
99
secure: fGRoClN1IQiZvokEiqmKOrF7EeaNQDHDHqUMaT4n7d3qW2fMe3N8ZLxlIDlzgJ2pv09VWqK7rmPgdhJR8yVG7OE4QQ5kzR59xD8ePN0j0jf6W6eOBPq3a9UUarnny21LFsShvRMZ/BaXcvTox1zMVltpMGFw2K4ijH8+ZvdkNz8=
1010
before_script:
1111
- echo $JAVA_OPTS
12-
- export JAVA_OPTS="$JAVA_OPTS -Xmx2g"
12+
- export JAVA_OPTS="$JAVA_OPTS -Xmx1024m"

src/main/java/com/opentok/OpenTok.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ public Archive startArchive(String sessionId) throws OpenTokException {
373373
return startArchive(sessionId, new ArchiveProperties.Builder().build());
374374
}
375375

376+
public Archive startArchive(String sessionId, String name) throws OpenTokException {
377+
ArchiveProperties properties = new ArchiveProperties.Builder().name(name).build();
378+
return startArchive(sessionId, properties);
379+
}
380+
376381
/**
377382
* Starts archiving an OpenTok 2.0 session.
378383
*

src/test/java/com/opentok/test/OpenTokTest.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,41 @@ public void testStartArchive() throws OpenTokException {
507507
.withHeader("User-Agent", matching(".*Opentok-Java-SDK/"+ Version.VERSION+".*")));
508508
}
509509

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+
510545
@Test
511546
public void testStartVoiceOnlyArchive() throws OpenTokException {
512547
String sessionId = "SESSIONID";

0 commit comments

Comments
 (0)