Skip to content

Commit 4bea05c

Browse files
v1.6.2
v1.6.2
2 parents 266f52b + 81ddbd8 commit 4bea05c

38 files changed

+877
-73
lines changed

agent/src/main/resources/agent.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
cloud.url=${CLOUD_URL:https://local.testsigmaos.com}
1010
local.server.url=${LOCAL_SERVER_URL:http://localhost:9090}
1111
local.agent.register=${LOCAL_AGENT_REGISTER:true}
12-
agent.version=1.6.1
12+
agent.version=1.6.2

automator/src/com/testsigma/automator/constants/TestStepConditionType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313

1414
@AllArgsConstructor
1515
public enum TestStepConditionType {
16-
CONDITION_IF, CONDITION_IFNOT, CONDITION_ELSE_IF, CONDITION_ELSE_IFNOT, CONDITION_ELSE, LOOP_FOR, LOOP_WHILE
16+
NOT_USED, CONDITION_IF, CONDITION_IFNOT, CONDITION_ELSE_IF, CONDITION_ELSE_IFNOT, CONDITION_ELSE, LOOP_FOR, LOOP_WHILE
1717
}

server/src/main/java/com/testsigma/dto/AgentDTO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ public class AgentDTO {
3030
private String hostName;
3131
private AgentOs osType;
3232
private String osVersion;
33-
private String currentAgentVersion = "1.6.1";
33+
private String currentAgentVersion = "1.6.2";
3434
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.testsigma.dto.export;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import com.fasterxml.jackson.annotation.JsonRootName;
5+
import com.testsigma.annotation.JsonListRootName;
6+
import lombok.Data;
7+
8+
@Data
9+
@JsonListRootName(name = "suite_test_case_mappings")
10+
@JsonRootName(value = "suite_test_case_mapping")
11+
public class SuiteTestCaseMappingXMLDTO extends BaseXMLDTO {
12+
@JsonProperty("Id")
13+
private Long id;
14+
@JsonProperty("SuiteId")
15+
private Long suiteId;
16+
@JsonProperty("TestCaseId")
17+
private Long testCaseId;
18+
@JsonProperty("Position")
19+
private Integer position;
20+
}

server/src/main/java/com/testsigma/dto/export/TestStepCloudXMLDTO.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package com.testsigma.dto.export;
99

1010
import com.fasterxml.jackson.annotation.*;
11+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
1112
import com.testsigma.annotation.JsonListRootName;
1213
import com.testsigma.model.*;
1314
import com.testsigma.service.ObjectMapperService;
@@ -44,7 +45,8 @@ public class TestStepCloudXMLDTO extends BaseXMLDTO {
4445
@JsonProperty("CustomFields")
4546
private String customFields;
4647
@JsonProperty("DataMap")
47-
private String dataMap;
48+
@JsonDeserialize(using = TestStepDataMapDeserializer.class)
49+
private TestStepCloudDataMap dataMap;
4850
@JsonProperty("ExceptedResult")
4951
private String exceptedResult;
5052
@JsonProperty("TemplateId")
@@ -83,14 +85,16 @@ public class TestStepCloudXMLDTO extends BaseXMLDTO {
8385
private Boolean ignoreStepResult;
8486
@JsonIgnore
8587
private String typeName;
88+
@JsonProperty("VisualEnabled")
89+
private Boolean visualEnabled = false;
8690

8791

88-
public TestStepCloudDataMap getDataMap() {
92+
/* public TestStepCloudDataMap getDataMap() {
8993
return new ObjectMapperService().parseJson(dataMap, TestStepCloudDataMap.class);
9094
}
9195
9296
public void setDataMap(TestStepCloudDataMap testStepDataMap) {
9397
this.dataMap = new ObjectMapperService().convertToJson(testStepDataMap);
9498
}
95-
99+
*/
96100
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
package com.testsigma.dto.export;
2+
3+
import com.fasterxml.jackson.core.JsonParser;
4+
import com.fasterxml.jackson.core.TreeNode;
5+
import com.fasterxml.jackson.databind.DeserializationContext;
6+
import com.fasterxml.jackson.databind.JsonDeserializer;
7+
import com.fasterxml.jackson.databind.ObjectMapper;
8+
import com.testsigma.model.*;
9+
import com.testsigma.service.ObjectMapperService;
10+
import lombok.extern.log4j.Log4j2;
11+
12+
import java.io.IOException;
13+
import java.util.Map;
14+
15+
@Log4j2
16+
public class TestStepDataMapDeserializer extends JsonDeserializer<TestStepCloudDataMap> {
17+
@Override
18+
public TestStepCloudDataMap deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
19+
TreeNode treeNode = jsonParser.getCodec().readTree(jsonParser);
20+
ObjectMapperService mapperService = new ObjectMapperService();
21+
try {
22+
TestStepCloudDataMap testStepCloudDataMap = mapperService.parseJson(treeNode.toString(), TestStepCloudDataMap.class);
23+
log.info(testStepCloudDataMap.toString().trim());
24+
return testStepCloudDataMap;
25+
} catch (Exception e) {
26+
Map<String, String> map = mapperService.parseJson(treeNode.toString(), Map.class);
27+
TestStepCloudDataMap testStepDataMap = new TestStepCloudDataMap();
28+
log.info("Parsing json to map: " + map);
29+
if (map.containsKey("test-data")) {
30+
if (treeNode.get("test-data").get("test-data")!=null){
31+
Map<String, String> testData = mapperService.parseJson(treeNode.get("test-data").get("test-data").toString(), Map.class);
32+
testStepDataMap.setTestData(testData.get("value").toString());
33+
testStepDataMap.setTestDataType(testData.get("type").toString());
34+
if (testData.containsKey("test-data-function")) {
35+
testStepDataMap.setTestDataFunction(new ObjectMapper().convertValue(map.get("test-data-function"),
36+
DefaultDataGenerator.class));
37+
}
38+
if (testData.containsKey("kibbutz_test_data_function")) {
39+
testStepDataMap.setKibbutzTDF(new ObjectMapper().convertValue(map.get("kibbutz_test_data_function"),
40+
AddonTestStepTestData.class));
41+
}
42+
}
43+
else {
44+
testStepDataMap.setTestData(map.get("test-data").toString());
45+
testStepDataMap.setTestDataType(map.get("test-data-type").toString());
46+
if (map.containsKey("test-data-function")) {
47+
testStepDataMap.setTestDataFunction(new ObjectMapper().convertValue(map.get("test-data-function"),
48+
DefaultDataGenerator.class));
49+
}
50+
if (map.containsKey("kibbutz_test_data_function")) {
51+
testStepDataMap.setKibbutzTDF(new ObjectMapper().convertValue(map.get("kibbutz_test_data_function"),
52+
AddonTestStepTestData.class));
53+
}
54+
}
55+
}
56+
if (map.containsKey("condition_if")) {
57+
testStepDataMap.setIfConditionExpectedResults(map.get("condition_if"));
58+
}
59+
if (map.containsKey("condition-type")) {
60+
testStepDataMap.setIfConditionExpectedResults(map.get("condition-type"));
61+
}
62+
if (map.containsKey("custom-step")) {
63+
testStepDataMap.setCustomStep(new ObjectMapper().convertValue(map.get("custom-step"), TestStepCustomStep.class));
64+
}
65+
if (map.containsKey("ui-identifier")) {
66+
testStepDataMap.setElement(map.get("ui-identifier"));
67+
}
68+
if (map.containsKey("from-ui-identifier")) {
69+
testStepDataMap.setFromElement(map.get("from-ui-identifier"));
70+
}
71+
if (map.containsKey("to-ui-identifier")) {
72+
testStepDataMap.setToElement(map.get("to-ui-identifier"));
73+
}
74+
if (map.containsKey("attribute")) {
75+
testStepDataMap.setAttribute(map.get("attribute"));
76+
}
77+
if (map.containsKey("for_loop")) {
78+
testStepDataMap.setForLoop(new ObjectMapper().convertValue(map.get("for_loop"), TestStepCloudForLoop.class));
79+
}
80+
if (map.containsKey("while_loop")) {
81+
testStepDataMap.setWhileLoop(new ObjectMapper().convertValue(map.get("while_loop"), TestStepWhileLoop.class));
82+
}
83+
if (map.containsKey("whileCondition")) {
84+
testStepDataMap.setWhileCondition(map.get("whileCondition"));
85+
}
86+
log.info("Parsed json to testStepDataMap: " + testStepDataMap);
87+
return testStepDataMap;
88+
}
89+
}
90+
}

server/src/main/java/com/testsigma/dto/export/TestStepXMLDTO.java

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
import com.fasterxml.jackson.annotation.*;
1111
import com.testsigma.annotation.JsonListRootName;
12-
import com.testsigma.model.TestStepConditionType;
13-
import com.testsigma.model.TestStepPriority;
14-
import com.testsigma.model.TestStepType;
12+
import com.testsigma.model.*;
13+
import com.testsigma.service.ObjectMapperService;
1514
import lombok.Data;
1615

1716
import java.sql.Timestamp;
@@ -42,8 +41,6 @@ public class TestStepXMLDTO extends BaseXMLDTO {
4241
private Long stepGroupId;
4342
@JsonProperty("custom-fields")
4443
private String customFields;
45-
@JsonProperty("data-map")
46-
private String dataMap;
4744
@JsonProperty("excepted-result")
4845
private String exceptedResult;
4946
@JsonProperty("natural-text-action-id")
@@ -80,4 +77,31 @@ public class TestStepXMLDTO extends BaseXMLDTO {
8077
private Boolean disabled;
8178
@JsonProperty("VisualEnabled")
8279
private Boolean visualEnabled = false;
80+
@JsonProperty("condition_if")
81+
private ResultConstant[] ifConditionExpectedResults;
82+
@JsonProperty("test-data")
83+
private String testData;
84+
@JsonProperty("test-data-function")
85+
private DefaultDataGenerator defaultDataGenerator;
86+
@JsonProperty("custom-step")
87+
private TestStepCustomStep customStep;
88+
@JsonProperty("test-data-type")
89+
private String testDataType;
90+
@JsonProperty("element")
91+
private String element;
92+
@JsonProperty("from-element")
93+
private String fromElement;
94+
@JsonProperty("to-element")
95+
private String toElement;
96+
@JsonProperty("attribute")
97+
private String attribute;
98+
@JsonProperty("for_loop")
99+
private TestStepForLoop forLoop;
100+
@JsonProperty("while_loop")
101+
private TestStepWhileLoop whileLoop;
102+
@JsonProperty("whileCondition")
103+
private String whileCondition;
104+
@JsonProperty("addon_test_data_function")
105+
private AddonTestStepTestData addonTDF;
106+
83107
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
*
3+
* ****************************************************************************
4+
* * Copyright (C) 2019 Testsigma Inc.
5+
* * All rights reserved.
6+
* ****************************************************************************
7+
*
8+
*/
9+
10+
package com.testsigma.mapper;
11+
12+
import com.testsigma.dto.export.SuiteTestCaseMappingXMLDTO;
13+
import com.testsigma.model.SuiteTestCaseMapping;
14+
import org.mapstruct.Mapper;
15+
import org.mapstruct.NullValueCheckStrategy;
16+
import org.mapstruct.NullValuePropertyMappingStrategy;
17+
import org.mapstruct.ReportingPolicy;
18+
19+
import java.util.List;
20+
21+
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE,
22+
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
23+
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
24+
public interface TestSuiteTestCaseMapper {
25+
26+
List<SuiteTestCaseMappingXMLDTO> map(List<SuiteTestCaseMapping> suiteTestCaseMappingList);
27+
28+
List<SuiteTestCaseMapping> mapXML(List<SuiteTestCaseMappingXMLDTO> suiteTestCaseMappingList);
29+
30+
SuiteTestCaseMapping copy(SuiteTestCaseMapping suite);
31+
32+
}
33+

server/src/main/java/com/testsigma/model/SuiteTestCaseMapping.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public class SuiteTestCaseMapping {
4040
@UpdateTimestamp
4141
private Timestamp updatedDate;
4242

43+
@Column(name = "imported_id")
44+
private Long importedId;
4345

4446
@ManyToOne
4547
@Fetch(value = FetchMode.SELECT)

server/src/main/java/com/testsigma/repository/SuiteTestCaseMappingRepository.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import com.testsigma.model.AbstractTestSuite;
1313
import com.testsigma.model.SuiteTestCaseMapping;
1414
import com.testsigma.model.TestCase;
15+
import org.springframework.data.domain.Page;
16+
import org.springframework.data.domain.Pageable;
17+
import org.springframework.data.jpa.domain.Specification;
1518
import org.springframework.data.jpa.repository.JpaRepository;
1619
import org.springframework.data.jpa.repository.Query;
1720
import org.springframework.data.repository.query.Param;
@@ -36,4 +39,8 @@ public interface SuiteTestCaseMappingRepository extends JpaRepository<SuiteTestC
3639

3740
@Query("SELECT suiteTestCaseMapping.testCaseId FROM SuiteTestCaseMapping suiteTestCaseMapping WHERE suiteTestCaseMapping.suiteId = :id ORDER BY suiteTestCaseMapping.position")
3841
List<Long> findTestCaseIdsByTestSuiteId(Long id);
42+
43+
Page<SuiteTestCaseMapping> findAll(Specification specification, Pageable pageRequest);
44+
45+
Optional<SuiteTestCaseMapping> findAllBySuiteIdInAndImportedId(List<Long> ids, Long id);
3946
}

0 commit comments

Comments
 (0)