Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from opendx/0.7.5
Browse files Browse the repository at this point in the history
0.7.5
  • Loading branch information
jiangyitao authored Jul 26, 2020
2 parents c9e4756 + b3dea8d commit 4730583
Show file tree
Hide file tree
Showing 20 changed files with 200 additions and 73 deletions.
3 changes: 3 additions & 0 deletions db/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ INSERT INTO `role`(`id`, `name`, `alias`) VALUES (10, 'testcase', '测试用例
INSERT INTO `role`(`id`, `name`, `alias`) VALUES (11, 'testPlan', '测试计划管理员');
INSERT INTO `role`(`id`, `name`, `alias`) VALUES (12, 'testTask', '测试任务管理员');
INSERT INTO `role`(`id`, `name`, `alias`) VALUES (13, 'testSuite', '测试集管理员');

INSERT INTO `category`(`id`, `name`, `type`, `create_time`, `creator_uid`) VALUES (10000, '废弃', 5, '2020-07-23 18:21:00', 1);

4 changes: 2 additions & 2 deletions db/table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE `action` (
`description` varchar(255) DEFAULT NULL COMMENT '描述',
`type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '类型:1.基础action(代码形式的) 2.用户在网页前端封装的action 3.测试用例',
`invoke` varchar(255) DEFAULT NULL COMMENT '基础action专用:调用',
`return_value` varchar(255) NOT NULL COMMENT '返回值: void / 其他',
`return_value_type` varchar(255) NOT NULL COMMENT '返回值类型: void / 其他',
`return_value_desc` varchar(255) DEFAULT NULL COMMENT '返回值描述',
`params` json DEFAULT NULL COMMENT '方法参数',
`local_vars` json DEFAULT NULL COMMENT '局部变量',
Expand All @@ -35,7 +35,7 @@ CREATE TABLE `action` (
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`updator_uid` int(11) DEFAULT NULL COMMENT '更新人id',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`platforms` json DEFAULT NULL COMMENT '1.android 2.ios 3.pc web null.通用',
`platforms` json DEFAULT NULL COMMENT '1.android 2.ios 3.pc web empty.通用',
`page_id` int(11) DEFAULT NULL COMMENT '所属的page id',
`category_id` int(11) DEFAULT NULL COMMENT '所属的分类id',
`project_id` int(11) DEFAULT NULL COMMENT '所属的项目id',
Expand Down
6 changes: 6 additions & 0 deletions db/update.sql
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ ADD COLUMN `parent_id` int(11) NOT NULL DEFAULT 0 COMMENT '父id' AFTER `id`;

ALTER TABLE `category`
MODIFY COLUMN `project_id` int(11) NULL COMMENT '所属项目的id' AFTER `type`;

-- 0.7.5
ALTER TABLE `action`
CHANGE COLUMN `return_value` `return_value_type` varchar(255) NOT NULL COMMENT '返回值类型: void / 其他' AFTER `invoke`;

INSERT INTO `category`(`id`, `name`, `type`, `create_time`, `creator_uid`) VALUES (10000, '废弃', 5, '2020-07-23 17:11:00', 1);
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.daxiang</groupId>
<artifactId>server</artifactId>
<version>0.7.2</version>
<version>0.7.5</version>
<packaging>jar</packaging>

<properties>
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/daxiang/controller/ActionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


/**
Expand All @@ -29,6 +30,11 @@ public Response add(@RequestBody @Validated({SaveActionGroup.class}) Action acti
return actionService.add(action);
}

@PostMapping("/resetBasicAction")
public Response resetBasicAction(@RequestBody List<Action> actions) {
return actionService.resetBasicAction(actions);
}

@DeleteMapping("/{actionId}")
public Response delete(@PathVariable Integer actionId) {
return actionService.delete(actionId);
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/daxiang/controller/ApplicationController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.daxiang.controller;

import com.daxiang.model.Response;
import com.google.common.collect.ImmutableMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* Created by jiangyitao.
*/
@RestController
@RequestMapping("/application")
public class ApplicationController {

@Value("${version}")
private String version;

@GetMapping("/version")
public Response version() {
return Response.success(ImmutableMap.of("version", version));
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/daxiang/dao/ActionDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ public interface ActionDao {
List<Action> selectByLocalVarsEnvironmentId(@Param("envId") Integer envId);

List<Action> selectPublishedCascaderData(@Param("projectId") Integer projectId, @Param("platform") Integer platform, @Param("type") Integer type);

int insertBasicActions(@Param("actions") List<Action> actions);
}
6 changes: 6 additions & 0 deletions src/main/java/com/daxiang/init/StartupRunner.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.daxiang.init;

import com.daxiang.model.UploadFile;
import com.daxiang.service.DataMigrationService;
import com.daxiang.service.TestPlanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -20,6 +21,8 @@ public class StartupRunner implements ApplicationRunner {

@Autowired
private TestPlanService testPlanService;
@Autowired
private DataMigrationService dataMigrationService;

@Value("${static-location}/")
private String staticLocation;
Expand Down Expand Up @@ -64,5 +67,8 @@ public void run(ApplicationArguments args) {

// 启动server时,按cron表达式执行所有开启的定时任务
testPlanService.scheduleEnabledTasks();

// v0.7.5 数据迁移 todo 后续删除
dataMigrationService.actionStepParamValuesToArgs();
}
}
28 changes: 9 additions & 19 deletions src/main/java/com/daxiang/mbg/po/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ public class Action implements Serializable {
* 测试用例action
*/
public static final int TYPE_TESTCASE = 3;
/**
* 有返回值
*/
public static final int HAS_RETURN_VALUE = 1;
/**
* 无返回值
*/
public static final int NO_RETURN_VALUE = 0;

/**
* 主键id
Expand Down Expand Up @@ -85,12 +77,12 @@ public class Action implements Serializable {
private String invoke;

/**
* 返回值: void / 其他
* 返回值类型: void / 其他
*
* @mbg.generated
*/
@NotBlank(message = "返回值类型不能为空")
private String returnValue;
private String returnValueType;

/**
* 返回值描述
Expand Down Expand Up @@ -146,7 +138,6 @@ public class Action implements Serializable {
*
* @mbg.generated
*/
@NotNull(message = "项目id不能为空")
private Integer projectId;

/**
Expand Down Expand Up @@ -209,11 +200,10 @@ public void setImportActions(List<Action> importActions) {
}

/**
* 1.android 2.ios 3.android微信web 4.android微信小程序 null.通用
* 1.android 2.ios 3.pc web empty.通用
*
* @mbg.generated
*/
@NotEmpty(message = "platforms不能为空")
private java.util.List<Integer> platforms;

/**
Expand Down Expand Up @@ -265,12 +255,12 @@ public void setInvoke(String invoke) {
this.invoke = invoke;
}

public String getReturnValue() {
return returnValue;
public String getReturnValueType() {
return returnValueType;
}

public void setReturnValue(String returnValue) {
this.returnValue = returnValue;
public void setReturnValueType(String returnValueType) {
this.returnValueType = returnValueType;
}

public String getReturnValueDesc() {
Expand Down Expand Up @@ -412,7 +402,7 @@ public String toString() {
sb.append(", description=").append(description);
sb.append(", type=").append(type);
sb.append(", invoke=").append(invoke);
sb.append(", returnValue=").append(returnValue);
sb.append(", returnValueType=").append(returnValueType);
sb.append(", returnValueDesc=").append(returnValueDesc);
sb.append(", creatorUid=").append(creatorUid);
sb.append(", createTime=").append(createTime);
Expand All @@ -433,4 +423,4 @@ public String toString() {
sb.append("]");
return sb.toString();
}
}
}
56 changes: 28 additions & 28 deletions src/main/java/com/daxiang/mbg/po/ActionExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,73 +435,73 @@ public Criteria andInvokeNotBetween(String value1, String value2) {
return (Criteria) this;
}

public Criteria andReturnValueIsNull() {
addCriterion("return_value is null");
public Criteria andReturnValueTypeIsNull() {
addCriterion("return_value_type is null");
return (Criteria) this;
}

public Criteria andReturnValueIsNotNull() {
addCriterion("return_value is not null");
public Criteria andReturnValueTypeIsNotNull() {
addCriterion("return_value_type is not null");
return (Criteria) this;
}

public Criteria andReturnValueEqualTo(String value) {
addCriterion("return_value =", value, "returnValue");
public Criteria andReturnValueTypeEqualTo(String value) {
addCriterion("return_value_type =", value, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueNotEqualTo(String value) {
addCriterion("return_value <>", value, "returnValue");
public Criteria andReturnValueTypeNotEqualTo(String value) {
addCriterion("return_value_type <>", value, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueGreaterThan(String value) {
addCriterion("return_value >", value, "returnValue");
public Criteria andReturnValueTypeGreaterThan(String value) {
addCriterion("return_value_type >", value, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueGreaterThanOrEqualTo(String value) {
addCriterion("return_value >=", value, "returnValue");
public Criteria andReturnValueTypeGreaterThanOrEqualTo(String value) {
addCriterion("return_value_type >=", value, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueLessThan(String value) {
addCriterion("return_value <", value, "returnValue");
public Criteria andReturnValueTypeLessThan(String value) {
addCriterion("return_value_type <", value, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueLessThanOrEqualTo(String value) {
addCriterion("return_value <=", value, "returnValue");
public Criteria andReturnValueTypeLessThanOrEqualTo(String value) {
addCriterion("return_value_type <=", value, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueLike(String value) {
addCriterion("return_value like", value, "returnValue");
public Criteria andReturnValueTypeLike(String value) {
addCriterion("return_value_type like", value, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueNotLike(String value) {
addCriterion("return_value not like", value, "returnValue");
public Criteria andReturnValueTypeNotLike(String value) {
addCriterion("return_value_type not like", value, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueIn(List<String> values) {
addCriterion("return_value in", values, "returnValue");
public Criteria andReturnValueTypeIn(List<String> values) {
addCriterion("return_value_type in", values, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueNotIn(List<String> values) {
addCriterion("return_value not in", values, "returnValue");
public Criteria andReturnValueTypeNotIn(List<String> values) {
addCriterion("return_value_type not in", values, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueBetween(String value1, String value2) {
addCriterion("return_value between", value1, value2, "returnValue");
public Criteria andReturnValueTypeBetween(String value1, String value2) {
addCriterion("return_value_type between", value1, value2, "returnValueType");
return (Criteria) this;
}

public Criteria andReturnValueNotBetween(String value1, String value2) {
addCriterion("return_value not between", value1, value2, "returnValue");
public Criteria andReturnValueTypeNotBetween(String value1, String value2) {
addCriterion("return_value_type not between", value1, value2, "returnValueType");
return (Criteria) this;
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/daxiang/model/action/ParamValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Created by jiangyitao.
* 步骤传入的参数值
*/
@Deprecated
// todo 后续删除
@Data
public class ParamValue {
/**
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/daxiang/model/action/Step.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.daxiang.model.action;

import com.alibaba.fastjson.annotation.JSONField;
import com.daxiang.mbg.po.Action;
import com.daxiang.validator.group.SaveActionGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
Expand Down Expand Up @@ -54,6 +56,11 @@ public class Step {
/**
* 调用action传入的值
*/
private List<String> args;
@Deprecated
// todo 后续删除
@JsonIgnore
@JSONField(serialize = false)
private List<ParamValue> paramValues;

@NotNull(message = "步骤status不能为空")
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/daxiang/model/vo/AgentVo.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@Data
public class AgentVo {
private String instanceId;
private String version;
private String ip;
private Integer port;
private String osName;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/daxiang/security/WebSecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ protected void configure(HttpSecurity http) throws Exception {
.antMatchers("/user/login").permitAll()
// 以下为agent调用的接口,放行
.antMatchers("/springboot-admin/**").permitAll()
.antMatchers("/action/resetBasicAction").permitAll()
.antMatchers("/upload/file").permitAll()
.antMatchers("/project/list").permitAll()
.antMatchers("/mobile/list").permitAll()
Expand Down
Loading

0 comments on commit 4730583

Please sign in to comment.