Skip to content

Commit b10603c

Browse files
Release 5.13.2 (#1083)
* EPMRPP-98912 || New type of widget (#1078) * EPMRPP-99229 || Update release versions * EPMRPP-98912 || Add widget type * EPMRPP-98912 || Add widget type * EPMRPP-99369 || change cascade type for ProjectAttribute (#1077) (cherry picked from commit 6298e53) * EPMRPP-98956 || Test case search widget (#1079) * EPMRPP-98956 || Added optimized queries for test case search * EPMRPP-98956 || Update naming * EPMRPP-98956 || Add ignoring of system attributes * EPMRPP-93396 || Add pagination by slice * EPMRPP-93396 || Fix attribute query * EPMRPP-98956 || Make searching by name case-insensitive * EPMRPP-98956 || Make searching by name case-insensitive * rc/5.13.2 || Change ilike with lower function * rc/5.13.2 || Add timeouts for hard queries * rc/5.13.2 || Change lower to ILIKE for using indexes * EPMRPP-100652 || Added an optimized query for searching items with nullable key * EPMRPP-100709 || Add ability to filter test cases by status in Test case search widget (#1082) * EPMRPP-100709 || Added queries for searching with statuses * EPMRPP-100709 || Added queries for searching with statuses * 5.13.2 || Update release versions --------- Co-authored-by: APiankouski <109206864+APiankouski@users.noreply.github.com>
1 parent e7eba81 commit b10603c

File tree

8 files changed

+305
-27
lines changed

8 files changed

+305
-27
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ on:
1212
env:
1313
GH_USER_NAME: github.actor
1414
SCRIPTS_VERSION: 5.12.0
15-
BOM_VERSION: 5.13.2
16-
MIGRATIONS_VERSION: 5.13.0
17-
RELEASE_VERSION: 5.13.1
15+
BOM_VERSION: 5.13.3
16+
MIGRATIONS_VERSION: 5.13.1
17+
RELEASE_VERSION: 5.13.2
1818

1919
jobs:
2020
release:

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ext['spring-boot.version'] = '2.5.15'
3333

3434
dependencyManagement {
3535
imports {
36-
mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:5.13.2' : 'com.epam.reportportal:commons-bom:5.13.2')
36+
mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:5.13.3' : 'com.epam.reportportal:commons-bom:5.13.3')
3737
mavenBom('io.zonky.test.postgres:embedded-postgres-binaries-bom:16.2.0')
3838
}
3939
}
@@ -42,7 +42,7 @@ dependencies {
4242
if (releaseMode) {
4343
implementation 'com.epam.reportportal:commons'
4444
} else {
45-
implementation 'com.github.reportportal:commons:develop-SNAPSHOT'
45+
implementation 'com.github.reportportal:commons:master-SNAPSHOT'
4646
}
4747

4848
implementation 'org.springframework.security:spring-security-core'

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=5.13.1
1+
version=5.13.2
22
lombokVersion=1.18.30
33
jooqVersion=3.19.13

src/main/java/com/epam/ta/reportportal/dao/TestItemRepository.java

Lines changed: 127 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@
2424
import java.util.List;
2525
import java.util.Optional;
2626
import java.util.stream.Stream;
27+
import javax.persistence.QueryHint;
28+
import org.springframework.data.domain.Pageable;
29+
import org.springframework.data.domain.Slice;
2730
import org.springframework.data.jpa.repository.Modifying;
2831
import org.springframework.data.jpa.repository.Query;
32+
import org.springframework.data.jpa.repository.QueryHints;
2933
import org.springframework.data.repository.query.Param;
3034

3135
/**
@@ -37,6 +41,109 @@ public interface TestItemRepository extends ReportPortalRepository<TestItem, Lon
3741
@Query(value = "SELECT * FROM test_item WHERE item_id = (SELECT parent_id FROM test_item WHERE item_id = :childId)", nativeQuery = true)
3842
Optional<TestItem> findParentByChildId(@Param("childId") Long childId);
3943

44+
@Query(value = """
45+
SELECT ti.* FROM test_item ti
46+
INNER JOIN launch l ON ti.launch_id = l.id
47+
WHERE ti.has_children = false
48+
AND ti.has_stats = true
49+
AND ti.retry_of IS NULL
50+
AND ti.type = 'STEP'
51+
AND l.project_id = :projectId
52+
AND ti.name ILIKE %:name%
53+
""", nativeQuery = true)
54+
@QueryHints(@QueryHint(name = "javax.persistence.query.timeout", value = "10000"))
55+
Slice<TestItem> findTestItemsContainsName(@Param("name") String nameTerm,
56+
@Param("projectId") Long projectId,
57+
Pageable pageable);
58+
59+
@Query(value = """
60+
SELECT ti.* FROM test_item ti
61+
JOIN test_item_results tir on ti.item_id = tir.result_id
62+
JOIN launch l ON ti.launch_id = l.id
63+
WHERE ti.has_children = false
64+
AND ti.has_stats = true
65+
AND ti.retry_of IS NULL
66+
AND ti.type = 'STEP'
67+
AND l.project_id = :projectId
68+
AND ti.name ILIKE %:name%
69+
AND CAST(tir.status AS VARCHAR) in (:statuses)
70+
""", nativeQuery = true)
71+
@QueryHints(@QueryHint(name = "javax.persistence.query.timeout", value = "10000"))
72+
Slice<TestItem> findTestItemsContainsNameAndStatuses(@Param("name") String nameTerm,
73+
@Param("projectId") Long projectId, @Param("statuses") List<String> statuses,
74+
Pageable pageable);
75+
76+
@Query(value = """
77+
SELECT ti.* FROM test_item ti
78+
JOIN launch l ON ti.launch_id = l.id
79+
LEFT JOIN item_attribute ia ON ti.item_id = ia.item_id
80+
WHERE ti.has_children = false
81+
AND ti.has_stats = true
82+
AND ti.retry_of IS NULL
83+
AND ti.type = 'STEP'
84+
AND l.project_id = :projectId
85+
AND ia.key = :key AND ia.value = :value and ia.system = false
86+
""", nativeQuery = true)
87+
@QueryHints(@QueryHint(name = "javax.persistence.query.timeout", value = "10000"))
88+
Slice<TestItem> findTestItemsByAttribute(@Param("projectId") Long projectId,
89+
@Param("key") String attributeKey,
90+
@Param("value") String attributeValue,
91+
Pageable pageable);
92+
93+
@Query(value = """
94+
SELECT ti.* FROM test_item ti
95+
JOIN test_item_results tir on ti.item_id = tir.result_id
96+
JOIN launch l ON ti.launch_id = l.id
97+
LEFT JOIN item_attribute ia ON ti.item_id = ia.item_id
98+
WHERE ti.has_children = false
99+
AND ti.has_stats = true
100+
AND ti.retry_of IS NULL
101+
AND ti.type = 'STEP'
102+
AND l.project_id = :projectId
103+
AND ia.key = :key AND ia.value = :value and ia.system = false
104+
AND CAST(tir.status AS VARCHAR) in (:statuses)
105+
""", nativeQuery = true)
106+
@QueryHints(@QueryHint(name = "javax.persistence.query.timeout", value = "10000"))
107+
Slice<TestItem> findTestItemsByAttributeAndStatuses(@Param("projectId") Long projectId,
108+
@Param("key") String attributeKey,
109+
@Param("value") String attributeValue,
110+
@Param("statuses") List<String> statuses,
111+
Pageable pageable);
112+
113+
114+
@Query(value = """
115+
SELECT ti.* FROM test_item ti
116+
JOIN launch l ON ti.launch_id = l.id
117+
LEFT JOIN item_attribute ia ON ti.item_id = ia.item_id
118+
WHERE ti.has_children = false
119+
AND ti.has_stats = true
120+
AND ti.retry_of IS NULL
121+
AND ti.type = 'STEP'
122+
AND l.project_id = :projectId
123+
AND ia.key is null AND ia.value = :value and ia.system = false
124+
""", nativeQuery = true)
125+
@QueryHints(@QueryHint(name = "javax.persistence.query.timeout", value = "10000"))
126+
Slice<TestItem> findTestItemsByAttribute(@Param("projectId") Long projectId,
127+
@Param("value") String attributeValue, Pageable pageable);
128+
129+
@Query(value = """
130+
SELECT ti.* FROM test_item ti
131+
JOIN launch l ON ti.launch_id = l.id
132+
JOIN test_item_results tir on ti.item_id = tir.result_id
133+
LEFT JOIN item_attribute ia ON ti.item_id = ia.item_id
134+
WHERE ti.has_children = false
135+
AND ti.has_stats = true
136+
AND ti.retry_of IS NULL
137+
AND ti.type = 'STEP'
138+
AND l.project_id = :projectId
139+
AND ia.key is null AND ia.value = :value and ia.system = false
140+
AND CAST(tir.status AS VARCHAR) in (:statuses)
141+
""", nativeQuery = true)
142+
@QueryHints(@QueryHint(name = "javax.persistence.query.timeout", value = "10000"))
143+
Slice<TestItem> findTestItemsByAttributeAndStatuses(@Param("projectId") Long projectId,
144+
@Param("value") String attributeValue, @Param("statuses") List<String> statuses,
145+
Pageable pageable);
146+
40147
/**
41148
* Retrieve list of test item ids for provided launch
42149
*
@@ -351,24 +458,26 @@ Optional<Long> findLatestIdByTestCaseHashAndLaunchIdWithoutParents(
351458
@Param("testCaseHash") Integer testCaseHash,
352459
@Param("launchId") Long launchId);
353460

354-
/**
355-
* Finds latest {@link TestItem#getItemId()} with specified {@code testCaseHash}, {@code launchId} and {@code parentId}
356-
*
357-
* @param testCaseHash {@link TestItem#getTestCaseHash()}
358-
* @param launchId {@link TestItem#getLaunchId()}
359-
* @param parentId {@link TestItem#getParentId()}
360-
* @return {@link Optional} of {@link TestItem#getItemId()} if exists otherwise {@link Optional#empty()}
361-
*/
362-
@Query(value =
363-
"SELECT t.item_id FROM test_item t WHERE t.test_case_hash = :testCaseHash AND t.launch_id = :launchId "
364-
+ " AND t.parent_id = :parentId AND t.has_stats AND t.retry_of IS NULL"
365-
+ " ORDER BY t.start_time DESC, t.item_id DESC LIMIT 1 FOR UPDATE", nativeQuery = true)
366-
Optional<Long> findLatestIdByTestCaseHashAndLaunchIdAndParentId(
367-
@Param("testCaseHash") Integer testCaseHash,
368-
@Param("launchId") Long launchId, @Param("parentId") Long parentId);
369-
370-
@Query(value = "SELECT t.name FROM test_item t WHERE t.item_id = :itemId", nativeQuery = true)
371-
Optional<String> findItemNameByItemId(Long itemId);
461+
/**
462+
* Finds latest {@link TestItem#getItemId()} with specified {@code testCaseHash}, {@code launchId}
463+
* and {@code parentId}
464+
*
465+
* @param testCaseHash {@link TestItem#getTestCaseHash()}
466+
* @param launchId {@link TestItem#getLaunchId()}
467+
* @param parentId {@link TestItem#getParentId()}
468+
* @return {@link Optional} of {@link TestItem#getItemId()} if exists otherwise
469+
* {@link Optional#empty()}
470+
*/
471+
@Query(value =
472+
"SELECT t.item_id FROM test_item t WHERE t.test_case_hash = :testCaseHash AND t.launch_id = :launchId "
473+
+ " AND t.parent_id = :parentId AND t.has_stats AND t.retry_of IS NULL"
474+
+ " ORDER BY t.start_time DESC, t.item_id DESC LIMIT 1 FOR UPDATE", nativeQuery = true)
475+
Optional<Long> findLatestIdByTestCaseHashAndLaunchIdAndParentId(
476+
@Param("testCaseHash") Integer testCaseHash,
477+
@Param("launchId") Long launchId, @Param("parentId") Long parentId);
478+
479+
@Query(value = "SELECT t.name FROM test_item t WHERE t.item_id = :itemId", nativeQuery = true)
480+
Optional<String> findItemNameByItemId(Long itemId);
372481

373482
/**
374483
* Count items by launch id

src/main/java/com/epam/ta/reportportal/entity/project/Project.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class Project implements Serializable {
7676
@OrderBy("creationDate desc")
7777
private Set<Integration> integrations = Sets.newHashSet();
7878

79-
@OneToMany(mappedBy = "project", cascade = {CascadeType.PERSIST}, fetch = FetchType.LAZY)
79+
@OneToMany(mappedBy = "project", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
8080
private Set<ProjectAttribute> projectAttributes = Sets.newHashSet();
8181

8282
@OneToMany(mappedBy = "project", cascade = {CascadeType.PERSIST,

src/main/java/com/epam/ta/reportportal/entity/widget/WidgetType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public enum WidgetType {
4848
CUMULATIVE("cumulative", true, false),
4949
TOP_PATTERN_TEMPLATES("topPatternTemplates", true, false),
5050
COMPONENT_HEALTH_CHECK("componentHealthCheck", true, false),
51-
COMPONENT_HEALTH_CHECK_TABLE("componentHealthCheckTable", true, false);
51+
COMPONENT_HEALTH_CHECK_TABLE("componentHealthCheckTable", true, false),
52+
TEST_CASE_SEARCH("testCaseSearch", false, false);
5253

5354
private final String type;
5455

0 commit comments

Comments
 (0)