49
  security:
50
    enabled: false
51
security:
52
  user:
53
    name: ipu
54
    password: ipu

+ 41 - 0
qb-auth-server/src/main/resources/test/ipu-mybatis-config.xml

@ -0,0 +1,41 @@
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE configuration
3
    PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
4
    "http://mybatis.org/dtd/mybatis-3-config.dtd">
5
6
<configuration>
7
    <settings>
8
		<setting name="defaultFetchSize" value="1000" /> <!-- 结果集获取数量提示值,分批传输 -->
9
		<!-- 当没有为参数提供特定的 JDBC 类型时,为空值指定 JDBC 类型。 某些驱动需要指定列的 JDBC 类型,多数情况直接用一般类型即可,比如 NULL、VARCHAR 或 OTHER。mybatis缺省为OTHER -->
10
		<setting name="jdbcTypeForNull" value="NULL" />
11
	</settings>
12
    <plugins>
13
        <!-- 分页插件,可根据参数定制化 -->
14
	    <plugin interceptor="com.github.pagehelper.PageInterceptor">
15
	        <!-- config params as the following -->
16
		</plugin>
17
	</plugins>
18
	<environments default="test">
19
		<environment id="test">
20
			<transactionManager type="JDBC" />
21
			<dataSource type="com.ai.ipu.database.datasource.C3P0DataSourceFactory">
22
				<property name="driverClass" value="com.mysql.jdbc.Driver" />
23
				<property name="jdbcUrl" value="jdbc:mysql://121.42.183.206:3307/test" />
24
				<property name="user" value="ipu" />
25
				<property name="password" value="ipumysql" />
26
				<!-- 连接池用完时,等待获取新连接的时间 (毫秒) -->
27
				<property name="checkoutTimeout" value="5000" />
28
				<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
29
				<property name="acquireRetryAttempts" value="5" />
30
				<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
31
				<property name="acquireRetryDelay" value="1000" />
32
				<property name="initialPoolSize" value="3" />
33
				<property name="minPoolSize" value="3" />
34
				<property name="maxPoolSize" value="3" />
35
				<property name="maxIdleTime" value="600" />
36
				<property name="idleConnectionTestPeriod" value="60" />
37
				<property name="preferredTestQuery" value="SELECT 1" />
38
			</dataSource>
39
		</environment>
40
	</environments>
41
</configuration>

+ 14 - 0
qb-auth-server/src/main/resources/test/log4j2.xml

@ -0,0 +1,14 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<Configuration status="WARN">
3
    <Appenders>
4
        <Console name="Console" target="SYSTEM_OUT">
5
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
6
        </Console>
7
    </Appenders>
8
    <Loggers>
9
        <Root level="ERROR">
10
            <AppenderRef ref="Console"/>
11
        </Root>
12
        <logger name="com.ai" level="DEBUG"></logger>
13
    </Loggers>
14
</Configuration>

+ 91 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/MenuTest.java

@ -0,0 +1,91 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
15
/**
16
 * <p>desc: 菜单对象逻辑的测试 </p>
17
 * <p>date: 2022/3/18 22:10 </p>
18
 *
19
 * @author nuosi fsofs@163.com
20
 * @version v1.0.0
21
 */
22
public class MenuTest {
23
24
    @Test
25
    public void testInsertMenu(){
26
        JMap result = null;
27
        try {
28
            JMap param = new JsonMap();
29
            param.put("menu", new JSONObject(createMenu()));
30
            result = LogicFlowEngine.execute("menu_insert", param, false);
31
            System.out.println("执行结果:" + result);
32
            Assert.assertEquals("新增菜单信息失败!", result.getInt("insert_num"), 1);
33
        } catch (Exception e) {
34
            System.out.println("错误信息:" + e.getMessage());
35
            Assert.assertTrue(false);
36
        }
37
    }
38
39
    @Test
40
    public void testDeleteMenu(){
41
        JMap result = null;
42
        try {
43
            JMap param = new JsonMap();
44
            param.put("menu_id", 4);
45
            result = LogicFlowEngine.execute("menu_delete", param, false);
46
            System.out.println("执行结果:" + result);
47
            Assert.assertEquals("删除菜单信息失败!", result.getInt("delete_num"), 1);
48
        } catch (Exception e) {
49
            System.out.println("错误信息:" + e.getMessage());
50
            Assert.assertTrue(false);
51
        }
52
    }
53
54
    @Before
55
    public void before() throws IOException {
56
        String[] models = {
57
                "flow/menu/model/sec_menu.xml",
58
                "flow/menu/model/sec_priv_entity.xml"
59
        };
60
        LogicFlowUtil.loadLogicModels(models);
61
62
        String[] flows = {
63
                "flow/menu/menu_insert.xml",
64
                "flow/menu/menu_delete.xml"
65
        };
66
67
        LogicFlowUtil.loadLogicFlows(flows);
68
    }
69
70
    private JMap createMenu() throws Exception {
71
        String menu_id = String.valueOf(System.currentTimeMillis()).substring(7);
72
        JMap menuParam = new JsonMap();
73
        menuParam.put("menu_id", menu_id);
74
        menuParam.put("parent_menu_id", "1");
75
        menuParam.put("menu_type", "2");
76
        menuParam.put("menu_name", "系统管理");
77
        menuParam.put("menu_title", "1");
78
        menuParam.put("level", "1");
79
        menuParam.put("menu_sort", "1");
80
        menuParam.put("menu_component", "md-home");
81
        menuParam.put("menu_icon", "/sys");
82
        menuParam.put("link_url", null);
83
        menuParam.put("iframe_flag", "0");
84
        menuParam.put("hidden_flag", "1");
85
        menuParam.put("data_status", "1");
86
        menuParam.put("create_date", new InitialMethod().getDatetime());
87
        menuParam.put("done_date", new InitialMethod().getDatetime());
88
        menuParam.put("op_id", "1");
89
        return menuParam;
90
    }
91
}

+ 93 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/OrganizeTest.java

@ -0,0 +1,93 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
15
/**
16
 * <p>desc: 组织对象逻辑的测试 </p>
17
 * <p>date: 2022/3/13 10:53 </p>
18
 *
19
 * @author nuosi fsofs@163.com
20
 * @version v1.0.0
21
 */
22
public class OrganizeTest {
23
24
    @Test
25
    public void testInsertOrganize(){
26
        JMap result = null;
27
        try {
28
            JMap param = new JsonMap();
29
            param.put("organize", new JSONObject(createOrganize()));
30
            result = LogicFlowEngine.execute("organize_insert", param);
31
            System.out.println("执行结果:" + result);
32
            Assert.assertEquals("新增组织信息失败!", result.getInt("insert_num"), 1);
33
        } catch (Exception e) {
34
            System.out.println("错误信息:" + e.getMessage());
35
            Assert.assertTrue(false);
36
        }
37
    }
38
39
    @Test
40
    public void testSelectOrganize() {
41
        JMap param = new JsonMap();
42
        JSONObject organize = new JSONObject();
43
        organize.put("organize_id", "33");
44
        param.put("organize", organize);
45
        try{
46
            JMap result = LogicFlowEngine.execute("organize_select", param);
47
            System.out.println("执行结果:" + result);
48
            Assert.assertTrue(true);
49
        }catch (Exception e){
50
            e.printStackTrace();
51
            System.out.println("错误信息:" + e.getMessage());
52
            Assert.assertTrue(false);
53
        }
54
    }
55
56
    @Before
57
    public void before() throws IOException {
58
        String[] models = {
59
                "flow/org/model/sec_organize.xml"
60
        };
61
        LogicFlowUtil.loadLogicModels(models);
62
63
        String[] flows = {
64
                "flow/org/organize_insert.xml",
65
                "flow/org/organize_select.xml"
66
        };
67
68
        LogicFlowUtil.loadLogicFlows(flows);
69
    }
70
71
    private JMap createOrganize() throws Exception {
72
        String organize_id = String.valueOf(System.currentTimeMillis()).substring(7);
73
        JMap userParam = new JsonMap();
74
        userParam.put("organize_id", organize_id);
75
        userParam.put("organize_type", "0");
76
        userParam.put("organize_name", "亚信科技有限责任公司");
77
        userParam.put("parent_organize_id", "0");
78
        userParam.put("short_name", "亚信科技");
79
        userParam.put("english_name", "asiainfo");
80
        userParam.put("dept_full_id", "1");
81
        userParam.put("dept_full_name", "亚信科技");
82
        userParam.put("level", 1);
83
        userParam.put("dept_leader", 1);
84
        userParam.put("org_level", "1");
85
        userParam.put("remark", "NULL");
86
        userParam.put("data_status", "1");
87
        userParam.put("create_date", "2022-1-10 16:09:12");
88
        userParam.put("create_op_id", "1");
89
        userParam.put("done_date", new InitialMethod().getDatetime());
90
        userParam.put("op_id", new InitialMethod().getDatetime());
91
        return userParam;
92
    }
93
}

+ 67 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/PrivEntityTest.java

@ -0,0 +1,67 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
15
/**
16
 * <p>desc: 角色关联菜单对象逻辑的测试 </p>
17
 * <p>date: 2022/3/18 23:19 </p>
18
 *
19
 * @author nuosi fsofs@163.com
20
 * @version v1.0.0
21
 */
22
public class PrivEntityTest {
23
24
    @Test
25
    public void testInsertPrivEntity(){
26
        JMap result = null;
27
        try {
28
            JMap param = new JsonMap();
29
            param.put("priv_entity", new JSONObject(createPrivEntity()));
30
            result = LogicFlowEngine.execute("priv_entity_insert", param);
31
            System.out.println("执行结果:" + result);
32
            Assert.assertEquals("新增角色关联菜单信息失败!", result.getInt("insert_num"), 1);
33
        } catch (Exception e) {
34
            System.out.println("错误信息:" + e.getMessage());
35
            Assert.assertTrue(false);
36
        }
37
    }
38
39
    @Before
40
    public void before() throws IOException {
41
        String[] models = {
42
                "flow/menu/model/sec_priv_entity.xml"
43
        };
44
        LogicFlowUtil.loadLogicModels(models);
45
46
        String[] flows = {
47
                "flow/menu/priv_entity_insert.xml",
48
        };
49
50
        LogicFlowUtil.loadLogicFlows(flows);
51
    }
52
53
    private JMap createPrivEntity() throws Exception {
54
        String priv_ent_id = String.valueOf(System.currentTimeMillis()).substring(7);
55
        JMap param = new JsonMap();
56
        param.put("priv_ent_id", priv_ent_id);
57
        param.put("priv_ent_name", "角色关联菜单范例");
58
        param.put("busi_obj_id", "4");
59
        param.put("busi_obj_type", "1");
60
        param.put("data_status", "1");
61
        param.put("create_date", new InitialMethod().getDatetime());
62
        param.put("create_op_id", "1");
63
        param.put("done_date", new InitialMethod().getDatetime());
64
        param.put("op_id", "1");
65
        return param;
66
    }
67
}

+ 66 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/RoleGrantTest.java

@ -0,0 +1,66 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
15
/**
16
 * <p>desc: 角色授权对象逻辑的测试 </p>
17
 * <p>date: 2022/3/18 23:03 </p>
18
 *
19
 * @author nuosi fsofs@163.com
20
 * @version v1.0.0
21
 */
22
public class RoleGrantTest {
23
24
    @Test
25
    public void testInsertRoleGrant(){
26
        JMap result = null;
27
        try {
28
            JMap param = new JsonMap();
29
            param.put("role_grant", new JSONObject(createRoleGrant()));
30
            result = LogicFlowEngine.execute("role_grant_insert", param);
31
            System.out.println("执行结果:" + result);
32
            Assert.assertEquals("新增角色授权信息失败!", result.getInt("insert_num"), 1);
33
        } catch (Exception e) {
34
            System.out.println("错误信息:" + e.getMessage());
35
            Assert.assertTrue(false);
36
        }
37
    }
38
39
    @Before
40
    public void before() throws IOException {
41
        String[] models = {
42
                "flow/role/model/sec_role_grant.xml"
43
        };
44
        LogicFlowUtil.loadLogicModels(models);
45
46
        String[] flows = {
47
                "flow/role/role_grant_insert.xml",
48
        };
49
50
        LogicFlowUtil.loadLogicFlows(flows);
51
    }
52
53
    private JMap createRoleGrant() throws Exception {
54
        String role_grant_id = String.valueOf(System.currentTimeMillis()).substring(7);
55
        JMap menuParam = new JsonMap();
56
        menuParam.put("role_grant_id", role_grant_id);
57
        menuParam.put("role_id", "1");
58
        menuParam.put("priv_ent_id", "2");
59
        menuParam.put("valid_date", new InitialMethod().getDatetime());
60
        menuParam.put("data_status", "1");
61
        menuParam.put("create_date", new InitialMethod().getDatetime());
62
        menuParam.put("done_date", new InitialMethod().getDatetime());
63
        menuParam.put("op_id", "1");
64
        return menuParam;
65
    }
66
}

+ 219 - 0
qb-auth-server/src/test/java/com/ipu/logicflow/server/UserTest.java

@ -0,0 +1,219 @@
1
package com.ipu.logicflow.server;
2
3
import com.ai.ipu.data.JMap;
4
import com.ai.ipu.data.impl.JsonMap;
5
import com.alibaba.fastjson.JSONObject;
6
import com.nuosi.flow.logic.LogicFlowEngine;
7
import com.nuosi.flow.logic.inject.initial.InitialMethod;
8
import com.nuosi.flow.util.LogicFlowUtil;
9
import org.junit.Assert;
10
import org.junit.Before;
11
import org.junit.Test;
12
13
import java.io.IOException;
14
import java.util.List;
15
16
/**
17
 * <p>desc: 用户对象逻辑的测试 </p>
18
 * <p>date: 2022/1/18 19:43 </p>
19
 *
20
 * @author nuosi fsofs@163.com
21
 * @version v1.0.0
22
 */
23
public class UserTest {
24
25
    @Test
26
    public void testInsertUser(){
27
        JMap result = null;
28
        try {
29
            JMap param = new JsonMap();
30
            param.put("user", new JSONObject(createUser()));
31
            result = LogicFlowEngine.execute("user_insert", param);
32
            System.out.println("执行结果:" + result);
33
            Assert.assertEquals("新增用户信息失败!", result.getInt("insert_num"), 1);
34
        } catch (Exception e) {
35
            System.out.println("错误信息:" + e.getMessage());
36
            Assert.assertTrue(false);
37
        }
38
    }
39
40
    @Test
41
    public void testSelectUser() {
42
        JMap param = new JsonMap();
43
        JSONObject user = new JSONObject();
44
        user.put("user_id", "331843");
45
        param.put("user", user);
46
        try{
47
            JMap result = LogicFlowEngine.execute("user_select", param);
48
            System.out.println("执行结果:" + result);
49
            Assert.assertTrue(true);
50
        }catch (Exception e){
51
            e.printStackTrace();
52
            System.out.println("错误信息:" + e.getMessage());
53
            Assert.assertTrue(false);
54
        }
55
    }
56
57
    @Test
58
    public void testSelectUserById() {
59
        JMap param = new JsonMap();
60
        param.put("user_id", "331843");
61
        try{
62
            JMap result = LogicFlowEngine.execute("user_select_by_id", param);
63
            System.out.println("执行结果:" + result);
64
            Assert.assertTrue(true);
65
        }catch (Exception e){
66
            System.out.println("错误信息:" + e.getMessage());
67
            Assert.assertTrue(false);
68
        }
69
    }
70
71
    @Test
72
    public void testSelectUserByName() throws Exception {
73
        JMap param = new JsonMap();
74
        param.put("nick_name", "嘉信立恒");
75
76
        try{
77
            JMap result = LogicFlowEngine.execute("user_select_by_name", param);
78
            System.out.println("执行结果:" + result);
79
            Assert.assertTrue("查询用户列表失败!", ((List)result.get("user_list")).size()>=1);
80
        }catch (Exception e){
81
            System.out.println("错误信息:" + e.getMessage());
82
            Assert.assertTrue(false);
83
        }
84
    }
85
86
    @Test
87
    public void testDisableUser(){
88
        String user_id = "331843";
89
        JSONObject user_cond = new JSONObject();
90
        user_cond.put("user_id", user_id);
91
92
        JSONObject user = new JSONObject();
93
        user.put("enabled_flag", "0");
94
        user.put("done_date", new InitialMethod().getDatetime());
95
        user.put("op_id", "1");
96
97
        JMap param = new JsonMap();
98
        param.put("user_cond", user_cond);
99
        param.put("user", user);
100
        try{
101
            JMap result = LogicFlowEngine.execute("user_update", param);
102
            System.out.println("执行结果:" + result);
103
            Assert.assertTrue(true);
104
105
            // 还原数据
106
            user.put("enabled_flag", "1");
107
            user.put("op_id", user_id);
108
            param.put("user", user);
109
            LogicFlowEngine.execute("user_update", param);
110
        }catch (Exception e){
111
            e.printStackTrace();
112
            System.out.println("错误信息:" + e.getMessage());
113
            Assert.assertTrue(false);
114
        }
115
    }
116
117
    @Test
118
    public void testDisableUserWithAggregate(){
119
        String user_id = "331843";
120
        JMap param = new JsonMap();
121
        param.put("user_id", user_id);
122
        try{
123
            JMap result = LogicFlowEngine.execute("user_disable_with_aggregate", param);
124
            System.out.println("执行结果:" + result);
125
            Assert.assertTrue(true);
126
127
            // 还原数据
128
            JSONObject user = new JSONObject();
129
            user.put("enabled_flag", "1");
130
            user.put("op_id", user_id);
131
            param.put("user", user);
132
133
            JSONObject user_cond = new JSONObject();
134
            user_cond.put("user_id", user_id);
135
            param.put("user_cond", user_cond);
136
137
            LogicFlowEngine.execute("user_update", param);
138
        }catch (Exception e){
139
            e.printStackTrace();
140
            System.out.println("错误信息:" + e.getMessage());
141
            Assert.assertTrue(false);
142
        }
143
    }
144
145
    @Test
146
    public void testEnableUser(){
147
        String user_id = "331843";
148
        JSONObject user_cond = new JSONObject();
149
        user_cond.put("user_id", user_id);
150
151
        JSONObject user = new JSONObject();
152
        user.put("enabled_flag", "1");
153
        user.put("done_date", new InitialMethod().getDatetime());
154
        user.put("op_id", "1");
155
156
        JMap param = new JsonMap();
157
        param.put("user_cond", user_cond);
158
        param.put("user", user);
159
        try{
160
            JMap result = LogicFlowEngine.execute("user_update", param);
161
            System.out.println("执行结果:" + result);
162
            Assert.assertTrue(true);
163
164
            // 还原数据
165
            user.put("enabled_flag", "0");
166
            user.put("op_id", user_id);
167
            param.put("user", user);
168
            LogicFlowEngine.execute("user_update", param);
169
        }catch (Exception e){
170
            e.printStackTrace();
171
            System.out.println("错误信息:" + e.getMessage());
172
            Assert.assertTrue(false);
173
        }
174
    }
175
176
    @Before
177
    public void before() throws IOException {
178
        String[] models = {
179
                "flow/user/model/sec_user.xml"
180
        };
181
        LogicFlowUtil.loadLogicModels(models);
182
183
        String[] flows = {
184
                "flow/user/user_insert.xml",
185
                "flow/user/user_select.xml",
186
                "flow/user/user_select_by_id.xml",
187
                "flow/user/user_select_by_name.xml",
188
                "flow/user/user_update.xml",
189
                "flow/user/user_disable_with_aggregate.xml"
190
        };
191
192
        LogicFlowUtil.loadLogicFlows(flows);
193
    }
194
195
    private JMap createUser() throws Exception {
196
        String user_id = String.valueOf(System.currentTimeMillis()).substring(7);
197
        JMap userParam = new JsonMap();
198
        userParam.put("user_id", user_id);
199
        userParam.put("nick_name", "嘉信立恒管理员");
200
        userParam.put("user_account", "superadmin");
201
        userParam.put("gender", "1");
202
        userParam.put("avatar_name", "head.png");
203
        userParam.put("email", "zhangsan@163.com");
204
        userParam.put("link_phone", "13788888888");
205
        userParam.put("password", "qwerasdf");
206
        userParam.put("admin_flag", 0);
207
        userParam.put("sec_level", "4");
208
        userParam.put("enabled_flag", "1");
209
        userParam.put("pwd_reset_time", 0);
210
        userParam.put("valid_date", "2022-1-10 15:22:27");
211
        userParam.put("expire_date", "2099-12-31 15:22:32");
212
        userParam.put("data_status", "1");
213
        userParam.put("create_date", new InitialMethod().getDatetime());
214
        userParam.put("done_date", new InitialMethod().getDatetime());
215
        userParam.put("create_op_id", user_id);
216
        userParam.put("op_id", user_id);
217
        return userParam;
218
    }
219
}

【提交内容】:更新jar · e660738bec - Nuosi Git Service
瀏覽代碼

【提交内容】:更新jar

wangyj18 9 年之前
父節點
當前提交
e660738bec
共有 3 個文件被更改,包括 0 次插入0 次删除
  1. 二進制
      wade-mobile-common/libs/wade-mobile-func.jar
  2. 二進制
      wade-mobile-common/libs/wade-mobile.jar
  3. 二進制
      wade-mobile-library/common/wade-mobile-server.jar

二進制
wade-mobile-common/libs/wade-mobile-func.jar


二進制
wade-mobile-common/libs/wade-mobile.jar


二進制
wade-mobile-library/common/wade-mobile-server.jar