aboutsummaryrefslogtreecommitdiffstats
path: root/app/src
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-07-11 08:18:56 +0000
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-07-11 08:18:56 +0000
commit376886832fddb2880921b3e290af69fcb778b897 (patch)
treed88c4d0c3f47c54d9d0f5fc5084bc86b2e28c0f7 /app/src
parente932b0f9b8aff49d9bfd78440bc693397b00c16c (diff)
Remove vavr
Issue-ID: PORTALNG-12 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de> Change-Id: I13cc4998d082b1dbd3ab1c8986e4525cd177cf89
Diffstat (limited to 'app/src')
-rw-r--r--app/src/test/java/org/onap/portal/bff/BaseIntegrationTest.java49
-rw-r--r--app/src/test/java/org/onap/portal/bff/TokenGenerator.java7
-rw-r--r--app/src/test/java/org/onap/portal/bff/headers/XRequestIdHeaderTest.java9
-rw-r--r--app/src/test/java/org/onap/portal/bff/roles/ListRealmRolesIntegrationTest.java2
-rw-r--r--app/src/test/java/org/onap/portal/bff/roles/RolesMocks.java2
-rw-r--r--app/src/test/java/org/onap/portal/bff/users/CreateUserIntegrationTest.java25
-rw-r--r--app/src/test/java/org/onap/portal/bff/users/GetUserDetailIntegrationTest.java2
-rw-r--r--app/src/test/java/org/onap/portal/bff/users/ListAssignedRolesIntegrationTest.java2
-rw-r--r--app/src/test/java/org/onap/portal/bff/users/ListAvailableRolesIntegrationTest.java2
-rw-r--r--app/src/test/java/org/onap/portal/bff/users/ListUsersIntegrationTest.java24
-rw-r--r--app/src/test/java/org/onap/portal/bff/users/UpdateAssignedRolesIntegrationTest.java7
-rw-r--r--app/src/test/java/org/onap/portal/bff/users/UpdateUserIntegrationTest.java2
-rw-r--r--app/src/test/java/org/onap/portal/bff/utils/SortingChainResolverTest.java141
-rw-r--r--app/src/test/java/org/onap/portal/bff/utils/SortingParserTest.java50
-rw-r--r--app/src/test/java/org/onap/portal/bff/utils/VersionComparatorTest.java41
15 files changed, 72 insertions, 293 deletions
diff --git a/app/src/test/java/org/onap/portal/bff/BaseIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/BaseIntegrationTest.java
index f310850..c02082c 100644
--- a/app/src/test/java/org/onap/portal/bff/BaseIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/BaseIntegrationTest.java
@@ -21,9 +21,6 @@
package org.onap.portal.bff;
-import static io.vavr.API.None;
-import static io.vavr.API.Some;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer;
@@ -32,11 +29,14 @@ import io.restassured.RestAssured;
import io.restassured.filter.log.RequestLoggingFilter;
import io.restassured.filter.log.ResponseLoggingFilter;
import io.restassured.specification.RequestSpecification;
-import io.vavr.collection.List;
-import io.vavr.control.Option;
+import java.net.URISyntaxException;
import java.time.Clock;
import java.time.OffsetDateTime;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
import java.util.UUID;
+import org.apache.http.client.utils.URIBuilder;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.onap.portal.bff.config.IdTokenExchangeFilterFunction;
@@ -45,7 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
-import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.cloud.contract.wiremock.WireMockConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
@@ -183,7 +183,7 @@ public abstract class BaseIntegrationTest {
return TokenGenerator.TokenGeneratorConfig.builder()
.port(port)
.realm(realm)
- .roles(List.of(role))
+ .roles(Collections.singletonList(role))
.build();
}
@@ -210,19 +210,32 @@ public abstract class BaseIntegrationTest {
return UUID.randomUUID().toString();
}
- public static String adjustPath(String basePath, Option<Integer> page, Option<Integer> pageSize) {
- return adjustPath(basePath, page, pageSize, None());
+ public static String adjustPath(
+ String basePath, Optional<Integer> page, Optional<Integer> pageSize) {
+ return adjustPath(basePath, page, pageSize, Optional.empty());
}
public static String adjustPath(
- String basePath, Option<Integer> page, Option<Integer> pageSize, Option<String> filter) {
- return page.map(pg -> basePath + "?page=" + pg)
- .fold(
- () -> pageSize.map(pgs -> basePath + "?pageSize=" + pgs),
- pth -> pageSize.map(pgs -> pth + "&pageSize=" + pgs).orElse(Some(pth)))
- .fold(
- () -> filter.map(f -> basePath + "?filter=" + f),
- pth -> filter.map(f -> pth + "&filter=" + f).orElse(Some(pth)))
- .getOrElse(basePath);
+ String basePath,
+ Optional<Integer> page,
+ Optional<Integer> pageSize,
+ Optional<String> filter) {
+ URIBuilder builder;
+ try {
+ builder = new URIBuilder(basePath);
+ if (page.isPresent()) {
+ builder.addParameter("page", String.valueOf(page.get()));
+ }
+ if (pageSize.isPresent()) {
+ builder.addParameter("pageSize", String.valueOf(pageSize.get()));
+ }
+ if (filter.isPresent()) {
+ builder.addParameter("filter", filter.get());
+ }
+ return builder.build().toString();
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ return basePath;
}
}
diff --git a/app/src/test/java/org/onap/portal/bff/TokenGenerator.java b/app/src/test/java/org/onap/portal/bff/TokenGenerator.java
index d438d95..33b9207 100644
--- a/app/src/test/java/org/onap/portal/bff/TokenGenerator.java
+++ b/app/src/test/java/org/onap/portal/bff/TokenGenerator.java
@@ -32,16 +32,16 @@ import com.nimbusds.jose.jwk.RSAKey;
import com.nimbusds.jose.jwk.gen.RSAKeyGenerator;
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
-import io.vavr.collection.List;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
+import java.util.Collections;
import java.util.Date;
+import java.util.List;
import java.util.UUID;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@@ -54,7 +54,6 @@ public class TokenGenerator {
private final JWKSet jwkSet;
private final JWSSigner signer;
- @Autowired
public TokenGenerator(Clock clock) {
try {
this.clock = clock;
@@ -114,7 +113,7 @@ public class TokenGenerator {
@NonNull @Builder.Default private final Duration expireIn = Duration.ofMinutes(5);
- @Builder.Default private final List<String> roles = List.empty();
+ @Builder.Default private final List<String> roles = Collections.emptyList();
public String issuer() {
return String.format("http://localhost:%d/auth/realms/%s", port, realm);
diff --git a/app/src/test/java/org/onap/portal/bff/headers/XRequestIdHeaderTest.java b/app/src/test/java/org/onap/portal/bff/headers/XRequestIdHeaderTest.java
index ad54c82..50f75c7 100644
--- a/app/src/test/java/org/onap/portal/bff/headers/XRequestIdHeaderTest.java
+++ b/app/src/test/java/org/onap/portal/bff/headers/XRequestIdHeaderTest.java
@@ -39,18 +39,17 @@ class XRequestIdHeaderTest extends BaseIntegrationTest {
@Test
void xRequestIdHeaderIsCorrectlySetInResponse() throws Exception {
// use preferences endpoint for testing the header
- final PreferencesPortalPrefsDto preferencesPortalPrefsDto =
- new PreferencesPortalPrefsDto();
+ final PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto();
- //mockGetTile(tileDetailResponsePortalServiceDto, X_REQUEST_ID);
+ // mockGetTile(tileDetailResponsePortalServiceDto, X_REQUEST_ID);
mockGetPreferences(preferencesPortalPrefsDto, X_REQUEST_ID);
final String response = getPreferencesExtractHeader(X_REQUEST_ID);
assertThat(response).isEqualTo(X_REQUEST_ID);
}
- protected void mockGetPreferences(PreferencesPortalPrefsDto preferencesPortalPrefsDto, String xRequestId)
- throws Exception {
+ protected void mockGetPreferences(
+ PreferencesPortalPrefsDto preferencesPortalPrefsDto, String xRequestId) throws Exception {
WireMock.stubFor(
WireMock.get(WireMock.urlEqualTo("/v1/preferences"))
.withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID))
diff --git a/app/src/test/java/org/onap/portal/bff/roles/ListRealmRolesIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/roles/ListRealmRolesIntegrationTest.java
index 03f39db..8228ac9 100644
--- a/app/src/test/java/org/onap/portal/bff/roles/ListRealmRolesIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/roles/ListRealmRolesIntegrationTest.java
@@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.restassured.http.Header;
-import io.vavr.collection.List;
+import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto;
diff --git a/app/src/test/java/org/onap/portal/bff/roles/RolesMocks.java b/app/src/test/java/org/onap/portal/bff/roles/RolesMocks.java
index fa43302..3243497 100644
--- a/app/src/test/java/org/onap/portal/bff/roles/RolesMocks.java
+++ b/app/src/test/java/org/onap/portal/bff/roles/RolesMocks.java
@@ -23,7 +23,7 @@ package org.onap.portal.bff.roles;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.restassured.http.Header;
-import io.vavr.collection.List;
+import java.util.List;
import org.onap.portal.bff.BaseIntegrationTest;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto;
import org.onap.portal.bff.openapi.server.model.RoleListResponseApiDto;
diff --git a/app/src/test/java/org/onap/portal/bff/users/CreateUserIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/users/CreateUserIntegrationTest.java
index 4e752aa..8fb1eba 100644
--- a/app/src/test/java/org/onap/portal/bff/users/CreateUserIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/users/CreateUserIntegrationTest.java
@@ -21,14 +21,13 @@
package org.onap.portal.bff.users;
-import static io.vavr.API.List;
import static org.assertj.core.api.Assertions.assertThat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.restassured.http.Header;
-import io.vavr.API;
-import io.vavr.collection.List;
+import java.util.Collections;
+import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.portal.bff.BaseIntegrationTest;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto;
@@ -54,7 +53,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
.username("user1")
.email("user1@localhost.com")
.enabled(true)
- .requiredActions(List(RequiredActionsKeycloakDto.UPDATE_PASSWORD).toJavaList());
+ .requiredActions(List.of(RequiredActionsKeycloakDto.UPDATE_PASSWORD));
final String userId = randomUUID();
mockCreateUser(keycloakRequest, userId);
@@ -69,9 +68,9 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
mockGetUser(userId, keycloakResponse);
final RoleKeycloakDto onapAdmin = new RoleKeycloakDto().id(randomUUID()).name("onap_admin");
- mockAddRoles(userId, List(onapAdmin));
- mockAssignedRoles(userId, List(onapAdmin));
- mockListRealmRoles(List(onapAdmin));
+ mockAddRoles(userId, List.of(onapAdmin));
+ mockAssignedRoles(userId, List.of(onapAdmin));
+ mockListRealmRoles(List.of(onapAdmin));
requestSpecification()
.given()
@@ -84,7 +83,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
.extract()
.body()
.as(RoleListResponseApiDto.class);
- mockSendUpdateEmail(userId, API.List(RequiredActionsKeycloakDto.UPDATE_PASSWORD));
+ mockSendUpdateEmail(userId, List.of(RequiredActionsKeycloakDto.UPDATE_PASSWORD));
final CreateUserRequestApiDto request =
new CreateUserRequestApiDto()
@@ -127,7 +126,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
.username("user1")
.email("user1@localhost.com")
.enabled(true)
- .requiredActions(List(RequiredActionsKeycloakDto.UPDATE_PASSWORD).toJavaList());
+ .requiredActions(List.of(RequiredActionsKeycloakDto.UPDATE_PASSWORD));
final String userId = randomUUID();
mockCreateUser(keycloakRequest, userId);
@@ -142,14 +141,14 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
mockGetUser(userId, keycloakResponse);
final RoleKeycloakDto onapAdmin = new RoleKeycloakDto().id(randomUUID()).name("onap_admin");
- mockAddRoles(userId, List(onapAdmin));
- mockListRealmRoles(List(onapAdmin));
+ mockAddRoles(userId, List.of(onapAdmin));
+ mockListRealmRoles(List.of(onapAdmin));
final ErrorResponseKeycloakDto keycloakErrorResponse =
new ErrorResponseKeycloakDto().errorMessage("Some error message");
mockSendUpdateEmailWithProblem(
- userId, API.List(RequiredActionsKeycloakDto.UPDATE_PASSWORD), keycloakErrorResponse);
+ userId, List.of(RequiredActionsKeycloakDto.UPDATE_PASSWORD), keycloakErrorResponse);
final CreateUserRequestApiDto request =
new CreateUserRequestApiDto()
@@ -186,7 +185,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
void userCanNotBeCreatedWithNonexistentRoles() throws Exception {
String xRequestID = "addf6005-3075-4c80-b7bc-2c70b7d42b57";
- mockListRealmRoles(List());
+ mockListRealmRoles(Collections.emptyList());
final CreateUserRequestApiDto request =
new CreateUserRequestApiDto()
diff --git a/app/src/test/java/org/onap/portal/bff/users/GetUserDetailIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/users/GetUserDetailIntegrationTest.java
index 1bca58c..7974549 100644
--- a/app/src/test/java/org/onap/portal/bff/users/GetUserDetailIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/users/GetUserDetailIntegrationTest.java
@@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.restassured.http.Header;
-import io.vavr.collection.List;
+import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.portal.bff.BaseIntegrationTest;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto;
diff --git a/app/src/test/java/org/onap/portal/bff/users/ListAssignedRolesIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/users/ListAssignedRolesIntegrationTest.java
index 6564577..193f399 100644
--- a/app/src/test/java/org/onap/portal/bff/users/ListAssignedRolesIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/users/ListAssignedRolesIntegrationTest.java
@@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.restassured.http.Header;
-import io.vavr.collection.List;
+import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.portal.bff.BaseIntegrationTest;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto;
diff --git a/app/src/test/java/org/onap/portal/bff/users/ListAvailableRolesIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/users/ListAvailableRolesIntegrationTest.java
index b5ca3c6..d5f9bbf 100644
--- a/app/src/test/java/org/onap/portal/bff/users/ListAvailableRolesIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/users/ListAvailableRolesIntegrationTest.java
@@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.restassured.http.Header;
-import io.vavr.collection.List;
+import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.portal.bff.BaseIntegrationTest;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto;
diff --git a/app/src/test/java/org/onap/portal/bff/users/ListUsersIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/users/ListUsersIntegrationTest.java
index 1df7b69..18c486a 100644
--- a/app/src/test/java/org/onap/portal/bff/users/ListUsersIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/users/ListUsersIntegrationTest.java
@@ -21,13 +21,13 @@
package org.onap.portal.bff.users;
-import static io.vavr.API.*;
import static org.assertj.core.api.Assertions.assertThat;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.restassured.http.Header;
-import io.vavr.collection.List;
-import io.vavr.control.Option;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
import org.junit.jupiter.api.Test;
import org.onap.portal.bff.BaseIntegrationTest;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto;
@@ -67,9 +67,9 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
mockGetUserCount(2);
mockListUsers(List.of(tAdmin, tDesigner), 0, 10);
- mockListRealmRoles(List(ONAP_ADMIN, OFFLINE_ACCESS));
- mockListRoleUsers(OFFLINE_ACCESS.getName(), List(tAdmin, tDesigner));
- mockListRoleUsers(ONAP_ADMIN.getName(), List(tAdmin));
+ mockListRealmRoles(List.of(ONAP_ADMIN, OFFLINE_ACCESS));
+ mockListRoleUsers(OFFLINE_ACCESS.getName(), List.of(tAdmin, tDesigner));
+ mockListRoleUsers(ONAP_ADMIN.getName(), List.of(tAdmin));
final UserResponseApiDto expectedTAdmin =
new UserResponseApiDto()
@@ -114,9 +114,9 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
mockGetUserCount(1);
mockListUsers(List.of(keycloakUser), 60, 30);
- mockListRealmRoles(List());
+ mockListRealmRoles(Collections.emptyList());
- final UserListResponseApiDto response = listUsers(Some(3), Some(30));
+ final UserListResponseApiDto response = listUsers(Optional.of(3), Optional.of(30));
assertThat(response).isNotNull();
assertThat(response.getTotalCount()).isEqualTo(1);
assertThat(response.getItems())
@@ -138,7 +138,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
mockGetUserCount(55);
mockListUsersWithProblems(keycloakErrorResponse, 60, 30);
- mockListRealmRoles(List());
+ mockListRealmRoles(Collections.emptyList());
ProblemApiDto response =
requestSpecification()
@@ -146,7 +146,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
.accept(MediaType.APPLICATION_JSON_VALUE)
.header(new Header("X-Request-Id", "addf6005-3075-4c80-b7bc-2c70b7d42b57"))
.when()
- .get(adjustPath("/users", Some(3), Some(30)))
+ .get(adjustPath("/users", Optional.of(3), Optional.of(30)))
.then()
.statusCode(HttpStatus.BAD_GATEWAY.value())
.extract()
@@ -205,10 +205,10 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
}
protected UserListResponseApiDto listUsers() {
- return listUsers(None(), None());
+ return listUsers(Optional.empty(), Optional.empty());
}
- protected UserListResponseApiDto listUsers(Option<Integer> page, Option<Integer> pageSize) {
+ protected UserListResponseApiDto listUsers(Optional<Integer> page, Optional<Integer> pageSize) {
return requestSpecification()
.given()
.accept(MediaType.APPLICATION_JSON_VALUE)
diff --git a/app/src/test/java/org/onap/portal/bff/users/UpdateAssignedRolesIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/users/UpdateAssignedRolesIntegrationTest.java
index 54afdcd..8abe781 100644
--- a/app/src/test/java/org/onap/portal/bff/users/UpdateAssignedRolesIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/users/UpdateAssignedRolesIntegrationTest.java
@@ -26,7 +26,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.stubbing.Scenario;
import io.restassured.http.Header;
-import io.vavr.collection.List;
+import java.util.Collections;
+import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.portal.bff.BaseIntegrationTest;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto;
@@ -219,7 +220,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
final RoleKeycloakDto keycloakRole2 = new RoleKeycloakDto().id("2").name("role2");
final List<RoleKeycloakDto> keycloakAvailableRoles = List.of(keycloakRole1, keycloakRole2);
- final List<RoleKeycloakDto> keycloakAssignedRoles = List.empty();
+ final List<RoleKeycloakDto> keycloakAssignedRoles = Collections.emptyList();
final List<RoleKeycloakDto> keycloakRolesToRemove = List.of(keycloakRole1, keycloakRole2);
WireMock.stubFor(
@@ -249,7 +250,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
.withBody(objectMapper.writeValueAsString(keycloakAssignedRoles))));
- final List<RoleApiDto> rolesToAssign = List.empty();
+ final List<RoleApiDto> rolesToAssign = Collections.emptyList();
final RoleListResponseApiDto response =
requestSpecification()
diff --git a/app/src/test/java/org/onap/portal/bff/users/UpdateUserIntegrationTest.java b/app/src/test/java/org/onap/portal/bff/users/UpdateUserIntegrationTest.java
index 74f0438..f75773c 100644
--- a/app/src/test/java/org/onap/portal/bff/users/UpdateUserIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/bff/users/UpdateUserIntegrationTest.java
@@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.tomakehurst.wiremock.client.WireMock;
import io.restassured.http.Header;
-import io.vavr.collection.List;
+import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.portal.bff.BaseIntegrationTest;
import org.onap.portal.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto;
diff --git a/app/src/test/java/org/onap/portal/bff/utils/SortingChainResolverTest.java b/app/src/test/java/org/onap/portal/bff/utils/SortingChainResolverTest.java
deleted file mode 100644
index c12b01f..0000000
--- a/app/src/test/java/org/onap/portal/bff/utils/SortingChainResolverTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *
- * Copyright (c) 2022. Deutsche Telekom AG
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- *
- */
-
-package org.onap.portal.bff.utils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.vavr.collection.HashMap;
-import io.vavr.collection.List;
-import io.vavr.control.Option;
-import java.util.Comparator;
-import lombok.Data;
-import lombok.NonNull;
-import org.junit.jupiter.api.Test;
-
-class SortingChainResolverTest {
-
- @Test
- void emptySortIsCorrectlyResolved() {
- final SortingChainResolver<DummyPerson> resolver =
- new SortingChainResolver<>(HashMap.of("age", Comparator.comparing(DummyPerson::getAge)));
-
- final Option<Comparator<DummyPerson>> comparatorOption =
- resolver.resolve(SortingParser.parse(""));
- assertThat(comparatorOption.isEmpty()).isTrue();
- }
-
- @Test
- void sortWithUnknownPropertyIsCorrectlyResolved() {
- final SortingChainResolver<DummyPerson> resolver =
- new SortingChainResolver<>(HashMap.of("age", Comparator.comparing(DummyPerson::getAge)));
-
- final Option<Comparator<DummyPerson>> comparatorOption =
- resolver.resolve(SortingParser.parse("unknown"));
- assertThat(comparatorOption.isEmpty()).isTrue();
- }
-
- @Test
- void sortWithSingleAscendingPropertyIsCorrectlyResolved() {
- final SortingChainResolver<DummyPerson> resolver =
- new SortingChainResolver<>(HashMap.of("age", Comparator.comparing(DummyPerson::getAge)));
-
- final Option<Comparator<DummyPerson>> comparatorOption =
- resolver.resolve(SortingParser.parse("age"));
- assertThat(comparatorOption.isDefined()).isTrue();
-
- final List<DummyPerson> list =
- List.of(new DummyPerson("Albert", 10), new DummyPerson("Bernard", 7));
- final List<DummyPerson> expectedList =
- List.of(new DummyPerson("Bernard", 7), new DummyPerson("Albert", 10));
- assertThat(list.sorted(comparatorOption.get())).containsExactlyElementsOf(expectedList);
- }
-
- @Test
- void sortWithSingleDescendingPropertyIsCorrectlyResolved() {
- final SortingChainResolver<DummyPerson> resolver =
- new SortingChainResolver<>(HashMap.of("age", Comparator.comparing(DummyPerson::getAge)));
-
- final Option<Comparator<DummyPerson>> comparatorOption =
- resolver.resolve(SortingParser.parse("-age"));
- assertThat(comparatorOption.isDefined()).isTrue();
-
- final List<DummyPerson> list =
- List.of(new DummyPerson("Charles", 23), new DummyPerson("Dominick", 31));
- final List<DummyPerson> expectedList =
- List.of(new DummyPerson("Dominick", 31), new DummyPerson("Charles", 23));
- assertThat(list.sorted(comparatorOption.get())).containsExactlyElementsOf(expectedList);
- }
-
- @Test
- void sortWithMultiplePropertiesIsCorrectlyResolved() {
- final SortingChainResolver<DummyPerson> resolver =
- new SortingChainResolver<>(
- HashMap.of("age", Comparator.comparing(DummyPerson::getAge))
- .put("name", Comparator.comparing(DummyPerson::getName)));
-
- final Option<Comparator<DummyPerson>> comparatorOption =
- resolver.resolve(SortingParser.parse("age,name"));
- assertThat(comparatorOption.isDefined()).isTrue();
-
- final List<DummyPerson> list =
- List.of(
- new DummyPerson("Harold", 27),
- new DummyPerson("Diego", 70),
- new DummyPerson("David", 27));
- final List<DummyPerson> expectedList =
- List.of(
- new DummyPerson("David", 27),
- new DummyPerson("Harold", 27),
- new DummyPerson("Diego", 70));
- assertThat(list.sorted(comparatorOption.get())).containsExactlyElementsOf(expectedList);
- }
-
- @Test
- void sortWithMultiplePropertiesInDifferentOrderIsCorrectlyResolved() {
- final SortingChainResolver<DummyPerson> resolver =
- new SortingChainResolver<>(
- HashMap.of("age", Comparator.comparing(DummyPerson::getAge))
- .put("name", Comparator.comparing(DummyPerson::getName)));
-
- final Option<Comparator<DummyPerson>> comparatorOption =
- resolver.resolve(SortingParser.parse("name,age"));
- assertThat(comparatorOption.isDefined()).isTrue();
-
- final List<DummyPerson> list =
- List.of(
- new DummyPerson("Harold", 27),
- new DummyPerson("Diego", 70),
- new DummyPerson("David", 27));
- final List<DummyPerson> expectedList =
- List.of(
- new DummyPerson("David", 27),
- new DummyPerson("Diego", 70),
- new DummyPerson("Harold", 27));
- assertThat(list.sorted(comparatorOption.get())).containsExactlyElementsOf(expectedList);
- }
-
- @Data
- private static class DummyPerson {
- @NonNull private final String name;
- private final int age;
- }
-}
diff --git a/app/src/test/java/org/onap/portal/bff/utils/SortingParserTest.java b/app/src/test/java/org/onap/portal/bff/utils/SortingParserTest.java
deleted file mode 100644
index 6412a25..0000000
--- a/app/src/test/java/org/onap/portal/bff/utils/SortingParserTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Copyright (c) 2022. Deutsche Telekom AG
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- *
- */
-
-package org.onap.portal.bff.utils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.jupiter.api.Test;
-
-class SortingParserTest {
-
- @Test
- void emptySortIsCorrectlyParsed() {
- assertThat(SortingParser.parse("")).isEmpty();
- }
-
- @Test
- void sortIsCorrectlyParsed() {
- assertThat(SortingParser.parse("age,-name"))
- .containsExactly(
- new SortingParser.SortingParam("age", false),
- new SortingParser.SortingParam("name", true));
- }
-
- @Test
- void sortWithInvalidPartsIsCorrectlyParsed() {
- assertThat(SortingParser.parse("age,,name,-"))
- .containsExactly(
- new SortingParser.SortingParam("age", false),
- new SortingParser.SortingParam("name", false));
- }
-}
diff --git a/app/src/test/java/org/onap/portal/bff/utils/VersionComparatorTest.java b/app/src/test/java/org/onap/portal/bff/utils/VersionComparatorTest.java
deleted file mode 100644
index af99f50..0000000
--- a/app/src/test/java/org/onap/portal/bff/utils/VersionComparatorTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright (c) 2022. Deutsche Telekom AG
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- *
- */
-
-package org.onap.portal.bff.utils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import io.vavr.collection.List;
-import org.junit.jupiter.api.Test;
-
-class VersionComparatorTest {
-
- @Test
- void versionsAreCorrectlySorted() {
- final VersionComparator comparator = new VersionComparator();
-
- final List<String> expectedVersions =
- List.of("1.0", "1.0.1", "1.1", "1.1.1", "1.2", "1.2.1", "1.10", "2.0");
- final List<String> versions = expectedVersions.shuffle().shuffle();
-
- assertThat(versions.sorted(comparator)).containsExactlyElementsOf(expectedVersions);
- }
-}