From 4271b3d5edb467fbb3db27f22d58df4bb5c50e75 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Wed, 2 Oct 2024 11:50:22 +0200 Subject: [PATCH] refactor: remove unused imports and clean up code --- .../java/de/szut/lf8_starter/hello/HelloController.java | 3 --- .../de/szut/lf8_starter/project/dto/GetProjectDto.java | 2 -- .../szut/lf8_starter/security/KeycloakSecurityConfig.java | 7 ------- .../de/szut/lf8_starter/Lf8StarterApplicationTests.java | 1 - .../project/ProjectFindAllNotAuthenticated.java | 5 ----- ...ProjectActionTest.java => RemoveProjectActionTest.java} | 0 6 files changed, 18 deletions(-) rename src/test/java/de/szut/lf8_starter/integration/project/{DeleteProjectActionTest.java => RemoveProjectActionTest.java} (100%) diff --git a/src/main/java/de/szut/lf8_starter/hello/HelloController.java b/src/main/java/de/szut/lf8_starter/hello/HelloController.java index 3a4a993..f6baab4 100644 --- a/src/main/java/de/szut/lf8_starter/hello/HelloController.java +++ b/src/main/java/de/szut/lf8_starter/hello/HelloController.java @@ -14,9 +14,6 @@ import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import java.util.List; -import java.util.stream.Collectors; - @RestController @RequestMapping(value = "hello") @PreAuthorize("hasAnyAuthority('user')") diff --git a/src/main/java/de/szut/lf8_starter/project/dto/GetProjectDto.java b/src/main/java/de/szut/lf8_starter/project/dto/GetProjectDto.java index 614ece1..90ebe5e 100644 --- a/src/main/java/de/szut/lf8_starter/project/dto/GetProjectDto.java +++ b/src/main/java/de/szut/lf8_starter/project/dto/GetProjectDto.java @@ -3,8 +3,6 @@ package de.szut.lf8_starter.project.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/de/szut/lf8_starter/security/KeycloakSecurityConfig.java b/src/main/java/de/szut/lf8_starter/security/KeycloakSecurityConfig.java index cd03823..99fbc5d 100644 --- a/src/main/java/de/szut/lf8_starter/security/KeycloakSecurityConfig.java +++ b/src/main/java/de/szut/lf8_starter/security/KeycloakSecurityConfig.java @@ -1,24 +1,17 @@ package de.szut.lf8_starter.security; import java.util.*; -import java.util.stream.Collectors; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.http.HttpMethod; import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; -import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; import org.springframework.security.core.session.SessionRegistry; import org.springframework.security.core.session.SessionRegistryImpl; -import org.springframework.security.oauth2.core.oidc.user.OidcUserAuthority; -import org.springframework.security.oauth2.core.user.OAuth2UserAuthority; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter; -import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.session.RegisterSessionAuthenticationStrategy; import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy; diff --git a/src/test/java/de/szut/lf8_starter/Lf8StarterApplicationTests.java b/src/test/java/de/szut/lf8_starter/Lf8StarterApplicationTests.java index b5c7f7b..942f2cb 100644 --- a/src/test/java/de/szut/lf8_starter/Lf8StarterApplicationTests.java +++ b/src/test/java/de/szut/lf8_starter/Lf8StarterApplicationTests.java @@ -2,7 +2,6 @@ package de.szut.lf8_starter; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.TestPropertySource; @SpringBootTest class Lf8StarterApplicationTests { diff --git a/src/test/java/de/szut/lf8_starter/integration/project/ProjectFindAllNotAuthenticated.java b/src/test/java/de/szut/lf8_starter/integration/project/ProjectFindAllNotAuthenticated.java index 8c62848..307ad4d 100644 --- a/src/test/java/de/szut/lf8_starter/integration/project/ProjectFindAllNotAuthenticated.java +++ b/src/test/java/de/szut/lf8_starter/integration/project/ProjectFindAllNotAuthenticated.java @@ -1,6 +1,5 @@ package de.szut.lf8_starter.integration.project; -import de.szut.lf8_starter.project.ProjectEntity; import de.szut.lf8_starter.project.ProjectRepository; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -9,12 +8,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.test.web.servlet.MockMvc; -import java.time.LocalDate; -import java.util.List; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) diff --git a/src/test/java/de/szut/lf8_starter/integration/project/DeleteProjectActionTest.java b/src/test/java/de/szut/lf8_starter/integration/project/RemoveProjectActionTest.java similarity index 100% rename from src/test/java/de/szut/lf8_starter/integration/project/DeleteProjectActionTest.java rename to src/test/java/de/szut/lf8_starter/integration/project/RemoveProjectActionTest.java