diff --git a/UPDATELOG.md b/UPDATELOG.md index 2e5066e..8705ae4 100644 --- a/UPDATELOG.md +++ b/UPDATELOG.md @@ -1,12 +1,17 @@ ======================rap v0.8 更新列表=========================================== - [功能] 增加jQuery/Kissy插件,更好的使用RAP MOCK - [BUG] 修复JSON导入最外层为数组时失效的问题 - [重构] 修复JSHint提出的N多个rap.js中的编码规范问题 - + [功能] 增加jQuery/Kissy插件,更好的使用RAP MOCK 2013-01-14 + [BUG] 修复JSON导入最外层为数组时失效的问题 2013-01-14 + [重构] 修复JSHint提出的N多个rap.js中的编码规范问题 2013-01-14 + [改进] 增加当前action的高亮显示 2013-01-15 + [插件] RAP MOCK插件增加黑白名单及工作模式配置的功能 2013-01-16 + [MOCK] 1. 处理多选1预发(data|1:["1","2","3","8"])时,错误增加引好的问题。 2013-01-17 + 2. 常规RAP MOCK规则忽略掉MockJS语法,例如:{"data|1" : [1,2,3]} => {"data" : 1} + 3. 修复createData对参数做过滤时,修改到服务器上的标识符从而导致MockJS标签丢失的问题 + ======================rap v0.7 更新列表=========================================== - [组织]新增对公司、业务线、分组分级的项目组织结构管理。全新设计的界面。 2013-12-16 - [UC]增加公司统一账户登录。这里后续还会增加普通帐号的支持。(外部用户请注释掉web.xml中的SSOFilter及相应的filter-mapping, 然后恢复template.rap.vm中的logout注销按钮即可正常使用。 2013-12-16 - [作者信息]作者新增思竹(wangweaf),感谢新伙伴的加入,让我们的RAP越来越强大!谢谢思竹和李牧的大力支持! + [组织]新增对公司、业务线、分组分级的项目组织结构管理。全新设计的界面。 2013-12-16 + [UC]增加公司统一账户登录。这里后续还会增加普通帐号的支持。(外部用户请注释掉web.xml中的SSOFilter及相应的filter-mapping, 然后恢复template.rap.vm中的logout注销按钮即可正常使用。 2013-12-16 + [作者信息]作者新增思竹(wangweaf),感谢新伙伴的加入,让我们的RAP越来越强大!谢谢思竹和李牧的大力支持! [MOCK模块]增加对array, array, array, array的@value支持,RAP用户一旦为数组元素设定@value标签,将以@value中的内容作为该字段输出,不会继续遍历深层结构。 2013-11-21 [MOCK模块]增加对备注标签、注释分隔符的转义处理,当用户标签内容包含分隔符分号时,需使用////替代来防止当作分隔符处理。 2013-11-21 [MOCK模块]增加MOCK串联,只要设置tb_project.related_ids即可实现跨项目的MOCK数据共享 2013-12-10 diff --git a/WebContent/platform/about.vm b/WebContent/platform/about.vm index 79ad598..d88346c 100644 --- a/WebContent/platform/about.vm +++ b/WebContent/platform/about.vm @@ -10,6 +10,8 @@ #bodyStart

对于RAP平台的任何问题,欢迎邮件至huoyong.msb@taobao.com

+

RAP是THX平台中的产品,想了解THX更多内容,请访问:http://thx.alibaba-inc.com

+

RAP Github Repo: http://github.com/thx/RAP

#bodyEnd diff --git a/WebContent/platform/home.vm b/WebContent/platform/home.vm index e8bba08..d0c1868 100644 --- a/WebContent/platform/home.vm +++ b/WebContent/platform/home.vm @@ -17,6 +17,9 @@ #bodyNewStart +

对于RAP平台的任何问题,欢迎邮件至huoyong.msb@taobao.com

+

RAP是THX平台中的产品,想了解THX更多内容,请访问:http://thx.alibaba-inc.com

+

RAP Github Repo: http://github.com/thx/RAP

Rigel Automation Platform

在开发WEB应用时前后端会约定请求接口,包含请求链接、参数等细节。RAP提供了接口数据的共享平台,功能强大使用方便。同时利用这些数据自动化的生成伪造数据、提供后端开发工具包等,减少重复劳动并提升开发效率。

diff --git a/WebContent/plugins/index.htm b/WebContent/plugins/index.htm index ae186be..4214350 100644 --- a/WebContent/plugins/index.htm +++ b/WebContent/plugins/index.htm @@ -1,40 +1,28 @@ - - - RAP Example - - - - - - - - -
-
- - + + + RAP Example + + + + + + + +
+        
+ + diff --git a/WebContent/plugins/rap.plugin.js b/WebContent/plugins/rap.plugin.js index 6ed7e49..a4c4773 100644 --- a/WebContent/plugins/rap.plugin.js +++ b/WebContent/plugins/rap.plugin.js @@ -23,6 +23,8 @@ var node = document.getElementById('rap'); var blackList = []; var whiteList = []; + //var ROOT = 'rap.alibaba-inc.com'; + var ROOT = 'etaoux-bj.taobao.ali.com:8080'; /** * mode value range: * 0-disabled @@ -83,7 +85,7 @@ if (url.charAt(0) != '/') { url = '/' + url; } - url = "http://rap.alibaba-inc.com/mockjs/" + projectId + url; + url = "http://" + ROOT + "/mockjs/" + projectId + url; oOptions.url = url; } ajax.apply(this, arguments); @@ -113,7 +115,7 @@ if (url.charAt(0) != '/') { url = '/' + url; } - url = "http://rap.alibaba-inc.com/mockjs/" + projectId + url; + url = "http://" + ROOT + "/mockjs/" + projectId + url; oOptions.url = url; var oldSuccess = oOptions.success; oOptions.success = function(data) { diff --git a/WebContent/stat/css/myWorkspace.css b/WebContent/stat/css/myWorkspace.css index 4b2b581..aa4d878 100644 --- a/WebContent/stat/css/myWorkspace.css +++ b/WebContent/stat/css/myWorkspace.css @@ -187,6 +187,10 @@ body { float: left; } +.tree-m .cur a { + color: #CC0000; +} + .seperator { height: 400px; left: 250px; diff --git a/WebContent/stat/js/core/rap.js b/WebContent/stat/js/core/rap.js index 702c837..7ac905f 100644 --- a/WebContent/stat/js/core/rap.js +++ b/WebContent/stat/js/core/rap.js @@ -1288,6 +1288,18 @@ var rap = rap || {}; if (action === null) return; getDiv(_curModuleId, "a").innerHTML = getAHtml(action); renderA(); + + + var last = b.g('div-a-tree-node-' + _curActionId); + var cur = b.g('div-a-tree-node-' + actionId); + + if (last && b.dom.hasClass(last, 'cur')) { + b.dom.removeClass(last, 'cur'); + } + if (cur && !b.dom.hasClass(cur, 'cur')) { + b.dom.addClass(cur, 'cur'); + } + _curActionId = actionId; }; @@ -2936,6 +2948,13 @@ var rap = rap || {}; moduleId = moduleList[i].id; ecui.init(baidu.g("div-tree-" + moduleId)); } + + var cur = b.g('div-a-tree-node-' + _curActionId); + + if (cur && !b.dom.hasClass(cur, 'cur')) { + b.dom.addClass(cur, 'cur'); + } + } /** diff --git a/WebContent/tcom/const.inc.vm b/WebContent/tcom/const.inc.vm index cda9c68..9bccfe5 100644 --- a/WebContent/tcom/const.inc.vm +++ b/WebContent/tcom/const.inc.vm @@ -14,7 +14,7 @@ #set($dateFormat = 'yyyy-MM-dd') ## 时间戳 -#set($timeStamp = '201312161659.v0.7') +#set($timeStamp = '20140115.v0.7') ##----------------------页面请求action地址------------------------------- ## 配置工程的上下文路径 diff --git a/WebContent/workspace/myWorkspace.vm b/WebContent/workspace/myWorkspace.vm index e0f77cd..4fd938f 100644 --- a/WebContent/workspace/myWorkspace.vm +++ b/WebContent/workspace/myWorkspace.vm @@ -3,7 +3,7 @@ - Project Manage + $!utils.escapeInH($workspace.project.name) 接口编辑 #includeRapStatic diff --git a/src/com/taobao/rigel/rap/mock/service/impl/MockMgrImpl.java b/src/com/taobao/rigel/rap/mock/service/impl/MockMgrImpl.java index d03a417..5f34256 100644 --- a/src/com/taobao/rigel/rap/mock/service/impl/MockMgrImpl.java +++ b/src/com/taobao/rigel/rap/mock/service/impl/MockMgrImpl.java @@ -303,10 +303,10 @@ private void buildMockTemplate(StringBuilder json, Parameter para, int index) { if (para.getParameterList() == null || para.getParameterList().size() == 0) { - json.append(para.getMockIdentifier() + ":" + mockjsValue(para, index)); + json.append(para.getMockJSIdentifier() + ":" + mockjsValue(para, index)); } else { // object and array - json.append(para.getMockIdentifier() + ":"); + json.append(para.getMockJSIdentifier() + ":"); String left = "{", right = "}"; if (isArrayObject) { @@ -338,7 +338,6 @@ private void buildMockTemplate(StringBuilder json, Parameter para, int index) { } private String mockValue(Parameter para, int index) { - parameterFilter(para); String dataType = para.getDataType(); String[] tags = para.getMockDataTEMP().split(";"); Map tagMap = new HashMap(); @@ -514,29 +513,20 @@ private String mockValue(Parameter para, int index) { private String mockjsValue(Parameter para, int index) { - parameterFilter(para); - //String dataType = para.getDataType(); String[] tags = para.getMockDataTEMP().split(";"); Map tagMap = new HashMap(); parseTags(tags, tagMap, true); String returnValue = "1"; String mockValue = tagMap.get("mock"); if (mockValue != null && !mockValue.isEmpty()) { - return "\"" + mockValue + "\""; - } - return returnValue; - } - - - private void parameterFilter(Parameter para) { - String identifier = para.getIdentifier(); - if (identifier != null && !identifier.isEmpty()) { - int index = identifier.indexOf("|"); - if (index > -1) { - identifier = identifier.substring(0, index); - para.setIdentifier(identifier); + if (mockValue.startsWith("[") && mockValue.endsWith("]")) { + return mockValue; + } else { + return "\"" + mockValue + "\""; } + } + return returnValue; } /** diff --git a/src/com/taobao/rigel/rap/project/bo/Parameter.java b/src/com/taobao/rigel/rap/project/bo/Parameter.java index 6f3932a..7c3bfc1 100644 --- a/src/com/taobao/rigel/rap/project/bo/Parameter.java +++ b/src/com/taobao/rigel/rap/project/bo/Parameter.java @@ -12,32 +12,32 @@ public class Parameter implements java.io.Serializable { private static final long serialVersionUID = 1L; - + private int id; - + public int getId() { return id; } - + public void setId(int id) { this.id = id; } - + private String mockData; - + public String getMockData() { return mockData; } - + public void setMockData(String mockData) { this.mockData = mockData; } - + /** * temporary property */ private String mockDataTEMP; - + public String getMockDataTEMP() { return mockDataTEMP; } @@ -47,92 +47,110 @@ public void setMockDataTEMP(String mockDataTEMP) { } private String name; - + public String getName() { return name; } - + public void setName(String name) { this.name = (name == null ? "" : name); } - + private String identifier; - + public String getIdentifier() { return identifier; } - + public String getMockIdentifier() { + String rv = ""; if (identifier == null || identifier.isEmpty()) { return "emptyIdentifier"; } - return "\"" + identifier + "\""; + + rv = identifier; + if (rv != null && !rv.isEmpty()) { + int index = rv.indexOf("|"); + if (index > -1) { + rv = rv.substring(0, index); + } + } + return "\"" + rv + "\""; } + public String getMockJSIdentifier() { + String rv = ""; + if (identifier == null || identifier.isEmpty()) { + return "emptyIdentifier"; + } + rv = identifier; + return "\"" + rv + "\""; + } + public void setIdentifier(String identifier) { this.identifier = (identifier == null ? "" : identifier); } - + private String dataType; - + public String getDataType() { return dataType; } - + public void setDataType(String dataType) { this.dataType = (dataType == null ? "" : dataType); } - + private String remark; - + public String getRemark() { return (remark == null ? "" : remark); } - + public void setRemark(String remark) { this.remark = remark; } - + private Set actionRequestList = new HashSet(); - + public Set getActionRequestList() { return actionRequestList; } - + public void setActionRequestList(Set actionRequestList) { this.actionRequestList = actionRequestList; } - + private Set actionResponseList = new HashSet(); - + public Set getActionResponseList() { return actionResponseList; } - + public void setActionResponseList(Set actionResponseList) { this.actionResponseList = actionResponseList; } - + private String validator = ""; - + public String getValidator() { return validator; } - + public void setValidator(String validator) { this.validator = validator; } - + private Set parameterList = new HashSet(); - + public Set getParameterList() { return parameterList; } - + public void setParameterList(Set parameterList) { this.parameterList = parameterList; } - + public void update(Parameter parameter) { setDataType(parameter.getDataType()); setIdentifier(parameter.getIdentifier()); @@ -140,7 +158,7 @@ public void update(Parameter parameter) { setRemark(parameter.getRemark()); setValidator(parameter.getValidator()); } - + public List getParameterListOrdered() { Set parameterList = getParameterList(); List parameterListOrdered = new ArrayList(); @@ -148,40 +166,45 @@ public List getParameterListOrdered() { Collections.sort(parameterListOrdered, new ParameterComparator()); return parameterListOrdered; } - + private Set complexParamerterList = new HashSet(); - + public Set getComplexParameterList() { return complexParamerterList; } - + public void setComplexParameterList(Set complexParameterList) { this.complexParamerterList = complexParameterList; } - + public void addChild(Parameter parameter) { getParameterList().add(parameter); parameter.getComplexParameterList().add(this); } - + public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("{\"id\":" + getId() + ","); - stringBuilder.append("\"identifier\":\"" + StringUtils.escapeInJ(getIdentifier()) + "\","); - stringBuilder.append("\"name\":\"" + StringUtils.escapeInJ(getName()) + "\","); - stringBuilder.append("\"remark\":\"" + StringUtils.escapeInJ(getRemark()) + "\","); + stringBuilder.append("\"identifier\":\"" + + StringUtils.escapeInJ(getIdentifier()) + "\","); + stringBuilder.append("\"name\":\"" + StringUtils.escapeInJ(getName()) + + "\","); + stringBuilder.append("\"remark\":\"" + + StringUtils.escapeInJ(getRemark()) + "\","); stringBuilder.append("\"parameterList\":"); stringBuilder.append("["); Iterator iterator = getParameterListOrdered().iterator(); - while(iterator.hasNext()) { + while (iterator.hasNext()) { stringBuilder.append(iterator.next()); if (iterator.hasNext()) { stringBuilder.append(","); } } - stringBuilder.append("],"); - stringBuilder.append("\"validator\":\"" + StringUtils.escapeInJ(getValidator()) + "\","); - stringBuilder.append("\"dataType\":\"" + StringUtils.escapeInJ(getDataType()) + "\"}"); + stringBuilder.append("],"); + stringBuilder.append("\"validator\":\"" + + StringUtils.escapeInJ(getValidator()) + "\","); + stringBuilder.append("\"dataType\":\"" + + StringUtils.escapeInJ(getDataType()) + "\"}"); return stringBuilder.toString(); } diff --git a/src/com/taobao/rigel/rap/project/dao/impl/ProjectDaoImpl.java b/src/com/taobao/rigel/rap/project/dao/impl/ProjectDaoImpl.java index da1f485..2b169bf 100644 --- a/src/com/taobao/rigel/rap/project/dao/impl/ProjectDaoImpl.java +++ b/src/com/taobao/rigel/rap/project/dao/impl/ProjectDaoImpl.java @@ -76,7 +76,7 @@ public Project getProject(int id) { Project p = null; try { Session session = getSession(); - p = (Project) session.load(Project.class, id); + p = (Project) session.get(Project.class, id); } catch (Exception ex) { ex.printStackTrace(); } diff --git a/src/com/taobao/rigel/rap/workspace/web/action/WorkspaceAction.java b/src/com/taobao/rigel/rap/workspace/web/action/WorkspaceAction.java index 5f02aee..4374b60 100644 --- a/src/com/taobao/rigel/rap/workspace/web/action/WorkspaceAction.java +++ b/src/com/taobao/rigel/rap/workspace/web/action/WorkspaceAction.java @@ -224,6 +224,7 @@ public String myWorkspace() { Workspace workspace = new Workspace(); workspace.setProject(projectMgr.getProject(getProjectId())); setWorkspaceJsonString(workspace.toString()); + setWorkspace(workspace); return SUCCESS; }