Skip to content

Commit

Permalink
Merge pull request #49 from Real-Dev-Squad/db-integration-test
Browse files Browse the repository at this point in the history
Added the dependency for test containers and logging format for console
  • Loading branch information
vikhyat187 authored Dec 19, 2023
2 parents f04aa5f + ce68b3e commit 2d73838
Show file tree
Hide file tree
Showing 11 changed files with 467 additions and 279 deletions.
194 changes: 114 additions & 80 deletions skill-tree /pom.xml
Original file line number Diff line number Diff line change
@@ -1,83 +1,117 @@
<?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>3.1.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.RDS</groupId>
<artifactId>skill-tree</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>skill-tree</name>
<description>skill tree project</description>
<properties>
<java.version>17</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-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.5.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-xml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
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>3.1.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.RDS</groupId>
<artifactId>skill-tree</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>skill-tree</name>
<description>skill tree project</description>
<properties>
<java.version>17</java.version>
<testcontainers.version>1.17.6</testcontainers.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-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.5.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-xml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-testcontainers</artifactId>
<scope>test</scope>
<version>3.2.0</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>${testcontainers.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<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>
</build>

<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>
</build>

</project>
</project>
13 changes: 8 additions & 5 deletions skill-tree /src/main/java/com/RDS/skilltree/Skill/SkillDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.Builder;
import lombok.Getter;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
Expand All @@ -27,11 +28,13 @@ public static SkillDTO toDto(SkillModel skillModel) {
}

public static SkillDTO getSkillsWithUsers(SkillModel skillModel) {
Set<UserDTO> users = skillModel.getUsers()
.stream()
.map(UserDTO::toDTO)
.collect(Collectors.toSet());

Set<UserDTO> users = new HashSet<>();
if (skillModel.getUsers() != null) {
users = skillModel.getUsers()
.stream()
.map(UserDTO::toDTO)
.collect(Collectors.toSet());
}
return SkillDTO.builder()
.id(skillModel.getId())
.name(skillModel.getName())
Expand Down
35 changes: 16 additions & 19 deletions skill-tree /src/main/java/com/RDS/skilltree/User/UserService.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
//package com.RDS.skilltree.User;
//
//
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//import java.util.UUID;
//
//public interface UserService {
// UserDTO createUser(UserDRO user);
//
// void updateUser(UUID id,UserDRO user);
//
// UserDTO getUserById(UUID id);
//
// List<UserDTO> getAllUsers();
//
// void addSkill(UUID skill, UUID userId);
//}
package com.RDS.skilltree.User;

import java.util.List;
import java.util.UUID;

public interface UserService {
UserDTO createUser(UserDRO user);

void updateUser(UUID id,UserDRO user);

UserDTO getUserById(UUID id);

List<UserDTO> getAllUsers();

void addSkill(UUID skill, UUID userId);
}
Loading

0 comments on commit 2d73838

Please sign in to comment.