Skip to content

Commit

Permalink
Boot 3.1.4 & remove tests Boot auto-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ch4mpy committed Sep 24, 2023
1 parent 6861fbf commit d5d857a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 26 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@

<sonar-maven-plugin.version>3.9.1.2184</sonar-maven-plugin.version>

<spring-boot.version>3.1.3</spring-boot.version>
<spring-boot.version>3.1.4</spring-boot.version>

<hibernate.version>6.2.7.Final</hibernate.version>
<hibernate.version>6.3.1.Final</hibernate.version>
<hibernate-enhance-maven-plugin.version>6.2.7.Final</hibernate-enhance-maven-plugin.version>

<lombok.version>1.18.28</lombok.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.security.test.context.support.WithAnonymousUser;
import org.springframework.test.web.servlet.MockMvc;

import com.c4_soft.springaddons.security.oauth2.test.annotations.WithJwt;
Expand All @@ -29,13 +30,14 @@ class SampleApiIntegrationTest {
MockMvc api;

@Test
@WithAnonymousUser
void givenRequestIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception {
api.perform(get("/greet")).andExpect(status().isUnauthorized());
}

@Test
@WithJwt("ch4mp.json")
void givenUserIsCh4mpy_whenGetGreet_thenOk() throws Exception {
void givenUserIsCh4mp_whenGetGreet_thenOk() throws Exception {
api.perform(get("/greet")).andExpect(content().string("Hello ch4mp! You are granted with [USER_ROLES_EDITOR, ROLE_AUTHORIZED_PERSONNEL]."));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

import com.c4_soft.springaddons.security.oauth2.test.webmvc.AutoConfigureAddonsWebmvcResourceServerSecurity;
import com.c4_soft.springaddons.security.oidc.starter.reactive.client.ReactiveSpringAddonsOidcClientBeans;
import com.c4_soft.springaddons.security.oidc.starter.reactive.resourceserver.ReactiveSpringAddonsOidcResourceServerBeans;
import com.c4_soft.springaddons.security.oidc.starter.synchronised.client.SpringAddonsOidcClientBeans;
import com.c4_soft.springaddons.security.oidc.starter.synchronised.resourceserver.SpringAddonsOidcResourceServerBeans;

/**
* To be used when testing secured components which are not controllers
Expand All @@ -22,12 +18,7 @@
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@EnableAutoConfiguration(
exclude = {
ReactiveSpringAddonsOidcResourceServerBeans.class,
ReactiveSpringAddonsOidcClientBeans.class,
SpringAddonsOidcResourceServerBeans.class,
SpringAddonsOidcClientBeans.class })
@EnableAutoConfiguration()
@AutoConfigureAddonsWebfluxMinimalSecurity
public @interface AddonsWebfluxComponentTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

import com.c4_soft.springaddons.security.oauth2.test.webflux.AutoConfigureAddonsWebfluxClientSecurity;
import com.c4_soft.springaddons.security.oidc.starter.reactive.client.ReactiveSpringAddonsOidcClientBeans;
import com.c4_soft.springaddons.security.oidc.starter.reactive.resourceserver.ReactiveSpringAddonsOidcResourceServerBeans;
import com.c4_soft.springaddons.security.oidc.starter.synchronised.client.SpringAddonsOidcClientBeans;
import com.c4_soft.springaddons.security.oidc.starter.synchronised.resourceserver.SpringAddonsOidcResourceServerBeans;

/**
* To be used when testing secured components which are not controllers
Expand All @@ -22,12 +18,7 @@
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@EnableAutoConfiguration(
exclude = {
ReactiveSpringAddonsOidcResourceServerBeans.class,
ReactiveSpringAddonsOidcClientBeans.class,
SpringAddonsOidcResourceServerBeans.class,
SpringAddonsOidcClientBeans.class })
@EnableAutoConfiguration()
@AutoConfigureAddonsWebmvcMinimalSecurity
public @interface AddonsWebmvcComponentTest {

Expand Down

This file was deleted.

This file was deleted.

0 comments on commit d5d857a

Please sign in to comment.