aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-05-07 14:20:16 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-05-07 14:20:16 +0200
commit25bd84ec32115b346cab66eeed9dc47cd574d12b (patch)
tree7c8cff4489fe48b54a1a40f152b0d86a56efd0ed
parentbe08f91dac2b018fb9a08c89e3961ebc0263a1a4 (diff)
Read app version from version.properties
- read app version from version.properties - make openapi dependencies compileOnly - run spotless formatter Issue-ID: PORTALNG-94 Change-Id: I3d3b9f057bc998d90763101ac8f3b32a0df280c1 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
-rw-r--r--app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java12
-rw-r--r--app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java3
-rw-r--r--app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java6
-rw-r--r--app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java9
-rw-r--r--app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java15
-rw-r--r--app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java9
-rw-r--r--app/src/test/resources/application-access-control.yml41
-rw-r--r--lib/build.gradle19
-rw-r--r--lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java12
-rw-r--r--openapi/client-history/build.gradle4
-rw-r--r--openapi/client-keycloak/build.gradle4
-rw-r--r--openapi/client-preferences/build.gradle4
-rw-r--r--openapi/server/build.gradle6
-rw-r--r--version1
-rw-r--r--version.properties4
15 files changed, 74 insertions, 75 deletions
diff --git a/app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java
index bfc868d..7928c3b 100644
--- a/app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java
+++ b/app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java
@@ -226,15 +226,13 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
.withHeader(
- "location",
- String.format("/admin/realms/%s/users/%s", realm, userId))));
+ "location", String.format("/admin/realms/%s/users/%s", realm, userId))));
}
protected void mockGetUser(String userId, UserKeycloakDto response) throws Exception {
WireMock.stubFor(
WireMock.get(
- WireMock.urlMatching(
- String.format("/admin/realms/%s/users/%s", realm, userId)))
+ WireMock.urlMatching(String.format("/admin/realms/%s/users/%s", realm, userId)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -245,8 +243,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.post(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/%s/role-mappings/realm", realm, userId)))
+ String.format("/admin/realms/%s/users/%s/role-mappings/realm", realm, userId)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -276,8 +273,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
+ String.format("/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
diff --git a/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java
index 6766af8..337d3e3 100644
--- a/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java
+++ b/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java
@@ -117,8 +117,7 @@ class GetUserDetailIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
+ String.format("/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
diff --git a/app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java
index d8fb3c7..06d9b89 100644
--- a/app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java
+++ b/app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java
@@ -47,8 +47,7 @@ class ListAvailableRolesIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+ String.format("/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -83,8 +82,7 @@ class ListAvailableRolesIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+ String.format("/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
diff --git a/app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java
index d4d74da..2b5fdb4 100644
--- a/app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java
+++ b/app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java
@@ -162,8 +162,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
protected void mockGetUserCount(Integer userCount) {
WireMock.stubFor(
- WireMock.get(
- WireMock.urlMatching(String.format("/admin/realms/%s/users/count", realm)))
+ WireMock.get(WireMock.urlMatching(String.format("/admin/realms/%s/users/count", realm)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -175,8 +174,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users\\?first=%s&max=%s", realm, first, max)))
+ String.format("/admin/realms/%s/users\\?first=%s&max=%s", realm, first, max)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -227,8 +225,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users\\?first=%s&max=%s", realm, first, max)))
+ String.format("/admin/realms/%s/users\\?first=%s&max=%s", realm, first, max)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
diff --git a/app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java
index a69e969..9fcff3b 100644
--- a/app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java
+++ b/app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java
@@ -54,8 +54,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+ String.format("/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
.inScenario("test")
.whenScenarioStateIs(Scenario.STARTED)
.willReturn(
@@ -138,8 +137,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+ String.format("/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
.inScenario("test")
.whenScenarioStateIs(Scenario.STARTED)
.willReturn(
@@ -226,8 +224,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+ String.format("/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -288,8 +285,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+ String.format("/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
.inScenario("test")
.whenScenarioStateIs(Scenario.STARTED)
.willReturn(
@@ -374,8 +370,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+ String.format("/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
.inScenario("test")
.whenScenarioStateIs(Scenario.STARTED)
.willReturn(
diff --git a/app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java
index 3ce7d8b..349909f 100644
--- a/app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java
+++ b/app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java
@@ -101,8 +101,7 @@ class UpdateUserIntegrationTest extends BaseIntegrationTest {
protected void mockUpdateUser(UserKeycloakDto request, String userId) throws Exception {
WireMock.stubFor(
WireMock.put(
- WireMock.urlMatching(
- String.format("/admin/realms/%s/users/%s", realm, userId)))
+ WireMock.urlMatching(String.format("/admin/realms/%s/users/%s", realm, userId)))
.withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(request)))
.willReturn(
WireMock.aResponse().withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)));
@@ -111,8 +110,7 @@ class UpdateUserIntegrationTest extends BaseIntegrationTest {
protected void mockGetUser(String userId, UserKeycloakDto response) throws Exception {
WireMock.stubFor(
WireMock.get(
- WireMock.urlMatching(
- String.format("/admin/realms/%s/users/%s", realm, userId)))
+ WireMock.urlMatching(String.format("/admin/realms/%s/users/%s", realm, userId)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -124,8 +122,7 @@ class UpdateUserIntegrationTest extends BaseIntegrationTest {
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format(
- "/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
+ String.format("/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
diff --git a/app/src/test/resources/application-access-control.yml b/app/src/test/resources/application-access-control.yml
index ad470ce..6fda781 100644
--- a/app/src/test/resources/application-access-control.yml
+++ b/app/src/test/resources/application-access-control.yml
@@ -1,20 +1,21 @@
-bff.access-control:
- ACTIONS_CREATE: [ portal_admin, portal_designer, portal_operator ]
- ACTIONS_GET: [ portal_admin, portal_designer, portal_operator ]
- ACTIONS_LIST: [ portal_admin, portal_designer, portal_operator ]
- ACTIVE_ALARM_LIST: [portal_admin, portal_designer, portal_operator]
- KEY_ENCRYPT_BY_USER: [portal_admin, portal_designer, portal_operator]
- KEY_ENCRYPT_BY_VALUE: [portal_admin, portal_designer, portal_operator]
- PREFERENCES_CREATE: [portal_admin, portal_designer, portal_operator]
- PREFERENCES_GET: [portal_admin, portal_designer, portal_operator]
- PREFERENCES_UPDATE: [portal_admin, portal_designer, portal_operator]
- ROLE_LIST: ["*"]
- USER_CREATE: [portal_admin, portal_designer, portal_operator]
- USER_DELETE: [portal_admin, portal_designer, portal_operator]
- USER_GET: [portal_admin, portal_designer, portal_operator]
- USER_LIST_AVAILABLE_ROLES: [portal_admin, portal_designer, portal_operator]
- USER_LIST_ROLES: [portal_admin, portal_designer, portal_operator]
- USER_LIST: [portal_admin, portal_designer, portal_operator]
- USER_UPDATE_PASSWORD: [portal_admin, portal_designer, portal_operator]
- USER_UPDATE_ROLES: [portal_admin, portal_designer, portal_operator]
- USER_UPDATE: [portal_admin, portal_designer, portal_operator]
+bff:
+ access-control:
+ ACTIONS_CREATE: [ portal_admin, portal_designer, portal_operator ]
+ ACTIONS_GET: [ portal_admin, portal_designer, portal_operator ]
+ ACTIONS_LIST: [ portal_admin, portal_designer, portal_operator ]
+ ACTIVE_ALARM_LIST: [portal_admin, portal_designer, portal_operator]
+ KEY_ENCRYPT_BY_USER: [portal_admin, portal_designer, portal_operator]
+ KEY_ENCRYPT_BY_VALUE: [portal_admin, portal_designer, portal_operator]
+ PREFERENCES_CREATE: [portal_admin, portal_designer, portal_operator]
+ PREFERENCES_GET: [portal_admin, portal_designer, portal_operator]
+ PREFERENCES_UPDATE: [portal_admin, portal_designer, portal_operator]
+ ROLE_LIST: ["*"]
+ USER_CREATE: [portal_admin, portal_designer, portal_operator]
+ USER_DELETE: [portal_admin, portal_designer, portal_operator]
+ USER_GET: [portal_admin, portal_designer, portal_operator]
+ USER_LIST_AVAILABLE_ROLES: [portal_admin, portal_designer, portal_operator]
+ USER_LIST_ROLES: [portal_admin, portal_designer, portal_operator]
+ USER_LIST: [portal_admin, portal_designer, portal_operator]
+ USER_UPDATE_PASSWORD: [portal_admin, portal_designer, portal_operator]
+ USER_UPDATE_ROLES: [portal_admin, portal_designer, portal_operator]
+ USER_UPDATE: [portal_admin, portal_designer, portal_operator]
diff --git a/lib/build.gradle b/lib/build.gradle
index 93064db..90ab5b2 100644
--- a/lib/build.gradle
+++ b/lib/build.gradle
@@ -9,7 +9,7 @@ plugins {
}
group 'org.onap.portal-ng'
-version rootProject.file('version').text.trim()
+version getAppVersion()
dependencies {
implementation project(':openapi:server')
@@ -100,4 +100,19 @@ spotbugs {
ignoreFailures = false
reportLevel = "high"
excludeFilter = file("$rootProject.projectDir/spotbugs-exclude.xml")
-} \ No newline at end of file
+}
+
+def String getAppVersion() {
+ Properties versionProperties = getVersionProperties()
+ String major = versionProperties.getProperty('major')
+ String minor = versionProperties.getProperty('minor')
+ String patch = versionProperties.getProperty('patch')
+ return major + '.' + minor + '.' + patch
+}
+def Properties getVersionProperties() {
+ def versionProperties = new Properties()
+ rootProject.file('version.properties').withInputStream {
+ versionProperties.load(it)
+ }
+ return versionProperties
+}
diff --git a/lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java
index 3eb5f87..a23ac0c 100644
--- a/lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java
+++ b/lib/src/main/java/org/onap/portalng/bff/config/BeansConfig.java
@@ -33,6 +33,7 @@ import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.onap.portalng.bff.exceptions.DownstreamApiProblemException;
import org.onap.portalng.bff.utils.Logger;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.codec.ClientCodecConfigurer;
@@ -58,9 +59,11 @@ public class BeansConfig {
"logRequestExchangeFilterFunction";
public static final String LOG_RESPONSE_EXCHANGE_FILTER_FUNCTION =
"logResponseExchangeFilterFunction";
- private static final String CLIENT_REGISTRATION_ID = "keycloak";
public static final String X_REQUEST_ID = "X-Request-Id";
+ private static final String CLIENT_REGISTRATION_ID = "keycloak";
+ private static final ObjectMapper objectMapper = new ObjectMapper();
+
@Bean(name = OAUTH2_EXCHANGE_FILTER_FUNCTION)
ExchangeFilterFunction oauth2ExchangeFilterFunction(
ReactiveOAuth2AuthorizedClientManager authorizedClientManager) {
@@ -88,9 +91,8 @@ public class BeansConfig {
downstreamExceptionBody -> {
try {
return Mono.error(
- new ObjectMapper()
- .readValue(
- downstreamExceptionBody, DownstreamApiProblemException.class));
+ objectMapper.readValue(
+ downstreamExceptionBody, DownstreamApiProblemException.class));
} catch (JsonProcessingException e) {
return Mono.error(DownstreamApiProblemException.builder().build());
}
@@ -130,7 +132,7 @@ public class BeansConfig {
}
@Bean
- ExchangeStrategies exchangeStrategies(ObjectMapper objectMapper) {
+ ExchangeStrategies exchangeStrategies(@Qualifier("objectMapper") ObjectMapper objectMapper) {
return ExchangeStrategies.builder()
.codecs(
configurer -> {
diff --git a/openapi/client-history/build.gradle b/openapi/client-history/build.gradle
index 20b5258..7b734d2 100644
--- a/openapi/client-history/build.gradle
+++ b/openapi/client-history/build.gradle
@@ -7,8 +7,8 @@ plugins {
}
dependencies {
- implementation 'org.springframework.boot:spring-boot-starter-webflux'
- implementation "org.openapitools:openapi-generator:$openapiVersion"
+ compileOnly 'org.springframework.boot:spring-boot-starter-webflux'
+ compileOnly "org.openapitools:openapi-generator:$openapiVersion"
}
openApiGenerate {
diff --git a/openapi/client-keycloak/build.gradle b/openapi/client-keycloak/build.gradle
index 46c842d..eff24ec 100644
--- a/openapi/client-keycloak/build.gradle
+++ b/openapi/client-keycloak/build.gradle
@@ -7,8 +7,8 @@ plugins {
}
dependencies {
- implementation 'org.springframework.boot:spring-boot-starter-webflux'
- implementation "org.openapitools:openapi-generator:$openapiVersion"
+ compileOnly 'org.springframework.boot:spring-boot-starter-webflux'
+ compileOnly "org.openapitools:openapi-generator:$openapiVersion"
}
openApiGenerate {
diff --git a/openapi/client-preferences/build.gradle b/openapi/client-preferences/build.gradle
index 208b20d..668dc37 100644
--- a/openapi/client-preferences/build.gradle
+++ b/openapi/client-preferences/build.gradle
@@ -7,8 +7,8 @@ plugins {
}
dependencies {
- implementation 'org.springframework.boot:spring-boot-starter-webflux'
- implementation "org.openapitools:openapi-generator:$openapiVersion"
+ compileOnly 'org.springframework.boot:spring-boot-starter-webflux'
+ compileOnly "org.openapitools:openapi-generator:$openapiVersion"
}
openApiGenerate {
diff --git a/openapi/server/build.gradle b/openapi/server/build.gradle
index 78c5103..bdb7b1e 100644
--- a/openapi/server/build.gradle
+++ b/openapi/server/build.gradle
@@ -7,12 +7,12 @@ plugins {
}
dependencies {
- implementation 'org.springframework.boot:spring-boot-starter-webflux'
- implementation "org.openapitools:openapi-generator:$openapiVersion"
+ compileOnly 'org.springframework.boot:spring-boot-starter-webflux'
+ compileOnly "org.openapitools:openapi-generator:$openapiVersion"
// implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
constraints {
- implementation('io.swagger.core.v3:swagger-annotations:2.2.5') {
+ compileOnly('io.swagger.core.v3:swagger-annotations:2.2.5') {
because 'there is a dependency conflict between swagger-parser versions 2 and 3 (https://github.com/OpenAPITools/openapi-generator/issues/14901)'
}
}
diff --git a/version b/version
deleted file mode 100644
index d917d3e..0000000
--- a/version
+++ /dev/null
@@ -1 +0,0 @@
-0.1.2
diff --git a/version.properties b/version.properties
index 55a18bc..5294d92 100644
--- a/version.properties
+++ b/version.properties
@@ -3,8 +3,8 @@
# because they are used in Jenkins, whose plug-in doesn't support
major=0
-minor=0
-patch=9
+minor=1
+patch=0
base_version=${major}.${minor}.${patch}