Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
SPRING_DATASOURCE_USERNAME: "${MYSQLDB_USER}"
SPRING_DATASOURCE_PASSWORD: "${MYSQLDB_PASSWORD}"
SPRING_JPA_PROPERTIES_HIBERNATE_DIALECT: "org.hibernate.dialect.MySQL8Dialect"
JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:${DEBUG_PORT}"
depends_on:
mysqldb:
condition: service_healthy
24 changes: 24 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,35 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lombok.mapstruct.binding.version>0.2.0</lombok.mapstruct.binding.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<testcontainers.version>1.20.6</testcontainers.version>
<jjwt.version>0.12.6</jjwt.version>
<liquibase.version>4.27.0</liquibase.version>
<lombok.version>1.18.32</lombok.version>
</properties>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mate/academy/bookshop/dto/book/BookDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import java.math.BigDecimal;
import java.util.Set;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class BookDto {
private Long id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import java.math.BigDecimal;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class BookDtoWithoutCategoryIds {
private Long id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.ISBN;
import org.hibernate.validator.constraints.URL;

@Data
@Accessors(chain = true)
public class CreateBookRequestDto {
@NotNull
@Size(min = 1, max = 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class CategoryRequestDto {
@NotBlank
@Size(min = 2, max = 100,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package mate.academy.bookshop.dto.category;

import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class CategoryResponseDto {
private Long id;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package mate.academy.bookshop.exceptions;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(HttpStatus.NOT_FOUND)
public class EntityNotFoundException extends RuntimeException {
public EntityNotFoundException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package mate.academy.bookshop.config;

import org.testcontainers.containers.MySQLContainer;

public class CustomMySqlContainer extends MySQLContainer<CustomMySqlContainer> {
private static final String IMAGE_VERSION = "mysql:8.0";
private static CustomMySqlContainer container;

private CustomMySqlContainer() {
super(IMAGE_VERSION);
}

public static CustomMySqlContainer getInstance() {
if (container == null) {
container = new CustomMySqlContainer();
}
return container;
}

@Override
public void start() {
super.start();
System.setProperty("TEST_DB_URL", container.getJdbcUrl());
System.setProperty("TEST_DB_USERNAME", container.getUsername());
System.setProperty("TEST_DB_PASSWORD", container.getPassword());
}

@Override
public void stop() {
super.stop();
}
}

Loading