Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update all non-major dependencies (v3.x.x) #3942

Open
wants to merge 8 commits into
base: v3.x.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.zowe.apiml.apicatalog.controllers.api;

import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Bean;
import org.zowe.apiml.apicatalog.controllers.handlers.ApiCatalogControllerExceptionHandler;
import org.zowe.apiml.apicatalog.services.cached.CachedProductFamilyService;
Expand All @@ -21,11 +20,13 @@

class ApiCatalogControllerContainerRetrievalTestContextConfiguration {

@MockBean
private CachedProductFamilyService cachedProductFamilyService;
@Bean
public CachedProductFamilyService cachedProductFamilyService() {
return mock(CachedProductFamilyService.class);
}

@Bean
public ApiCatalogController apiCatalogController() {
public ApiCatalogController apiCatalogController(CachedProductFamilyService cachedProductFamilyService) {
when(cachedProductFamilyService.getAllContainers())
.thenThrow(new NullPointerException());

Expand All @@ -43,4 +44,5 @@ public MessageService messageService() {
public ApiCatalogControllerExceptionHandler apiCatalogControllerExceptionHandler() {
return new ApiCatalogControllerExceptionHandler(messageService());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.zowe.apiml.apicatalog.controllers.api;

import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Bean;
import org.zowe.apiml.apicatalog.controllers.handlers.CatalogApiDocControllerExceptionHandler;
import org.zowe.apiml.apicatalog.services.status.APIServiceStatusService;
Expand All @@ -22,11 +21,13 @@

class CatalogApiDocControllerApiDocNotFoundTestContextConfiguration {

@MockBean
private APIServiceStatusService apiServiceStatusService;
@Bean
public APIServiceStatusService apiServiceStatusService() {
return mock(APIServiceStatusService.class);
}

@Bean
public CatalogApiDocController catalogApiDocController() {
public CatalogApiDocController catalogApiDocController(APIServiceStatusService apiServiceStatusService) {
when(apiServiceStatusService.getServiceCachedApiDocInfo("service2", "v1"))
.thenThrow(new ApiDocNotFoundException("Really bad stuff happened"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

package org.zowe.apiml.apicatalog.controllers.api;

import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Bean;
import org.zowe.apiml.apicatalog.controllers.handlers.CatalogApiDocControllerExceptionHandler;
import org.zowe.apiml.apicatalog.services.status.APIServiceStatusService;
Expand All @@ -22,11 +21,13 @@

class CatalogApiDocControllerServiceNotFoundTestContextConfiguration {

@MockBean
private APIServiceStatusService apiServiceStatusService;
@Bean
public APIServiceStatusService apiServiceStatusService() {
return mock(APIServiceStatusService.class);
}

@Bean
public CatalogApiDocController catalogApiDocController() {
public CatalogApiDocController catalogApiDocController(APIServiceStatusService apiServiceStatusService) {
when(apiServiceStatusService.getServiceCachedApiDocInfo("service1", "v1"))
.thenThrow(new ServiceNotFoundException("API Documentation not retrieved, The service is running."));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
Expand All @@ -27,6 +26,7 @@

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
Expand Down Expand Up @@ -72,9 +72,13 @@ void whenPostRequest() throws Exception {

@Configuration
@Profile("test")
@SpyBean(ExampleService.class)
static class Context {

@Bean
public ExampleService exampleService() {
return spy(new ExampleService());
}

@Bean
public MockController mockController(ExampleService exampleService) {
return new MockController(exampleService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
Expand All @@ -26,11 +25,7 @@
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.*;

@ExtendWith(SpringExtension.class)
@ActiveProfiles("test")
Expand Down Expand Up @@ -82,11 +77,13 @@ private ConfigurableApplicationContext mockContext(ApplicationReadyEvent event,
@Profile("test")
public static class TestConfiguration {

@MockBean
private StandaloneLoaderService standaloneLoaderService;
@Bean
public StandaloneLoaderService standaloneLoaderService() {
return mock(StandaloneLoaderService.class);
}

@Bean
public StandaloneInitializer getStandaloneInitializer() {
public StandaloneInitializer getStandaloneInitializer(StandaloneLoaderService standaloneLoaderService) {
return new StandaloneInitializer(standaloneLoaderService);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

package org.zowe.apiml.apicatalog.staticapi;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -25,6 +26,7 @@
import org.zowe.apiml.apicatalog.services.status.model.ServiceNotFoundException;

import static org.hamcrest.Matchers.hasSize;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
Expand All @@ -46,6 +48,11 @@ class StaticAPIRefreshControllerTest {
@Autowired
private StaticAPIService staticAPIService;

@BeforeEach
void setUp() {
reset(staticAPIService);
}

@Test
void givenServiceNotFoundException_whenCallRefreshAPI_thenResponseShouldBe503WithSpecificMessage() throws Exception {
when(staticAPIService.refresh()).thenThrow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@

package org.zowe.apiml.apicatalog.staticapi;

import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Bean;
import org.zowe.apiml.message.core.MessageService;
import org.zowe.apiml.message.yaml.YamlMessageService;

import static org.mockito.Mockito.mock;

public class StaticApiContextConfiguration {

@MockBean
private StaticAPIService staticAPIService;
@Bean
public StaticAPIService staticAPIService() {
return mock(StaticAPIService.class);
}

@Bean
public MessageService messageService() {
Expand All @@ -31,20 +34,22 @@ public StaticAPIRefreshControllerExceptionHandler staticAPIRefreshControllerExce
}

@Bean
public StaticAPIRefreshController apiCatalogController() {
public StaticAPIRefreshController apiCatalogController(StaticAPIService staticAPIService) {
return new StaticAPIRefreshController(staticAPIService);
}

@MockBean
private StaticDefinitionGenerator staticDefinitionGenerator;
@Bean
public StaticDefinitionGenerator staticDefinitionGenerator() {
return mock(StaticDefinitionGenerator.class);
}

@Bean
public StaticDefinitionControllerExceptionHandler staticDefinitionControllerExceptionHandler(MessageService messageService) {
return new StaticDefinitionControllerExceptionHandler(messageService);
}

@Bean
public StaticDefinitionController staticAPIRefreshController() {
public StaticDefinitionController staticAPIRefreshController(StaticDefinitionGenerator staticDefinitionGenerator) {
return new StaticDefinitionController(staticDefinitionGenerator);
}
}
Loading
Loading