Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf79d02f

Browse files
author
Scott Kidder
committed
Parse all ingest response details and make available in the toString
output to aid in debugging.
1 parent60159ee commitf79d02f

File tree

5 files changed

+125
-16
lines changed

5 files changed

+125
-16
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Copyright 2015 Brightcove Inc. All rights reserved.
3+
*
4+
* @author Scott Kidder
5+
*/
6+
packagecom.brightcove.castlabs.client.response;
7+
8+
/**
9+
* @author Scott Kidder
10+
*
11+
*/
12+
publicclassIngestCENCProtectionDetails {
13+
14+
privateStringname;
15+
privateStringpsshBoxContent;
16+
privateStringxmlFragment;
17+
18+
publicStringgetName() {
19+
returnname;
20+
}
21+
22+
publicvoidsetName(Stringname) {
23+
this.name =name;
24+
}
25+
26+
publicStringgetPsshBoxContent() {
27+
returnpsshBoxContent;
28+
}
29+
30+
publicvoidsetPsshBoxContent(StringpsshBoxContent) {
31+
this.psshBoxContent =psshBoxContent;
32+
}
33+
34+
publicStringgetXmlFragment() {
35+
returnxmlFragment;
36+
}
37+
38+
publicvoidsetXmlFragment(StringxmlFragment) {
39+
this.xmlFragment =xmlFragment;
40+
}
41+
42+
@Override
43+
publicStringtoString() {
44+
return"IngestCENCProtectionDetails [name=" +name +", psshBoxContent=" +psshBoxContent
45+
+", xmlFragment=" +xmlFragment +"]";
46+
}
47+
48+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright 2015 Brightcove Inc. All rights reserved.
3+
*
4+
* @author Scott Kidder
5+
*/
6+
packagecom.brightcove.castlabs.client.response;
7+
8+
importjava.util.HashMap;
9+
importjava.util.Map;
10+
11+
/**
12+
* @author Scott Kidder
13+
*
14+
*/
15+
publicclassIngestCENCResponse {
16+
17+
Map<String,IngestCENCProtectionDetails>systemId =
18+
newHashMap<String,IngestCENCProtectionDetails>();
19+
20+
publicMap<String,IngestCENCProtectionDetails>getSystemId() {
21+
returnsystemId;
22+
}
23+
24+
publicvoidsetSystemId(Map<String,IngestCENCProtectionDetails>systemId) {
25+
this.systemId =systemId;
26+
}
27+
28+
@Override
29+
publicStringtoString() {
30+
return"IngestCENCResponse [systemId=" +systemId +"]";
31+
}
32+
33+
}

‎src/main/java/com/brightcove/castlabs/client/response/IngestKeysResponse.java‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class IngestKeysResponse {
1616

1717
privateStringkeyId;
1818
privateStringkeyRotationId;
19+
privateIngestCENCResponsecencResponse;
1920
privateList<IngestAssetKeyError>errors =newArrayList<IngestAssetKeyError>();
2021

2122
publicStringgetKeyId() {
@@ -34,6 +35,14 @@ public void setKeyRotationId(String keyRotationId) {
3435
this.keyRotationId =keyRotationId;
3536
}
3637

38+
publicIngestCENCResponsegetCencResponse() {
39+
returncencResponse;
40+
}
41+
42+
publicvoidsetCencResponse(IngestCENCResponsecencResponse) {
43+
this.cencResponse =cencResponse;
44+
}
45+
3746
publicList<IngestAssetKeyError>getErrors() {
3847
returnerrors;
3948
}
@@ -45,6 +54,6 @@ public void setErrors(List<IngestAssetKeyError> errors) {
4554
@Override
4655
publicStringtoString() {
4756
return"IngestKeysResponse [keyId=" +keyId +", keyRotationId=" +keyRotationId
48-
+", errors=" +errors +"]";
57+
+",cencResponse=" +cencResponse +",errors=" +errors +"]";
4958
}
5059
}

‎src/test/java/com/brightcove/castlabs/client/CastlabsClientTest.java‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
importstaticorg.mockserver.model.HttpRequest.request;
1212
importstaticorg.mockserver.model.HttpResponse.response;
1313

14+
importjava.io.FileInputStream;
1415
importjava.io.IOException;
1516
importjava.util.concurrent.TimeUnit;
1617

18+
importorg.apache.commons.io.IOUtils;
1719
importorg.junit.After;
1820
importorg.junit.Before;
1921
importorg.junit.Rule;
@@ -212,20 +214,8 @@ public void testIngestKeysGold() throws Exception {
212214
.withQueryStringParameter("ticket",ticket)
213215
.withHeader("accept","application/json")
214216
.withHeader("content-type","application/json");
215-
mockServerClient.when(ingestAssetKeysRequest).respond(response().withStatusCode(200).withBody("{\n" +
216-
"\"assets\": [\n" +
217-
" {\n" +
218-
"\"assetId\":\"rst_test_20150909_004\",\n" +
219-
"\"keys\": [\n" +
220-
" {\n" +
221-
"\"streamType\":\"VIDEO\",\n" +
222-
"\"keyRotationId\":\"1\",\n" +
223-
"\"keyId\":\"a6dHTVECSJe0MEJEOiZHQg==\"\n" +
224-
" }\n" +
225-
" ]\n" +
226-
" }\n" +
227-
" ]\n" +
228-
"}"));
217+
finalStringresponse =IOUtils.toString(newFileInputStream("src/test/resources/sample_ingest_response.json"));
218+
mockServerClient.when(ingestAssetKeysRequest).respond(response().withStatusCode(200).withBody(response));
229219
finalIngestKeysRequestingestKeysRequest =newIngestKeysRequest();
230220
finalAssetRequestasset =newAssetRequest();
231221
asset.setAssetId("rst_test_20150909_004");
@@ -242,7 +232,7 @@ public void testIngestKeysGold() throws Exception {
242232
assertEquals(key.getKeyId(),asset.getIngestKeys().get(0).getKeyId());
243233
assertEquals(key.getKeyRotationId(),asset.getIngestKeys().get(0).getKeyRotationId());
244234
assertEquals(key.getStreamType(),asset.getIngestKeys().get(0).getStreamType());
245-
235+
246236
mockServerClient.verify(loginRequest,VerificationTimes.once());
247237
mockServerClient.verify(ticketRequest,VerificationTimes.once());
248238
mockServerClient.verify(ingestAssetKeysRequest,VerificationTimes.once());
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"assets": [
3+
{
4+
"assetId":"rst_test_20150909_004",
5+
"keys": [
6+
{
7+
"streamType":"VIDEO",
8+
"keyRotationId":"1",
9+
"keyId":"a6dHTVECSJe0MEJEOiZHQg==",
10+
"cencResponse": {
11+
"systemId": {
12+
"edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": {
13+
"name":"Widevine",
14+
"psshBoxContent":"CAESEGunR0[...]"
15+
},
16+
"9A04F079-9840-4286-AB92-E65BE0885F95": {
17+
"name":"PlayReady",
18+
"xmlFragment":"<mspr:pro>LgMAAAEAAQA[...]</mspr:pro>",
19+
"psshBoxContent":"LgMAAAEAAQAkAzwA[...]"
20+
}
21+
}
22+
},
23+
"errors": []
24+
}
25+
],
26+
"errors": []
27+
}
28+
]
29+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp