Skip to content

Commit 4cedb72

Browse files
pbortnikgrabsefxAPiankouski
authored
Release 5.14.4 (#1131)
* EPMRPP-99168 || fix attribute filtering (#1097) * EPMRPP-99168 || fix attribute filtering * EPMRPP-103637 || Add query for updating launcher retention policy (#1108) * EPMRPP-103637 || Add query for updating launcher retention policy * EPMRPP-103637 || Change update query * EPMRPP-103637 || Change return value * EPMRPP-103637 || Add query for removing attribute by key * EPMRPP-103637 || Add system flag to the query * EPMRPP-104096 || Add transient attachments info to test item entity (#1122) * EPMRPP-104096 || Added streaming method * EPMRPP-104096 || Add transient attachments info to test item entity * EPMRPP-105146 || Move jasper related objects from dao layer (#1126) * EPMRPP-103585 || add launchId to the widget (#1128) * EPMRPP-103585 || add launchId field to the widget * EPMRPP-105732 || Fix most-failed widget displays tests without grouping (#1130) * EPMRPP-105732 || Fix grouping of to items widget * EPMRPP-105732 || Add alias * 5.14.2 || Update release version * 5.14.2 || Fix unit tests --------- Co-authored-by: Siarhei Hrabko <45555481+grabsefx@users.noreply.github.com> Co-authored-by: APiankouski <109206864+APiankouski@users.noreply.github.com> Co-authored-by: Andrei Piankouski <andrei_piankouski@epam.com>
1 parent 190fe67 commit 4cedb72

File tree

17 files changed

+129
-131
lines changed

17 files changed

+129
-131
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
SCRIPTS_VERSION: 5.14.0
1515
BOM_VERSION: 5.14.2
1616
MIGRATIONS_VERSION: 5.14.0
17-
RELEASE_VERSION: 5.14.3
17+
RELEASE_VERSION: 5.14.4
1818

1919
jobs:
2020
release:

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=5.14.3
1+
version=5.14.4
22
springBootVersion=3.4.2
33
lombokVersion=1.18.36
44
jooqVersion=3.19.18

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ Optional<ItemAttribute> findByLaunchIdAndKeyAndSystem(Long launchId, String key,
2929
boolean isSystem);
3030

3131
int deleteAllByLaunchIdAndKeyAndSystem(Long launchId, String key, boolean isSystem);
32+
33+
int deleteAllByKeyAndSystem(String key, boolean isSystem);
3234
}

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@
1919
import static org.hibernate.jpa.QueryHints.HINT_FETCH_SIZE;
2020

2121
import com.epam.ta.reportportal.entity.enums.LaunchModeEnum;
22+
import com.epam.ta.reportportal.entity.enums.RetentionPolicyEnum;
2223
import com.epam.ta.reportportal.entity.enums.StatusEnum;
2324
import com.epam.ta.reportportal.entity.item.TestItem;
2425
import com.epam.ta.reportportal.entity.item.TestItemResults;
2526
import com.epam.ta.reportportal.entity.launch.Launch;
2627
import com.epam.ta.reportportal.entity.project.Project;
28+
import jakarta.persistence.LockModeType;
29+
import jakarta.persistence.QueryHint;
2730
import java.time.Instant;
2831
import java.util.Collection;
2932
import java.util.List;
3033
import java.util.Optional;
3134
import java.util.stream.Stream;
32-
import jakarta.persistence.LockModeType;
33-
import jakarta.persistence.QueryHint;
3435
import org.springframework.data.jpa.repository.Lock;
36+
import org.springframework.data.jpa.repository.Modifying;
3537
import org.springframework.data.jpa.repository.Query;
3638
import org.springframework.data.jpa.repository.QueryHints;
3739
import org.springframework.data.repository.query.Param;
@@ -42,6 +44,22 @@
4244
public interface LaunchRepository extends ReportPortalRepository<Launch, Long>,
4345
LaunchRepositoryCustom {
4446

47+
/**
48+
* Updates the launches table setting the retention_policy column according to the provided
49+
* retention policy. Only updates records where the current retention_policy differs from the
50+
* provided one.
51+
*
52+
* @param policy the retention policy to set
53+
* @return the number of rows updated
54+
*/
55+
@Modifying
56+
@Query(value = """
57+
UPDATE Launch l
58+
SET l.retentionPolicy = :policy
59+
WHERE l.retentionPolicy <> :policy
60+
""")
61+
int updateLaunchesRetentionPolicy(RetentionPolicyEnum policy);
62+
4563
/**
4664
* Finds launch by {@link Launch#id} and sets a lock on the found launch row in the database.
4765
* Required for fetching launch from the concurrent environment to provide synchronization between
@@ -119,10 +137,10 @@ List<Launch> findLaunchesHistory(@Param("historyDepth") int historyDepth,
119137

120138
/**
121139
* @param launchId {@link Launch#getId()}
122-
* @param statuses {@link TestItemResults#getStatus()}
123-
* @return `true` if {@link TestItem#getLaunchId()} equal to provided `launchId`,
124-
* {@link TestItem#getParentId()} equal to `NULL` and {@link TestItemResults#getStatus()} is not
125-
* equal to provided `status`, otherwise return `false`
140+
* @param statuses {@link TestItemResults#getStatus()}
141+
* @return `true` if {@link TestItem#getLaunchId()} equal to provided `launchId`, {@link
142+
* TestItem#getParentId()} equal to `NULL` and {@link TestItemResults#getStatus()} is not equal to
143+
* provided `status`, otherwise return `false`
126144
*/
127145
@Query(value =
128146
"SELECT exists(SELECT 1 FROM test_item ti JOIN test_item_results tir ON ti.item_id = tir.result_id "

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.epam.ta.reportportal.dao;
1818

19+
import static org.hibernate.jpa.HibernateHints.HINT_FETCH_SIZE;
20+
1921
import com.epam.ta.reportportal.entity.enums.StatusEnum;
2022
import com.epam.ta.reportportal.entity.item.TestItem;
2123
import com.epam.ta.reportportal.entity.item.TestItemResults;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,8 @@ public List<TestItem> selectTestItemsProjection(Long launchId) {
765765
.from(TEST_ITEM)
766766
.join(TEST_ITEM_RESULTS)
767767
.on(TEST_ITEM.ITEM_ID.eq(TEST_ITEM_RESULTS.RESULT_ID))
768-
.leftJoin(ISSUE)
769-
.on(ISSUE.ISSUE_ID.eq(TEST_ITEM_RESULTS.RESULT_ID))
768+
.leftJoin(ATTACHMENT)
769+
.on(TEST_ITEM.ITEM_ID.eq(ATTACHMENT.ITEM_ID))
770770
.leftJoin(STATISTICS)
771771
.on(TEST_ITEM.ITEM_ID.eq(STATISTICS.ITEM_ID))
772772
.leftJoin(STATISTICS_FIELD)
@@ -881,8 +881,8 @@ public Optional<Pair<Long, String>> selectPath(String uuid) {
881881
}
882882

883883
/**
884-
* {@link Log} entities are searched from the whole tree under {@link TestItem} that matched to
885-
* the provided `launchId` and `autoAnalyzed` conditions
884+
* {@link Log} entities are searched from the whole tree under {@link TestItem} that matched to the provided
885+
* `launchId` and `autoAnalyzed` conditions
886886
*/
887887
@Override
888888
public List<Long> selectIdsByAnalyzedWithLevelGteExcludingIssueTypes(boolean autoAnalyzed,

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

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ public List<CriteriaHistoryItem> topItemsByCriteria(Filter filter, String criter
284284
true).otherwise(false))
285285
.orderBy(LAUNCH.NUMBER.asc())
286286
.as(STATUS_HISTORY),
287+
DSL.max(TEST_ITEM.LAUNCH_ID).as(TEST_ITEM.LAUNCH_ID.getName()),
287288
DSL.max(TEST_ITEM.START_TIME).filterWhere(
288289
fieldName(criteriaTable.getName(), CRITERIA_FLAG).cast(Integer.class).ge(1))
289290
.as(START_TIME_HISTORY),
@@ -763,7 +764,8 @@ public List<LaunchesDurationContent> launchesDurationStatistics(Filter filter, S
763764
LAUNCH.STATUS,
764765
LAUNCH.START_TIME,
765766
LAUNCH.END_TIME,
766-
timestampDiff(LAUNCH.END_TIME.cast(Timestamp.class), LAUNCH.START_TIME.cast(Timestamp.class)).as(DURATION)
767+
timestampDiff(LAUNCH.END_TIME.cast(Timestamp.class),
768+
LAUNCH.START_TIME.cast(Timestamp.class)).as(DURATION)
767769
)
768770
.from(LAUNCH)
769771
.join(LAUNCHES)
@@ -852,31 +854,31 @@ public List<LaunchesTableContent> launchesTableStatistics(Filter filter,
852854
@Override
853855
public List<ActivityResource> activityStatistics(Filter filter, Sort sort, int limit) {
854856

855-
return dsl.with(ACTIVITIES)
857+
return dsl.with(ACTIVITIES)
856858
.as(QueryBuilder.newBuilder(filter, collectJoinFields(filter, sort)).with(sort).with(limit)
857859
.build())
858-
.select(ACTIVITY.ID,
859-
ACTIVITY.EVENT_NAME,
860-
ACTIVITY.OBJECT_TYPE,
861-
ACTIVITY.CREATED_AT,
862-
ACTIVITY.DETAILS,
863-
ACTIVITY.PROJECT_ID,
864-
ACTIVITY.OBJECT_ID,
865-
ACTIVITY.OBJECT_NAME,
866-
ACTIVITY.SUBJECT_NAME,
867-
USERS.LOGIN,
868-
PROJECT.NAME
869-
)
860+
.select(ACTIVITY.ID,
861+
ACTIVITY.EVENT_NAME,
862+
ACTIVITY.OBJECT_TYPE,
863+
ACTIVITY.CREATED_AT,
864+
ACTIVITY.DETAILS,
865+
ACTIVITY.PROJECT_ID,
866+
ACTIVITY.OBJECT_ID,
867+
ACTIVITY.OBJECT_NAME,
868+
ACTIVITY.SUBJECT_NAME,
869+
USERS.LOGIN,
870+
PROJECT.NAME
871+
)
870872
.from(ACTIVITY)
871873
.join(ACTIVITIES)
872874
.on(fieldName(ACTIVITIES, ID).cast(Long.class).eq(ACTIVITY.ID))
873875
.leftJoin(USERS)
874876
.on(ACTIVITY.SUBJECT_ID.eq(USERS.ID))
875-
.join(PROJECT)
876-
.on(ACTIVITY.PROJECT_ID.eq(PROJECT.ID))
877-
.orderBy(WidgetSortUtils.sortingTransformer(filter.getTarget()).apply(sort, ACTIVITIES))
878-
.fetch()
879-
.map(ACTIVITY_MAPPER);
877+
.join(PROJECT)
878+
.on(ACTIVITY.PROJECT_ID.eq(PROJECT.ID))
879+
.orderBy(WidgetSortUtils.sortingTransformer(filter.getTarget()).apply(sort, ACTIVITIES))
880+
.fetch()
881+
.map(ACTIVITY_MAPPER);
880882

881883
}
882884

@@ -1094,7 +1096,8 @@ public List<ComponentHealthCheckContent> componentHealthCheck(Filter launchFilte
10941096
.on((TEST_ITEM.ITEM_ID.eq(ITEM_ATTRIBUTE.ITEM_ID)
10951097
.or(TEST_ITEM.LAUNCH_ID.eq(ITEM_ATTRIBUTE.LAUNCH_ID))).and(
10961098
ITEM_ATTRIBUTE.KEY.eq(currentLevelKey).and(ITEM_ATTRIBUTE.SYSTEM.isFalse())))
1097-
.groupBy(TEST_ITEM.ITEM_ID, TEST_ITEM_RESULTS.STATUS, ITEM_ATTRIBUTE.KEY, ITEM_ATTRIBUTE.VALUE)
1099+
.groupBy(TEST_ITEM.ITEM_ID, TEST_ITEM_RESULTS.STATUS, ITEM_ATTRIBUTE.KEY,
1100+
ITEM_ATTRIBUTE.VALUE)
10981101
.having(filterSkippedTests(excludeSkipped))
10991102
.asTable(ITEMS))
11001103
.groupBy(fieldName(ITEMS, VALUE))
@@ -1109,12 +1112,12 @@ public List<ComponentHealthCheckContent> componentHealthCheck(Filter launchFilte
11091112
private Condition filterSkippedTests(boolean excludeSkipped) {
11101113
Condition condition = DSL.noCondition();
11111114
if (excludeSkipped) {
1112-
return DSL.notExists(
1113-
dsl.selectOne().from(STATISTICS).join(STATISTICS_FIELD)
1114-
.on(STATISTICS.STATISTICS_FIELD_ID.eq(STATISTICS_FIELD.SF_ID))
1115-
.where(TEST_ITEM.ITEM_ID.eq(STATISTICS.ITEM_ID)
1116-
.and(STATISTICS.STATISTICS_FIELD_ID.eq(STATISTICS_FIELD.SF_ID))
1117-
.and(STATISTICS_FIELD.NAME.eq(EXECUTIONS_SKIPPED))));
1115+
return DSL.notExists(
1116+
dsl.selectOne().from(STATISTICS).join(STATISTICS_FIELD)
1117+
.on(STATISTICS.STATISTICS_FIELD_ID.eq(STATISTICS_FIELD.SF_ID))
1118+
.where(TEST_ITEM.ITEM_ID.eq(STATISTICS.ITEM_ID)
1119+
.and(STATISTICS.STATISTICS_FIELD_ID.eq(STATISTICS_FIELD.SF_ID))
1120+
.and(STATISTICS_FIELD.NAME.eq(EXECUTIONS_SKIPPED))));
11181121
}
11191122
return condition;
11201123
}
@@ -1453,7 +1456,8 @@ private List<Field<?>> getCommonProductStatusFields(Filter filter,
14531456
.where(STATISTICS_FIELD.NAME.eq(EXECUTIONS_TOTAL)
14541457
.and(STATISTICS.LAUNCH_ID.eq(LAUNCH.ID)))
14551458
.asField(), 0)), 2).as(PASSING_RATE),
1456-
timestampDiff(LAUNCH.END_TIME.cast(Timestamp.class), LAUNCH.START_TIME.cast(Timestamp.class))
1459+
timestampDiff(LAUNCH.END_TIME.cast(Timestamp.class),
1460+
LAUNCH.START_TIME.cast(Timestamp.class))
14571461
.as(DURATION)
14581462
);
14591463

src/main/java/com/epam/ta/reportportal/dao/util/ResultFetchers.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ private ResultFetchers() {
186186
}
187187
testItem.getItemResults().getStatistics()
188188
.add(RecordMappers.STATISTICS_RECORD_MAPPER.map(record));
189+
testItem.getAttachments().add(RecordMappers.ATTACHMENT_MAPPER.map(record));
189190
testItems.put(id, testItem);
190191
});
191192
return new ArrayList<>(testItems.values());

src/main/java/com/epam/ta/reportportal/dao/util/WidgetContentUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ private static void proceedProductStatusAttributes(Record record, String columnN
498498
entry.setName(record.get(TEST_ITEM.NAME));
499499
entry.setUniqueId(record.get(TEST_ITEM.UNIQUE_ID));
500500
entry.setStartTime(Collections.singletonList(record.get(DSL.field(fieldName(START_TIME_HISTORY)), Instant.class)));
501+
entry.setLaunchId(record.get(TEST_ITEM.LAUNCH_ID));
501502
return entry;
502503
})
503504
.collect(Collectors.toList());

src/main/java/com/epam/ta/reportportal/entity/attachment/Attachment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
package com.epam.ta.reportportal.entity.attachment;
1818

1919
import com.epam.ta.reportportal.dao.converters.JpaInstantConverter;
20-
import java.io.Serializable;
21-
import java.time.Instant;
22-
import java.util.Objects;
2320
import jakarta.persistence.Column;
2421
import jakarta.persistence.Convert;
2522
import jakarta.persistence.Entity;
2623
import jakarta.persistence.GeneratedValue;
2724
import jakarta.persistence.GenerationType;
2825
import jakarta.persistence.Id;
2926
import jakarta.persistence.Table;
27+
import java.io.Serializable;
28+
import java.time.Instant;
29+
import java.util.Objects;
3030

3131
/**
3232
* @author <a href="mailto:ivan_budayeu@epam.com">Ivan Budayeu</a>

0 commit comments

Comments
 (0)