issue-1090 using mocked instance of CronJobSchedulerService in s-w-c tests
@@ -2,6 +2,7 @@ package org.carlspring.strongbox.config;
import org.carlspring.strongbox.MockedRemoteRepositoriesHeartbeatConfig;
import org.carlspring.strongbox.app.StrongboxSpringBootApplication;
+import org.carlspring.strongbox.cron.services.CronJobSchedulerService;
import org.carlspring.strongbox.data.CacheManagerTestExecutionListener;
import org.carlspring.strongbox.rest.common.RestAssuredTestExecutionListener;
@@ -12,7 +13,11 @@ import java.lang.annotation.Target;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
+import org.mockito.Mockito;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
import org.springframework.security.test.context.support.WithUserDetails;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestExecutionListeners;
@@ -29,6 +34,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
@Retention(RetentionPolicy.RUNTIME)
@SpringBootTest(classes = { StrongboxSpringBootApplication.class,
MockedRemoteRepositoriesHeartbeatConfig.class,
+ IntegrationTest.IntegrationTestsConfiguration.class,
RestAssuredConfig.class })
@WebAppConfiguration("classpath:")
@WithUserDetails(value = "admin")
@@ -39,4 +45,16 @@ import org.springframework.test.context.web.WebAppConfiguration;
public @interface IntegrationTest
{
+ @Configuration
+ class IntegrationTestsConfiguration
+ {
+
+ @Bean
+ @Primary
+ CronJobSchedulerService mockCronJobSchedulerService()
+ {
+ return Mockito.mock(CronJobSchedulerService.class);
+ }
+ }
+
}
