Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
bb376da4
F
Flowable Engine
项目概览
开发团队
/
Flowable Engine
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flowable Engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bb376da4
编写于
12月 18, 2015
作者:
J
Joram Barrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Porting
https://github.com/Activiti/Activiti/commit/850cce3c2ebb75820188e6b7b3676b5a120a1484
to v6
上级
dca72869
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
85 addition
and
49 deletion
+85
-49
modules/activiti-json-converter/src/test/java/org/activiti/editor/language/FormPropertiesConverterTest.java
...activiti/editor/language/FormPropertiesConverterTest.java
+67
-30
modules/activiti-json-converter/src/test/resources/test.formpropertiesmodel.json
...onverter/src/test/resources/test.formpropertiesmodel.json
+18
-19
未找到文件。
modules/activiti-json-converter/src/test/java/org/activiti/editor/language/FormPropertiesConverterTest.java
浏览文件 @
bb376da4
...
...
@@ -3,6 +3,7 @@ package org.activiti.editor.language;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -24,22 +25,22 @@ public class FormPropertiesConverterTest extends AbstractConverterTest {
BpmnModel
bpmnModel
=
readJsonFile
();
validateModel
(
bpmnModel
);
}
@Test
@Test
public
void
doubleConversionValidation
()
throws
Exception
{
BpmnModel
bpmnModel
=
readJsonFile
();
validateModel
(
bpmnModel
);
bpmnModel
=
convertToJsonAndBack
(
bpmnModel
);
validateModel
(
bpmnModel
);
}
protected
String
getResource
()
{
return
"test.formpropertiesmodel.json"
;
}
private
void
validateModel
(
BpmnModel
model
)
{
assertEquals
(
"
p
rocess"
,
model
.
getMainProcess
().
getId
());
assertEquals
(
"
formPropsProcess
"
,
model
.
getMainProcess
().
getName
());
assertEquals
(
"
formPropertiesP
rocess"
,
model
.
getMainProcess
().
getId
());
assertEquals
(
"
User registration
"
,
model
.
getMainProcess
().
getName
());
assertEquals
(
true
,
model
.
getMainProcess
().
isExecutable
());
FlowElement
startFlowElement
=
model
.
getMainProcess
().
getFlowElement
(
"startNode"
);
...
...
@@ -47,8 +48,41 @@ public class FormPropertiesConverterTest extends AbstractConverterTest {
assertTrue
(
startFlowElement
instanceof
StartEvent
);
StartEvent
startEvent
=
(
StartEvent
)
startFlowElement
;
for
(
FormProperty
formProperty
:
startEvent
.
getFormProperties
())
{
assertEquals
(
true
,
formProperty
.
isRequired
());
List
<
FormProperty
>
formProperties
=
startEvent
.
getFormProperties
();
assertNotNull
(
formProperties
);
assertEquals
(
"Invalid form properties list: "
,
8
,
formProperties
.
size
());
for
(
FormProperty
formProperty
:
formProperties
)
{
if
(
formProperty
.
getId
().
equals
(
"new_property_1"
))
{
checkFormProperty
(
formProperty
,
"v000"
,
true
,
false
,
false
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_2"
))
{
checkFormProperty
(
formProperty
,
"v001"
,
true
,
false
,
true
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_3"
))
{
checkFormProperty
(
formProperty
,
"v010"
,
true
,
true
,
false
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_4"
))
{
checkFormProperty
(
formProperty
,
"v011"
,
true
,
true
,
true
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_5"
))
{
checkFormProperty
(
formProperty
,
"v100"
,
true
,
false
,
false
);
List
<
Map
<
String
,
Object
>>
formValues
=
new
ArrayList
<
Map
<
String
,
Object
>>();
for
(
FormValue
formValue
:
formProperty
.
getFormValues
())
{
Map
<
String
,
Object
>
formValueMap
=
new
HashMap
<
String
,
Object
>();
formValueMap
.
put
(
"id"
,
formValue
.
getId
());
formValueMap
.
put
(
"name"
,
formValue
.
getName
());
formValues
.
add
(
formValueMap
);
}
checkFormPropertyFormValues
(
formValues
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_6"
))
{
checkFormProperty
(
formProperty
,
"v101"
,
true
,
false
,
true
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_7"
))
{
checkFormProperty
(
formProperty
,
"v110"
,
true
,
true
,
false
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_8"
))
{
checkFormProperty
(
formProperty
,
"v111"
,
true
,
true
,
true
);
}
else
{
fail
(
"unexpected form property id "
+
formProperty
.
getId
());
}
}
FlowElement
userFlowElement
=
model
.
getMainProcess
().
getFlowElement
(
"userTask"
);
...
...
@@ -56,22 +90,22 @@ public class FormPropertiesConverterTest extends AbstractConverterTest {
assertTrue
(
userFlowElement
instanceof
UserTask
);
UserTask
userTask
=
(
UserTask
)
userFlowElement
;
List
<
FormProperty
>
formProperties
=
userTask
.
getFormProperties
();
formProperties
=
userTask
.
getFormProperties
();
assertNotNull
(
formProperties
);
assertEquals
(
"Invalid form properties list: "
,
8
,
formProperties
.
size
());
for
(
FormProperty
formProperty
:
formProperties
)
{
if
(
formProperty
.
getId
().
equals
(
"new_property_1"
))
{
checkFormProperty
(
formProperty
,
false
,
false
,
false
);
checkFormProperty
(
formProperty
,
"v000"
,
false
,
false
,
false
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_2"
))
{
checkFormProperty
(
formProperty
,
false
,
false
,
true
);
checkFormProperty
(
formProperty
,
"v001"
,
false
,
false
,
true
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_3"
))
{
checkFormProperty
(
formProperty
,
false
,
true
,
false
);
checkFormProperty
(
formProperty
,
"v010"
,
false
,
true
,
false
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_4"
))
{
checkFormProperty
(
formProperty
,
false
,
true
,
true
);
checkFormProperty
(
formProperty
,
"v011"
,
false
,
true
,
true
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_5"
))
{
checkFormProperty
(
formProperty
,
true
,
false
,
false
);
checkFormProperty
(
formProperty
,
"v100"
,
true
,
false
,
false
);
List
<
Map
<
String
,
Object
>>
formValues
=
new
ArrayList
<
Map
<
String
,
Object
>>();
for
(
FormValue
formValue
:
formProperty
.
getFormValues
())
{
...
...
@@ -83,38 +117,41 @@ public class FormPropertiesConverterTest extends AbstractConverterTest {
checkFormPropertyFormValues
(
formValues
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_6"
))
{
checkFormProperty
(
formProperty
,
true
,
false
,
true
);
checkFormProperty
(
formProperty
,
"v101"
,
true
,
false
,
true
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_7"
))
{
checkFormProperty
(
formProperty
,
true
,
true
,
false
);
checkFormProperty
(
formProperty
,
"v110"
,
true
,
true
,
false
);
}
else
if
(
formProperty
.
getId
().
equals
(
"new_property_8"
))
{
checkFormProperty
(
formProperty
,
true
,
true
,
true
);
checkFormProperty
(
formProperty
,
"v111"
,
true
,
true
,
true
);
}
else
{
fail
(
"unexpected form property id "
+
formProperty
.
getId
());
}
}
}
private
void
checkFormProperty
(
FormProperty
formProperty
,
boolean
shouldBeRequired
,
boolean
shouldBeReadable
,
boolean
shouldBeWritable
)
{
private
void
checkFormProperty
(
FormProperty
formProperty
,
String
name
,
boolean
shouldBeRequired
,
boolean
shouldBeReadable
,
boolean
shouldBeWritable
)
{
assertEquals
(
name
,
formProperty
.
getName
());
assertEquals
(
shouldBeRequired
,
formProperty
.
isRequired
());
assertEquals
(
shouldBeReadable
,
formProperty
.
isReadable
());
assertEquals
(
shouldBeWritable
,
formProperty
.
isWriteable
());
}
private
void
checkFormPropertyFormValues
(
List
<
Map
<
String
,
Object
>>
formValues
)
{
List
<
Map
<
String
,
Object
>>
expectedFormValues
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
expectedFormValues
=
new
ArrayList
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
formValue1
=
new
HashMap
<
String
,
Object
>();
formValue1
.
put
(
"id"
,
"value
1"
);
formValue1
.
put
(
"name"
,
"
v
alue 1"
);
formValue1
.
put
(
"id"
,
"value1"
);
formValue1
.
put
(
"name"
,
"
V
alue 1"
);
Map
<
String
,
Object
>
formValue2
=
new
HashMap
<
String
,
Object
>();
formValue2
.
put
(
"id"
,
"value
2"
);
formValue2
.
put
(
"name"
,
"
v
alue 2"
);
formValue2
.
put
(
"id"
,
"value2"
);
formValue2
.
put
(
"name"
,
"
V
alue 2"
);
Map
<
String
,
Object
>
formValue3
=
new
HashMap
<
String
,
Object
>();
formValue3
.
put
(
"id"
,
"value
3"
);
formValue3
.
put
(
"name"
,
"
v
alue 3"
);
formValue3
.
put
(
"id"
,
"value3"
);
formValue3
.
put
(
"name"
,
"
V
alue 3"
);
Map
<
String
,
Object
>
formValue4
=
new
HashMap
<
String
,
Object
>();
formValue4
.
put
(
"id"
,
"value
4"
);
formValue4
.
put
(
"name"
,
"
v
alue 4"
);
formValue4
.
put
(
"id"
,
"value4"
);
formValue4
.
put
(
"name"
,
"
V
alue 4"
);
expectedFormValues
.
add
(
formValue1
);
expectedFormValues
.
add
(
formValue2
);
...
...
modules/activiti-json-converter/src/test/resources/test.formpropertiesmodel.json
浏览文件 @
bb376da4
{
"resourceId"
:
"1744"
,
"properties"
:
{
"process_id"
:
"
p
rocess"
,
"name"
:
"
formPropsProcess
"
,
"process_id"
:
"
formPropertiesP
rocess"
,
"name"
:
"
User registration
"
,
"documentation"
:
""
,
"process_author"
:
""
,
"process_version"
:
""
,
...
...
@@ -71,20 +71,20 @@
"required"
:
true
,
"enumValues"
:
[
{
"
value"
:
"value
1"
,
"
$$hashKey"
:
"0CU
"
"
id"
:
"value
1"
,
"
name"
:
"Value 1
"
},
{
"
value"
:
"value
2"
,
"
$$hashKey"
:
"0CV
"
"
id"
:
"value
2"
,
"
name"
:
"Value 2
"
},
{
"
value"
:
"value
3"
,
"
$$hashKey"
:
"0CZ
"
"
id"
:
"value
3"
,
"
name"
:
"Value 3
"
},
{
"
value"
:
"value
4"
,
"
$$hashKey"
:
"0D2
"
"
id"
:
"value
4"
,
"
name"
:
"Value 4
"
}
]
},
...
...
@@ -198,20 +198,20 @@
"writable"
:
false
,
"enumValues"
:
[
{
"
value"
:
"value
1"
,
"
$$hashKey"
:
"0CU
"
"
id"
:
"value
1"
,
"
name"
:
"Value 1
"
},
{
"
value"
:
"value
2"
,
"
$$hashKey"
:
"0CV
"
"
id"
:
"value
2"
,
"
name"
:
"Value 2
"
},
{
"
value"
:
"value
3"
,
"
$$hashKey"
:
"0CZ
"
"
id"
:
"value
3"
,
"
name"
:
"Value 3
"
},
{
"
value"
:
"value
4"
,
"
$$hashKey"
:
"0D2
"
"
id"
:
"value
4"
,
"
name"
:
"Value 4
"
}
],
"required"
:
true
...
...
@@ -393,4 +393,3 @@
},
"ssextensions"
:
[]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录