Skip to content

Commit

Permalink
EPMHLM-348
Browse files Browse the repository at this point in the history
Fix Vulnerabilities from dependencies
  • Loading branch information
Alex-Reif committed Oct 30, 2023
1 parent 8f4c4be commit 40df466
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 78 deletions.
18 changes: 8 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
plugins {
id 'org.springframework.boot' version '2.7.14'
id 'io.spring.dependency-management' version "1.1.0"
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version "1.1.3"
id 'java'
id 'maven-publish'
id 'jacoco'
}

group 'com.epam.healenium'
version '3.4.1'
version '3.4.2'


repositories {
Expand Down Expand Up @@ -36,17 +36,15 @@ dependencies {
implementation 'org.projectlombok:lombok:1.18.22'
implementation 'org.mapstruct:mapstruct:1.3.1.Final'

implementation 'org.testcontainers:junit-jupiter:1.18.3'
implementation 'org.testcontainers:junit-jupiter:1.19.1'
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.24.0'
testImplementation 'org.testcontainers:postgresql:1.18.3'
testImplementation('org.testcontainers:testcontainers:1.18.3')
testImplementation 'io.rest-assured:rest-assured:4.5.1'
testImplementation 'org.springframework:spring-test:5.3.22'
testImplementation 'io.rest-assured:rest-assured:5.3.2'

testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.boot:spring-boot-starter-test'

annotationProcessor 'org.hibernate:hibernate-jpamodelgen:5.4.14.Final'
annotationProcessor 'org.hibernate.orm:hibernate-jpamodelgen:6.3.1.Final'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.3.1.Final'
Expand Down
2 changes: 1 addition & 1 deletion example/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
- healenium

healenium:
image: healenium/hlm-backend:3.4.1
image: healenium/hlm-backend:3.4.2
container_name: healenium
restart: on-failure
ports:
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
14 changes: 14 additions & 0 deletions src/main/java/com/epam/healenium/config/WebConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.epam.healenium.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfiguration implements WebMvcConfigurer {

@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseTrailingSlashMatch(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import com.epam.healenium.model.wrapper.NodePathWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.persistence.AttributeConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.persistence.AttributeConverter;

import java.io.IOException;

@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import com.epam.healenium.model.wrapper.RecordWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.persistence.AttributeConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.persistence.AttributeConverter;

import java.io.IOException;

@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class ReportUUIDGenerator extends UUIDGenerator {

@Override
public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException {
Serializable id = session.getEntityPersister(null, object)
Serializable id = (Serializable) session.getEntityPersister(null, object)
.getClassMetadata().getIdentifier(object, session);
return id != null ? id : super.generate(session, object);
return id != null ? id : (Serializable) super.generate(session, object);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import com.epam.healenium.model.domain.Selector;
import com.epam.healenium.repository.SelectorRepository;
import com.epam.healenium.service.SelectorService;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Slf4j(topic = "healenium")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/epam/healenium/model/domain/Healing.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.epam.healenium.model.domain;

import jakarta.persistence.*;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.Set;

Expand Down
26 changes: 5 additions & 21 deletions src/main/java/com/epam/healenium/model/domain/HealingResult.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,21 @@
package com.epam.healenium.model.domain;

import com.epam.healenium.model.Locator;
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import jakarta.persistence.*;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;

import java.time.LocalDateTime;

@Getter
@Setter
@Entity
@Table(name = "healing_result")
@TypeDefs({
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
})
public class HealingResult {

@Id
Expand All @@ -40,7 +24,7 @@ public class HealingResult {
private Integer id;

@Column(name = "locator", columnDefinition = "jsonb")
@Type(type = "jsonb")
@JdbcTypeCode(SqlTypes.JSON)
@Basic(fetch = FetchType.LAZY)
private Locator locator;

Expand Down
17 changes: 2 additions & 15 deletions src/main/java/com/epam/healenium/model/domain/Report.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,12 @@

import com.epam.healenium.converter.RecordWrapperConverter;
import com.epam.healenium.model.wrapper.RecordWrapper;
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import jakarta.persistence.*;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import java.time.LocalDateTime;

/**
Expand All @@ -29,9 +19,6 @@
@Data
@Entity
@Table(name = "report")
@TypeDefs({
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
})
public class Report {

@Id
Expand Down
20 changes: 4 additions & 16 deletions src/main/java/com/epam/healenium/model/domain/Selector.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@
import com.epam.healenium.converter.NodeConverter;
import com.epam.healenium.model.Locator;
import com.epam.healenium.model.wrapper.NodePathWrapper;
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import jakarta.persistence.*;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.ColumnTransformer;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import java.time.LocalDateTime;

/**
Expand All @@ -31,9 +22,6 @@
@Data
@Entity
@Table(name = "selector")
@TypeDefs({
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
})
public class Selector {

@Id
Expand All @@ -50,7 +38,7 @@ public class Selector {
private String methodName;

@Column(name = "locator", columnDefinition = "json")
@Type(type = "jsonb")
@JdbcTypeCode(SqlTypes.JSON)
@Basic(fetch = FetchType.LAZY)
@ColumnTransformer(read = "locator::json")
private Locator locator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
@Repository
public interface SelectorRepository extends JpaRepository<Selector, String> {

List<Selector> findByLocator(String locatorValue);

List<Selector> findByCommandAndEnableHealing(String command, boolean enableHealing);

List<Selector> findByCommandNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import com.epam.healenium.specification.HealingSpecBuilder;
import com.epam.healenium.util.StreamUtils;
import com.epam.healenium.util.Utils;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.transaction.Transactional;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.epam.healenium.service.SelectorService;
import com.epam.healenium.treecomparing.Node;
import com.epam.healenium.util.Utils;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.map.PassiveExpiringMap;
Expand All @@ -25,7 +26,6 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.transaction.Transactional;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import com.epam.healenium.model.domain.Selector_;
import com.epam.healenium.model.dto.RequestDto;
import com.epam.healenium.util.JpaTools;
import jakarta.persistence.criteria.Join;
import lombok.experimental.UtilityClass;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.util.StringUtils;

import javax.persistence.criteria.Join;


@UtilityClass
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/epam/healenium/util/JpaTools.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.epam.healenium.util;

import jakarta.persistence.criteria.*;
import jakarta.persistence.metamodel.SetAttribute;
import jakarta.persistence.metamodel.SingularAttribute;
import lombok.experimental.UtilityClass;

import javax.persistence.criteria.*;
import javax.persistence.metamodel.SetAttribute;
import javax.persistence.metamodel.SingularAttribute;


@UtilityClass
public class JpaTools {
Expand Down

0 comments on commit 40df466

Please sign in to comment.