private static final Logger log = LoggerFactory.getLogger(VodVideoCourseWare.class);
/**
* 同步上传课件
*/
@Test
public void testUploadCourseWareSync() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userid = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/video/%s/uploadPPT",userid);
String vid = "1b448be323fb327a42539cbb788913b4_1";
String format = "json";
String pptFilePath = getClass().getResource("/file/").getPath() + "class.pptx";
String pptControlPath = getClass().getResource("/file/").getPath() + "pptControl.txt";
File ppt = new File(pptFilePath);
File txt = new File(pptControlPath);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
requestMap.put("format",format);
Map<String,File> fileMap = new HashMap<>();
fileMap.put("ppt",ppt);
fileMap.put("txt",txt);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFile(url, requestMap,fileMap,Constant.UTF8);
log.debug("测试同步上传课件,{}", response);
//do somethings
}