diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..99eeafeb72a93872eddc32a452429036c847d977 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM openjdk:11 +MAINTAINER haridas <haridas.kakunje@tarento.com> +ADD target/comment-hub-0.0.1-SNAPSHOT.jar comment-hub-0.0.1-SNAPSHOT.jar +#ADD public/emails emails +ENTRYPOINT ["java", "-jar", "/comment-hub-0.0.1-SNAPSHOT.jar"] +EXPOSE 8099 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..e4534a9bf3fb87755228737bedd5f9f9562f38a3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3' +services: + comment-hub: + image: comment-hub-dev:1.10 + build: + context: . + ports: + - '8099:8099' diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..754a18e1085a1a896b573dcfdf63a548b03d98b0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>2.7.15</version> + <relativePath/> <!-- lookup parent from repository --> + </parent> + <groupId>com.tarento</groupId> + <artifactId>comment-hub</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>comment-hub</name> + <description>Demo project for Spring Boot</description> + <properties> + <java.version>11</java.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-redis</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.vladmihalcea</groupId> + <artifactId>hibernate-types-52</artifactId> + <version>2.3.4</version> + </dependency> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-ui</artifactId> + <version>1.6.12</version> + </dependency> + <dependency> + <groupId>com.auth0</groupId> + <artifactId>java-jwt</artifactId> + <version>4.4.0</version> + </dependency> + <dependency> + <groupId>com.fasterxml.uuid</groupId> + <artifactId>java-uuid-generator</artifactId> + <version>4.2.0</version> + </dependency> + <dependency> + <groupId>com.networknt</groupId> + <artifactId>json-schema-validator</artifactId> + <version>1.0.86</version> + <exclusions> + <exclusion> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <excludes> + <exclude> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </exclude> + </excludes> + </configuration> + </plugin> + </plugins> + <finalName>comment-hub-0.0.1-SNAPSHOT</finalName> + </build> + +</project> diff --git a/src/main/java/com/tarento/commenthub/CommentHubApplication.java b/src/main/java/com/tarento/commenthub/CommentHubApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..5bae5d8f04a3c07fc85d2b11adb4b57005b61d92 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/CommentHubApplication.java @@ -0,0 +1,13 @@ +package com.tarento.commenthub; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CommentHubApplication { + + public static void main(String[] args) { + SpringApplication.run(CommentHubApplication.class, args); + } + +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/config/RedisConfig.java b/src/main/java/com/tarento/commenthub/config/RedisConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..19cf13415813b9ae1e6b9a8d1af08d14f28677bd --- /dev/null +++ b/src/main/java/com/tarento/commenthub/config/RedisConfig.java @@ -0,0 +1,24 @@ + +package com.tarento.commenthub.config; + + +import com.tarento.commenthub.entity.Comment; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +@Configuration +public class RedisConfig { + + @Bean + public RedisTemplate<String, Comment> redisTemplate(RedisConnectionFactory connectionFactory) { + RedisTemplate<String, Comment> redisTemplate = new RedisTemplate<>(); + redisTemplate.setConnectionFactory(connectionFactory); + redisTemplate.setKeySerializer(new StringRedisSerializer()); + return redisTemplate; + } + +} + diff --git a/src/main/java/com/tarento/commenthub/constant/Constants.java b/src/main/java/com/tarento/commenthub/constant/Constants.java new file mode 100644 index 0000000000000000000000000000000000000000..f21ab9be431b3fd682a6761bb584c3dbbf33ab43 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/constant/Constants.java @@ -0,0 +1,61 @@ +package com.tarento.commenthub.constant; + +public class Constants { + + private Constants() { + + } + + public static final String ENTITY_ID = "entityId"; + + public static final String ENTITY_TYPE = "entityType"; + + public static final String WORKFLOW = "workflow"; + + public static final String COMMENT_ID = "commentId"; + + public static final String COMMENT_TREE_ID = "commentTreeId"; + + public static final String COMMENT_KEY = "comment_"; + + public static final String COMMENTS = "comments"; + + public static final String CHILD_NODES = "childNodes"; + + public static final String ERROR = "ERROR"; + + public static final String HIERARCHY_PATH = "hierarchyPath"; + + public static final String COMMENT_DATA = "commentData"; + + public static final String COMMENT_TREE_DATA = "commentTreeData"; + + public static final String CHILDREN = "children"; + + public static final String FIRST_LEVEL_NODES = "firstLevelNodes"; + + public static final String COMMENT_SOURCE = "commentSource"; + public static final String FILE = "file"; + public static final String SUCCESS_STRING = "success"; + + public static final String DUPLICATE_TREE_ERROR = "DUPLICATE TREE CREATION ERROR"; + + public static final String DUPLICATE_TREE_ERROR_MESSAGE = + "Failed to create a new comment tree. " + + "A comment tree with the same 'entityType,' 'entityId,' and 'workflow' already exists."; + + public static final String WRONG_HIERARCHY_PATH_ERROR = "WRONG HIERARCHY PATH ERROR"; + public static final String ADD_FIRST_COMMENT_PAYLOAD_VALIDATION_FILE = "/payloadValidation/firstComment.json"; + public static final String ADD_NEW_COMMENT_PAYLOAD_VALIDATION_FILE = "/payloadValidation/newComment.json"; + public static final String UPDATE_EXISTING_COMMENT_VALIDATION_FILE = "/payloadValidation/updateComment.json"; + public static final String RESOLVED = "resolved"; + + public static final String COMMENT_RESOLVED = "commentResolved"; + + public static final String TRUE = "true"; + + public static final String FALSE = "false"; + + + +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/controller/CommentController.java b/src/main/java/com/tarento/commenthub/controller/CommentController.java new file mode 100644 index 0000000000000000000000000000000000000000..df979f02cb233bbcfe04d14fe8628498c5b82213 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/controller/CommentController.java @@ -0,0 +1,111 @@ +package com.tarento.commenthub.controller; + +import com.fasterxml.jackson.databind.JsonNode; +import com.tarento.commenthub.constant.Constants; +import com.tarento.commenthub.dto.CommentTreeIdentifierDTO; +import com.tarento.commenthub.dto.MultipleWorkflowsCommentResponseDTO; +import com.tarento.commenthub.dto.CommentsResoponseDTO; +import com.tarento.commenthub.dto.ResponseDTO; +import com.tarento.commenthub.entity.Comment; +import com.tarento.commenthub.entity.CommentTree; +import com.tarento.commenthub.service.CommentService; +import com.tarento.commenthub.service.CommentTreeService; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/v1/comment") +@Slf4j +public class CommentController { + + @Autowired + CommentTreeService commentTreeService; + + @Autowired + private CommentService commentService; + + @PostMapping("/addFirst") + public ResponseDTO addFirstComment(@RequestBody JsonNode payload) { + return commentService.addFirstCommentToCreateTree(payload); + } + + @PostMapping("/addNew") + public ResponseDTO addNewComment(@RequestBody JsonNode payload) { + return commentService.addNewCommentToTree(payload); + } + + @PutMapping("/update") + public ResponseDTO updateExistingComment(@RequestBody JsonNode payload) { + return commentService.updateExistingComment(payload); + } + + @GetMapping("/getAll") + public CommentsResoponseDTO getComments( + @RequestParam(name = "entityType") String entityType, + @RequestParam(name = "entityId") String entityId, + @RequestParam(name = "workflow") String workflow) { + + CommentTreeIdentifierDTO commentTreeIdentifierDTO = new CommentTreeIdentifierDTO(); + commentTreeIdentifierDTO.setEntityType(entityType); + commentTreeIdentifierDTO.setEntityId(entityId); + commentTreeIdentifierDTO.setWorkflow(workflow); + + return commentService.getComments(commentTreeIdentifierDTO); + } + + @GetMapping("/multipleWorkflows") + public List<MultipleWorkflowsCommentResponseDTO> getCommentsForMultipleWorkflows( + @RequestParam(name = "entityType") String entityType, + @RequestParam(name = "entityId") String entityId, + @RequestParam(name = "workflow") List<String> workflows) { + return commentService.getComments(entityType, entityId, workflows); + } + + @DeleteMapping("/delete/{commentId}") + public Comment deleteComment( + @PathVariable String commentId, + @RequestParam(name = "entityType") String entityType, + @RequestParam(name = "entityId") String entityId, + @RequestParam(name = "workflow") String workflow) { + + CommentTreeIdentifierDTO commentTreeIdentifierDTO = new CommentTreeIdentifierDTO(); + commentTreeIdentifierDTO.setEntityType(entityType); + commentTreeIdentifierDTO.setEntityId(entityId); + commentTreeIdentifierDTO.setWorkflow(workflow); + + return commentService.deleteCommentById(commentId, commentTreeIdentifierDTO); + } + + @PostMapping("/setStatusToResolved") + public CommentTree setCommentTreeStatusToResolved( + @RequestParam(name = "entityType") String entityType, + @RequestParam(name = "entityId") String entityId, + @RequestParam(name = "workflow") String workflow) { + + CommentTreeIdentifierDTO commentTreeIdentifierDTO = new CommentTreeIdentifierDTO(); + commentTreeIdentifierDTO.setEntityType(entityType); + commentTreeIdentifierDTO.setEntityId(entityId); + commentTreeIdentifierDTO.setWorkflow(workflow); + return commentTreeService.setCommentTreeStatusToResolved(commentTreeIdentifierDTO); + } + + @PostMapping("/{commentId}/resolve") + public Comment resolveComment(@PathVariable String commentId) { + return commentService.resolveComment(commentId); + } + + @GetMapping("/health") + public String healthCheck() { + return Constants.SUCCESS_STRING; + } +} diff --git a/src/main/java/com/tarento/commenthub/dto/CommentTreeIdentifierDTO.java b/src/main/java/com/tarento/commenthub/dto/CommentTreeIdentifierDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..df645a4c08d47e721fe70ee7646b3eea1258f9bb --- /dev/null +++ b/src/main/java/com/tarento/commenthub/dto/CommentTreeIdentifierDTO.java @@ -0,0 +1,19 @@ +package com.tarento.commenthub.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class CommentTreeIdentifierDTO { + + private String entityType; + + private String entityId; + + private String workflow; +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/dto/CommentsResoponseDTO.java b/src/main/java/com/tarento/commenthub/dto/CommentsResoponseDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..93b21a68f500c274d78d3d5d14c368fedadfbfed --- /dev/null +++ b/src/main/java/com/tarento/commenthub/dto/CommentsResoponseDTO.java @@ -0,0 +1,22 @@ +package com.tarento.commenthub.dto; + +import com.tarento.commenthub.entity.Comment; +import com.tarento.commenthub.entity.CommentTree; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class CommentsResoponseDTO { + + private CommentTree commentTree; + + private List<Comment> comments; + + private int commentCount; +} diff --git a/src/main/java/com/tarento/commenthub/dto/MultipleWorkflowsCommentResponseDTO.java b/src/main/java/com/tarento/commenthub/dto/MultipleWorkflowsCommentResponseDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..0606cfe5279e98389c6254ca136a0dc992040201 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/dto/MultipleWorkflowsCommentResponseDTO.java @@ -0,0 +1,20 @@ +package com.tarento.commenthub.dto; + +import com.tarento.commenthub.entity.Comment; +import com.tarento.commenthub.entity.CommentTree; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class MultipleWorkflowsCommentResponseDTO { + + private CommentTree commentTree; + private List<Comment> comments; + private int commentCount; +} diff --git a/src/main/java/com/tarento/commenthub/dto/ResponseDTO.java b/src/main/java/com/tarento/commenthub/dto/ResponseDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..f2c4c2bede2e148c187165eca4dcb8a6d8e285c5 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/dto/ResponseDTO.java @@ -0,0 +1,19 @@ +package com.tarento.commenthub.dto; + +import com.tarento.commenthub.entity.Comment; +import com.tarento.commenthub.entity.CommentTree; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class ResponseDTO { + + private CommentTree commentTree; + + private Comment comment; +} diff --git a/src/main/java/com/tarento/commenthub/entity/Comment.java b/src/main/java/com/tarento/commenthub/entity/Comment.java new file mode 100644 index 0000000000000000000000000000000000000000..b97aa47be57f197f0f38d017cdd64d0ae2803d34 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/entity/Comment.java @@ -0,0 +1,44 @@ +package com.tarento.commenthub.entity; + +import com.fasterxml.jackson.databind.JsonNode; +import com.vladmihalcea.hibernate.type.json.JsonBinaryType; +import java.io.Serializable; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.Type; +import org.hibernate.annotations.TypeDef; +import org.hibernate.annotations.UpdateTimestamp; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Entity +@Table(name = "comment") +@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class) +public class Comment implements Serializable { + + @Id + private String commentId; + + @Type(type = "jsonb") + @Column(columnDefinition = "jsonb") + private JsonNode commentData; + + @Column(columnDefinition = "varchar(255) default 'active'") + private String status; + + private Timestamp createdDate; + + private Timestamp lastUpdatedDate; + +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/entity/CommentTree.java b/src/main/java/com/tarento/commenthub/entity/CommentTree.java new file mode 100644 index 0000000000000000000000000000000000000000..d21810b74e3a5547e4faa4f8c92238ede1b0320e --- /dev/null +++ b/src/main/java/com/tarento/commenthub/entity/CommentTree.java @@ -0,0 +1,42 @@ +package com.tarento.commenthub.entity; + +import com.fasterxml.jackson.databind.JsonNode; +import com.vladmihalcea.hibernate.type.json.JsonBinaryType; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.Type; +import org.hibernate.annotations.TypeDef; +import org.hibernate.annotations.UpdateTimestamp; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Entity +@Table(name = "comment_tree") +@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class) +public class CommentTree { + + @Id + private String commentTreeId; + + @Type(type = "jsonb") + @Column(columnDefinition = "jsonb") + private JsonNode commentTreeData; + + @Column(columnDefinition = "varchar(255) default 'active'") + private String status; + + private Timestamp createdDate; + + private Timestamp lastUpdatedDate; +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/exception/CommentException.java b/src/main/java/com/tarento/commenthub/exception/CommentException.java new file mode 100644 index 0000000000000000000000000000000000000000..d416671ea0146e2a79dcc3ad5941274c4d51c756 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/exception/CommentException.java @@ -0,0 +1,36 @@ +package com.tarento.commenthub.exception; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.stereotype.Component; + +import java.util.Map; + +@Getter +@Setter +@Component +public class CommentException extends RuntimeException{ + private String code; + private String message; + private String httpStatusCode; + private Map<String, String> errors; + + public CommentException() { + } + + public CommentException(String code, String message) { + this.code = code; + this.message = message; + } + + public CommentException(String code, String message, String httpStatusCode) { + this.code = code; + this.message = message; + this.httpStatusCode = httpStatusCode; + } + + public CommentException(Map<String, String> errors) { + this.message = errors.toString(); + this.errors = errors; + } +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/exception/ErrorResponse.java b/src/main/java/com/tarento/commenthub/exception/ErrorResponse.java new file mode 100644 index 0000000000000000000000000000000000000000..1fd718d040d758c02df141b53fe5ca4237c20a63 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/exception/ErrorResponse.java @@ -0,0 +1,15 @@ +package com.tarento.commenthub.exception; + +import java.util.Map; +import lombok.Builder; +import lombok.Value; + +@Value +@Builder +public class ErrorResponse { + + private String code; + private String message; + private Map<String, String> errors; + private String httpStatusCode; +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/exception/RestExceptionHandling.java b/src/main/java/com/tarento/commenthub/exception/RestExceptionHandling.java new file mode 100644 index 0000000000000000000000000000000000000000..297ac9018c3d5913de4f43fc95c358336d44b7d1 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/exception/RestExceptionHandling.java @@ -0,0 +1,40 @@ +package com.tarento.commenthub.exception; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +@RestControllerAdvice +@Slf4j +public class RestExceptionHandling { + + @ExceptionHandler(Exception.class) + public ResponseEntity handleException(Exception ex) { + log.debug("RestExceptionHandler::handleException::" + ex); + HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR; + ErrorResponse errorResponse = null; + if (ex instanceof CommentException) { + CommentException commentException = (CommentException) ex; + status = HttpStatus.BAD_REQUEST; + errorResponse = ErrorResponse.builder() + .code(commentException.getCode()) + .message(commentException.getMessage()) + .httpStatusCode(commentException.getHttpStatusCode() != null + ? commentException.getHttpStatusCode() + : String.valueOf(status.value())) + .build(); + if (StringUtils.isNotBlank(commentException.getMessage())) { + log.error(commentException.getMessage()); + } + + return new ResponseEntity<>(errorResponse, status); + } + errorResponse = ErrorResponse.builder() + .code(ex.getMessage()).build(); + return new ResponseEntity<>(errorResponse, status); + } + +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/repository/CommentRepository.java b/src/main/java/com/tarento/commenthub/repository/CommentRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..ef6f10a86f329182eb33a56261f83c964ab97994 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/repository/CommentRepository.java @@ -0,0 +1,22 @@ +package com.tarento.commenthub.repository; + +import com.tarento.commenthub.entity.Comment; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +public interface CommentRepository extends JpaRepository<Comment, String> { + + + Optional<Comment> findByCommentIdAndStatus(String id, String status); + + List<Comment> findByCommentIdInAndStatus(List<String> ids, String status); + + List<Comment> findByStatus(String status); + + @Query(value = "SELECT created_date FROM comment WHERE comment_id = ?1", nativeQuery = true) + LocalDateTime getCreatedDateByCommentId(String commentId); + +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/repository/CommentTreeRepository.java b/src/main/java/com/tarento/commenthub/repository/CommentTreeRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..84dc8056c810db9a7fd4c75e0d797d94e8621d2c --- /dev/null +++ b/src/main/java/com/tarento/commenthub/repository/CommentTreeRepository.java @@ -0,0 +1,28 @@ +package com.tarento.commenthub.repository; + +import com.tarento.commenthub.entity.CommentTree; +import java.util.List; +import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface CommentTreeRepository extends JpaRepository<CommentTree, String> { + + @Query(value = "SELECT * " + + "FROM comment_tree " + + "WHERE comment_tree_id IN (" + + " SELECT comment_tree_id " + + " FROM comment_tree " + + " WHERE (comment_tree_data->>'entityId' = :entityId AND comment_tree_data->>'entityType' = :entityType " + + " AND comment_tree_data->>'workflow' IN (:workflowList))" + + ")", nativeQuery = true) + List<CommentTree> getAllCommentTreeForMultipleWorkflows( + @Param("entityId") String entityId, + @Param("entityType") String entityType, + @Param("workflowList") List<String> workflowList + ); + + @Query(value = "SELECT COUNT(*) FROM comment_tree WHERE comment_tree_id = ?1", nativeQuery = true) + int getIdCount(String commentTreeId); +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/service/CommentService.java b/src/main/java/com/tarento/commenthub/service/CommentService.java new file mode 100644 index 0000000000000000000000000000000000000000..67419432785391a4c62f1e43f793cfc535eee9c6 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/service/CommentService.java @@ -0,0 +1,29 @@ +package com.tarento.commenthub.service; + +import com.fasterxml.jackson.databind.JsonNode; +import com.tarento.commenthub.dto.CommentTreeIdentifierDTO; +import com.tarento.commenthub.dto.MultipleWorkflowsCommentResponseDTO; +import com.tarento.commenthub.dto.CommentsResoponseDTO; +import com.tarento.commenthub.dto.ResponseDTO; +import com.tarento.commenthub.entity.Comment; +import io.swagger.v3.core.util.Json; +import java.util.List; + +public interface CommentService { + + ResponseDTO addFirstCommentToCreateTree(JsonNode payload); + + ResponseDTO addNewCommentToTree(JsonNode payload); + + ResponseDTO updateExistingComment(JsonNode paylaod); + + CommentsResoponseDTO getComments(CommentTreeIdentifierDTO commentTreeIdentifierDTO); + + List<MultipleWorkflowsCommentResponseDTO> getComments(String entityType, String entityId, + List<String> workflowList); + + Comment deleteCommentById(String commentId, CommentTreeIdentifierDTO commentTreeIdentifierDTO); + + Comment resolveComment(String commentId); + +} diff --git a/src/main/java/com/tarento/commenthub/service/CommentTreeService.java b/src/main/java/com/tarento/commenthub/service/CommentTreeService.java new file mode 100644 index 0000000000000000000000000000000000000000..2661975175598173165054c06ae7dfd68d9bff18 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/service/CommentTreeService.java @@ -0,0 +1,26 @@ +package com.tarento.commenthub.service; + +import com.fasterxml.jackson.databind.JsonNode; +import com.tarento.commenthub.dto.CommentTreeIdentifierDTO; +import com.tarento.commenthub.entity.CommentTree; +import java.util.List; + +public interface CommentTreeService { + + CommentTree createCommentTree(JsonNode payload); + + CommentTree updateCommentTree(JsonNode payload); + + CommentTree getCommentTreeById(String commentTreeId); + + CommentTree getCommentTree(CommentTreeIdentifierDTO commentTreeIdentifierDTO); + + void updateCommentTreeForDeletedComment(String commentId, + CommentTreeIdentifierDTO commentTreeIdentifierDTO); + + List<CommentTree> getAllCommentTreeForMultipleWorkflows(String entityType, String entityId, + List<String> workflows); + + CommentTree setCommentTreeStatusToResolved(CommentTreeIdentifierDTO commentTreeIdentifierDTO); + +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/service/impl/CommentServiceImpl.java b/src/main/java/com/tarento/commenthub/service/impl/CommentServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e702012732795e1f74302852a4f6ece4d5951c5c --- /dev/null +++ b/src/main/java/com/tarento/commenthub/service/impl/CommentServiceImpl.java @@ -0,0 +1,269 @@ +package com.tarento.commenthub.service.impl; + +import static com.tarento.commenthub.constant.Constants.COMMENT_KEY; +import static com.tarento.commenthub.utility.CommentsUtility.containsNull; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.uuid.Generators; +import com.networknt.schema.JsonSchema; +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.ValidationMessage; +import com.tarento.commenthub.constant.Constants; +import com.tarento.commenthub.dto.CommentTreeIdentifierDTO; +import com.tarento.commenthub.dto.MultipleWorkflowsCommentResponseDTO; +import com.tarento.commenthub.dto.CommentsResoponseDTO; +import com.tarento.commenthub.dto.ResponseDTO; +import com.tarento.commenthub.entity.Comment; +import com.tarento.commenthub.entity.CommentTree; +import com.tarento.commenthub.exception.CommentException; +import com.tarento.commenthub.repository.CommentRepository; +import com.tarento.commenthub.service.CommentService; +import com.tarento.commenthub.service.CommentTreeService; +import com.tarento.commenthub.utility.Status; +import java.io.InputStream; +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class CommentServiceImpl implements CommentService { + + @Autowired + private CommentRepository commentRepository; + + @Autowired + private CommentTreeService commentTreeService; + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private RedisTemplate redisTemplate; + + @Value("${redis.ttl}") + private long redisTtl; + + @Override + public ResponseDTO addFirstCommentToCreateTree(JsonNode payload) { + validatePayload(Constants.ADD_FIRST_COMMENT_PAYLOAD_VALIDATION_FILE, payload); + Comment comment = getPersistedComment(payload); + + ((ObjectNode) payload).put(Constants.COMMENT_ID, comment.getCommentId()); + CommentTree commentTree = commentTreeService.createCommentTree(payload); + + ResponseDTO responseDTO = new ResponseDTO(); + responseDTO.setComment(comment); + responseDTO.setCommentTree(commentTree); + return responseDTO; + } + + @Override + public ResponseDTO addNewCommentToTree(JsonNode payload) { + validatePayload(Constants.ADD_NEW_COMMENT_PAYLOAD_VALIDATION_FILE, payload); + Comment comment = getPersistedComment(payload); + ((ObjectNode) payload).put(Constants.COMMENT_ID, comment.getCommentId()); + CommentTree commentTree = commentTreeService.updateCommentTree(payload); + + ResponseDTO responseDTO = new ResponseDTO(); + responseDTO.setComment(comment); + responseDTO.setCommentTree(commentTree); + return responseDTO; + } + + @Override + public ResponseDTO updateExistingComment(JsonNode paylaod) { + validatePayload(Constants.UPDATE_EXISTING_COMMENT_VALIDATION_FILE, paylaod); + if (paylaod.get(Constants.COMMENT_ID) == null + || paylaod.get(Constants.COMMENT_ID).asText().isEmpty()) { + throw new CommentException( + Constants.ERROR, "To update an existing comment, please provide a valid commentId."); + } + + log.info("commentId: " + paylaod.get(Constants.COMMENT_ID).asText()); + + Optional<Comment> optComment = + commentRepository.findById(paylaod.get(Constants.COMMENT_ID).asText()); + + if (!optComment.isPresent() + || !optComment.get().getStatus().equalsIgnoreCase(Status.ACTIVE.name())) { + throw new CommentException( + Constants.ERROR, "The requested comment was not found or has been deleted."); + } + + Comment commentToBeUpdated = optComment.get(); + commentToBeUpdated.setCommentData(paylaod.get(Constants.COMMENT_DATA)); + + Timestamp currentTime = new Timestamp(System.currentTimeMillis()); + commentToBeUpdated.setLastUpdatedDate(currentTime); + Comment updatedComment = commentRepository.save(commentToBeUpdated); + redisTemplate.opsForValue() + .set(COMMENT_KEY + commentToBeUpdated.getCommentId(), updatedComment, redisTtl, + TimeUnit.SECONDS); + CommentTree commentTree = + commentTreeService.getCommentTreeById(paylaod.get(Constants.COMMENT_TREE_ID).asText()); + ResponseDTO responseDTO = new ResponseDTO(); + responseDTO.setComment(updatedComment); + responseDTO.setCommentTree(commentTree); + + return responseDTO; + } + + @Override + public CommentsResoponseDTO getComments(CommentTreeIdentifierDTO commentTreeIdentifierDTO) { + CommentTree commentTree = commentTreeService.getCommentTree(commentTreeIdentifierDTO); + JsonNode childNodes = commentTree.getCommentTreeData().get(Constants.CHILD_NODES); + List<String> childNodeList = objectMapper.convertValue(childNodes, List.class); + log.info("CommentServiceImpl::getComments::fetch comments from redis"); + List<Comment> comments = redisTemplate.opsForValue().multiGet(getKeys(childNodeList)); + if (containsNull(comments)) { + log.info("CommentServiceImpl::getComments::fetch Comments from postgres"); + // Fetch from db and add fetched comments into redis + comments = commentRepository.findByCommentIdInAndStatus(childNodeList, + Status.ACTIVE.name().toLowerCase()); + comments.stream(). + forEach(comment -> + redisTemplate.opsForValue() + .set(COMMENT_KEY + comment.getCommentId(), comment, redisTtl, TimeUnit.SECONDS)); + } + CommentsResoponseDTO commentsResoponseDTO = new CommentsResoponseDTO(); + commentsResoponseDTO.setComments(comments); + commentsResoponseDTO.setCommentTree(commentTree); + Optional.ofNullable(comments) + .ifPresent(commentsList -> commentsResoponseDTO.setCommentCount(commentsList.size())); + return commentsResoponseDTO; + } + + @Override + public List<MultipleWorkflowsCommentResponseDTO> getComments(String entityType, String entityId, + List<String> workflowList) { + + List<CommentTree> commentTreeList = commentTreeService.getAllCommentTreeForMultipleWorkflows(entityType, + entityId, + workflowList); + return commentTreeList.stream() + .map(commentTree -> { + JsonNode childNodes = commentTree.getCommentTreeData().get(Constants.CHILD_NODES); + List<String> childNodeList = objectMapper.convertValue(childNodes, List.class); + log.info("CommentServiceImpl::getComments::fetch comments from redis"); + List<Comment> comments = redisTemplate.opsForValue().multiGet(getKeys(childNodeList)); + if (containsNull(comments)) { + log.info("CommentServiceImpl::getComments::fetch Comments from postgres"); + // Fetch from db and add fetched comments into redis + comments = commentRepository.findByCommentIdInAndStatus(childNodeList, + Status.ACTIVE.name().toLowerCase()); + comments.forEach(comment -> + redisTemplate.opsForValue() + .set(COMMENT_KEY + comment.getCommentId(), comment, redisTtl, TimeUnit.SECONDS) + ); + } + MultipleWorkflowsCommentResponseDTO multipleWorkflowsCommentResponseDTO = new MultipleWorkflowsCommentResponseDTO(); + multipleWorkflowsCommentResponseDTO.setCommentTree(commentTree); + Optional.ofNullable(comments) + .ifPresent(commentsList -> multipleWorkflowsCommentResponseDTO.setCommentCount( + commentsList.size())); + multipleWorkflowsCommentResponseDTO.setComments(comments); + return multipleWorkflowsCommentResponseDTO; + }) + .collect(Collectors.toList()); + } + + @Override + public Comment deleteCommentById( + String commentId, CommentTreeIdentifierDTO commentTreeIdentifierDTO) { + log.info("CommentServiceImpl::deleteCommentById: Deleting comment with ID: {}", commentId); + Optional<Comment> fetchedComment = commentRepository.findById(commentId); + if (!fetchedComment.isPresent()) { + throw new CommentException(Constants.ERROR, "No such comment found"); + } + Comment comment = fetchedComment.get(); + if (!comment.getStatus().equalsIgnoreCase(Status.ACTIVE.name())) { + throw new CommentException( + Constants.ERROR, "You are trying to delete an already deleted comment"); + } + comment.setStatus(Status.INACTIVE.name().toLowerCase()); + comment = commentRepository.save(comment); + redisTemplate.opsForValue().getOperations().delete(COMMENT_KEY + commentId); + commentTreeService.updateCommentTreeForDeletedComment(commentId, commentTreeIdentifierDTO); + return comment; + } + + private String generateCommentId() { + UUID uuid = Generators.timeBasedGenerator().generate(); + return uuid.toString(); + } + + public Comment getPersistedComment(JsonNode commentPayload) { + Comment comment = new Comment(); + String commentId = generateCommentId(); + comment.setCommentId(commentId); + comment.setCommentData(commentPayload.get(Constants.COMMENT_DATA)); + // Set Status default value 'active' for new comment + comment.setStatus(Status.ACTIVE.name().toLowerCase()); + ObjectNode objectNode = (ObjectNode) comment.getCommentData(); + // Set commentResolved default value 'false' for new comment + objectNode.put(Constants.COMMENT_RESOLVED, Constants.FALSE); + Timestamp currentTime = new Timestamp(System.currentTimeMillis()); + comment.setCreatedDate(currentTime); + comment.setLastUpdatedDate(currentTime); + comment = commentRepository.save(comment); + redisTemplate.opsForValue() + .set(COMMENT_KEY + comment.getCommentId(), comment, redisTtl, TimeUnit.SECONDS); + return comment; + } + + public void validatePayload(String fileName, JsonNode payload) { + try { + JsonSchemaFactory schemaFactory = JsonSchemaFactory.getInstance(); + InputStream schemaStream = schemaFactory.getClass().getResourceAsStream(fileName); + JsonSchema schema = schemaFactory.getSchema(schemaStream); + + Set<ValidationMessage> validationMessages = schema.validate(payload); + if (!validationMessages.isEmpty()) { + StringBuilder errorMessage = new StringBuilder("Validation error(s): \n"); + for (ValidationMessage message : validationMessages) { + errorMessage.append(message.getMessage()).append("\n"); + } + throw new CommentException(Constants.ERROR, errorMessage.toString()); + } + } catch (Exception e) { + throw new CommentException(Constants.ERROR, "Failed to validate payload: " + e.getMessage()); + } + } + + private List<String> getKeys(List<String> childNodeList) { + return childNodeList.stream().map(id -> COMMENT_KEY + id) + .collect(Collectors.toList()); + } + + @Override + public Comment resolveComment(String commentId) { + log.info("CommentServiceImpl::resolveComment: Resolving comment with ID: {}", commentId); + Optional<Comment> fetchedComment = commentRepository.findById(commentId); + if (!fetchedComment.isPresent()) { + throw new CommentException(Constants.ERROR, "No such comment found"); + } + Comment comment = fetchedComment.get(); + ObjectNode objectNode = (ObjectNode) comment.getCommentData(); + objectNode.put(Constants.COMMENT_RESOLVED, Constants.TRUE); + Timestamp currentTime = new Timestamp(System.currentTimeMillis()); + comment.setLastUpdatedDate(currentTime); + comment = commentRepository.save(comment); + redisTemplate.opsForValue() + .set(COMMENT_KEY + commentId, comment, redisTtl, + TimeUnit.SECONDS); + return comment; + } + +} \ No newline at end of file diff --git a/src/main/java/com/tarento/commenthub/service/impl/CommentTreeServiceImpl.java b/src/main/java/com/tarento/commenthub/service/impl/CommentTreeServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9f84199630af78cd3bbe8ec059ab83fd6e60fc2b --- /dev/null +++ b/src/main/java/com/tarento/commenthub/service/impl/CommentTreeServiceImpl.java @@ -0,0 +1,265 @@ +package com.tarento.commenthub.service.impl; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.algorithms.Algorithm; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.tarento.commenthub.constant.Constants; +import com.tarento.commenthub.dto.CommentTreeIdentifierDTO; +import com.tarento.commenthub.entity.CommentTree; +import com.tarento.commenthub.exception.CommentException; +import com.tarento.commenthub.repository.CommentTreeRepository; +import com.tarento.commenthub.service.CommentTreeService; +import com.tarento.commenthub.utility.Status; +import java.sql.Timestamp; +import java.util.List; +import java.util.Optional; +import lombok.extern.log4j.Log4j2; +import net.bytebuddy.implementation.bytecode.Throw; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +@Service +@Log4j2 +public class CommentTreeServiceImpl implements CommentTreeService { + + @Value("${jwt.secret.key}") + private String jwtSecretKey; + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private CommentTreeRepository commentTreeRepository; + + public CommentTree createCommentTree(JsonNode payload) { + CommentTreeIdentifierDTO commentTreeIdentifierDTO = getCommentTreeIdentifierDTO( + payload.get(Constants.COMMENT_TREE_DATA)); + String commentTreeId = generateJwtTokenKey(commentTreeIdentifierDTO); + int commentTreeIdCount = commentTreeRepository.getIdCount(commentTreeId); + if (commentTreeIdCount > 0) { + throw new CommentException(Constants.DUPLICATE_TREE_ERROR, + Constants.DUPLICATE_TREE_ERROR_MESSAGE); + } + + try { + CommentTree commentTree = new CommentTree(); + commentTree.setCommentTreeId(commentTreeId); + // Set Status default value 'active' for new commentTree + commentTree.setStatus(Status.ACTIVE.name().toLowerCase()); + // Create an object node for a comment entry + ObjectNode commentEntryNode = objectMapper.createObjectNode(); + commentEntryNode.set(Constants.COMMENT_ID, payload.get(Constants.COMMENT_ID)); + + ObjectNode commentTreeObjNode = (ObjectNode) payload.get(Constants.COMMENT_TREE_DATA); + commentTreeObjNode.putArray(Constants.COMMENTS).add(commentEntryNode); + commentTreeObjNode.putArray(Constants.CHILD_NODES).add(payload.get(Constants.COMMENT_ID)); + commentTreeObjNode.putArray(Constants.FIRST_LEVEL_NODES) + .add(payload.get(Constants.COMMENT_ID)); + commentTree.setCommentTreeData(commentTreeObjNode); + + Timestamp currentTime = new Timestamp(System.currentTimeMillis()); + commentTree.setCreatedDate(currentTime); + commentTree.setLastUpdatedDate(currentTime); + + return commentTreeRepository.save(commentTree); + } catch (Exception e) { + e.printStackTrace(); + throw new CommentException(Constants.ERROR, e.getMessage()); + } + } + + public CommentTree updateCommentTree(JsonNode payload) { + CommentTree commentTree; + String commentTreeId = payload.get(Constants.COMMENT_TREE_ID).asText(); + Optional<CommentTree> optCommentTree = commentTreeRepository.findById(commentTreeId); + if (optCommentTree.isPresent()) { + commentTree = optCommentTree.get(); + JsonNode commentTreeJson = commentTree.getCommentTreeData(); + + try { + // Create an object node for a comment entry + ObjectNode commentEntryNode = objectMapper.createObjectNode(); + commentEntryNode.set(Constants.COMMENT_ID, payload.get(Constants.COMMENT_ID)); + + if (payload.get(Constants.HIERARCHY_PATH) != null && !payload.get( + Constants.HIERARCHY_PATH).isEmpty()) { + String[] hierarchyPath = objectMapper.treeToValue( + payload.get(Constants.HIERARCHY_PATH), String[].class); + // Find the target position based on the hierarchy path + JsonNode targetJsonNode = findTargetNode(commentTreeJson.get(Constants.COMMENTS), + hierarchyPath, 0); + if (targetJsonNode == null) { + throw new CommentException(Constants.ERROR, Constants.WRONG_HIERARCHY_PATH_ERROR); + } + if (targetJsonNode.isArray()) { + ArrayNode targetArrayNode = (ArrayNode) targetJsonNode; + targetArrayNode.add(commentEntryNode); + } else { + if (targetJsonNode.get(Constants.CHILDREN) != null) { + ArrayNode childrenArrayNode = (ArrayNode) targetJsonNode.get(Constants.CHILDREN); + childrenArrayNode.add(commentEntryNode); + } else { + ObjectNode targetObjectNode = (ObjectNode) targetJsonNode; + targetObjectNode.putArray(Constants.CHILDREN).add(commentEntryNode); + } + } + } else { + ArrayNode targetArrayNode = (ArrayNode) commentTreeJson.get(Constants.COMMENTS); + targetArrayNode.add(commentEntryNode); + // Retrieve the existing firstLevelNodes array + ArrayNode firstLevelNodesArray = (ArrayNode) commentTreeJson.get( + Constants.FIRST_LEVEL_NODES); + // Add the new comment ID to the existing firstLevelNodes array + firstLevelNodesArray.add(payload.get(Constants.COMMENT_ID)); + } + // Retrieve the existing childNodes array + ArrayNode childNodesArray = (ArrayNode) commentTreeJson.get(Constants.CHILD_NODES); + //Add the new comment ID to the existing childNodes array + childNodesArray.add(payload.get(Constants.COMMENT_ID)); + + Timestamp currentTime = new Timestamp(System.currentTimeMillis()); + commentTree.setLastUpdatedDate(currentTime); + return commentTreeRepository.save(commentTree); + } catch (Exception e) { + e.printStackTrace(); + throw new CommentException(Constants.ERROR, e.getMessage()); + } + } + return null; + } + + public static JsonNode findTargetNode(JsonNode currentNode, String[] hierarchyPath, int index) { + if (index >= hierarchyPath.length) { + return currentNode; + } + + String targetCommentId = hierarchyPath[index]; + if (currentNode.isArray()) { + for (JsonNode childNode : currentNode) { + if (childNode.isObject() && targetCommentId.equals( + childNode.get(Constants.COMMENT_ID).asText()) + && childNode.get(Constants.CHILDREN) != null) { + return findTargetNode(childNode.get(Constants.CHILDREN), hierarchyPath, index + 1); + } else if (childNode.isObject() && targetCommentId.equals( + childNode.get(Constants.COMMENT_ID).asText())) { + return findTargetNode(childNode, hierarchyPath, index + 1); + } + } + } + return null; + } + + @Override + public CommentTree getCommentTreeById(String commentTreeId) { + Optional<CommentTree> optionalCommentTree = commentTreeRepository.findById(commentTreeId); + if (optionalCommentTree.isPresent()) { + return optionalCommentTree.get(); + } + return null; + } + + @Override + public CommentTree getCommentTree(CommentTreeIdentifierDTO commentTreeIdentifierDTO) { + String commentTreeId = generateJwtTokenKey(commentTreeIdentifierDTO); + Optional<CommentTree> optionalCommentTree = commentTreeRepository.findById(commentTreeId); + if (optionalCommentTree.isPresent()) { + return optionalCommentTree.get(); + } + throw new CommentException(Constants.ERROR, "Comment Tree not found"); + } + + @Override + public void updateCommentTreeForDeletedComment(String commentId, + CommentTreeIdentifierDTO commentTreeIdentifierDTO) { + log.info("Updating comment tree for deleted comment with ID: {}", commentId); + Optional<CommentTree> optionalCommentTree = commentTreeRepository.findById( + generateJwtTokenKey(commentTreeIdentifierDTO)); + if (optionalCommentTree.isPresent()) { + CommentTree commentTreeToBeUpdated = optionalCommentTree.get(); + JsonNode jsonNode = commentTreeToBeUpdated.getCommentTreeData(); + + boolean commentIdFound = false; + // To remove commentId from childNodes + ArrayNode childNodes = (ArrayNode) jsonNode.get(Constants.CHILD_NODES); + for (int i = 0; i < childNodes.size(); i++) { + if (commentId.equals(childNodes.get(i).asText())) { + commentIdFound = true; + childNodes.remove(i); + break; // Exit the loop once the ID is found and removed + } + } + + if (!commentIdFound) { + throw new CommentException(Constants.ERROR, + "Comment, you're trying to delete not found in the specified comment tree." + + " Please double-check the 'entityType', 'entityId', and 'workflow' values to locate the correct comment tree."); + } + + // To remove commentId from firstLevelNodes + ArrayNode firstLevelNodes = (ArrayNode) jsonNode.get(Constants.FIRST_LEVEL_NODES); + for (int i = 0; i < firstLevelNodes.size(); i++) { + if (commentId.equals(firstLevelNodes.get(i).asText())) { + firstLevelNodes.remove(i); + break; // Exit the loop once the ID is found and removed + } + } + + commentTreeRepository.save(commentTreeToBeUpdated); + } + } + + public String generateJwtTokenKey(CommentTreeIdentifierDTO commentTreeIdentifierDTO) { + log.info("generating JwtTokenKey"); + + if (StringUtils.isAnyBlank( + commentTreeIdentifierDTO.getEntityId(), + commentTreeIdentifierDTO.getEntityType(), + commentTreeIdentifierDTO.getWorkflow())) { + throw new CommentException(Constants.ERROR, + "Please provide values for 'entityType', 'entityId', and 'workflow' as all of these fields are mandatory."); + } + + String jwtToken = JWT.create() + .withClaim(Constants.ENTITY_ID, commentTreeIdentifierDTO.getEntityId()) + .withClaim(Constants.ENTITY_TYPE, commentTreeIdentifierDTO.getEntityType()) + .withClaim(Constants.WORKFLOW, commentTreeIdentifierDTO.getWorkflow()) + .sign(Algorithm.HMAC256(jwtSecretKey)); + + log.info("commentTreeId: {}", jwtToken); + return jwtToken; + } + + + public CommentTreeIdentifierDTO getCommentTreeIdentifierDTO(JsonNode commentTreeData) { + return new CommentTreeIdentifierDTO( + commentTreeData.get(Constants.ENTITY_TYPE).asText(), + commentTreeData.get(Constants.ENTITY_ID).asText(), + commentTreeData.get(Constants.WORKFLOW).asText() + ); + } + + @Override + public List<CommentTree> getAllCommentTreeForMultipleWorkflows(String entityType, String entityId, + List<String> workflowList) { + return commentTreeRepository.getAllCommentTreeForMultipleWorkflows(entityId, entityType, workflowList); + } + + @Override + public CommentTree setCommentTreeStatusToResolved( + CommentTreeIdentifierDTO commentTreeIdentifierDTO) { + Optional<CommentTree> optionalCommentTree = commentTreeRepository.findById( + generateJwtTokenKey(commentTreeIdentifierDTO)); + if(optionalCommentTree.isPresent()) { + CommentTree commentTree = optionalCommentTree.get(); + commentTree.setStatus(Constants.RESOLVED); + return commentTreeRepository.save(commentTree); + } + throw new CommentException(Constants.ERROR,"Comment Tree not found"); + } + +} diff --git a/src/main/java/com/tarento/commenthub/utility/CommentsUtility.java b/src/main/java/com/tarento/commenthub/utility/CommentsUtility.java new file mode 100644 index 0000000000000000000000000000000000000000..904247aa8751ca4ff96ae7cf0d186fcc4ae9ded3 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/utility/CommentsUtility.java @@ -0,0 +1,20 @@ +package com.tarento.commenthub.utility; + +import java.util.List; + +public class CommentsUtility { + + public static boolean containsNull(List<?> list) { + if (list == null) { + return true; + } + + for (Object element : list) { + if (element == null) { + return true; + } + } + + return false; + } +} diff --git a/src/main/java/com/tarento/commenthub/utility/Status.java b/src/main/java/com/tarento/commenthub/utility/Status.java new file mode 100644 index 0000000000000000000000000000000000000000..4e407e53c4480472794ab1efe48913cd4fcea556 --- /dev/null +++ b/src/main/java/com/tarento/commenthub/utility/Status.java @@ -0,0 +1,6 @@ +package com.tarento.commenthub.utility; + +public enum Status { + ACTIVE, + INACTIVE +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea8f01a3674e34a6c8ba21b43ff558a51ecb4f --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,30 @@ +server.port=8099 + +# PostgreSQL configuration +spring.datasource.url=jdbc:postgresql://10.0.2.18:5432/commentdb +spring.datasource.username=postgres +spring.datasource.password=yoursupersecret +spring.datasource.driver-class-name=org.postgresql.Driver + +## Hibernate Properties +# The SQL dialect makes Hibernate generate better SQL for the chosen database +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect +spring.jpa.properties.hibernate.format_sql=true +spring.jpa.show-sql=false +spring.jpa.hibernate.ddl-auto=update + +#------------------secretes------------# +jwt.secret.key=comment-hub + +#----------------------------------Redis ----------------------------- +spring.redis.host=10.0.2.18 +spring.redis.port=6379 +#spring.redis.password=KZ9u%Z&mki4&p35 +# 14 days in second 14 * 24 * 60 * 60 +redis.ttl=86400 + +#----------------------------Configure Logback pattern ----------------------- +logging.pattern.console=%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n +logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n +# Log to console and file +logging.file=logs/commentHub.log \ No newline at end of file diff --git a/src/main/resources/payloadValidation/firstComment.json b/src/main/resources/payloadValidation/firstComment.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0e4459f5a3b79a9ad883ca6aa223ea9eedb405 --- /dev/null +++ b/src/main/resources/payloadValidation/firstComment.json @@ -0,0 +1,66 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "commentTreeData": { + "type": "object", + "properties": { + "entityId": { + "type": "string", + "minLength": 1 + }, + "entityType": { + "type": "string", + "minLength": 1 + }, + "workflow": { + "type": "string", + "minLength": 1 + } + }, + "required": ["entityId", "entityType", "workflow"], + "additionalProperties": false + }, + "commentData": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "minLength": 1 + }, + "file": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "commentSource": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "minLength": 1 + }, + "userPic": { + "type": "string", + "minLength": 1 + }, + "userName": { + "type": "string" + }, + "userRole": { + "type": "string" + } + }, + "required": ["userId", "userPic", "userRole"], + "additionalProperties": false + } + }, + "required": ["comment", "commentSource"], + "additionalProperties": false + } + }, + "required": ["commentTreeData", "commentData"], + "additionalProperties": false +} diff --git a/src/main/resources/payloadValidation/newComment.json b/src/main/resources/payloadValidation/newComment.json new file mode 100644 index 0000000000000000000000000000000000000000..1c0042f0288c2da16e4970f9f3427e3efae515da --- /dev/null +++ b/src/main/resources/payloadValidation/newComment.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "commentTreeId": { + "type": "string" + }, + "hierarchyPath": { + "type": "array", + "items": { + "type": "string" + } + }, + "commentData": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "minLength": 1 + }, + "file": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "commentSource": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "minLength": 1 + }, + "userPic": { + "type": "string", + "minLength": 1 + }, + "userName": { + "type": "string" + }, + "userRole": { + "type": "string" + } + }, + "required": ["userId", "userPic", "userRole"], + "additionalProperties": false + } + }, + "required": ["comment", "commentSource"], + "additionalProperties": false + } + }, + "required": ["commentTreeId", "commentData"], + "additionalProperties": false +} \ No newline at end of file diff --git a/src/main/resources/payloadValidation/updateComment.json b/src/main/resources/payloadValidation/updateComment.json new file mode 100644 index 0000000000000000000000000000000000000000..0b609584a8cfbee01e56049569bccf28c57ef3e1 --- /dev/null +++ b/src/main/resources/payloadValidation/updateComment.json @@ -0,0 +1,57 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "commentTreeId": { + "type": "string" + }, + "commentId": { + "type": "string" + }, + "commentData": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "minLength": 1 + }, + "file": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "commentSource": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "minLength": 1 + }, + "userPic": { + "type": "string", + "minLength": 1 + }, + "userName": { + "type": "string" + }, + "userRole": { + "type": "string" + } + }, + "required": ["userId", "userPic", "userRole"], + "additionalProperties": false + }, + "commentResolved": { + "type": "string", + "minLength": 1 + } + }, + "required": ["comment", "commentSource", "commentResolved"], + "additionalProperties": false + } + }, + "required": ["commentTreeId", "commentId", "commentData"], + "additionalProperties": false +} \ No newline at end of file diff --git a/src/test/java/com/tarento/commenthub/CommentHubApplicationTests.java b/src/test/java/com/tarento/commenthub/CommentHubApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..834aaff694a66f3e96550b3b665cef4c89eb6fac --- /dev/null +++ b/src/test/java/com/tarento/commenthub/CommentHubApplicationTests.java @@ -0,0 +1,13 @@ +package com.tarento.commenthub; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class CommentHubApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/target/classes/application.properties b/target/classes/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..8dea8f01a3674e34a6c8ba21b43ff558a51ecb4f --- /dev/null +++ b/target/classes/application.properties @@ -0,0 +1,30 @@ +server.port=8099 + +# PostgreSQL configuration +spring.datasource.url=jdbc:postgresql://10.0.2.18:5432/commentdb +spring.datasource.username=postgres +spring.datasource.password=yoursupersecret +spring.datasource.driver-class-name=org.postgresql.Driver + +## Hibernate Properties +# The SQL dialect makes Hibernate generate better SQL for the chosen database +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect +spring.jpa.properties.hibernate.format_sql=true +spring.jpa.show-sql=false +spring.jpa.hibernate.ddl-auto=update + +#------------------secretes------------# +jwt.secret.key=comment-hub + +#----------------------------------Redis ----------------------------- +spring.redis.host=10.0.2.18 +spring.redis.port=6379 +#spring.redis.password=KZ9u%Z&mki4&p35 +# 14 days in second 14 * 24 * 60 * 60 +redis.ttl=86400 + +#----------------------------Configure Logback pattern ----------------------- +logging.pattern.console=%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n +logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n +# Log to console and file +logging.file=logs/commentHub.log \ No newline at end of file diff --git a/target/classes/com/tarento/commenthub/CommentHubApplication.class b/target/classes/com/tarento/commenthub/CommentHubApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..d335accab9138ffc24164a984f82609b7f980f8e Binary files /dev/null and b/target/classes/com/tarento/commenthub/CommentHubApplication.class differ diff --git a/target/classes/com/tarento/commenthub/config/RedisConfig.class b/target/classes/com/tarento/commenthub/config/RedisConfig.class new file mode 100644 index 0000000000000000000000000000000000000000..2ba6a9926aa17bdd664036d26b434db3b3f8026b Binary files /dev/null and b/target/classes/com/tarento/commenthub/config/RedisConfig.class differ diff --git a/target/classes/com/tarento/commenthub/constant/Constants.class b/target/classes/com/tarento/commenthub/constant/Constants.class new file mode 100644 index 0000000000000000000000000000000000000000..c78cc72d04a81f237f022ce4415dd85caadd432e Binary files /dev/null and b/target/classes/com/tarento/commenthub/constant/Constants.class differ diff --git a/target/classes/com/tarento/commenthub/controller/CommentController.class b/target/classes/com/tarento/commenthub/controller/CommentController.class new file mode 100644 index 0000000000000000000000000000000000000000..586c029e1503c9f70089341d605d67928efe8cd4 Binary files /dev/null and b/target/classes/com/tarento/commenthub/controller/CommentController.class differ diff --git a/target/classes/com/tarento/commenthub/dto/CommentTreeIdentifierDTO.class b/target/classes/com/tarento/commenthub/dto/CommentTreeIdentifierDTO.class new file mode 100644 index 0000000000000000000000000000000000000000..b85f9401a08c170715923995272467e8e206835c Binary files /dev/null and b/target/classes/com/tarento/commenthub/dto/CommentTreeIdentifierDTO.class differ diff --git a/target/classes/com/tarento/commenthub/dto/CommentsResoponseDTO.class b/target/classes/com/tarento/commenthub/dto/CommentsResoponseDTO.class new file mode 100644 index 0000000000000000000000000000000000000000..7750feed86b0baed1d5ecb97edc8e1fc0467bb86 Binary files /dev/null and b/target/classes/com/tarento/commenthub/dto/CommentsResoponseDTO.class differ diff --git a/target/classes/com/tarento/commenthub/dto/MultipleWorkflowsCommentResponseDTO.class b/target/classes/com/tarento/commenthub/dto/MultipleWorkflowsCommentResponseDTO.class new file mode 100644 index 0000000000000000000000000000000000000000..9be19e2f0724bfc7129a723eb086127045e26b89 Binary files /dev/null and b/target/classes/com/tarento/commenthub/dto/MultipleWorkflowsCommentResponseDTO.class differ diff --git a/target/classes/com/tarento/commenthub/dto/ResponseDTO.class b/target/classes/com/tarento/commenthub/dto/ResponseDTO.class new file mode 100644 index 0000000000000000000000000000000000000000..ad6a082b9e53dee2c8353894ad347a335e5d516e Binary files /dev/null and b/target/classes/com/tarento/commenthub/dto/ResponseDTO.class differ diff --git a/target/classes/com/tarento/commenthub/entity/Comment.class b/target/classes/com/tarento/commenthub/entity/Comment.class new file mode 100644 index 0000000000000000000000000000000000000000..ebce6d4971285a9423ecbbe12563e0208974c92b Binary files /dev/null and b/target/classes/com/tarento/commenthub/entity/Comment.class differ diff --git a/target/classes/com/tarento/commenthub/entity/CommentTree.class b/target/classes/com/tarento/commenthub/entity/CommentTree.class new file mode 100644 index 0000000000000000000000000000000000000000..010a5ae9c338996a545630941fb0f59b3d3c738d Binary files /dev/null and b/target/classes/com/tarento/commenthub/entity/CommentTree.class differ diff --git a/target/classes/com/tarento/commenthub/exception/CommentException.class b/target/classes/com/tarento/commenthub/exception/CommentException.class new file mode 100644 index 0000000000000000000000000000000000000000..022eb70000e5228c7fde4e983fbb4f93fc0e0e1e Binary files /dev/null and b/target/classes/com/tarento/commenthub/exception/CommentException.class differ diff --git a/target/classes/com/tarento/commenthub/exception/ErrorResponse$ErrorResponseBuilder.class b/target/classes/com/tarento/commenthub/exception/ErrorResponse$ErrorResponseBuilder.class new file mode 100644 index 0000000000000000000000000000000000000000..e230396f45ec49db6fcad57918c847cf34af5d64 Binary files /dev/null and b/target/classes/com/tarento/commenthub/exception/ErrorResponse$ErrorResponseBuilder.class differ diff --git a/target/classes/com/tarento/commenthub/exception/ErrorResponse.class b/target/classes/com/tarento/commenthub/exception/ErrorResponse.class new file mode 100644 index 0000000000000000000000000000000000000000..9211df77acfb9fceda927eba0cc7f015b6f036fb Binary files /dev/null and b/target/classes/com/tarento/commenthub/exception/ErrorResponse.class differ diff --git a/target/classes/com/tarento/commenthub/exception/RestExceptionHandling.class b/target/classes/com/tarento/commenthub/exception/RestExceptionHandling.class new file mode 100644 index 0000000000000000000000000000000000000000..971d83fd69a99107a78d6e13a01646b2b6a65242 Binary files /dev/null and b/target/classes/com/tarento/commenthub/exception/RestExceptionHandling.class differ diff --git a/target/classes/com/tarento/commenthub/repository/CommentRepository.class b/target/classes/com/tarento/commenthub/repository/CommentRepository.class new file mode 100644 index 0000000000000000000000000000000000000000..8e170c93fb1ca92e7cf5a81b4f9fe81641bc7672 Binary files /dev/null and b/target/classes/com/tarento/commenthub/repository/CommentRepository.class differ diff --git a/target/classes/com/tarento/commenthub/repository/CommentTreeRepository.class b/target/classes/com/tarento/commenthub/repository/CommentTreeRepository.class new file mode 100644 index 0000000000000000000000000000000000000000..98d3b4fc45762dc6ee1d39abfaaae5e5f6f06db6 Binary files /dev/null and b/target/classes/com/tarento/commenthub/repository/CommentTreeRepository.class differ diff --git a/target/classes/com/tarento/commenthub/service/CommentService.class b/target/classes/com/tarento/commenthub/service/CommentService.class new file mode 100644 index 0000000000000000000000000000000000000000..b5c49cab6db028069ac2104e149590a589e517a6 Binary files /dev/null and b/target/classes/com/tarento/commenthub/service/CommentService.class differ diff --git a/target/classes/com/tarento/commenthub/service/CommentTreeService.class b/target/classes/com/tarento/commenthub/service/CommentTreeService.class new file mode 100644 index 0000000000000000000000000000000000000000..4a1e810e9363b43ebbd08cf2cb6a92950071412b Binary files /dev/null and b/target/classes/com/tarento/commenthub/service/CommentTreeService.class differ diff --git a/target/classes/com/tarento/commenthub/service/impl/CommentServiceImpl.class b/target/classes/com/tarento/commenthub/service/impl/CommentServiceImpl.class new file mode 100644 index 0000000000000000000000000000000000000000..074760e6e963a8a73f52dd22a26906ca9423d5c7 Binary files /dev/null and b/target/classes/com/tarento/commenthub/service/impl/CommentServiceImpl.class differ diff --git a/target/classes/com/tarento/commenthub/service/impl/CommentTreeServiceImpl.class b/target/classes/com/tarento/commenthub/service/impl/CommentTreeServiceImpl.class new file mode 100644 index 0000000000000000000000000000000000000000..8b9f24ffee137f6aae42938ef8a9ed70ce446377 Binary files /dev/null and b/target/classes/com/tarento/commenthub/service/impl/CommentTreeServiceImpl.class differ diff --git a/target/classes/com/tarento/commenthub/utility/CommentsUtility.class b/target/classes/com/tarento/commenthub/utility/CommentsUtility.class new file mode 100644 index 0000000000000000000000000000000000000000..c62b13bf690391af594acaefa47196efe498ece1 Binary files /dev/null and b/target/classes/com/tarento/commenthub/utility/CommentsUtility.class differ diff --git a/target/classes/com/tarento/commenthub/utility/Status.class b/target/classes/com/tarento/commenthub/utility/Status.class new file mode 100644 index 0000000000000000000000000000000000000000..219fc18bda1763735165d13343ea1c3374fd5494 Binary files /dev/null and b/target/classes/com/tarento/commenthub/utility/Status.class differ diff --git a/target/classes/payloadValidation/firstComment.json b/target/classes/payloadValidation/firstComment.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0e4459f5a3b79a9ad883ca6aa223ea9eedb405 --- /dev/null +++ b/target/classes/payloadValidation/firstComment.json @@ -0,0 +1,66 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "commentTreeData": { + "type": "object", + "properties": { + "entityId": { + "type": "string", + "minLength": 1 + }, + "entityType": { + "type": "string", + "minLength": 1 + }, + "workflow": { + "type": "string", + "minLength": 1 + } + }, + "required": ["entityId", "entityType", "workflow"], + "additionalProperties": false + }, + "commentData": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "minLength": 1 + }, + "file": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "commentSource": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "minLength": 1 + }, + "userPic": { + "type": "string", + "minLength": 1 + }, + "userName": { + "type": "string" + }, + "userRole": { + "type": "string" + } + }, + "required": ["userId", "userPic", "userRole"], + "additionalProperties": false + } + }, + "required": ["comment", "commentSource"], + "additionalProperties": false + } + }, + "required": ["commentTreeData", "commentData"], + "additionalProperties": false +} diff --git a/target/classes/payloadValidation/newComment.json b/target/classes/payloadValidation/newComment.json new file mode 100644 index 0000000000000000000000000000000000000000..1c0042f0288c2da16e4970f9f3427e3efae515da --- /dev/null +++ b/target/classes/payloadValidation/newComment.json @@ -0,0 +1,56 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "commentTreeId": { + "type": "string" + }, + "hierarchyPath": { + "type": "array", + "items": { + "type": "string" + } + }, + "commentData": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "minLength": 1 + }, + "file": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "commentSource": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "minLength": 1 + }, + "userPic": { + "type": "string", + "minLength": 1 + }, + "userName": { + "type": "string" + }, + "userRole": { + "type": "string" + } + }, + "required": ["userId", "userPic", "userRole"], + "additionalProperties": false + } + }, + "required": ["comment", "commentSource"], + "additionalProperties": false + } + }, + "required": ["commentTreeId", "commentData"], + "additionalProperties": false +} \ No newline at end of file diff --git a/target/classes/payloadValidation/updateComment.json b/target/classes/payloadValidation/updateComment.json new file mode 100644 index 0000000000000000000000000000000000000000..0b609584a8cfbee01e56049569bccf28c57ef3e1 --- /dev/null +++ b/target/classes/payloadValidation/updateComment.json @@ -0,0 +1,57 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "commentTreeId": { + "type": "string" + }, + "commentId": { + "type": "string" + }, + "commentData": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "minLength": 1 + }, + "file": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "commentSource": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "minLength": 1 + }, + "userPic": { + "type": "string", + "minLength": 1 + }, + "userName": { + "type": "string" + }, + "userRole": { + "type": "string" + } + }, + "required": ["userId", "userPic", "userRole"], + "additionalProperties": false + }, + "commentResolved": { + "type": "string", + "minLength": 1 + } + }, + "required": ["comment", "commentSource", "commentResolved"], + "additionalProperties": false + } + }, + "required": ["commentTreeId", "commentId", "commentData"], + "additionalProperties": false +} \ No newline at end of file diff --git a/target/comment-hub-0.0.1-SNAPSHOT.jar b/target/comment-hub-0.0.1-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..7a395699dca43764110d68a141a40c7f37263e75 Binary files /dev/null and b/target/comment-hub-0.0.1-SNAPSHOT.jar differ diff --git a/target/comment-hub-0.0.1-SNAPSHOT.jar.original b/target/comment-hub-0.0.1-SNAPSHOT.jar.original new file mode 100644 index 0000000000000000000000000000000000000000..4267d355428fc873e13d98d09c55b7bc1bca9e6e Binary files /dev/null and b/target/comment-hub-0.0.1-SNAPSHOT.jar.original differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..d872baba53a1d2a1c0a1f825f1a7948e5fd9239c --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=comment-hub +groupId=com.tarento +version=0.0.1-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..dd87b7ff944c65b5e91b18761d7e3a7ca97c5e77 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,22 @@ +com/tarento/commenthub/dto/CommentTreeIdentifierDTO.class +com/tarento/commenthub/entity/Comment.class +com/tarento/commenthub/CommentHubApplication.class +com/tarento/commenthub/utility/CommentsUtility.class +com/tarento/commenthub/utility/Status.class +com/tarento/commenthub/entity/CommentTree.class +com/tarento/commenthub/service/impl/CommentServiceImpl.class +com/tarento/commenthub/exception/ErrorResponse.class +com/tarento/commenthub/exception/RestExceptionHandling.class +com/tarento/commenthub/service/impl/CommentTreeServiceImpl.class +com/tarento/commenthub/repository/CommentTreeRepository.class +com/tarento/commenthub/service/CommentTreeService.class +com/tarento/commenthub/repository/CommentRepository.class +com/tarento/commenthub/controller/CommentController.class +com/tarento/commenthub/dto/CommentsResoponseDTO.class +com/tarento/commenthub/service/CommentService.class +com/tarento/commenthub/exception/ErrorResponse$ErrorResponseBuilder.class +com/tarento/commenthub/exception/CommentException.class +com/tarento/commenthub/dto/MultipleWorkflowsCommentResponseDTO.class +com/tarento/commenthub/constant/Constants.class +com/tarento/commenthub/config/RedisConfig.class +com/tarento/commenthub/dto/ResponseDTO.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..fd1a5c134eef01f3958074c980a51b201bd4eb6e --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,21 @@ +/opt/comment-hub/src/main/java/com/tarento/commenthub/entity/CommentTree.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/dto/CommentsResoponseDTO.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/dto/MultipleWorkflowsCommentResponseDTO.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/exception/ErrorResponse.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/utility/CommentsUtility.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/dto/CommentTreeIdentifierDTO.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/exception/RestExceptionHandling.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/service/CommentTreeService.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/repository/CommentTreeRepository.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/repository/CommentRepository.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/utility/Status.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/exception/CommentException.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/constant/Constants.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/entity/Comment.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/config/RedisConfig.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/service/CommentService.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/controller/CommentController.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/dto/ResponseDTO.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/CommentHubApplication.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/service/impl/CommentTreeServiceImpl.java +/opt/comment-hub/src/main/java/com/tarento/commenthub/service/impl/CommentServiceImpl.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..21de2d9a2b047f8ed33733bc392fda5d6a0c1c71 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +com/tarento/commenthub/CommentHubApplicationTests.class diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..0cdc2601dbbeefc944c7db130f5579ca2dc72610 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/opt/comment-hub/src/test/java/com/tarento/commenthub/CommentHubApplicationTests.java diff --git a/target/surefire-reports/TEST-com.tarento.commenthub.CommentHubApplicationTests.xml b/target/surefire-reports/TEST-com.tarento.commenthub.CommentHubApplicationTests.xml new file mode 100644 index 0000000000000000000000000000000000000000..f3d0ec7912bf522b66f485fce0f55e792fca2112 --- /dev/null +++ b/target/surefire-reports/TEST-com.tarento.commenthub.CommentHubApplicationTests.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="com.tarento.commenthub.CommentHubApplicationTests" time="7.149" tests="1" errors="0" skipped="0" failures="0"> + <properties> + <property name="awt.toolkit" value="sun.awt.X11.XToolkit"/> + <property name="java.specification.version" value="11"/> + <property name="sun.cpu.isalist" value=""/> + <property name="sun.jnu.encoding" value="UTF-8"/> + <property name="java.class.path" value="/opt/comment-hub/target/test-classes:/opt/comment-hub/target/classes:/root/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/2.7.15/spring-boot-starter-data-jpa-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-aop/2.7.15/spring-boot-starter-aop-2.7.15.jar:/root/.m2/repository/org/springframework/spring-aop/5.3.29/spring-aop-5.3.29.jar:/root/.m2/repository/org/aspectj/aspectjweaver/1.9.7/aspectjweaver-1.9.7.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.7.15/spring-boot-starter-jdbc-2.7.15.jar:/root/.m2/repository/com/zaxxer/HikariCP/4.0.3/HikariCP-4.0.3.jar:/root/.m2/repository/org/springframework/spring-jdbc/5.3.29/spring-jdbc-5.3.29.jar:/root/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/root/.m2/repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar:/root/.m2/repository/org/hibernate/hibernate-core/5.6.15.Final/hibernate-core-5.6.15.Final.jar:/root/.m2/repository/org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.jar:/root/.m2/repository/net/bytebuddy/byte-buddy/1.12.23/byte-buddy-1.12.23.jar:/root/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/root/.m2/repository/org/jboss/jandex/2.4.2.Final/jandex-2.4.2.Final.jar:/root/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/root/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.1.2.Final/hibernate-commons-annotations-5.1.2.Final.jar:/root/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.8/jaxb-runtime-2.3.8.jar:/root/.m2/repository/org/glassfish/jaxb/txw2/2.3.8/txw2-2.3.8.jar:/root/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.12/istack-commons-runtime-3.0.12.jar:/root/.m2/repository/com/sun/activation/jakarta.activation/1.2.2/jakarta.activation-1.2.2.jar:/root/.m2/repository/org/springframework/data/spring-data-jpa/2.7.15/spring-data-jpa-2.7.15.jar:/root/.m2/repository/org/springframework/data/spring-data-commons/2.7.15/spring-data-commons-2.7.15.jar:/root/.m2/repository/org/springframework/spring-orm/5.3.29/spring-orm-5.3.29.jar:/root/.m2/repository/org/springframework/spring-context/5.3.29/spring-context-5.3.29.jar:/root/.m2/repository/org/springframework/spring-tx/5.3.29/spring-tx-5.3.29.jar:/root/.m2/repository/org/springframework/spring-beans/5.3.29/spring-beans-5.3.29.jar:/root/.m2/repository/org/springframework/spring-aspects/5.3.29/spring-aspects-5.3.29.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-data-redis/2.7.15/spring-boot-starter-data-redis-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter/2.7.15/spring-boot-starter-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot/2.7.15/spring-boot-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.15/spring-boot-autoconfigure-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.7.15/spring-boot-starter-logging-2.7.15.jar:/root/.m2/repository/ch/qos/logback/logback-classic/1.2.12/logback-classic-1.2.12.jar:/root/.m2/repository/ch/qos/logback/logback-core/1.2.12/logback-core-1.2.12.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.17.2/log4j-to-slf4j-2.17.2.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-api/2.17.2/log4j-api-2.17.2.jar:/root/.m2/repository/org/slf4j/jul-to-slf4j/1.7.36/jul-to-slf4j-1.7.36.jar:/root/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/root/.m2/repository/org/yaml/snakeyaml/1.30/snakeyaml-1.30.jar:/root/.m2/repository/org/springframework/data/spring-data-redis/2.7.15/spring-data-redis-2.7.15.jar:/root/.m2/repository/org/springframework/data/spring-data-keyvalue/2.7.15/spring-data-keyvalue-2.7.15.jar:/root/.m2/repository/org/springframework/spring-oxm/5.3.29/spring-oxm-5.3.29.jar:/root/.m2/repository/org/springframework/spring-context-support/5.3.29/spring-context-support-5.3.29.jar:/root/.m2/repository/io/lettuce/lettuce-core/6.1.10.RELEASE/lettuce-core-6.1.10.RELEASE.jar:/root/.m2/repository/io/netty/netty-common/4.1.97.Final/netty-common-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-handler/4.1.97.Final/netty-handler-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-resolver/4.1.97.Final/netty-resolver-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-buffer/4.1.97.Final/netty-buffer-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-transport-native-unix-common/4.1.97.Final/netty-transport-native-unix-common-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-codec/4.1.97.Final/netty-codec-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-transport/4.1.97.Final/netty-transport-4.1.97.Final.jar:/root/.m2/repository/io/projectreactor/reactor-core/3.4.32/reactor-core-3.4.32.jar:/root/.m2/repository/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.7.15/spring-boot-starter-web-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.7.15/spring-boot-starter-json-2.7.15.jar:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.13.5/jackson-datatype-jdk8-2.13.5.jar:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.13.5/jackson-datatype-jsr310-2.13.5.jar:/root/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.13.5/jackson-module-parameter-names-2.13.5.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.7.15/spring-boot-starter-tomcat-2.7.15.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.79/tomcat-embed-core-9.0.79.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.79/tomcat-embed-el-9.0.79.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.79/tomcat-embed-websocket-9.0.79.jar:/root/.m2/repository/org/springframework/spring-web/5.3.29/spring-web-5.3.29.jar:/root/.m2/repository/org/springframework/spring-webmvc/5.3.29/spring-webmvc-5.3.29.jar:/root/.m2/repository/org/springframework/spring-expression/5.3.29/spring-expression-5.3.29.jar:/root/.m2/repository/org/postgresql/postgresql/42.3.8/postgresql-42.3.8.jar:/root/.m2/repository/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar:/root/.m2/repository/org/projectlombok/lombok/1.18.28/lombok-1.18.28.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-test/2.7.15/spring-boot-starter-test-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-test/2.7.15/spring-boot-test-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-test-autoconfigure/2.7.15/spring-boot-test-autoconfigure-2.7.15.jar:/root/.m2/repository/com/jayway/jsonpath/json-path/2.7.0/json-path-2.7.0.jar:/root/.m2/repository/net/minidev/json-smart/2.4.11/json-smart-2.4.11.jar:/root/.m2/repository/net/minidev/accessors-smart/2.4.11/accessors-smart-2.4.11.jar:/root/.m2/repository/org/ow2/asm/asm/9.3/asm-9.3.jar:/root/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar:/root/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar:/root/.m2/repository/org/assertj/assertj-core/3.22.0/assertj-core-3.22.0.jar:/root/.m2/repository/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter/5.8.2/junit-jupiter-5.8.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/root/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/root/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/root/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.8.2/junit-jupiter-params-5.8.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/root/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/root/.m2/repository/org/mockito/mockito-core/4.5.1/mockito-core-4.5.1.jar:/root/.m2/repository/net/bytebuddy/byte-buddy-agent/1.12.23/byte-buddy-agent-1.12.23.jar:/root/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/root/.m2/repository/org/mockito/mockito-junit-jupiter/4.5.1/mockito-junit-jupiter-4.5.1.jar:/root/.m2/repository/org/skyscreamer/jsonassert/1.5.1/jsonassert-1.5.1.jar:/root/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar:/root/.m2/repository/org/springframework/spring-core/5.3.29/spring-core-5.3.29.jar:/root/.m2/repository/org/springframework/spring-jcl/5.3.29/spring-jcl-5.3.29.jar:/root/.m2/repository/org/springframework/spring-test/5.3.29/spring-test-5.3.29.jar:/root/.m2/repository/org/xmlunit/xmlunit-core/2.9.1/xmlunit-core-2.9.1.jar:/root/.m2/repository/com/vladmihalcea/hibernate-types-52/2.3.4/hibernate-types-52-2.3.4.jar:/root/.m2/repository/org/springdoc/springdoc-openapi-ui/1.6.12/springdoc-openapi-ui-1.6.12.jar:/root/.m2/repository/org/springdoc/springdoc-openapi-webmvc-core/1.6.12/springdoc-openapi-webmvc-core-1.6.12.jar:/root/.m2/repository/org/springdoc/springdoc-openapi-common/1.6.12/springdoc-openapi-common-1.6.12.jar:/root/.m2/repository/io/swagger/core/v3/swagger-core/2.2.4/swagger-core-2.2.4.jar:/root/.m2/repository/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar:/root/.m2/repository/io/swagger/core/v3/swagger-annotations/2.2.4/swagger-annotations-2.2.4.jar:/root/.m2/repository/io/swagger/core/v3/swagger-models/2.2.4/swagger-models-2.2.4.jar:/root/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/root/.m2/repository/org/webjars/swagger-ui/4.14.3/swagger-ui-4.14.3.jar:/root/.m2/repository/org/webjars/webjars-locator-core/0.50/webjars-locator-core-0.50.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.13.5/jackson-core-2.13.5.jar:/root/.m2/repository/io/github/classgraph/classgraph/4.8.149/classgraph-4.8.149.jar:/root/.m2/repository/com/auth0/java-jwt/4.4.0/java-jwt-4.4.0.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.13.5/jackson-databind-2.13.5.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.5/jackson-annotations-2.13.5.jar:/root/.m2/repository/com/fasterxml/uuid/java-uuid-generator/4.2.0/java-uuid-generator-4.2.0.jar:/root/.m2/repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:/root/.m2/repository/com/networknt/json-schema-validator/1.0.86/json-schema-validator-1.0.86.jar:/root/.m2/repository/com/ethlo/time/itu/1.7.0/itu-1.7.0.jar:/root/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.13.5/jackson-dataformat-yaml-2.13.5.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/2.7.15/spring-boot-starter-actuator-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.7.15/spring-boot-actuator-autoconfigure-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-actuator/2.7.15/spring-boot-actuator-2.7.15.jar:/root/.m2/repository/io/micrometer/micrometer-core/1.9.14/micrometer-core-1.9.14.jar:/root/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.12/HdrHistogram-2.1.12.jar:/root/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar:"/> + <property name="java.vm.vendor" value="Ubuntu"/> + <property name="sun.arch.data.model" value="64"/> + <property name="java.vendor.url" value="https://ubuntu.com/"/> + <property name="user.timezone" value=""/> + <property name="java.vm.specification.version" value="11"/> + <property name="os.name" value="Linux"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/> + <property name="sun.java.command" value="/opt/comment-hub/target/surefire/surefirebooter14075490145316422879.jar /opt/comment-hub/target/surefire 2024-02-09T05-30-17_263-jvmRun1 surefire14143674270441517108tmp surefire_07188630735268927059tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="/opt/comment-hub/target/test-classes:/opt/comment-hub/target/classes:/root/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/2.7.15/spring-boot-starter-data-jpa-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-aop/2.7.15/spring-boot-starter-aop-2.7.15.jar:/root/.m2/repository/org/springframework/spring-aop/5.3.29/spring-aop-5.3.29.jar:/root/.m2/repository/org/aspectj/aspectjweaver/1.9.7/aspectjweaver-1.9.7.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.7.15/spring-boot-starter-jdbc-2.7.15.jar:/root/.m2/repository/com/zaxxer/HikariCP/4.0.3/HikariCP-4.0.3.jar:/root/.m2/repository/org/springframework/spring-jdbc/5.3.29/spring-jdbc-5.3.29.jar:/root/.m2/repository/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3.jar:/root/.m2/repository/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar:/root/.m2/repository/org/hibernate/hibernate-core/5.6.15.Final/hibernate-core-5.6.15.Final.jar:/root/.m2/repository/org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.jar:/root/.m2/repository/net/bytebuddy/byte-buddy/1.12.23/byte-buddy-1.12.23.jar:/root/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/root/.m2/repository/org/jboss/jandex/2.4.2.Final/jandex-2.4.2.Final.jar:/root/.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/root/.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.1.2.Final/hibernate-commons-annotations-5.1.2.Final.jar:/root/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.8/jaxb-runtime-2.3.8.jar:/root/.m2/repository/org/glassfish/jaxb/txw2/2.3.8/txw2-2.3.8.jar:/root/.m2/repository/com/sun/istack/istack-commons-runtime/3.0.12/istack-commons-runtime-3.0.12.jar:/root/.m2/repository/com/sun/activation/jakarta.activation/1.2.2/jakarta.activation-1.2.2.jar:/root/.m2/repository/org/springframework/data/spring-data-jpa/2.7.15/spring-data-jpa-2.7.15.jar:/root/.m2/repository/org/springframework/data/spring-data-commons/2.7.15/spring-data-commons-2.7.15.jar:/root/.m2/repository/org/springframework/spring-orm/5.3.29/spring-orm-5.3.29.jar:/root/.m2/repository/org/springframework/spring-context/5.3.29/spring-context-5.3.29.jar:/root/.m2/repository/org/springframework/spring-tx/5.3.29/spring-tx-5.3.29.jar:/root/.m2/repository/org/springframework/spring-beans/5.3.29/spring-beans-5.3.29.jar:/root/.m2/repository/org/springframework/spring-aspects/5.3.29/spring-aspects-5.3.29.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-data-redis/2.7.15/spring-boot-starter-data-redis-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter/2.7.15/spring-boot-starter-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot/2.7.15/spring-boot-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.15/spring-boot-autoconfigure-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.7.15/spring-boot-starter-logging-2.7.15.jar:/root/.m2/repository/ch/qos/logback/logback-classic/1.2.12/logback-classic-1.2.12.jar:/root/.m2/repository/ch/qos/logback/logback-core/1.2.12/logback-core-1.2.12.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.17.2/log4j-to-slf4j-2.17.2.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-api/2.17.2/log4j-api-2.17.2.jar:/root/.m2/repository/org/slf4j/jul-to-slf4j/1.7.36/jul-to-slf4j-1.7.36.jar:/root/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/root/.m2/repository/org/yaml/snakeyaml/1.30/snakeyaml-1.30.jar:/root/.m2/repository/org/springframework/data/spring-data-redis/2.7.15/spring-data-redis-2.7.15.jar:/root/.m2/repository/org/springframework/data/spring-data-keyvalue/2.7.15/spring-data-keyvalue-2.7.15.jar:/root/.m2/repository/org/springframework/spring-oxm/5.3.29/spring-oxm-5.3.29.jar:/root/.m2/repository/org/springframework/spring-context-support/5.3.29/spring-context-support-5.3.29.jar:/root/.m2/repository/io/lettuce/lettuce-core/6.1.10.RELEASE/lettuce-core-6.1.10.RELEASE.jar:/root/.m2/repository/io/netty/netty-common/4.1.97.Final/netty-common-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-handler/4.1.97.Final/netty-handler-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-resolver/4.1.97.Final/netty-resolver-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-buffer/4.1.97.Final/netty-buffer-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-transport-native-unix-common/4.1.97.Final/netty-transport-native-unix-common-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-codec/4.1.97.Final/netty-codec-4.1.97.Final.jar:/root/.m2/repository/io/netty/netty-transport/4.1.97.Final/netty-transport-4.1.97.Final.jar:/root/.m2/repository/io/projectreactor/reactor-core/3.4.32/reactor-core-3.4.32.jar:/root/.m2/repository/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.7.15/spring-boot-starter-web-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.7.15/spring-boot-starter-json-2.7.15.jar:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.13.5/jackson-datatype-jdk8-2.13.5.jar:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.13.5/jackson-datatype-jsr310-2.13.5.jar:/root/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.13.5/jackson-module-parameter-names-2.13.5.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.7.15/spring-boot-starter-tomcat-2.7.15.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.79/tomcat-embed-core-9.0.79.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.79/tomcat-embed-el-9.0.79.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.79/tomcat-embed-websocket-9.0.79.jar:/root/.m2/repository/org/springframework/spring-web/5.3.29/spring-web-5.3.29.jar:/root/.m2/repository/org/springframework/spring-webmvc/5.3.29/spring-webmvc-5.3.29.jar:/root/.m2/repository/org/springframework/spring-expression/5.3.29/spring-expression-5.3.29.jar:/root/.m2/repository/org/postgresql/postgresql/42.3.8/postgresql-42.3.8.jar:/root/.m2/repository/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar:/root/.m2/repository/org/projectlombok/lombok/1.18.28/lombok-1.18.28.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-test/2.7.15/spring-boot-starter-test-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-test/2.7.15/spring-boot-test-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-test-autoconfigure/2.7.15/spring-boot-test-autoconfigure-2.7.15.jar:/root/.m2/repository/com/jayway/jsonpath/json-path/2.7.0/json-path-2.7.0.jar:/root/.m2/repository/net/minidev/json-smart/2.4.11/json-smart-2.4.11.jar:/root/.m2/repository/net/minidev/accessors-smart/2.4.11/accessors-smart-2.4.11.jar:/root/.m2/repository/org/ow2/asm/asm/9.3/asm-9.3.jar:/root/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar:/root/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar:/root/.m2/repository/org/assertj/assertj-core/3.22.0/assertj-core-3.22.0.jar:/root/.m2/repository/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter/5.8.2/junit-jupiter-5.8.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/root/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/root/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/root/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.8.2/junit-jupiter-params-5.8.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/root/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/root/.m2/repository/org/mockito/mockito-core/4.5.1/mockito-core-4.5.1.jar:/root/.m2/repository/net/bytebuddy/byte-buddy-agent/1.12.23/byte-buddy-agent-1.12.23.jar:/root/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/root/.m2/repository/org/mockito/mockito-junit-jupiter/4.5.1/mockito-junit-jupiter-4.5.1.jar:/root/.m2/repository/org/skyscreamer/jsonassert/1.5.1/jsonassert-1.5.1.jar:/root/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar:/root/.m2/repository/org/springframework/spring-core/5.3.29/spring-core-5.3.29.jar:/root/.m2/repository/org/springframework/spring-jcl/5.3.29/spring-jcl-5.3.29.jar:/root/.m2/repository/org/springframework/spring-test/5.3.29/spring-test-5.3.29.jar:/root/.m2/repository/org/xmlunit/xmlunit-core/2.9.1/xmlunit-core-2.9.1.jar:/root/.m2/repository/com/vladmihalcea/hibernate-types-52/2.3.4/hibernate-types-52-2.3.4.jar:/root/.m2/repository/org/springdoc/springdoc-openapi-ui/1.6.12/springdoc-openapi-ui-1.6.12.jar:/root/.m2/repository/org/springdoc/springdoc-openapi-webmvc-core/1.6.12/springdoc-openapi-webmvc-core-1.6.12.jar:/root/.m2/repository/org/springdoc/springdoc-openapi-common/1.6.12/springdoc-openapi-common-1.6.12.jar:/root/.m2/repository/io/swagger/core/v3/swagger-core/2.2.4/swagger-core-2.2.4.jar:/root/.m2/repository/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar:/root/.m2/repository/io/swagger/core/v3/swagger-annotations/2.2.4/swagger-annotations-2.2.4.jar:/root/.m2/repository/io/swagger/core/v3/swagger-models/2.2.4/swagger-models-2.2.4.jar:/root/.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/root/.m2/repository/org/webjars/swagger-ui/4.14.3/swagger-ui-4.14.3.jar:/root/.m2/repository/org/webjars/webjars-locator-core/0.50/webjars-locator-core-0.50.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.13.5/jackson-core-2.13.5.jar:/root/.m2/repository/io/github/classgraph/classgraph/4.8.149/classgraph-4.8.149.jar:/root/.m2/repository/com/auth0/java-jwt/4.4.0/java-jwt-4.4.0.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.13.5/jackson-databind-2.13.5.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.5/jackson-annotations-2.13.5.jar:/root/.m2/repository/com/fasterxml/uuid/java-uuid-generator/4.2.0/java-uuid-generator-4.2.0.jar:/root/.m2/repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:/root/.m2/repository/com/networknt/json-schema-validator/1.0.86/json-schema-validator-1.0.86.jar:/root/.m2/repository/com/ethlo/time/itu/1.7.0/itu-1.7.0.jar:/root/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.13.5/jackson-dataformat-yaml-2.13.5.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/2.7.15/spring-boot-starter-actuator-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.7.15/spring-boot-actuator-autoconfigure-2.7.15.jar:/root/.m2/repository/org/springframework/boot/spring-boot-actuator/2.7.15/spring-boot-actuator-2.7.15.jar:/root/.m2/repository/io/micrometer/micrometer-core/1.9.14/micrometer-core-1.9.14.jar:/root/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.12/HdrHistogram-2.1.12.jar:/root/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar:"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="/root"/> + <property name="user.language" value="en"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2023-10-17"/> + <property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/> + <property name="file.separator" value="/"/> + <property name="basedir" value="/opt/comment-hub"/> + <property name="java.vm.compressedOopsMode" value="Zero based"/> + <property name="line.separator" value=" "/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/> + <property name="surefire.real.class.path" value="/opt/comment-hub/target/surefire/surefirebooter14075490145316422879.jar"/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="11.0.21+9-post-Ubuntu-0ubuntu120.04"/> + <property name="user.name" value="root"/> + <property name="path.separator" value=":"/> + <property name="os.version" value="5.15.0-1030-gcp"/> + <property name="java.runtime.name" value="OpenJDK Runtime Environment"/> + <property name="file.encoding" value="UTF-8"/> + <property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/> + <property name="localRepository" value="/root/.m2/repository"/> + <property name="java.vendor.url.bug" value="https://bugs.launchpad.net/ubuntu/+source/openjdk-lts"/> + <property name="java.io.tmpdir" value="/tmp"/> + <property name="java.version" value="11.0.21"/> + <property name="user.dir" value="/opt/comment-hub"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/> + <property name="sun.os.patch.level" value="unknown"/> + <property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Ubuntu"/> + <property name="java.vm.version" value="11.0.21+9-post-Ubuntu-0ubuntu120.04"/> + <property name="java.specification.maintenance.version" value="2"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="55.0"/> + <property name="skiptest" value="true"/> + </properties> + <testcase name="contextLoads" classname="com.tarento.commenthub.CommentHubApplicationTests" time="0.109"/> +</testsuite> \ No newline at end of file diff --git a/target/surefire-reports/com.tarento.commenthub.CommentHubApplicationTests.txt b/target/surefire-reports/com.tarento.commenthub.CommentHubApplicationTests.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2cbf33bd552ed9607f5a340327076835dd0ffc0 --- /dev/null +++ b/target/surefire-reports/com.tarento.commenthub.CommentHubApplicationTests.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: com.tarento.commenthub.CommentHubApplicationTests +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.149 s - in com.tarento.commenthub.CommentHubApplicationTests diff --git a/target/test-classes/com/tarento/commenthub/CommentHubApplicationTests.class b/target/test-classes/com/tarento/commenthub/CommentHubApplicationTests.class new file mode 100644 index 0000000000000000000000000000000000000000..6b5c4f454566cf6a17652290ada8149fbe4c547f Binary files /dev/null and b/target/test-classes/com/tarento/commenthub/CommentHubApplicationTests.class differ