private static final Logger log = LoggerFactory.getLogger(VodVideoManagementTest.class);
/**
* 上传弹幕
*/
@Test
public void testUploadDanmuFile() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/v2/danmu/"+userId+"/upload";
String vid = "1b448be323b68b2999802799a98dba54_1";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userId);
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
File file = new File(getClass().getResource("/barrage/srt(zh_CN).srt").getPath());
Map<String, File> fileMap = new HashMap<>();
fileMap.put("file", file);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFile(url, requestMap, fileMap, null);
log.debug("测试上传弹幕,{}", response);
//do somethings
}