Skip to content
Snippets Groups Projects
Commit dd75dbf6 authored by Martin Lowe's avatar Martin Lowe :flag_ca: Committed by Zachary Sabourin
Browse files

Iss #34 - Migrate to commons 9.1, Quarkus 3.2, and Java 17 runtime

parent 72db9a85
No related branches found
No related tags found
1 merge request!19Iss #34 - Migrate to commons 9.1, Quarkus 3.2, and Java 17 runtime
Showing
with 170 additions and 127 deletions
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipsefoundation</groupId>
<artifactId>eclipse-openvsx-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<failsafe.useModulePath>false</failsafe.useModulePath>
<maven.compiler.release>11</maven.compiler.release>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id> quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.16.12.Final</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<auto-value.version>1.8.2</auto-value.version>
<eclipse-api-version>0.8.4</eclipse-api-version>
<fdndb-api-version>1.0.3</fdndb-api-version>
<quarkus.platform.version>3.2.9.Final</quarkus.platform.version>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
<auto-value.version>1.10.4</auto-value.version>
<hibernate.version>5.5.6.Final</hibernate.version>
<eclipse-api-version>0.9.1</eclipse-api-version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
<fdndb-api-version>1.0.6</fdndb-api-version>
<sonar.sources>src/main</sonar.sources>
<sonar.tests>src/test</sonar.tests>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/jacoco-report/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/target/jacoco-report/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.junit.reportPath>${project.build.directory}/surefire-reports</sonar.junit.reportPath>
</properties>
<repositories>
......
......@@ -207,19 +207,19 @@ components:
type: object
properties:
uid:
type: integer
description: The unique user id.
type: string
description: "The unique user id."
name:
type: string
description: The user's ef username name.
description: "The user's ef username name."
picture:
type: string
description: URL of the user's picture.
description: "URL of the user's picture."
mail:
oneOf:
- type: string
- type: "null"
description: The user's email.
description: "The user's email."
eca:
oneOf:
- $ref: "#/components/schemas/Eca"
......@@ -228,17 +228,13 @@ components:
oneOf:
- type: boolean
- type: "null"
description: User's committer status.
friends:
oneOf:
- $ref: "#/components/schemas/Friends"
- type: "null"
description: "User's committer status."
first_name:
type: string
description: The user's first name.
description: "The user's first name."
last_name:
type: string
description: The user's last name.
description: "The user's last name."
publisher_agreements:
type: object
propertyNames:
......@@ -247,66 +243,114 @@ components:
$ref: "#/components/schemas/ProfilePublisherAgreement"
github_handle:
type: string
description: The user's Github handle.
description: "The user's Github handle."
twitter_handle:
type: string
description: The user's Twitter handle.
description: "The user's Twitter handle."
org:
type: string
description: The user's organization.
org_id:
oneOf:
- type: string
- type: "null"
description: "The user's organization."
org_id:
oneOf:
- type: integer
- type: "null"
description: The user's organization id.
job_title:
type: string
description: The user's job title at the organization.
description: "The user's job title at the organization."
website:
type: string
description: The user's website.
description: "The user's website."
country:
$ref: "#/components/schemas/Country"
bio:
oneOf:
- type: string
- type: "null"
description: The user's account bio
description: "The user's account bio"
interests:
type: array
items:
type: string
description: A list of the user's interests.
description: "A list of the user's interests."
working_groups_interests:
type: array
items:
type: string
description: A list of the user's working group interests.
forums_url:
oneOf:
- type: string
- type: "null"
description: The user's forum URL.
- type: array
description: "A list of the user's working group interests."
public_fields:
oneOf:
- type: "null"
- type: array
description: "A list of the user's public fields."
mail_history:
oneOf:
- type: "null"
- type: array
description: "A list of the user's email history."
mail_alternate:
oneOf:
- type: "null"
- type: array
description: "A list of the user's alternate emails."
gerrit_url:
oneOf:
- type: string
- type: "null"
description: The user's Gerrit URL.
description: "The user's Gerrit URL."
projects_url:
oneOf:
- type: string
- type: "null"
description: The user's projects URL.
description: "The user's projects URL."
mailinglist_url:
oneOf:
- type: string
- type: "null"
description: The user's mailing list URL.
description: "The user's mailing list URL."
mpc_favorites_url:
oneOf:
- type: string
- type: "null"
description: The user's Marketplace favorites URL.
description: "The user's Marketplace favorites URL."
example:
uid: "606609"
name: zacharysabourin
mail: zachary.sabourin@eclipse-foundation.org
picture: https://secure.gravatar.com/avatar/fbbbb03860062596a5cf11105dcc7d47.jpg?d=mm&s=185&r=G
eca:
signed: true
can_contribute_spec_project: true
is_committer: true
first_name: Zachary
last_name: Sabourin
github_handle: zacharysabourin
twitter_handle: sometwitteruser
publisher_agreements:
"open-vsx":
version: "1"
org: Eclipse Foundation
org_id: null
job_title: Web Developer
website: https://google.com
country:
code: CA
name: Canada
bio: This is my bio. Hello!
interests:
- MTG
- Warhammer
- Bass guitar
working_groups_interests:
- adoptium
- oniro
eca_url: https://api.eclipse.org/sandbox/account/profile/zacharysabourin/eca
projects_url: https://api.eclipse.org/sandbox/account/profile/zacharysabourin/projects
gerrit_url: https://api.eclipse.org/sandbox/account/profile/zacharysabourin/gerrit
mailinglist_url: https://api.eclipse.org/sandbox/account/profile/zacharysabourin/mailing-list
mpc_favorites_url: https://api.eclipse.org/marketplace/favorites?name=zacharysabourin
Eca:
type: object
......@@ -321,15 +365,6 @@ components:
signed: true
can_contribute_spec_project: true
Friends:
type: object
properties:
friend_id:
type: integer
description: The friend's userid.
example:
friend_id: 6104
Country:
type: object
properties:
......@@ -352,3 +387,5 @@ components:
version:
type: string
description: the agreement document version.
example:
version: "1"
......@@ -13,17 +13,17 @@ package org.eclipsefoundation.openvsx.api;
import java.util.List;
import javax.annotation.security.RolesAllowed;
import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.BeanParam;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import jakarta.annotation.security.RolesAllowed;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.BeanParam;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import org.eclipsefoundation.foundationdb.client.model.PeopleData;
......
......@@ -13,12 +13,12 @@ package org.eclipsefoundation.openvsx.api;
import java.util.List;
import javax.annotation.security.RolesAllowed;
import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import jakarta.annotation.security.RolesAllowed;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import org.eclipsefoundation.foundationdb.client.model.SysModLogData;
......
......@@ -11,8 +11,8 @@
**********************************************************************/
package org.eclipsefoundation.openvsx.api.models;
import javax.annotation.Nullable;
import javax.ws.rs.HeaderParam;
import jakarta.annotation.Nullable;
import jakarta.ws.rs.HeaderParam;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
......
......@@ -11,7 +11,7 @@
**********************************************************************/
package org.eclipsefoundation.openvsx.models;
import javax.annotation.Nullable;
import jakarta.annotation.Nullable;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
......
......@@ -11,8 +11,8 @@
**********************************************************************/
package org.eclipsefoundation.openvsx.models;
import javax.enterprise.context.RequestScoped;
import javax.servlet.http.HttpServletRequest;
import jakarta.enterprise.context.RequestScoped;
import jakarta.servlet.http.HttpServletRequest;
import org.eclipsefoundation.core.exception.FinalForbiddenException;
import org.eclipsefoundation.efservices.api.models.EfUser;
......
......@@ -14,11 +14,11 @@ package org.eclipsefoundation.openvsx.request;
import java.io.IOException;
import java.util.Optional;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.ext.Provider;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerRequestFilter;
import jakarta.ws.rs.ext.Provider;
import org.eclipsefoundation.core.config.OAuth2SecurityConfig;
import org.eclipsefoundation.core.exception.FinalForbiddenException;
......@@ -53,8 +53,9 @@ public class OAuthFilter implements ContainerRequestFilter {
String token = DrupalAuthHelper
.stripBearerToken(requestContext.getHeaderString(HttpHeaderNames.AUTHORIZATION));
DrupalOAuthData tokenStatus = oauthService.validateTokenStatus(token, config.get().filter().validScopes(),
config.get().filter().validClientIds());
DrupalOAuthData tokenStatus = oauthService
.validateTokenStatus(token, config.get().filter().validScopes(),
config.get().filter().validClientIds());
// The incoming token must have a user associated with it.
if (tokenStatus == null || tokenStatus.getUserId() == null) {
......@@ -62,8 +63,8 @@ public class OAuthFilter implements ContainerRequestFilter {
}
// There is no openid scope incoming. User search needed for user data
Optional<EfUser> currentUserProfile = accountService.performUserSearch(
UserSearchParams.builder().setUid(Integer.valueOf(tokenStatus.getUserId())).build());
Optional<EfUser> currentUserProfile = accountService
.performUserSearch(UserSearchParams.builder().setUid(tokenStatus.getUserId()).build());
if (currentUserProfile.isEmpty()) {
LOGGER.warn("Cannot find profile for user {}", tokenStatus.getUserId());
throw new FinalForbiddenException(
......
......@@ -13,10 +13,10 @@ package org.eclipsefoundation.openvsx.resources;
import java.util.Arrays;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;
import org.eclipsefoundation.openvsx.models.RequestUserProfileWrapper;
......
......@@ -13,17 +13,17 @@ package org.eclipsefoundation.openvsx.resources;
import java.util.Optional;
import javax.inject.Inject;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.ServerErrorException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import jakarta.inject.Inject;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.ServerErrorException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.core.exception.FinalForbiddenException;
......
......@@ -15,8 +15,8 @@ import java.time.ZonedDateTime;
import java.util.List;
import java.util.Optional;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.microprofile.rest.client.inject.RestClient;
......@@ -67,7 +67,8 @@ public class DefaultFoundationOperationService implements FoundationOperationSer
}
// Sort by date. Most recent first
return results.stream()
return results
.stream()
.sorted((pDoc1, pDoc2) -> pDoc2.getEffectiveDate().compareTo(pDoc1.getEffectiveDate()))
.findFirst();
......@@ -94,7 +95,8 @@ public class DefaultFoundationOperationService implements FoundationOperationSer
public Optional<SysModLogData> insertErrorSysModLog(String pk1, String personId) {
try {
// All error ModLogs use client IP and log the failed action taken
SysModLogData src = SysModLogData.builder()
SysModLogData src = SysModLogData
.builder()
.setLogTable("openvsx/publisher_agreement")
.setPK1(pk1)
.setPK2(getBestMatchingIP())
......@@ -129,7 +131,8 @@ public class DefaultFoundationOperationService implements FoundationOperationSer
LOGGER.debug("User {} not found in fdndb. Creating new entry", user.getName());
PeopleData person = PeopleData.builder()
PeopleData person = PeopleData
.builder()
.setPersonID(user.getName())
.setFname(user.getFirstName())
.setLname(user.getLastName())
......@@ -151,8 +154,7 @@ public class DefaultFoundationOperationService implements FoundationOperationSer
}
/**
* Fetches a user given a specific personId and returns an Optional containing
* the result if it exists.
* Fetches a user given a specific personId and returns an Optional containing the result if it exists.
*
* @param personId The desired person's ID
* @return an Optional containing the desired PeopleData if it exists.
......@@ -160,8 +162,9 @@ public class DefaultFoundationOperationService implements FoundationOperationSer
private Optional<PeopleData> fetchFoundationUser(String personId) {
try {
LOGGER.debug("Fetching user: {}", personId);
return cache.get(personId, new MultivaluedMapImpl<>(), PeopleData.class,
() -> peopleAPI.getPerson(personId));
return cache
.get(personId, new MultivaluedMapImpl<>(), PeopleData.class, () -> peopleAPI.getPerson(personId))
.getData();
} catch (Exception e) {
LOGGER.error("Error searching for user: {}", personId, e);
insertErrorSysModLog("fetchFoundationUser", personId);
......@@ -170,12 +173,10 @@ public class DefaultFoundationOperationService implements FoundationOperationSer
}
/**
* Retrieves the best IP for the current request, using the x-real-ip and
* x-forwarded-for headers to pull the
* Retrieves the best IP for the current request, using the x-real-ip and x-forwarded-for headers to pull the
* information from the current request.
*
* @return the best matching IP for current request, or localhost if none can be
* found
* @return the best matching IP for current request, or localhost if none can be found
*/
private String getBestMatchingIP() {
LOGGER.debug("Looking up best IP address");
......
......@@ -19,8 +19,8 @@ import java.util.Date;
import java.util.List;
import java.util.Optional;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.apache.commons.lang3.ArrayUtils;
import org.eclipsefoundation.core.helper.DateTimeHelper;
......
......@@ -14,7 +14,7 @@ package org.eclipsefoundation.openvsx.resources;
import java.util.Map;
import java.util.Optional;
import javax.inject.Inject;
import jakarta.inject.Inject;
import org.eclipsefoundation.openvsx.models.AgreementSigningRequest;
import org.eclipsefoundation.openvsx.test.helpers.SchemaNamespaceHelper;
......
......@@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.eclipsefoundation.core.exception.FinalForbiddenException;
......
......@@ -20,9 +20,9 @@ import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.microprofile.rest.client.inject.RestClient;
......
......@@ -18,8 +18,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.NotFoundException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.NotFoundException;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.microprofile.rest.client.inject.RestClient;
......@@ -41,7 +41,7 @@ public class MockProfileAPI implements ProfileAPI {
this.users = new ArrayList<>();
this.users.addAll(Arrays.asList(
EfUser.builder()
.setUid(666)
.setUid("666")
.setName("firstlast")
.setFullName("sample")
.setGithubHandle("handle")
......@@ -58,7 +58,7 @@ public class MockProfileAPI implements ProfileAPI {
.setInterests(Arrays.asList())
.build(),
EfUser.builder()
.setUid(42)
.setUid("42")
.setName("fakeuser")
.setFullName("sample")
.setPicture("pic url")
......@@ -75,7 +75,7 @@ public class MockProfileAPI implements ProfileAPI {
.setInterests(Arrays.asList())
.build(),
EfUser.builder()
.setUid(333)
.setUid("333")
.setName("otheruser")
.setFullName("sample")
.setGithubHandle("other")
......@@ -92,7 +92,7 @@ public class MockProfileAPI implements ProfileAPI {
.setInterests(Arrays.asList())
.build(),
EfUser.builder()
.setUid(222)
.setUid("222")
.setName("name")
.setFullName("sample")
.setGithubHandle("name")
......@@ -109,7 +109,7 @@ public class MockProfileAPI implements ProfileAPI {
.setInterests(Arrays.asList())
.build(),
EfUser.builder()
.setUid(444)
.setUid("444")
.setName("nodoc")
.setFullName("sample")
.setGithubHandle("nodoc")
......
......@@ -15,7 +15,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.eclipsefoundation.foundationdb.client.model.SysModLogData;
......
......@@ -11,7 +11,7 @@
**********************************************************************/
package org.eclipsefoundation.openvsx.test.services.impl;
import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import org.eclipsefoundation.efservices.services.DrupalTokenService;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment