Skip to content

Commit

Permalink
feat: remove KC dependency in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeal committed Apr 28, 2024
1 parent a37bd58 commit 7073d2a
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 41 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.egm.stellio.search.web

import com.egm.stellio.search.authorization.AuthorizationService
import com.egm.stellio.search.config.SearchProperties
import com.egm.stellio.search.config.WebSecurityTestConfig
import com.egm.stellio.search.service.EntityEventService
import com.egm.stellio.search.service.EntityPayloadService
import com.egm.stellio.search.service.QueryService
Expand All @@ -14,7 +13,6 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.Import
import org.springframework.http.HttpHeaders
import org.springframework.security.test.context.support.WithAnonymousUser
import org.springframework.test.context.ActiveProfiles
Expand All @@ -24,7 +22,6 @@ import org.springframework.test.web.reactive.server.WebTestClient
@WebFluxTest(EntityHandler::class)
@EnableConfigurationProperties(ApplicationProperties::class, SearchProperties::class)
@Suppress("unused")
@Import(WebSecurityTestConfig::class)
class AnonymousUserHandlerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.egm.stellio.search.web
import arrow.core.left
import arrow.core.right
import com.egm.stellio.search.config.SearchProperties
import com.egm.stellio.search.config.WebSecurityTestConfig
import com.egm.stellio.search.model.AttributeDetails
import com.egm.stellio.search.model.AttributeList
import com.egm.stellio.search.model.AttributeType
Expand All @@ -21,7 +20,6 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.Import
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf
Expand All @@ -32,7 +30,6 @@ import org.springframework.test.web.reactive.server.WebTestClient
@ActiveProfiles("test")
@WebFluxTest(AttributeHandler::class)
@EnableConfigurationProperties(ApplicationProperties::class, SearchProperties::class)
@Import(WebSecurityTestConfig::class)
class AttributeHandlerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.egm.stellio.search.authorization.EntityAccessRights
import com.egm.stellio.search.authorization.EntityAccessRightsService
import com.egm.stellio.search.authorization.User
import com.egm.stellio.search.config.SearchProperties
import com.egm.stellio.search.config.WebSecurityTestConfig
import com.egm.stellio.search.service.EntityPayloadService
import com.egm.stellio.shared.config.ApplicationProperties
import com.egm.stellio.shared.model.*
Expand Down Expand Up @@ -37,7 +36,6 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.Import
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
Expand All @@ -51,7 +49,6 @@ import java.time.Duration
@ActiveProfiles("test")
@WebFluxTest(EntityAccessControlHandler::class)
@EnableConfigurationProperties(ApplicationProperties::class, SearchProperties::class)
@Import(WebSecurityTestConfig::class)
class EntityAccessControlHandlerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import arrow.core.left
import arrow.core.right
import com.egm.stellio.search.authorization.AuthorizationService
import com.egm.stellio.search.config.SearchProperties
import com.egm.stellio.search.config.WebSecurityTestConfig
import com.egm.stellio.search.model.*
import com.egm.stellio.search.service.EntityEventService
import com.egm.stellio.search.service.EntityPayloadService
Expand Down Expand Up @@ -34,7 +33,6 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.Import
import org.springframework.core.io.ClassPathResource
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
Expand All @@ -51,7 +49,6 @@ import java.time.*
@ActiveProfiles("test")
@WebFluxTest(EntityHandler::class)
@EnableConfigurationProperties(ApplicationProperties::class, SearchProperties::class)
@Import(WebSecurityTestConfig::class)
class EntityHandlerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import arrow.core.left
import arrow.core.right
import com.egm.stellio.search.authorization.AuthorizationService
import com.egm.stellio.search.config.SearchProperties
import com.egm.stellio.search.config.WebSecurityTestConfig
import com.egm.stellio.search.model.EMPTY_UPDATE_RESULT
import com.egm.stellio.search.model.EntityPayload
import com.egm.stellio.search.model.UpdateResult
Expand All @@ -31,7 +30,6 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.Import
import org.springframework.core.io.ClassPathResource
import org.springframework.http.HttpStatus
import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf
Expand All @@ -44,7 +42,6 @@ import java.net.URI
@ActiveProfiles("test")
@WebFluxTest(EntityOperationHandler::class)
@EnableConfigurationProperties(ApplicationProperties::class, SearchProperties::class)
@Import(WebSecurityTestConfig::class)
class EntityOperationHandlerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.egm.stellio.search.web
import arrow.core.left
import arrow.core.right
import com.egm.stellio.search.config.SearchProperties
import com.egm.stellio.search.config.WebSecurityTestConfig
import com.egm.stellio.search.model.*
import com.egm.stellio.search.model.AttributeType
import com.egm.stellio.search.service.EntityTypeService
Expand All @@ -19,7 +18,6 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.Import
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf
Expand All @@ -30,7 +28,6 @@ import org.springframework.test.web.reactive.server.WebTestClient
@ActiveProfiles("test")
@WebFluxTest(EntityTypeHandler::class)
@EnableConfigurationProperties(ApplicationProperties::class, SearchProperties::class)
@Import(WebSecurityTestConfig::class)
class EntityTypeHandlerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import arrow.core.left
import arrow.core.right
import com.egm.stellio.search.authorization.AuthorizationService
import com.egm.stellio.search.config.SearchProperties
import com.egm.stellio.search.config.WebSecurityTestConfig
import com.egm.stellio.search.model.SimplifiedAttributeInstanceResult
import com.egm.stellio.search.model.TemporalEntityAttribute
import com.egm.stellio.search.model.TemporalQuery
Expand All @@ -28,7 +27,6 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.Import
import org.springframework.core.io.ClassPathResource
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
Expand All @@ -46,7 +44,6 @@ import java.util.UUID
@ActiveProfiles("test")
@WebFluxTest(TemporalEntityHandler::class)
@EnableConfigurationProperties(ApplicationProperties::class, SearchProperties::class)
@Import(WebSecurityTestConfig::class)
class TemporalEntityHandlerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.egm.stellio.search.web
import arrow.core.Either
import com.egm.stellio.search.authorization.AuthorizationService
import com.egm.stellio.search.config.SearchProperties
import com.egm.stellio.search.config.WebSecurityTestConfig
import com.egm.stellio.search.model.TemporalQuery
import com.egm.stellio.search.service.QueryService
import com.egm.stellio.shared.config.ApplicationProperties
Expand All @@ -17,7 +16,6 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.Import
import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf
import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.mockJwt
import org.springframework.test.context.ActiveProfiles
Expand All @@ -27,7 +25,6 @@ import java.time.ZonedDateTime
@ActiveProfiles("test")
@WebFluxTest(TemporalEntityOperationsHandler::class)
@EnableConfigurationProperties(ApplicationProperties::class, SearchProperties::class)
@Import(WebSecurityTestConfig::class)
class TemporalEntityOperationsHandlerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.egm.stellio.shared.web.DEFAULT_TENANT_NAME
import com.egm.stellio.shared.web.NGSILD_TENANT_HEADER
import org.springframework.beans.factory.InitializingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.annotation.Profile
import org.springframework.security.authentication.ReactiveAuthenticationManager
import org.springframework.security.authentication.ReactiveAuthenticationManagerResolver
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoders
Expand All @@ -14,6 +15,7 @@ import org.springframework.web.server.ServerWebExchange
import reactor.core.publisher.Mono

@Component
@Profile("!test")
@ConditionalOnProperty("application.authentication.enabled")
class TenantAuthenticationManagerResolver(
private val applicationProperties: ApplicationProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package com.egm.stellio.shared.config
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Profile
import org.springframework.security.config.web.server.ServerHttpSecurity
import org.springframework.security.web.server.SecurityWebFilterChain

@Configuration
@Profile("!test")
@ConditionalOnProperty("application.authentication.enabled")
class WebSecurityConfig(
private val tenantAuthenticationManagerResolver: TenantAuthenticationManagerResolver
Expand Down

0 comments on commit 7073d2a

Please sign in to comment.