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

Merged
merged 26 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6ccb795
chore: Update all non-major dependencies
renovate-bot Jan 17, 2025
268a15c
updates
pj892031 Jan 17, 2025
cf41d40
replacement of deprecated annotation @MockBean
pj892031 Jan 17, 2025
c3f4856
attempt to fix circular dependency
pj892031 Jan 17, 2025
ba2ed3c
fix CORS - add Cors filter
pj892031 Jan 17, 2025
03ff10e
attempt to fix circular dependency
pj892031 Jan 17, 2025
f15a0c8
attempt to fix circular dependency
pj892031 Jan 17, 2025
16d1ece
set cors by event to split circular dependency
pj892031 Jan 17, 2025
28d80d7
fix doc
pj892031 Jan 20, 2025
f75a63b
remove common-logging from IT
pj892031 Jan 20, 2025
3ffdc19
fix CCS selector to fix E2E test
pj892031 Jan 20, 2025
3944432
attempt to fix standalone catalog tests
pj892031 Jan 20, 2025
df0aace
fix standalone catalog
pj892031 Jan 20, 2025
ec432db
fix Sonar issue - unnecessary lambda with a block
pj892031 Jan 20, 2025
0441b49
add dependsOn eurekaClient on eurekaAutoServiceRegistration
pj892031 Jan 20, 2025
ccdf20f
attempt to minimize circular dependencies
pj892031 Jan 21, 2025
00ced21
rollback DiscoveryClientOrderProcessorBean
pj892031 Jan 21, 2025
c29e0f1
replacement of RestTemplateDiscoveryClient
pj892031 Jan 21, 2025
bb138ac
fix configuration: spring.main.allow-circular-references
pj892031 Jan 21, 2025
65df3ff
Merge branch 'v3.x.x' into renovate/v3.x.x-all-minor-patch
pj892031 Jan 21, 2025
a027933
attempt to avoid circular dependencies
pj892031 Jan 21, 2025
3ed4812
Merge branch 'v3.x.x' into renovate/v3.x.x-all-minor-patch
pj892031 Jan 21, 2025
8960dbc
attempt to fix catalog loading
pj892031 Jan 21, 2025
b565a12
revert the behaviour about missing catalog instance
pj892031 Jan 21, 2025
655c5d9
Merge branch 'v3.x.x' into renovate/v3.x.x-all-minor-patch
pj892031 Jan 21, 2025
f726d61
Merge branch 'v3.x.x' into renovate/v3.x.x-all-minor-patch
pj892031 Feb 4, 2025
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
3 changes: 3 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
image: ghcr.io/balhar-jakub/api-catalog-services-standalone:${{ github.run_id }}-${{ github.run_number }}
volumes:
- /api-defs:/api-defs
env:
APIML_SERVICE_HOSTNAME: api-catalog-services-2
APIML_HEALTH_PROTECTED: false
api-catalog-services:
image: ghcr.io/balhar-jakub/api-catalog-services:${{ github.run_id }}-${{ github.run_number }}
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

package org.zowe.apiml.apicatalog.config;

import org.zowe.apiml.message.core.MessageService;
import org.zowe.apiml.product.gateway.GatewayClient;
import org.zowe.apiml.product.routing.transform.TransformService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.zowe.apiml.message.core.MessageService;
import org.zowe.apiml.message.yaml.YamlMessageServiceInstance;
import org.zowe.apiml.product.gateway.GatewayClient;
import org.zowe.apiml.product.routing.transform.TransformService;

/**
* General configuration of the API Catalog.
Expand All @@ -25,7 +26,9 @@ public class BeanConfig {

@Bean
@Primary
public MessageService messageServiceCatalog(MessageService messageService) {
public MessageService messageServiceCatalog() {
MessageService messageService = YamlMessageServiceInstance.getInstance();
messageService.loadMessages("/security-client-log-messages.yml");
messageService.loadMessages("/utility-log-messages.yml");
messageService.loadMessages("/common-log-messages.yml");
messageService.loadMessages("/security-common-log-messages.yml");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public ResponseEntity<List<String>> getOidcProvider() {
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "204", description = "No service available"),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "403", description = "Forbidden"),
@ApiResponse(responseCode = "404", description = "URI not found"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down Expand Up @@ -68,6 +69,7 @@
@EnableApimlAuth
@EnableMethodSecurity
@EnableConfigurationProperties(SafSecurityConfigurationProperties.class)
@ConditionalOnProperty(value = "apiml.catalog.standalone.enabled", havingValue = "false", matchIfMissing = true)
public class SecurityConfiguration {
private static final String APIDOC_ROUTES = "/apidoc/**";
private static final String STATIC_REFRESH_ROUTE = "/static-api/refresh";
Expand Down Expand Up @@ -299,4 +301,5 @@ private OidcContentFilter oidcFilter(AuthenticationManager authenticationManager
public LogoutSuccessHandler logoutSuccessHandler() {
return new ApiCatalogLogoutSuccessHandler(authConfigurationProperties);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@
package org.zowe.apiml.apicatalog.services.status.listeners;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.event.EventListener;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.zowe.apiml.apicatalog.instance.InstanceInitializeService;
import org.zowe.apiml.product.gateway.GatewayLookupCompleteEvent;
import org.zowe.apiml.product.registry.CannotRegisterServiceException;

import java.util.concurrent.atomic.AtomicBoolean;

/**
* This class fires on GatewayLookupCompleteEvent event
* Initializes Catalog instances from Eureka
*/
@Slf4j
@Component
@ConditionalOnProperty(
value = "apiml.catalog.standalone.enabled",
Expand All @@ -39,10 +40,15 @@ public class GatewayLookupEventListener {
private final AtomicBoolean hasRun = new AtomicBoolean(false);

@EventListener(GatewayLookupCompleteEvent.class)
public void onApplicationEvent() throws CannotRegisterServiceException {
public void onApplicationEvent() {
if (!hasRun.get()) {
hasRun.set(true);
instanceInitializeService.retrieveAndRegisterAllInstancesWithCatalog();
try {
instanceInitializeService.retrieveAndRegisterAllInstancesWithCatalog();
} catch (Exception e) {
hasRun.set(false);
log.debug("Unexpected error occurred while initial retrieving of services: {}", e.getMessage());
}
}
}
}
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe("Swagger rendering", () => {
.should('exist');

cy.get('@swaggerContainer')
.get('div.information-container > section > div > div.info > .main')
.get('div.information-container > section div.info .main')
.as('mainInfo');

cy.get('@mainInfo').should('exist');
Expand Down
Loading
Loading