diff --git a/quartz-manager-parent/quartz-manager-starter-api/src/test/java/it/fabioformosa/quartzmanager/configuration/SchedulerConfigTest.java b/quartz-manager-parent/quartz-manager-starter-api/src/test/java/it/fabioformosa/quartzmanager/configuration/SchedulerConfigTest.java index 88d094a..e8934c1 100644 --- a/quartz-manager-parent/quartz-manager-starter-api/src/test/java/it/fabioformosa/quartzmanager/configuration/SchedulerConfigTest.java +++ b/quartz-manager-parent/quartz-manager-starter-api/src/test/java/it/fabioformosa/quartzmanager/configuration/SchedulerConfigTest.java @@ -7,6 +7,9 @@ import org.quartz.Scheduler; import org.springframework.context.support.GenericApplicationContext; import org.springframework.scheduling.quartz.SchedulerFactoryBean; +import java.util.ArrayList; +import java.util.List; + class SchedulerConfigTest { public static final String TEST_SCHEDULER_NAME = "foo"; @@ -16,7 +19,9 @@ class SchedulerConfigTest { void givenASchedulerName_whenTheSchedulerIsInstatiated_thenTheSchedulerHasThatName() throws Exception { QuartzModuleProperties quartzModuleProperties = new QuartzModuleProperties(); quartzModuleProperties.getProperties().put("org.quartz.scheduler.instanceName", TEST_SCHEDULER_NAME); - SchedulerConfig schedulerConfig = new SchedulerConfig(quartzModuleProperties); + List quartzModulePropertiesList = new ArrayList<>(); + quartzModulePropertiesList.add(quartzModuleProperties); + SchedulerConfig schedulerConfig = new SchedulerConfig(quartzModulePropertiesList); GenericApplicationContext applicationContext = new GenericApplicationContext(); applicationContext.refresh(); SchedulerFactoryBean schedulerFactoryBean = schedulerConfig.schedulerFactoryBean(schedulerConfig.jobFactory(applicationContext)); @@ -29,7 +34,9 @@ class SchedulerConfigTest { @Test void givenNoSchedulerName_whenTheSchedulerIsInstatiated_thenTheSchedulerHasTheDefaultName() throws Exception { QuartzModuleProperties quartzModuleProperties = new QuartzModuleProperties(); - SchedulerConfig schedulerConfig = new SchedulerConfig(quartzModuleProperties); + List quartzModulePropertiesList = new ArrayList<>(); + quartzModulePropertiesList.add(quartzModuleProperties); + SchedulerConfig schedulerConfig = new SchedulerConfig(quartzModulePropertiesList); GenericApplicationContext applicationContext = new GenericApplicationContext(); applicationContext.refresh(); SchedulerFactoryBean schedulerFactoryBean = schedulerConfig.schedulerFactoryBean(schedulerConfig.jobFactory(applicationContext)); diff --git a/quartz-manager-parent/quartz-manager-starter-security/src/test/java/it/fabioformosa/quartzmanager/security/AbstractSecurityLoginTest.java b/quartz-manager-parent/quartz-manager-starter-security/src/test/java/it/fabioformosa/quartzmanager/security/AbstractSecurityLoginTest.java index 315492e..139941b 100644 --- a/quartz-manager-parent/quartz-manager-starter-security/src/test/java/it/fabioformosa/quartzmanager/security/AbstractSecurityLoginTest.java +++ b/quartz-manager-parent/quartz-manager-starter-security/src/test/java/it/fabioformosa/quartzmanager/security/AbstractSecurityLoginTest.java @@ -7,7 +7,7 @@ import org.springframework.http.*; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; -import static it.fabioformosa.quartzmanager.security.WebSecurityConfigJWT.LOGIN_PATH; +import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH; public class AbstractSecurityLoginTest { @Autowired @@ -23,7 +23,7 @@ public class AbstractSecurityLoginTest { HttpEntity> entity = new HttpEntity<>(map, headers); - ResponseEntity responseEntity = testRestTemplate.exchange(LOGIN_PATH, HttpMethod.POST, entity, UserTokenState.class); + ResponseEntity responseEntity = testRestTemplate.exchange(QUARTZ_MANAGER_LOGIN_PATH, HttpMethod.POST, entity, UserTokenState.class); return responseEntity; } } diff --git a/quartz-manager-parent/quartz-manager-starter-security/src/test/java/it/fabioformosa/quartzmanager/security/SecurityControllerTest.java b/quartz-manager-parent/quartz-manager-starter-security/src/test/java/it/fabioformosa/quartzmanager/security/SecurityControllerTest.java index 5489952..25e6a1b 100644 --- a/quartz-manager-parent/quartz-manager-starter-security/src/test/java/it/fabioformosa/quartzmanager/security/SecurityControllerTest.java +++ b/quartz-manager-parent/quartz-manager-starter-security/src/test/java/it/fabioformosa/quartzmanager/security/SecurityControllerTest.java @@ -1,6 +1,7 @@ package it.fabioformosa.quartzmanager.security; import it.fabioformosa.quartzmanager.security.controllers.TestController; +import org.hamcrest.core.IsNot; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -12,7 +13,7 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import static it.fabioformosa.quartzmanager.security.WebSecurityConfigJWT.LOGIN_PATH; +import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest @@ -51,7 +52,7 @@ public class SecurityControllerTest { @ValueSource(strings = {"/swagger-ui.html", "/v3/api-docs/**", "/swagger-resources/**", "/webjars/**"}) void givenAnAnonymousUser_whenRequestedAnEndpointInWhitelist_thenShouldnotReturnForbidden(String whitelistEndpoint) throws Exception { mockMvc.perform(MockMvcRequestBuilders.get(whitelistEndpoint)) - .andExpect(status().isNotFound()); + .andExpect(status().is(IsNot.not(403))); } @Test @@ -63,7 +64,7 @@ public class SecurityControllerTest { @Test void givenAnAnonymousUser_whenCalledTheLoginPath_thenShouldReturn2xx() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.post(LOGIN_PATH) + mockMvc.perform(MockMvcRequestBuilders.post(QUARTZ_MANAGER_LOGIN_PATH) .contentType("application/x-www-form-urlencoded") .accept("application/json") .param("username", "foo")