Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
李新华(Cherry Li)
autotest_wise
Commits
f354a5f3
Commit
f354a5f3
authored
2 years ago
by
苏丽贞(Rose Su)
Browse files
Options
Download
Email Patches
Plain Diff
Refactor EQPAccTest
parent
efee2dfd
main
1 merge request
!1
ADC Model Training Data Rule Configuration
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
src/main/java/com/futurefab/ai/services/util/HttpRequest.java
+0
-3
...main/java/com/futurefab/ai/services/util/HttpRequest.java
src/test/java/com/futurefab/ai/common/EQP/AreaAccTest.java
+110
-0
src/test/java/com/futurefab/ai/common/EQP/AreaAccTest.java
src/test/java/com/futurefab/ai/common/EQP/EQPAccTest.java
+113
-0
src/test/java/com/futurefab/ai/common/EQP/EQPAccTest.java
src/test/java/com/futurefab/ai/common/EQP/FabAccTest.java
+120
-0
src/test/java/com/futurefab/ai/common/EQP/FabAccTest.java
src/test/java/com/futurefab/ai/common/EQP/ModelAccTest.java
+109
-0
src/test/java/com/futurefab/ai/common/EQP/ModelAccTest.java
src/test/java/com/futurefab/ai/common/EQP/ModelVersionAccTest.java
+114
-0
...java/com/futurefab/ai/common/EQP/ModelVersionAccTest.java
src/test/java/com/futurefab/ai/common/EQP/ModuleModeAccTest.java
+108
-0
...t/java/com/futurefab/ai/common/EQP/ModuleModeAccTest.java
src/test/java/com/futurefab/ai/common/EQPAccTest.java
+0
-408
src/test/java/com/futurefab/ai/common/EQPAccTest.java
with
674 additions
and
411 deletions
+674
-411
src/main/java/com/futurefab/ai/services/util/HttpRequest.java
+
0
-
3
View file @
f354a5f3
...
...
@@ -20,8 +20,5 @@ public class HttpRequest {
.
post
(
url
)
.
then
()
.
extract
().
response
().
asString
();
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/futurefab/ai/common/EQP/AreaAccTest.java
0 → 100644
+
110
-
0
View file @
f354a5f3
package
com.futurefab.ai.common.EQP
;
import
com.futurefab.ai.services.EQPServices
;
import
com.futurefab.ai.services.UserServices
;
import
com.futurefab.ai.services.common.ConfigurationSettings
;
import
com.futurefab.ai.services.util.HttpRequest
;
import
com.futurefab.ai.services.util.StringHelper
;
import
com.jayway.jsonpath.JsonPath
;
import
org.junit.AfterClass
;
import
org.junit.Assert
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
AreaAccTest
{
static
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
AreaAccTest
.
class
);
static
private
String
token
;
static
private
String
prefix
;
static
EQPServices
eqpServices
;
static
HttpRequest
httpRequest
;
static
String
area
;
static
UserServices
userServices
;
static
String
areaId
;
static
String
defaultRequestBody
=
"{\"header\":{},\"body\":{}}"
;
@BeforeClass
public
static
void
setUp
()
{
userServices
=
new
UserServices
();
eqpServices
=
new
EQPServices
();
httpRequest
=
new
HttpRequest
();
logger
.
info
(
"Getting a token from server. "
);
token
=
userServices
.
getToken
(
ConfigurationSettings
.
SERVER_LOGIN_USER
,
ConfigurationSettings
.
SERVER_LOGIN_PASSWORD
,
"en"
);
logger
.
info
(
"Got token: "
+
token
);
Assert
.
assertTrue
(
token
!=
null
&&
token
.
length
()
>
1
);
eqpServices
.
AddDefaultEQP
(
token
);
}
@Test
public
void
Test004AddArea
(){
AddArea
();
// System.out.println(fablist);
// System.out.println(areaId);
}
@Test
public
void
Test005UpdateArea
(){
AddArea
();
logger
.
info
(
"Modify Area: "
+
area
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[],\"updateList\":[{\"area\":\""
+
area
+
"\",\"createBy\":null,\"createDtts\":null,\"description\":null,\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"rawId\":\""
+
areaId
+
"\",\"_X_ROW_KEY\":null}]}}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
AREA_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify area update successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
fablist
=
new
ArrayList
<
String
>();
fablist
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
AREA_LIST_PATH
),
String
.
format
(
"$.data[?(@.area =='%s')]"
,
area
));
Assert
.
assertTrue
(
"Verify update area in arealist"
,
fablist
.
size
()>
0
);
}
@Test
public
void
Test006DeleteArea
(){
AddArea
();
logger
.
info
(
"Delete Area: "
+
area
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":[{\"area\":\""
+
area
+
"\",\"createBy\":null,\"createDtts\":null,\"description\":null,\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"rawId\":\""
+
areaId
+
"\",\"_X_ROW_KEY\":null}]}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
AREA_DELETE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify delete area successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
fablist
=
new
ArrayList
<
String
>();
fablist
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
AREA_LIST_PATH
),
String
.
format
(
"$.data[?(@.area =='%s')]"
,
area
));
Assert
.
assertTrue
(
"Verify delete area not in arealist"
,
fablist
.
size
()==
0
);
}
@AfterClass
public
static
void
cleanup
()
{
}
private
void
AddArea
()
{
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
area
=
"area"
+
prefix
;
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[{\"isAdd\":true,\"rawId\":null,\"area\":\""
+
area
+
"\",\"description\":null,\"createBy\":null,\"createDtts\":null,\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"_X_ROW_KEY\":null}],\"updateList\":[]}}"
;
logger
.
info
(
"Creating a new Area: "
+
area
);
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
AREA_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify area created successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
fablist
=
new
ArrayList
<
String
>();
fablist
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
AREA_LIST_PATH
),
String
.
format
(
"$.data[?(@.area =='%s')]"
,
area
));
areaId
=
String
.
valueOf
(
fablist
.
get
(
0
)).
split
(
"rawId="
)[
1
].
split
(
","
)[
0
];
areaId
=
areaId
.
substring
(
0
,
areaId
.
length
()-
1
);
Assert
.
assertTrue
(
"Verify Add New Area in Arealist"
,
fablist
.
size
()>
0
);
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/futurefab/ai/common/EQP/EQPAccTest.java
0 → 100644
+
113
-
0
View file @
f354a5f3
package
com.futurefab.ai.common.EQP
;
import
Profile.Gatekeeper
;
import
com.futurefab.ai.services.EQPServices
;
import
com.futurefab.ai.services.UserServices
;
import
com.futurefab.ai.services.common.ConfigurationSettings
;
import
com.futurefab.ai.services.common.ModeType
;
import
com.futurefab.ai.services.util.StringHelper
;
import
org.junit.*
;
import
org.junit.experimental.categories.Category
;
import
org.junit.runners.MethodSorters
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
Profile.EQP
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Objects
;
import
com.jayway.jsonpath.JsonPath
;
import
com.futurefab.ai.services.util.HttpRequest
;
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@Category
({
EQP
.
class
,
Gatekeeper
.
class
})
public
class
EQPAccTest
{
static
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
EQPAccTest
.
class
);
static
private
String
token
;
static
private
String
prefix
;
static
EQPServices
eqpServices
;
static
UserServices
userServices
;
static
HttpRequest
httpRequest
;
static
String
site
;
static
String
fab
;
static
String
line
;
static
String
area
;
static
String
modelName
;
static
String
eesModel
;
static
String
modelVersion
;
static
String
moduleModel
;
static
String
fabId
;
static
String
modelId
;
static
String
areaId
;
static
String
modelVersionId
;
static
String
moduleModelId
;
static
String
defaultRequestBody
=
"{\"header\":{},\"body\":{}}"
;
@BeforeClass
public
static
void
setUp
()
{
userServices
=
new
UserServices
();
eqpServices
=
new
EQPServices
();
httpRequest
=
new
HttpRequest
();
logger
.
info
(
"Getting a token from server. "
);
token
=
userServices
.
getToken
(
ConfigurationSettings
.
SERVER_LOGIN_USER
,
ConfigurationSettings
.
SERVER_LOGIN_PASSWORD
,
"en"
);
logger
.
info
(
"Got token: "
+
token
);
Assert
.
assertTrue
(
token
!=
null
&&
token
.
length
()
>
1
);
eqpServices
.
AddDefaultEQP
(
token
);
}
// @Test
// public void registerEQPTest() {
// String site = "site " + prefix;
// String fab = "fab " + prefix;
// String line = "line " + prefix;
// String area = "area " + prefix;
// String modelName = "model Name " + prefix;
// String eesModel = "ees model" + prefix;
// String moduleModel = "module model " + prefix;
//
// logger.info("Creating a new FabConfig with site: " + site + " fab: " + fab + " line: " + line);
// String result = eqpServices.createFabConfig(token, site + prefix, fab + prefix, line + prefix);
// Assert.assertTrue("Verify fab config created successfully. ", result != null && result.equals("SUCCESS"));
//
// logger.info("Creating a new Area Config with area: " + area);
// result = eqpServices.createAreaConfig(token, area);
// Assert.assertTrue("Verify Area Config created successfully. ", result != null && result.equals("SUCCESS"));
//
// List<String> arealist = new ArrayList<String>();
// arealist = eqpServices.getAreaList(token).getList("data");
//
// for (int i = 0; i < arealist.size(); i++) {
// String tmp = String.valueOf(arealist.get(i));
// if (tmp.contains(area)) {
// areaId = tmp.split("rawId=")[1].split(",")[0];
// logger.info("Got areaId : " + areaId);
// break;
// }
// }
//
// Assert.assertTrue("Verify AreaId is not empty. ", areaId != null && areaId.length() > 0);
//
// logger.info("Creating a new Model Config with areaId: " + areaId);
// result = eqpServices.createModelConfig(token, modelName, eesModel, ModeType.PROC, areaId);
// Assert.assertTrue("Verify Model Config created successfully. ", result != null && result.equals("SUCCESS"));
//
// logger.info("Creating a new Module Model Config: " + moduleModel);
// result = eqpServices.createModuleModelConfig(token, moduleModel, areaId);
// Assert.assertTrue("Verify Module Model Config created successfully. ", result != null && result.equals("SUCCESS"));
//
// }
@AfterClass
public
static
void
cleanup
()
{
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/futurefab/ai/common/EQP/FabAccTest.java
0 → 100644
+
120
-
0
View file @
f354a5f3
package
com.futurefab.ai.common.EQP
;
import
com.futurefab.ai.services.EQPServices
;
import
com.futurefab.ai.services.UserServices
;
import
com.futurefab.ai.services.common.ConfigurationSettings
;
import
com.futurefab.ai.services.util.HttpRequest
;
import
com.futurefab.ai.services.util.StringHelper
;
import
com.jayway.jsonpath.JsonPath
;
import
org.junit.AfterClass
;
import
org.junit.Assert
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
FabAccTest
{
static
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
FabAccTest
.
class
);
static
private
String
token
;
static
private
String
prefix
;
static
EQPServices
eqpServices
;
static
UserServices
userServices
;
static
HttpRequest
httpRequest
;
static
String
site
;
static
String
fab
;
static
String
line
;
static
String
fabId
;
static
String
defaultRequestBody
=
"{\"header\":{},\"body\":{}}"
;
@BeforeClass
public
static
void
setUp
()
{
userServices
=
new
UserServices
();
eqpServices
=
new
EQPServices
();
httpRequest
=
new
HttpRequest
();
logger
.
info
(
"Getting a token from server. "
);
token
=
userServices
.
getToken
(
ConfigurationSettings
.
SERVER_LOGIN_USER
,
ConfigurationSettings
.
SERVER_LOGIN_PASSWORD
,
"en"
);
logger
.
info
(
"Got token: "
+
token
);
Assert
.
assertTrue
(
token
!=
null
&&
token
.
length
()
>
1
);
eqpServices
.
AddDefaultEQP
(
token
);
}
@Test
public
void
Test001AddFab
(){
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
site
=
"site "
+
prefix
;
fab
=
"fab "
+
prefix
;
line
=
"line "
+
prefix
;
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[{\"isAdd\":true,\"rawId\":null,\"site\":\""
+
site
+
"\",\"fab\":\""
+
fab
+
"\",\"line\":\""
+
line
+
"\",\"createBy\":null,\"createDtts\":null,\"_X_ROW_KEY\":null}],\"updateList\":[]}}"
;
logger
.
info
(
"Creating a new FabConfig with site: "
+
site
+
" fab: "
+
fab
+
" line: "
+
line
);
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
FAB_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify fab config created successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
fablist
=
new
ArrayList
<
String
>();
fablist
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
FAB_LIST_PATH
),
String
.
format
(
"$.data[?(@.site =='%s'&& @.fab == '%s' &&@.line=='%s')]"
,
site
,
fab
,
line
));
// for (int i = 0; i < fablist.size(); i++) {
// String tmp=String.valueOf(fablist.get(i));
// if (tmp.contains(site) & tmp.contains(fab) & tmp.contains(line)) {
// fabId = tmp.split("rawId=")[1].split(",")[0];
// logger.info("add fab successfully");
// break;
// }
// }
fabId
=
String
.
valueOf
(
fablist
.
get
(
0
)).
split
(
"rawId="
)[
1
].
split
(
","
)[
0
];
System
.
out
.
println
(
fablist
);
System
.
out
.
println
(
fabId
);
Assert
.
assertTrue
(
"verify add fab in fab list"
,
fablist
.
size
()>
0
);
}
@Test
public
void
Test002UpdateFab
(){
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
site
=
"site "
+
prefix
;
fab
=
"fab "
+
prefix
;
line
=
"line "
+
prefix
;
logger
.
info
(
"Modify FabConfig with site: "
+
site
+
" fab: "
+
fab
+
" line: "
+
line
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[],\"updateList\":[{\"createBy\":null,\"createDtts\":null,\"fab\":\""
+
fab
+
"\",\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"line\":\""
+
line
+
"\",\"rawId\":\""
+
fabId
+
"\",\"site\":\""
+
site
+
"\",\"_X_ROW_KEY\":null}]}}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
FAB_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify fab config created successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
fablist
=
new
ArrayList
<
String
>();
fablist
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
FAB_LIST_PATH
),
String
.
format
(
"$.data[?(@.site =='%s'&& @.fab == '%s' &&@.line=='%s')]"
,
site
,
fab
,
line
));
Assert
.
assertTrue
(
"verify update fab in fab list"
,
fablist
.
size
()>
0
);
}
@Test
public
void
Test003DeleteFab
(){
logger
.
info
(
"Delete FabConfig with site: "
+
site
+
" fab: "
+
fab
+
" line: "
+
line
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":[{\"createBy\":null,\"createDtts\":null,\"fab\":\""
+
fab
+
"\",\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"line\":\""
+
line
+
"\",\"rawId\":\""
+
fabId
+
"\",\"site\":\""
+
site
+
"\",\"_X_ROW_KEY\":null}]}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
FAB_DELETE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify fab config created successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
fablist
=
new
ArrayList
<
String
>();
fablist
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
FAB_LIST_PATH
),
String
.
format
(
"$.data[?(@.site =='%s'&& @.fab == '%s' &&@.line=='%s')]"
,
site
,
fab
,
line
));
Assert
.
assertTrue
(
"verify delete fab not in fab list"
,
fablist
.
size
()==
0
);
}
@AfterClass
public
static
void
cleanup
()
{
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/futurefab/ai/common/EQP/ModelAccTest.java
0 → 100644
+
109
-
0
View file @
f354a5f3
package
com.futurefab.ai.common.EQP
;
import
com.futurefab.ai.services.EQPServices
;
import
com.futurefab.ai.services.UserServices
;
import
com.futurefab.ai.services.common.ConfigurationSettings
;
import
com.futurefab.ai.services.util.HttpRequest
;
import
com.futurefab.ai.services.util.StringHelper
;
import
com.jayway.jsonpath.JsonPath
;
import
org.junit.AfterClass
;
import
org.junit.Assert
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ModelAccTest
{
static
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
ModelAccTest
.
class
);
static
private
String
token
;
static
private
String
prefix
;
static
EQPServices
eqpServices
;
static
UserServices
userServices
;
static
HttpRequest
httpRequest
;
static
String
modelName
;
static
String
eesModel
;
static
String
modelId
;
static
String
defaultRequestBody
=
"{\"header\":{},\"body\":{}}"
;
@BeforeClass
public
static
void
setUp
()
{
userServices
=
new
UserServices
();
eqpServices
=
new
EQPServices
();
httpRequest
=
new
HttpRequest
();
logger
.
info
(
"Getting a token from server. "
);
token
=
userServices
.
getToken
(
ConfigurationSettings
.
SERVER_LOGIN_USER
,
ConfigurationSettings
.
SERVER_LOGIN_PASSWORD
,
"en"
);
logger
.
info
(
"Got token: "
+
token
);
Assert
.
assertTrue
(
token
!=
null
&&
token
.
length
()
>
1
);
eqpServices
.
AddDefaultEQP
(
token
);
}
@Test
public
void
Test007AddModel
(){
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
modelName
=
"modelName"
+
prefix
;
eesModel
=
"eesModel"
+
prefix
;
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[{\"isAdd\":true,\"areaRawid\":\""
+
eqpServices
.
default_AreaId
+
"\",\"rawId\":null,\"modelName\":\""
+
modelName
+
"\",\"eesModel\":\""
+
eesModel
+
"\",\"modelTypeCd\":\"PROC\",\"modelVersionNames\":null,\"maker\":null,\"description\":null,\"_X_ROW_KEY\":null}],\"updateList\":[]}}"
;
logger
.
info
(
"Creating a model with model name: "
+
modelName
+
",eesModel:"
+
eesModel
);
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODEL_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify add model successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
MODEL_LIST_PATH
),
String
.
format
(
"$.data[?(@.eesModel =='%s'&& @.modelName == '%s')]"
,
eesModel
,
modelName
));
modelId
=
String
.
valueOf
(
list
.
get
(
0
)).
split
(
"rawId="
)[
1
].
split
(
","
)[
0
];
modelId
=
modelId
.
substring
(
0
,
modelId
.
length
()-
1
);
Assert
.
assertTrue
(
"Verify Add New Area in Arealist"
,
list
.
size
()>
0
);
System
.
out
.
println
(
modelId
);
}
@Test
public
void
Test008UpdateModel
(){
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
modelName
=
"modelName"
+
prefix
;
eesModel
=
"eesModel"
+
prefix
;
logger
.
info
(
"Modify model with model name is: "
+
modelName
+
"ees model is:"
+
eesModel
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[],\"updateList\":[{\"area\":\""
+
eqpServices
.
default_Area
+
"\",\"areaRawid\":\""
+
eqpServices
.
default_AreaId
+
"\",\"createBy\":null,\"createDtts\":null,\"description\":null,\"eesModel\":\""
+
eesModel
+
"\",\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"maker\":null,\"makerCd\":null,\"modelName\":\""
+
modelName
+
"\",\"modelTypeCd\":\"PROC\",\"modelVersionNames\":null,\"rawId\":\""
+
modelId
+
"\",\"_X_ROW_KEY\":null}]}}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODEL_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify model update successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
MODEL_LIST_PATH
),
String
.
format
(
"$.data[?(@.eesModel =='%s'&& @.modelName == '%s')]"
,
eesModel
,
modelName
));
Assert
.
assertTrue
(
"Verify update model in modellist"
,
list
.
size
()>
0
);
}
@Test
public
void
Test012DeleteModel
(){
//新建的model会有个默认的modelversion:V01,删除model之前需要删除所有modelversion,否则会提示删除关联数据
eqpServices
.
DeleteDefaultModelVersion
(
token
,
modelId
);
logger
.
info
(
"Delete Model: "
+
modelName
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":[{\"area\":\""
+
eqpServices
.
default_Area
+
"\",\"areaRawid\":\""
+
eqpServices
.
default_AreaId
+
"\",\"createBy\":null,\"createDtts\":null,\"description\":null,\"eesModel\":\""
+
eesModel
+
"\",\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"maker\":null,\"makerCd\":null,\"modelName\":\""
+
modelName
+
"\",\"modelTypeCd\":\"PROC\",\"modelVersionNames\":null,\"rawId\":\""
+
modelId
+
"\",\"_X_ROW_KEY\":null}]}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODEL_DELETE_PATH
),
"$.status"
);
Assert
.
assertTrue
(
"Verify delete model successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
MODEL_LIST_PATH
),
String
.
format
(
"$.data[?(@.eesModel =='%s'&& @.modelName == '%s')]"
,
eesModel
,
modelName
));
Assert
.
assertTrue
(
"Verify delete model not in modellist"
,
list
.
size
()==
0
);
}
@AfterClass
public
static
void
cleanup
()
{
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/futurefab/ai/common/EQP/ModelVersionAccTest.java
0 → 100644
+
114
-
0
View file @
f354a5f3
package
com.futurefab.ai.common.EQP
;
import
com.futurefab.ai.services.EQPServices
;
import
com.futurefab.ai.services.UserServices
;
import
com.futurefab.ai.services.common.ConfigurationSettings
;
import
com.futurefab.ai.services.util.HttpRequest
;
import
com.futurefab.ai.services.util.StringHelper
;
import
com.jayway.jsonpath.JsonPath
;
import
org.junit.AfterClass
;
import
org.junit.Assert
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ModelVersionAccTest
{
static
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
ModelVersionAccTest
.
class
);
static
private
String
token
;
static
private
String
prefix
;
static
EQPServices
eqpServices
;
static
UserServices
userServices
;
static
HttpRequest
httpRequest
;
static
String
modelName
;
static
String
eesModel
;
static
String
modelVersion
;
static
String
modelId
;
static
String
modelVersionId
;
@BeforeClass
public
static
void
setUp
()
{
userServices
=
new
UserServices
();
eqpServices
=
new
EQPServices
();
httpRequest
=
new
HttpRequest
();
logger
.
info
(
"Getting a token from server. "
);
token
=
userServices
.
getToken
(
ConfigurationSettings
.
SERVER_LOGIN_USER
,
ConfigurationSettings
.
SERVER_LOGIN_PASSWORD
,
"en"
);
logger
.
info
(
"Got token: "
+
token
);
Assert
.
assertTrue
(
token
!=
null
&&
token
.
length
()
>
1
);
eqpServices
.
AddDefaultEQP
(
token
);
}
@Test
public
void
Test009AddModelVersion
(){
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
modelVersion
=
"modelVersion"
+
prefix
;
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[{\"isAdd\":true,\"modelRawid\":\""
+
modelId
+
"\",\"rawId\":null,\"modelVersionName\":\""
+
modelVersion
+
"\",\"description\":null,\"_X_ROW_KEY\":null}],\"updateList\":[]}}"
;
logger
.
info
(
"Creating a model version with model name: "
+
modelName
);
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODELVERSION_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify add model version successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
List
<
String
>
list
=
new
ArrayList
<
String
>();
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"modelRawid\":\""
+
modelId
+
"\"}}"
;
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODELVERSION_LIST_PATH
),
String
.
format
(
"$.data[?(@.modelVersionName =='%s')]"
,
modelVersion
));
modelVersionId
=
String
.
valueOf
(
list
.
get
(
0
)).
split
(
"rawId="
)[
1
].
split
(
","
)[
0
];
modelVersionId
=
modelVersionId
.
substring
(
0
,
modelVersionId
.
length
()-
1
);
Assert
.
assertTrue
(
"Verify add model version in versionlist"
,
list
.
size
()>
0
);
System
.
out
.
println
(
modelVersionId
);
}
@Test
public
void
Test010UpdateModelVersion
(){
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
modelVersion
=
"modelVersion"
+
prefix
;
logger
.
info
(
"Modify modelversion with model name is: "
+
modelName
+
"ees model is:"
+
eesModel
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[],\"updateList\":[{\"createBy\":null,\"createDtts\":null,\"description\":null,\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"modelRawid\":\""
+
modelId
+
"\",\"modelVersionName\":\""
+
modelVersion
+
"\",\"rawId\":\""
+
modelVersionId
+
"\",\"_X_ROW_KEY\":null}]}}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODELVERSION_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify model version update successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
list
=
new
ArrayList
<
String
>();
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"modelRawid\":\""
+
modelId
+
"\"}}"
;
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODELVERSION_LIST_PATH
),
String
.
format
(
"$.data[?(@.modelVersionName =='%s')]"
,
modelVersion
));
Assert
.
assertTrue
(
"Verify update model version in modelversionlist"
,
list
.
size
()>
0
);
}
@Test
public
void
Test011DeleteModelVersion
(){
//删除刚刚添加的version
logger
.
info
(
"Delete Model Version: "
+
modelVersion
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":[{\"createBy\":null,\"createDtts\":null,\"description\":null,\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"modelRawid\":\""
+
modelId
+
"\",\"modelVersionName\":\""
+
modelVersion
+
"\",\"rawId\":\""
+
modelVersionId
+
"\",\"_X_ROW_KEY\":null}]}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODELVERSION_DELETE_PATH
),
"$.status"
);
Assert
.
assertTrue
(
"Verify delete model version successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
List
<
String
>
list
=
new
ArrayList
<
String
>();
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"modelRawid\":\""
+
modelId
+
"\"}}"
;
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODELVERSION_LIST_PATH
),
String
.
format
(
"$.data[?(@.modelVersionName =='%s')]"
,
modelVersion
));
Assert
.
assertTrue
(
"Verify delete model version not in modelversionlist"
,
list
.
size
()==
0
);
//删除默认version V01
}
@AfterClass
public
static
void
cleanup
()
{
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/futurefab/ai/common/EQP/ModuleModeAccTest.java
0 → 100644
+
108
-
0
View file @
f354a5f3
package
com.futurefab.ai.common.EQP
;
import
com.futurefab.ai.services.EQPServices
;
import
com.futurefab.ai.services.UserServices
;
import
com.futurefab.ai.services.common.ConfigurationSettings
;
import
com.futurefab.ai.services.util.HttpRequest
;
import
com.futurefab.ai.services.util.StringHelper
;
import
com.jayway.jsonpath.JsonPath
;
import
org.junit.AfterClass
;
import
org.junit.Assert
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ModuleModeAccTest
{
static
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
ModuleModeAccTest
.
class
);
static
private
String
token
;
static
private
String
prefix
;
static
EQPServices
eqpServices
;
static
UserServices
userServices
;
static
HttpRequest
httpRequest
;
static
String
moduleModel
;
static
String
moduleModelId
;
static
String
defaultRequestBody
=
"{\"header\":{},\"body\":{}}"
;
@BeforeClass
public
static
void
setUp
()
{
userServices
=
new
UserServices
();
eqpServices
=
new
EQPServices
();
httpRequest
=
new
HttpRequest
();
logger
.
info
(
"Getting a token from server. "
);
token
=
userServices
.
getToken
(
ConfigurationSettings
.
SERVER_LOGIN_USER
,
ConfigurationSettings
.
SERVER_LOGIN_PASSWORD
,
"en"
);
logger
.
info
(
"Got token: "
+
token
);
Assert
.
assertTrue
(
token
!=
null
&&
token
.
length
()
>
1
);
eqpServices
.
AddDefaultEQP
(
token
);
}
@Test
public
void
Test013AddModuleModel
(){
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
moduleModel
=
"moduleModel"
+
prefix
;
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[{\"isAdd\":true,\"areaRawid\":\""
+
eqpServices
.
default_AreaId
+
"\",\"rawId\":null,\"modelModuleName\":\""
+
moduleModel
+
"\",\"description\":null,\"createBy\":null,\"createDtts\":null,\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"_X_ROW_KEY\":null}],\"updateList\":[]}}"
;
logger
.
info
(
"Creating a model version with model name: "
+
moduleModel
);
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODULEMODEL_SAVE_PATH
),
"$.status"
);
//verify response status
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
"Verify add model version successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
MODULEMODEL_LIST_PATH
),
String
.
format
(
"$.data[?(@.modelModuleName =='%s')]"
,
moduleModel
));
moduleModelId
=
String
.
valueOf
(
list
.
get
(
0
)).
split
(
"rawId="
)[
1
].
split
(
","
)[
0
];
moduleModelId
=
moduleModelId
.
substring
(
0
,
moduleModelId
.
length
()-
1
);
Assert
.
assertTrue
(
"Verify add module model in moduleModellist"
,
list
.
size
()>
0
);
System
.
out
.
println
(
moduleModelId
);
}
@Test
public
void
Test014UpdateModuleModel
(){
prefix
=
StringHelper
.
getCharAndNumr
(
3
);
moduleModel
=
"moduleModule"
+
prefix
;
logger
.
info
(
"Modify modulemodel : "
+
moduleModel
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":{\"createList\":[],\"updateList\":[{\"area\":\""
+
eqpServices
.
default_Area
+
"\",\"areaRawid\":\""
+
eqpServices
.
default_AreaId
+
"\",\"createBy\":null,\"createDtts\":null,\"description\":null,\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"modelModuleName\":\""
+
moduleModel
+
"\",\"rawId\":\""
+
moduleModelId
+
"\",\"_X_ROW_KEY\":null}]}}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODULEMODEL_SAVE_PATH
),
"$.status"
);
//verify response status
Assert
.
assertTrue
(
"Verify model version update successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
//verify add fab data in fab list
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
MODULEMODEL_LIST_PATH
),
String
.
format
(
"$.data[?(@.modelModuleName =='%s')]"
,
moduleModel
));
Assert
.
assertTrue
(
"Verify update modulemodel in modulemodellist"
,
list
.
size
()>
0
);
}
@Test
public
void
Test015DeleteModuleModel
(){
logger
.
info
(
"Delete ModuleModel: "
+
moduleModel
);
String
requestBody
=
"{\"header\":{\"log\":\"N\"},\"body\":[{\"area\":\""
+
eqpServices
.
default_Area
+
"\",\"areaRawid\":\""
+
eqpServices
.
default_AreaId
+
"\",\"createBy\":null,\"createDtts\":null,\"description\":null,\"lastUpdateBy\":null,\"lastUpdateDtts\":null,\"modelModuleName\":null,\"rawId\":\""
+
moduleModelId
+
"\",\"_X_ROW_KEY\":null}]}"
;
String
result
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
requestBody
,
eqpServices
.
MODULEMODEL_DELETE_PATH
),
"$.status"
);
Assert
.
assertTrue
(
"Verify delete modulemodel successfully. "
,
result
!=
null
&&
result
.
equals
(
"SUCCESS"
));
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
=
JsonPath
.
read
(
httpRequest
.
postRequest
(
token
,
defaultRequestBody
,
eqpServices
.
MODULEMODEL_LIST_PATH
),
String
.
format
(
"$.data[?(@.modelModuleName =='%s')]"
,
moduleModel
));
Assert
.
assertTrue
(
"Verify delete model version not in modelversionlist"
,
list
.
size
()==
0
);
}
@AfterClass
public
static
void
cleanup
()
{
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/futurefab/ai/common/EQPAccTest.java
deleted
100644 → 0
+
0
-
408
View file @
efee2dfd
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets