private static final Logger log = LoggerFactory.getLogger(VodVideoUploadTest.class);
/**
*上传水印
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testUploadWatermark() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/v2/video/"+userId+"/watermarkSetting";
String path1 = getClass().getResource("/file/").getPath() + "cat.jpg";
File image = new File(path1);
String watermarkLocation = "3";
String cataid = "1602300731843";
//调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userId", userId);
requestMap.put("ptime", ptime);
requestMap.put("watermarkLocation", watermarkLocation);
requestMap.put("cataid", cataid);
Map<String,File> fileMap = new HashMap<>();
fileMap.put("image",image);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFile(url,requestMap,fileMap,"utf-8");
log.debug("测试上传水印,{}", response);
//do somethings
}