Commit 843621df by fanyuanmeng

create:新增接口

parent 6845488c
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.client.XMAppApi;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.RandomStringUtil;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fym
* @date 2021/2/19 4:20 下午
*/
public class TestCreateSeries extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_createSeries") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testCreateSeries(){
String seriesName = RandomStringUtil.randomNumber(25,"seriescourse_");
Map mediaMap = new HashMap();
mediaMap.put("mediaType","TEXT");
mediaMap.put("mediaContent","这是系列课简介");
mediaMap.put("key","sCJFBRyjFTzxcXCR");
mediaMap.put("mediaContentLength",7);
List scheduleMedia = new ArrayList();
scheduleMedia.add(mediaMap);
List enableJoinStuIds = new ArrayList();
List joinStudentIds = new ArrayList();
Map bodyMap = new HashMap();
bodyMap.put("seriesName",seriesName);
bodyMap.put("instId", xmAppApi.getLoginInfo().getInstId());
bodyMap.put("teacherId",xmAppApi.getLoginInfo().getTid());
bodyMap.put("coverId","1362677307414863873");
bodyMap.put("joinType","ALL");
bodyMap.put("smsCheck","VALID");
bodyMap.put("showType","LOCK");
bodyMap.put("scheduleMedia",scheduleMedia);
bodyMap.put("joinStudentIds",joinStudentIds);
bodyMap.put("enableJoinStuIds",enableJoinStuIds);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
com.alibaba.fastjson.JSONObject jsonBody = xmAppApi.getBodyInJSON();
GetSeriesCourseData getSeriesCourseData = new GetSeriesCourseData();
JSONObject jsonObject1 = getSeriesCourseData.getSeriesPage();
// System.out.println("jsonObject1"+jsonBody1);
String id = jsonObject1.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
Assert.assertEquals(id,jsonBody.getString("result"));
}
}
package com.live.cases.seriesCourse;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.RandomStringUtil;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetSeriesCourseData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fym
* @date 2021/2/19 4:20 下午
*/
public class TestSeriesPage extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_seriesPage") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testSeriesPage(){
Map bodyMap = new HashMap();
bodyMap.put("teacherId","");
bodyMap.put("current",1);
bodyMap.put("instId",xmAppApi.getLoginInfo().getInstId());
bodyMap.put("size",10);
bodyMap.put("createTimeBegin","");
bodyMap.put("createTimeEnd","");
bodyMap.put("seriesName","");
System.out.println("bodyMap = "+bodyMap);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
System.out.println("bodyData = "+bodyData);
xmAppApi.doRequest(RequestType.JSON, params,bodyData, headers);
System.out.println(xmAppApi);
JSONObject seriesPage = xmAppApi.getBodyInJSON();
System.out.println("seriesPage ="+seriesPage);
Assert.assertEquals("true", seriesPage.getString("success"));
Assert.assertEquals("200", seriesPage.getString("code"));
Assert.assertEquals("操作成功!", seriesPage.getString("message"));
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("teacherId","");
// jsonObject.put("current",1);
// jsonObject.put("instId",xmAppApi.getLoginInfo().getInstId());
// jsonObject.put("size",10);
// jsonObject.put("createTimeBegin","");
// jsonObject.put("createTimeEnd","");
// jsonObject.put("seriesName","");
//
//
// xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
// System.out.println(xmAppApi);
// JSONObject jsonBody = xmAppApi.getBodyInJSON();
// System.out.println("jsonBody ="+jsonBody );
}
}
package com.live.cases.videoClass;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetVideoClassData;
import net.minidev.json.JSONUtil;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fym
* @date 2021/2/19 1:52 下午
*/
public class TestAddLessonScheduleStu extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Video) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_addLessonScheduleStu") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void AddLessonScheduleSt() throws InterruptedException {
GetVideoClassData getVideoClassData = new GetVideoClassData();
String scheduleId = getVideoClassData.createVideoClass();
List studentIds = new ArrayList();
studentIds.add("1308376918943268866");
Map bodyMap = new HashMap();
bodyMap.put("instId",xmAppApi.getLoginInfo().getInstId());
bodyMap.put("scheduleId",scheduleId);
bodyMap.put("studentIds",studentIds);
org.json.JSONObject jsonObject = new org.json.JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
JSONObject jsonBody0 = xmAppApi.getBodyInJSON();
System.out.println(jsonBody0);
Assert.assertEquals("1",getVideoClassData.VideoClassData().getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("stuNum"));
}
}
package com.live.cases.videoClass;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetVideoClassData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/19 10:49 上午
*/
public class TestGetLessonScheduleStuPage extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Video) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getLessonScheduleStuPage") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testGetLessonScheduleStuPage() throws InterruptedException {
GetVideoClassData getVideoClassData = new GetVideoClassData();
String scheduleId = getVideoClassData.createVideoClass();
Map bodyMap = new HashMap();
bodyMap.put("current",1);
bodyMap.put("size",10);
bodyMap.put("scheduleId",scheduleId);
org.json.JSONObject jsonObject = new org.json.JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
com.alibaba.fastjson.JSONObject jsonBody0 = xmAppApi.getBodyInJSON();
Assert.assertEquals("0",jsonBody0.getJSONObject("result").getString("total"));
}
}
package com.live.cases.videoClass;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import com.live.xmutils.GetVideoClassData;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/19 11:34 上午
*/
public class TestRemoveLessonSchedule extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_Video) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_removeLessonSchedule") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("樊圆梦");
super.beforeTest();
}
@Test
public void testRemoveLessonSchedule(){
GetVideoClassData getVideoClassData = new GetVideoClassData();
JSONObject jsonBody = getVideoClassData.VideoClassData();
String scheduleId = jsonBody.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
String strTotal = jsonBody.getJSONObject("result").getString("total");
int total = Integer.parseInt(strTotal);
Map bodyMap = new HashMap();
bodyMap.put("scheduleId",scheduleId);
org.json.JSONObject jsonObject = new org.json.JSONObject(bodyMap);
String bodyData = jsonObject.toString();
xmAppApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(xmAppApi);
com.alibaba.fastjson.JSONObject jsonBody0 = xmAppApi.getBodyInJSON();
JSONObject jsonBody1 = getVideoClassData.VideoClassData();
String strTotal0 = jsonBody1.getJSONObject("result").getString("total");
int total0 = Integer.parseInt(strTotal0);
Assert.assertEquals(total,total0+1);
}
}
......@@ -14,6 +14,7 @@ public class ApiModele {
//云课堂B端接口模块
public static String CloudClass_Video = "cloudclass_video_b";
public static String CloudClass_File = "cloudclass_file_b";
public static String CloudClass_Series = "cloudclass_series_b";
//云课堂C端接口模块C
public static String CloudClass_VideoC = "cloudclass_video_c";
......
package com.live.xmutils;
import com.alibaba.fastjson.JSONObject;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import java.util.HashMap;
import java.util.Map;
/**
* @author fym
* @date 2021/2/19 5:15 下午
*/
public class GetSeriesCourseData extends XMBaseTest {
public JSONObject getSeriesPage(){
dataApi.setApiModule(ApiModele.CloudClass_Series) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_seriesPage") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
Map bodyMap = new HashMap();
bodyMap.put("teacherId","");
bodyMap.put("current",1);
bodyMap.put("instId",dataApi.getLoginInfo().getInstId());
bodyMap.put("size",10);
bodyMap.put("createTimeBegin","");
bodyMap.put("createTimeEnd","");
bodyMap.put("seriesName","");
System.out.println("bodyMap = "+bodyMap);
JSONObject jsonObject = new JSONObject(bodyMap);
String bodyData = jsonObject.toString();
System.out.println("bodyData = "+bodyData);
dataApi.doRequest(RequestType.JSON, params,bodyData, headers);
System.out.println(dataApi);
JSONObject seriesPage = dataApi.getBodyInJSON();
return seriesPage;
}
}
......@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @author fym
......@@ -28,6 +29,7 @@ public class GetVideoClassData extends XMBaseTest {
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
System.out.println("查询列表========"+dataApi);
Map bodyMap = new HashMap();
bodyMap.put("current",1);
......@@ -46,7 +48,7 @@ public class GetVideoClassData extends XMBaseTest {
}
//创建视频课(任何人)
public String createVideoClass(){
public String createVideoClass() throws InterruptedException {
dataApi.setApiModule(ApiModele.CloudClass_B) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_createLesson") // API 名称 必传
......@@ -98,6 +100,7 @@ public class GetVideoClassData extends XMBaseTest {
System.out.println(dataApi);
com.alibaba.fastjson.JSONObject jsonBody = dataApi.getBodyInJSON();
TimeUnit.SECONDS.sleep(3);
String scheduleId = jsonBody.getString("result");
return scheduleId;
......@@ -105,7 +108,7 @@ public class GetVideoClassData extends XMBaseTest {
}
//查询课次详情
public JSONObject classDetail(){
public JSONObject classDetail() throws InterruptedException {
dataApi.setApiModule(ApiModele.CloudClass_Video) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getLessonScheduleDetail") // API 名称 必传
......@@ -131,6 +134,39 @@ public class GetVideoClassData extends XMBaseTest {
}
//查询视频课学员列表
public JSONObject getLessonStudentsPage(){
dataApi.setApiModule(ApiModele.CloudClass_Video) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("API_getLessonScheduleStuPage") // API 名称 必传
.setLoginUser("fym-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeDataRequest();
System.out.println("this方法======="+dataApi);
String scheduleId = VideoClassData().getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id");
Map bodyMap = new HashMap();
bodyMap.put("current",1);
bodyMap.put("size",10);
bodyMap.put("scheduleId",scheduleId);
org.json.JSONObject jsonObject = new org.json.JSONObject(bodyMap);
String bodyData = jsonObject.toString();
dataApi.doRequest(RequestType.JSON, params, bodyData, headers);
System.out.println(dataApi);
JSONObject jsonBodyStudentPage = dataApi.getBodyInJSON();
return jsonBodyStudentPage;
}
......
{
"API_createSeries":
{
"apiPath": "/apollo/public/apollo/createSeries",
"apiContentType": "application/json;charset=utf-8",
"apiName": "新增系列课",
"desc": "新增系列课"
},
"API_seriesPage":
{
"apiPath": "/apollo/public/apollo/seriesPage",
"apiContentType": "application/json;charset=utf-8",
"apiName": "系列课列表",
"desc": "系列课列表"
}
}
\ No newline at end of file
......@@ -22,6 +22,7 @@ cloudclass_file_b = /src/main/resources/apicase/api-file-b.json
cloudclass_file_c = /src/main/resources/apicase/api-file-c.json
cloudclass_customerLive_api = /src/main/resources/apicase/customerLive.json
cloudclass_apollo_api = /src/main/resources/apicase/apollo.json
cloudclass_series_b = /src/main/resources/apicase/series-course-b.json
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment