明确需求
前几天亲自去百度跟张老师进行了沟通,明确了需要分析,之前思路一直比较乱,主要是没有做好需求分析。明确之后就找到了方向
打开首页,首先必须点击某个链路的启动,这样才可以选择工作模式,对于Record和Replay两种模式,分别需要弹窗与用户交互。
在Record模式下,重新录制需要新建一个版本,对于历史版本,有继续录制这一项,二者都是只要一点击就会触发handler,进行录制
在Replay模式下,针对所有的历史版本,先显示出来,然后有三种模式,点击Replay触发replayhandler。
加入版本号
与link类似,建立version类,其中它里面包括version_id ,link_id,name, add_time
同样,需要在数据库中建立相应数据库,并且写好mapper文件,用来读取数据库
package com.baidu.terminator.test;
import java.util.Date;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.baidu.terminator.manager.bo.Link;
import com.baidu.terminator.manager.bo.Version;
import com.baidu.terminator.manager.common.SpringInit;
import com.baidu.terminator.manager.service.LinkControlService;
import com.baidu.terminator.manager.service.LinkService;
import com.baidu.terminator.manager.service.VersionService;
public class AppTest {
private static final Object String = null;
private Logger logger;
@Test
public void test() {
ApplicationContext ac=new ClassPathXmlApplicationContext("conf/applicationContext.xml");
SpringInit.setApplicationContext(ac);
LinkControlService linkControlService = (LinkControlService) ac
.getBean("linkControlService");
LinkService linkService= (LinkService) ac.getBean("linkService");
VersionService versionService=(VersionService) ac.getBean("versionService");
// Version version=new Version();
//
// version.setVersionId(1);
// version.setLinkId(1);
// version.setName("test");
// version.setAddTime(new Date());
//
// versionService.addVersion(version);
//
// version.setVersionId(2);
// version.setLinkId(1);
// version.setName("test1");
// version.setAddTime(new Date());
//
// versionService.addVersion(version);
versionService.getVersionById(1);
System.out.println(versionService.getVersionById(1));
// versionService.deleteVersion(1);
//System.out.println(linkControlService.getLink(1));
// Link link = linkService.getLinkById(1);
// System.out.println(link.getRequestSigner());
// linkControlService.startServer(1);
// linkControlService.stopServer(1);
//文件测试
// Storage st=StorageFactory.getStorage(link);
// for(int i=0;i<4;i++){
//
// String req = new String("req");
// String res = new String("res");
// RequestResponseBundle rr=new RequestResponseBundle(req, res);
// MD5 md5 = new MD5();
// st.putRecordData(md5.getMD5ofStr("123".toString()),rr);
// }
//
// st.deleteRecordDataByID(62);
// st.deleteRecordData(1);
// RequestResponseBundle rs=new RequestResponseBundle();
// rs=(RequestResponseBundle)(st.getbyID(61));System.out.println(rs);
// rs=(RequestResponseBundle)(st.getbyID(62));System.out.println(rs);
// rs=(RequestResponseBundle)(st.getbyID(64));System.out.println(rs);
}
}