Skip to content
Snippets Groups Projects
Commit c4394bfc authored by Martin Lowe's avatar Martin Lowe :flag_ca:
Browse files

Merge branch 'malowe/main/q-3.15-update' into 'main'

update: upgrade to Quarkus 3.15 LTS and latest commons lib

See merge request !216
parents 56619cbd 1b11539b
No related branches found
No related tags found
1 merge request!216update: upgrade to Quarkus 3.15 LTS and latest commons lib
Pipeline #64574 passed
Showing
with 351 additions and 342 deletions
......@@ -8,17 +8,17 @@
<artifactId>git-eca</artifactId>
<version>1.1.0</version>
<properties>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
<compiler-plugin.version>3.13.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.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.8.6</quarkus.platform.version>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
<quarkus.platform.version>3.15.3</quarkus.platform.version>
<surefire-plugin.version>3.3.1</surefire-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<eclipse-api-version>1.1.6</eclipse-api-version>
<eclipse-api-version>1.2.0</eclipse-api-version>
<auto-value.version>1.10.4</auto-value.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
<sonar.sources>src/main</sonar.sources>
......
......@@ -100,7 +100,7 @@ public class CommitHelper {
* @return the project ID or the given default (empty string).
*/
public static String getProjectId(Project p) {
return p != null ? p.getProjectId() : "";
return p != null ? p.projectId() : "";
}
private CommitHelper() {
......
......@@ -21,8 +21,9 @@ import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.caching.service.CachingService;
import org.eclipsefoundation.efservices.api.models.InterestGroup;
import org.eclipsefoundation.efservices.api.models.Project;
import org.eclipsefoundation.efservices.api.models.Project.GithubProject;
import org.eclipsefoundation.efservices.api.models.Project.ProjectParticipant;
import org.eclipsefoundation.efservices.api.models.ProjectBuilder;
import org.eclipsefoundation.efservices.api.models.ProjectGithubProjectBuilder;
import org.eclipsefoundation.efservices.api.models.ProjectProjectParticipantBuilder;
import org.eclipsefoundation.efservices.services.ProjectService;
import org.eclipsefoundation.git.eca.model.ValidationRequest;
import org.eclipsefoundation.git.eca.namespace.ProviderType;
......@@ -74,12 +75,12 @@ public final class ProjectHelper {
// check if the website repo matches first, returning that project if it's found
Optional<Project> siteProjectMatch = availableProjects
.stream()
.filter(p -> p.getWebsiteRepo().stream().anyMatch(r -> repoUrl.equals(r.getUrl())))
.filter(p -> p.websiteRepo().stream().anyMatch(r -> repoUrl.equals(r.url())))
.findFirst();
if (siteProjectMatch.isPresent()) {
LOGGER
.trace("Found website repo match for project '{}', assuming project and returning",
siteProjectMatch.get().getProjectId());
siteProjectMatch.get().projectId());
return Arrays.asList(siteProjectMatch.get());
}
......@@ -93,7 +94,7 @@ public final class ProjectHelper {
case GERRIT:
return availableProjects
.stream()
.filter(p -> p.getGerritRepos().stream().anyMatch(re -> re.getUrl() != null && re.getUrl().endsWith(repoUrl)))
.filter(p -> p.gerritRepos().stream().anyMatch(re -> re.url() != null && re.url().endsWith(repoUrl)))
.toList();
default:
return Collections.emptyList();
......@@ -110,7 +111,7 @@ public final class ProjectHelper {
List<Project> availableProjects = projects.getAllProjects();
availableProjects.addAll(adaptInterestGroups(projects.getAllInterestGroups()));
return availableProjects;
}).getData().orElseGet(Collections::emptyList);
}).data().orElseGet(Collections::emptyList);
}
private List<Project> adaptInterestGroups(List<InterestGroup> igs) {
......@@ -124,47 +125,47 @@ public final class ProjectHelper {
* @return the project built from the interest group
*/
private Project convertToProject(InterestGroup ig) {
return Project
return ProjectBuilder
.builder()
.setProjectId(ig.getProjectId())
.setGerritRepos(Collections.emptyList())
.setGithubRepos(Collections.emptyList())
.setGitlab(ig.getGitlab())
.setCommitters(ig
.getParticipants()
.projectId(ig.projectId())
.gerritRepos(Collections.emptyList())
.gitlabRepos(Collections.emptyList())
.githubRepos(Collections.emptyList())
.gitlab(ig.gitlab())
.github(ProjectGithubProjectBuilder.builder().org("").ignoredRepos(Collections.emptyList()).build())
.committers(ig
.participants()
.stream()
.map(p -> ProjectParticipant
.map(p -> ProjectProjectParticipantBuilder
.builder()
.setFullName(p.getFullName())
.setUrl(p.getUrl())
.setUsername(p.getUsername())
.fullName(p.fullName())
.url(p.url())
.username(p.username())
.build())
.toList())
.setProjectLeads(ig
.getLeads()
.projectLeads(ig
.leads()
.stream()
.map(p -> ProjectParticipant
.map(p -> ProjectProjectParticipantBuilder
.builder()
.setFullName(p.getFullName())
.setUrl(p.getUrl())
.setUsername(p.getUsername())
.fullName(p.fullName())
.url(p.url())
.username(p.username())
.build())
.toList())
.setContributors(Collections.emptyList())
.setShortProjectId(ig.getShortProjectId())
.setSummary("")
.setWebsiteUrl("")
.setWebsiteRepo(Collections.emptyList())
.setGitlab(ig.getGitlab())
.setGithub(GithubProject.builder().setOrg("").setIgnoredRepos(Collections.emptyList()).build())
.setIndustryCollaborations(Collections.emptyList())
.setReleases(Collections.emptyList())
.setTopLevelProject("")
.setUrl("")
.setLogo(ig.getLogo())
.setTags(Collections.emptyList())
.setName(ig.getTitle())
.setSpecProjectWorkingGroup(Collections.emptyMap())
.contributors(Collections.emptyList())
.shortProjectId(ig.shortProjectId())
.summary("")
.websiteUrl("")
.websiteRepo(Collections.emptyList())
.industryCollaborations(Collections.emptyList())
.releases(Collections.emptyList())
.topLevelProject("")
.url("")
.logo(ig.logo())
.tags(Collections.emptyList())
.name(ig.title())
.specProjectWorkingGroup(Collections.emptyMap())
.build();
}
......@@ -178,9 +179,9 @@ public final class ProjectHelper {
* @return true if the project is a match via Gitlab repos or project namespace, false otherwise
*/
private boolean doesProjectMatchGitlabRepos(Project p, String repoUrl, String projectNamespace) {
return p.getGitlabRepos().stream().anyMatch(re -> re.getUrl() != null && re.getUrl().endsWith(repoUrl))
|| (projectNamespace.startsWith(p.getGitlab().getProjectGroup() + "/")
&& p.getGitlab().getIgnoredSubGroups().stream().noneMatch(sg -> projectNamespace.startsWith(sg + "/")));
return p.gitlabRepos().stream().anyMatch(re -> re.url() != null && re.url().endsWith(repoUrl))
|| (projectNamespace.startsWith(p.gitlab().projectGroup() + "/")
&& p.gitlab().ignoredSubGroups().stream().noneMatch(sg -> projectNamespace.startsWith(sg + "/")));
}
/**
......@@ -193,8 +194,8 @@ public final class ProjectHelper {
* @return true if the project is a match via Github repos or organization, false otherwise
*/
private boolean doesProjectMatchGithubRepos(Project p, String repoUrl, String projectNamespace) {
return p.getGithubRepos().stream().anyMatch(re -> re.getUrl() != null && re.getUrl().endsWith(repoUrl))
|| (StringUtils.isNotBlank(p.getGithub().getOrg()) && projectNamespace.startsWith(p.getGithub().getOrg())
&& p.getGithub().getIgnoredRepos().stream().noneMatch(repoUrl::endsWith));
return p.githubRepos().stream().anyMatch(re -> re.url() != null && re.url().endsWith(repoUrl))
|| (StringUtils.isNotBlank(p.github().org()) && projectNamespace.startsWith(p.github().org())
&& p.github().ignoredRepos().stream().noneMatch(repoUrl::endsWith));
}
}
......@@ -117,7 +117,7 @@ public class ValidationResource extends CommonResource {
if (user.isEmpty()) {
throw new NotFoundException(String.format("No user found with username '%s'", TransformationHelper.formatLog(query)));
}
if (!user.get().getEca().getSigned()) {
if (!user.get().eca().signed()) {
return Response.status(Status.FORBIDDEN).build();
}
} else {
......@@ -140,7 +140,7 @@ public class ValidationResource extends CommonResource {
}
// check that user has a project relation as a way of checking user trust
boolean isKnownCommitterOrPL = loggedInUser != null && loggedInUser.getIsCommitter();
boolean isKnownCommitterOrPL = loggedInUser != null && loggedInUser.isCommitter();
if (!isKnownCommitterOrPL) {
throw new FinalForbiddenException("User must be logged in and have committer level access to search by email");
}
......@@ -150,7 +150,7 @@ public class ValidationResource extends CommonResource {
throw new NotFoundException(String.format("No user found with mail '%s'", TransformationHelper.formatLog(email)));
}
// if the user doesn't have a signed Eca, return an empty 403
if (!user.getEca().getSigned()) {
if (!user.eca().signed()) {
throw new FinalForbiddenException("");
}
}
......
......@@ -77,7 +77,7 @@ public class CachedUserService implements UserService {
return null;
}
CacheWrapper<EfUser> result = cache.get(mail, new MultivaluedHashMap<>(), EfUser.class, () -> retrieveUser(mail));
Optional<EfUser> user = result.getData();
Optional<EfUser> user = result.data();
if (user.isPresent()) {
LOGGER.debug("Found user with email {}", mail);
return user.get();
......@@ -128,8 +128,8 @@ public class CachedUserService implements UserService {
}
// check if any of the projects match any of the bots
return filteredProjects.stream().anyMatch(p -> botObjs.stream().anyMatch(bot -> {
LOGGER.debug("Checking project {} for matching bots", p.getProjectId());
return p.getProjectId().equalsIgnoreCase(bot.get("projectId").asText())
LOGGER.debug("Checking project {} for matching bots", p.projectId());
return p.projectId().equalsIgnoreCase(bot.get("projectId").asText())
&& checkFieldsForMatchingValue(bot, checkedValue, checkedField);
}));
......@@ -251,7 +251,7 @@ public class CachedUserService implements UserService {
private List<JsonNode> getBots() {
return cache
.get("allBots", new MultivaluedHashMap<>(), JsonNode.class, () -> bots.getBots())
.getData()
.data()
.orElse(Collections.emptyList());
}
......
......@@ -125,7 +125,7 @@ public class DefaultGithubApplicationService implements GithubApplicationService
return cache
.get(fullRepoName, params, PullRequest.class,
() -> gh.getPullRequest(jwt.getGhBearerString(installationId), apiVersion, org, repoName, pullRequest))
.getData();
.data();
}
private List<GithubApplicationInstallation> getAllInstallRepos() {
......
......@@ -120,8 +120,8 @@ public class DefaultSystemHookService implements SystemHookService {
.get(Integer.toString(hook.getProjectId()), new MultivaluedHashMap<>(), GitlabProjectResponse.class,
() -> api.getProjectInfo(apiToken, hook.getProjectId()));
if (response.getData().isPresent()) {
PrivateProjectEvent dto = mapToDto(hook, response.getData().get());
if (response.data().isPresent()) {
PrivateProjectEvent dto = mapToDto(hook, response.data().get());
dao.add(new RDBMSQuery<>(wrapper, filters.get(PrivateProjectEvent.class)), Arrays.asList(dto));
} else {
LOGGER.error("No info for project: [id: {}, path: {}]", hook.getProjectId(), hook.getPathWithNamespace());
......@@ -231,7 +231,7 @@ public class DefaultSystemHookService implements SystemHookService {
Optional<GitlabUserResponse> response = cache
.get(Integer.toString(userId), new MultivaluedHashMap<>(), GitlabUserResponse.class,
() -> api.getUserInfo(apiToken, userId))
.getData();
.data();
return response.isPresent() ? response.get().getUsername() : null;
}
}
......@@ -21,8 +21,9 @@ import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.microprofile.context.ManagedExecutor;
import org.eclipsefoundation.efservices.api.models.EfUser;
import org.eclipsefoundation.efservices.api.models.EfUser.Country;
import org.eclipsefoundation.efservices.api.models.EfUser.Eca;
import org.eclipsefoundation.efservices.api.models.EfUserBuilder;
import org.eclipsefoundation.efservices.api.models.EfUserCountryBuilder;
import org.eclipsefoundation.efservices.api.models.EfUserEcaBuilder;
import org.eclipsefoundation.efservices.api.models.Project;
import org.eclipsefoundation.git.eca.config.ECAParallelProcessingConfig;
import org.eclipsefoundation.git.eca.config.MailValidationConfig;
......@@ -98,7 +99,7 @@ public class DefaultValidationService implements ValidationService {
// get previous validation status messages
List<CommitValidationStatus> statuses = statusService
.getRequestCommitValidationStatus(wrapper, req, filteredProjects.isEmpty() ? null : filteredProjects.get(0).getProjectId());
.getRequestCommitValidationStatus(wrapper, req, filteredProjects.isEmpty() ? null : filteredProjects.get(0).projectId());
List<ValidationResponsePart> parts;
if (parallelProcessingConfig.enabled()) {
LOGGER.trace("Using parallel for commit processing");
......@@ -287,28 +288,28 @@ public class DefaultValidationService implements ValidationService {
if (isCommitter) {
part
.commit()
.addMessage(String.format("Eclipse user '%s'(%s) is a committer on the project.", eclipseUser.getName(), userType));
.addMessage(String.format("Eclipse user '%s'(%s) is a committer on the project.", eclipseUser.name(), userType));
} else {
part
.commit()
.addMessage(String.format("Eclipse user '%s'(%s) is not a committer on the project.", eclipseUser.getName(), userType));
.addMessage(String.format("Eclipse user '%s'(%s) is not a committer on the project.", eclipseUser.name(), userType));
// check if the author is signed off if not a committer
if (eclipseUser.getEca().getSigned()) {
if (eclipseUser.eca().signed()) {
part
.commit()
.addMessage(String
.format("Eclipse user '%s'(%s) has a current Eclipse Contributor Agreement (ECA) on file.",
eclipseUser.getName(), userType));
eclipseUser.name(), userType));
} else {
part
.commit()
.addMessage(String
.format("Eclipse user '%s'(%s) does not have a current Eclipse Contributor Agreement (ECA) on file.\n"
+ "If there are multiple commits, please ensure that each author has a ECA.", eclipseUser.getName(),
+ "If there are multiple commits, please ensure that each author has a ECA.", eclipseUser.name(),
userType));
part
.addError(String
.format("An Eclipse Contributor Agreement is required for Eclipse user '%s'(%s).", eclipseUser.getName(),
.format("An Eclipse Contributor Agreement is required for Eclipse user '%s'(%s).", eclipseUser.name(),
userType),
errorCode);
}
......@@ -331,12 +332,12 @@ public class DefaultValidationService implements ValidationService {
private boolean isCommitter(ValidationResponsePart part, EfUser user, List<Project> filteredProjects) {
// iterate over filtered projects
for (Project p : filteredProjects) {
LOGGER.debug("Checking project '{}' for user '{}'", p.getName(), user.getName());
LOGGER.debug("Checking project '{}' for user '{}'", p.name(), user.name());
// check if any of the committers usernames match the current user
if (p.getCommitters().stream().anyMatch(u -> u.getUsername().equals(user.getName()))) {
if (p.committers().stream().anyMatch(u -> u.username().equals(user.name()))) {
// check if the current project is a committer project, and if the user can
// commit to specs
if (p.getSpecWorkingGroup().isPresent() && !user.getEca().getCanContributeSpecProject()) {
if (p.getSpecWorkingGroup().isPresent() && !user.eca().canContributeSpecProject()) {
// set error + update response status
part
.addError(String
......@@ -345,14 +346,14 @@ public class DefaultValidationService implements ValidationService {
APIStatusCode.ERROR_SPEC_PROJECT);
return false;
} else {
LOGGER.debug("User '{}' was found to be a committer on current project repo '{}'", user.getMail(), p.getName());
LOGGER.debug("User '{}' was found to be a committer on current project repo '{}'", user.mail(), p.name());
return true;
}
}
}
// check if user is a bot, either through early detection or through on-demand check
if ((user.getIsBot() != null && Boolean.TRUE.equals(user.getIsBot())) || users.userIsABot(user.getMail(), filteredProjects)) {
LOGGER.debug("User '{} <{}>' was found to be a bot", user.getName(), user.getMail());
if ((user.isBot() != null && Boolean.TRUE.equals(user.isBot())) || users.userIsABot(user.mail(), filteredProjects)) {
LOGGER.debug("User '{} <{}>' was found to be a bot", user.name(), user.mail());
return true;
}
return false;
......@@ -456,23 +457,23 @@ public class DefaultValidationService implements ValidationService {
}
private EfUser createBotStub(GitUser user) {
return EfUser
return EfUserBuilder
.builder()
.setUid("0")
.setPicture("")
.setFirstName("")
.setLastName("")
.setFullName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setJobTitle("")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setName(user.getName())
.setMail(user.getMail())
.setEca(Eca.builder().build())
.setIsBot(true)
.uid("0")
.picture("")
.firstName("")
.lastName("")
.fullName("")
.publisherAgreements(Collections.emptyMap())
.twitterHandle("")
.jobTitle("")
.website("")
.country(EfUserCountryBuilder.builder().build())
.interests(Collections.emptyList())
.name(user.getName())
.mail(user.getMail())
.eca(EfUserEcaBuilder.builder().build())
.isBot(true)
.build();
}
}
......@@ -71,7 +71,7 @@ public class ScheduledPrivateProjectScanTask {
Optional<List<GitlabProjectResponse>> response = cache
.get("all", new MultivaluedHashMap<>(), GitlabProjectResponse.class,
() -> middleware.getAll(p -> api.getPrivateProjects(p, apiToken, "private", PRIVATE_PROJECT_PAGE_SIZE)))
.getData();
.data();
response.ifPresent(this::processGitlabResponseList);
}
......@@ -199,7 +199,7 @@ public class ScheduledPrivateProjectScanTask {
Optional<GitlabUserResponse> response = cache
.get(Integer.toString(userId), new MultivaluedHashMap<>(), GitlabUserResponse.class,
() -> api.getUserInfo(apiToken, userId))
.getData();
.data();
return response.isPresent() ? response.get().getUsername() : null;
}
}
......@@ -25,7 +25,7 @@ class ProjectHelperTest {
List<Project> results = helper
.retrieveProjectsForRepoURL("http://www.gitlab.eclipse.org/eclipse/dash-second/sample-repo", ProviderType.GITLAB);
Assertions.assertEquals(1, results.size());
Assertions.assertEquals("sample.proto", results.get(0).getProjectId());
Assertions.assertEquals("sample.proto", results.get(0).projectId());
}
@Test
......@@ -33,7 +33,7 @@ class ProjectHelperTest {
List<Project> results = helper
.retrieveProjectsForRepoURL("http://www.gitlab.eclipse.org/eclipsefdn/sample/repo", ProviderType.GITLAB);
Assertions.assertEquals(1, results.size());
Assertions.assertEquals("spec.proj", results.get(0).getProjectId());
Assertions.assertEquals("spec.proj", results.get(0).projectId());
}
@Test
......@@ -56,14 +56,14 @@ class ProjectHelperTest {
void retrieveProjectsForRepoURL_success_githubOrg() {
List<Project> results = helper.retrieveProjectsForRepoURL("http://www.github.com/eclipsefdn-tck/dash-second", ProviderType.GITHUB);
Assertions.assertEquals(1, results.size());
Assertions.assertEquals("spec.proj", results.get(0).getProjectId());
Assertions.assertEquals("spec.proj", results.get(0).projectId());
}
@Test
void retrieveProjectsForRepoURL_success_githubRepo() {
List<Project> results = helper.retrieveProjectsForRepoURL("http://www.github.com/eclipsefdn/tck-proto", ProviderType.GITHUB);
Assertions.assertEquals(1, results.size());
Assertions.assertEquals("spec.proj", results.get(0).getProjectId());
Assertions.assertEquals("spec.proj", results.get(0).projectId());
}
@Test
......@@ -84,6 +84,6 @@ class ProjectHelperTest {
void retrieveProjectsForRepoURL_success_websiteRepo() {
List<Project> results = helper.retrieveProjectsForRepoURL(MockProjectsAPI.WEBSITE_REPO_URL, ProviderType.GITHUB);
Assertions.assertEquals(1, results.size());
Assertions.assertEquals("sample.proj", results.get(0).getProjectId());
Assertions.assertEquals("sample.proj", results.get(0).projectId());
}
}
......@@ -46,7 +46,7 @@ class CachedUserServiceTest {
EfUser u = users.getUser("grunt@important.co");
// assert that this is the user we expect and that it exists
Assertions.assertNotNull(u);
Assertions.assertEquals("grunter", u.getName());
Assertions.assertEquals("grunter", u.name());
}
@Test
......@@ -54,7 +54,7 @@ class CachedUserServiceTest {
EfUser u = users.getUser("123456789+grunter2@users.noreply.github.com");
// assert that this is the user we expect and that it exists
Assertions.assertNotNull(u);
Assertions.assertEquals("grunter", u.getName());
Assertions.assertEquals("grunter", u.name());
}
@Test
......@@ -78,7 +78,7 @@ class CachedUserServiceTest {
EfUser u = users.getUserByGithubUsername("grunter2");
// assert that this is the user we expect and that it exists
Assertions.assertNotNull(u);
Assertions.assertEquals("grunt@important.co", u.getMail());
Assertions.assertEquals("grunt@important.co", u.mail());
}
@Test
......@@ -136,7 +136,7 @@ class CachedUserServiceTest {
* @return the sample.proj project in a list for use in tests.
*/
private List<Project> getTestProject() {
Optional<Project> proj = projects.getProjects().stream().filter(p -> p.getProjectId().equals("sample.proj")).findFirst();
Optional<Project> proj = projects.getProjects().stream().filter(p -> p.projectId().equals("sample.proj")).findFirst();
if (proj.isEmpty()) {
Assertions.fail("Could not find one of the needed test projects for test, bad state.");
}
......
......@@ -20,8 +20,9 @@ import java.util.function.Predicate;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.eclipsefoundation.efservices.api.ProfileAPI;
import org.eclipsefoundation.efservices.api.models.EfUser;
import org.eclipsefoundation.efservices.api.models.EfUser.Country;
import org.eclipsefoundation.efservices.api.models.EfUser.Eca;
import org.eclipsefoundation.efservices.api.models.EfUserBuilder;
import org.eclipsefoundation.efservices.api.models.EfUserCountryBuilder;
import org.eclipsefoundation.efservices.api.models.EfUserEcaBuilder;
import org.eclipsefoundation.efservices.api.models.UserSearchParams;
import io.quarkus.test.Mock;
......@@ -46,146 +47,146 @@ public class MockAccountsAPI implements ProfileAPI {
this.users = new HashMap<>();
users
.put("newbie@important.co",
EfUser
EfUserBuilder
.builder()
.setIsCommitter(false)
.setPicture("")
.setFirstName("")
.setLastName("")
.setFullName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setJobTitle("")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setUid(Integer.toString(id++))
.setMail("newbie@important.co")
.setName("newbieAnon")
.setEca(Eca.builder().build())
.isCommitter(false)
.picture("")
.firstName("")
.lastName("")
.fullName("")
.publisherAgreements(Collections.emptyMap())
.twitterHandle("")
.jobTitle("")
.website("")
.country(EfUserCountryBuilder.builder().build())
.interests(Collections.emptyList())
.uid(Integer.toString(id++))
.mail("newbie@important.co")
.name("newbieAnon")
.eca(EfUserEcaBuilder.builder().build())
.build());
users
.put("slom@eclipse-foundation.org",
EfUser
EfUserBuilder
.builder()
.setIsCommitter(false)
.setPicture("")
.setFirstName("")
.setLastName("")
.setFullName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setJobTitle("")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setUid(Integer.toString(id++))
.setMail("slom@eclipse-foundation.org")
.setName("barshall_blathers")
.setEca(Eca.builder().setCanContributeSpecProject(true).setSigned(true).build())
.isCommitter(false)
.picture("")
.firstName("")
.lastName("")
.fullName("")
.publisherAgreements(Collections.emptyMap())
.twitterHandle("")
.jobTitle("")
.website("")
.country(EfUserCountryBuilder.builder().build())
.interests(Collections.emptyList())
.uid(Integer.toString(id++))
.mail("slom@eclipse-foundation.org")
.name("barshall_blathers")
.eca(EfUserEcaBuilder.builder().canContributeSpecProject(true).signed(true).build())
.build());
users
.put("tester@eclipse-foundation.org",
EfUser
EfUserBuilder
.builder()
.setIsCommitter(false)
.setPicture("")
.setFirstName("")
.setLastName("")
.setFullName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setJobTitle("")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setUid(Integer.toString(id++))
.setMail("tester@eclipse-foundation.org")
.setName("mctesterson")
.setEca(Eca.builder().setCanContributeSpecProject(false).setSigned(true).build())
.isCommitter(false)
.picture("")
.firstName("")
.lastName("")
.fullName("")
.publisherAgreements(Collections.emptyMap())
.twitterHandle("")
.jobTitle("")
.website("")
.country(EfUserCountryBuilder.builder().build())
.interests(Collections.emptyList())
.uid(Integer.toString(id++))
.mail("tester@eclipse-foundation.org")
.name("mctesterson")
.eca(EfUserEcaBuilder.builder().canContributeSpecProject(false).signed(true).build())
.build());
users
.put("code.wiz@important.co",
EfUser
EfUserBuilder
.builder()
.setIsCommitter(true)
.setPicture("")
.setFirstName("")
.setLastName("")
.setFullName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setJobTitle("")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setUid(Integer.toString(id++))
.setMail("code.wiz@important.co")
.setName("da_wizz")
.setEca(Eca.builder().setCanContributeSpecProject(true).setSigned(true).build())
.setGithubHandle("wiz_in_da_hub")
.isCommitter(true)
.picture("")
.firstName("")
.lastName("")
.fullName("")
.publisherAgreements(Collections.emptyMap())
.twitterHandle("")
.jobTitle("")
.website("")
.country(EfUserCountryBuilder.builder().build())
.interests(Collections.emptyList())
.uid(Integer.toString(id++))
.mail("code.wiz@important.co")
.name("da_wizz")
.eca(EfUserEcaBuilder.builder().canContributeSpecProject(true).signed(true).build())
.githubHandle("wiz_in_da_hub")
.build());
users
.put("grunt@important.co",
EfUser
EfUserBuilder
.builder()
.setIsCommitter(true)
.setPicture("")
.setFirstName("")
.setLastName("")
.setFullName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setJobTitle("")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setUid(Integer.toString(id++))
.setMail("grunt@important.co")
.setName("grunter")
.setEca(Eca.builder().setCanContributeSpecProject(false).setSigned(true).build())
.setGithubHandle("grunter2")
.isCommitter(true)
.picture("")
.firstName("")
.lastName("")
.fullName("")
.publisherAgreements(Collections.emptyMap())
.twitterHandle("")
.jobTitle("")
.website("")
.country(EfUserCountryBuilder.builder().build())
.interests(Collections.emptyList())
.uid(Integer.toString(id++))
.mail("grunt@important.co")
.name("grunter")
.eca(EfUserEcaBuilder.builder().canContributeSpecProject(false).signed(true).build())
.githubHandle("grunter2")
.build());
users
.put("paper.pusher@important.co",
EfUser
EfUserBuilder
.builder()
.setIsCommitter(false)
.setPicture("")
.setFirstName("")
.setLastName("")
.setFullName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setJobTitle("")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setUid(Integer.toString(id++))
.setMail("paper.pusher@important.co")
.setName("sumAnalyst")
.setEca(Eca.builder().setCanContributeSpecProject(false).setSigned(true).build())
.isCommitter(false)
.picture("")
.firstName("")
.lastName("")
.fullName("")
.publisherAgreements(Collections.emptyMap())
.twitterHandle("")
.jobTitle("")
.website("")
.country(EfUserCountryBuilder.builder().build())
.interests(Collections.emptyList())
.uid(Integer.toString(id++))
.mail("paper.pusher@important.co")
.name("sumAnalyst")
.eca(EfUserEcaBuilder.builder().canContributeSpecProject(false).signed(true).build())
.build());
users
.put("opearson@important.co",
EfUser
EfUserBuilder
.builder()
.setIsCommitter(true)
.setPicture("")
.setFirstName("")
.setLastName("")
.setFullName("")
.setPublisherAgreements(Collections.emptyMap())
.setTwitterHandle("")
.setJobTitle("")
.setWebsite("")
.setCountry(Country.builder().build())
.setInterests(Collections.emptyList())
.setUid(Integer.toString(id++))
.setMail("opearson@important.co")
.setName("opearson")
.setEca(Eca.builder().setCanContributeSpecProject(false).setSigned(true).build())
.setGithubHandle("opearson")
.isCommitter(true)
.picture("")
.firstName("")
.lastName("")
.fullName("")
.publisherAgreements(Collections.emptyMap())
.twitterHandle("")
.jobTitle("")
.website("")
.country(EfUserCountryBuilder.builder().build())
.interests(Collections.emptyList())
.uid(Integer.toString(id++))
.mail("opearson@important.co")
.name("opearson")
.eca(EfUserEcaBuilder.builder().canContributeSpecProject(false).signed(true).build())
.githubHandle("opearson")
.build());
}
......@@ -199,7 +200,7 @@ public class MockAccountsAPI implements ProfileAPI {
return users
.values()
.stream()
.filter(u -> u.getGithubHandle() != null && u.getGithubHandle().equals(ghHandle))
.filter(u -> u.githubHandle() != null && u.githubHandle().equals(ghHandle))
.findFirst()
.orElseGet(() -> null);
}
......@@ -210,12 +211,12 @@ public class MockAccountsAPI implements ProfileAPI {
.values()
.stream()
.filter(usernamePredicate(params.name))
.filter(u -> params.mail == null || u.getMail().equals(params.mail))
.filter(u -> params.uid == null || u.getUid().equals(params.uid))
.filter(u -> params.mail == null || u.mail().equals(params.mail))
.filter(u -> params.uid == null || u.uid().equals(params.uid))
.toList();
}
private Predicate<EfUser> usernamePredicate(String target) {
return u -> target == null || u.getName().equals(target);
return u -> target == null || u.name().equals(target);
}
}
......@@ -20,17 +20,21 @@ import java.util.Map;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.eclipsefoundation.core.service.APIMiddleware.BaseAPIParameters;
import org.eclipsefoundation.efservices.api.ProjectsAPI;
import org.eclipsefoundation.efservices.api.models.GitlabProject;
import org.eclipsefoundation.efservices.api.models.GitlabProjectBuilder;
import org.eclipsefoundation.efservices.api.models.InterestGroup;
import org.eclipsefoundation.efservices.api.models.InterestGroup.Descriptor;
import org.eclipsefoundation.efservices.api.models.InterestGroup.InterestGroupParticipant;
import org.eclipsefoundation.efservices.api.models.InterestGroup.Organization;
import org.eclipsefoundation.efservices.api.models.InterestGroup.Resource;
import org.eclipsefoundation.efservices.api.models.InterestGroupBuilder;
import org.eclipsefoundation.efservices.api.models.InterestGroupDescriptorBuilder;
import org.eclipsefoundation.efservices.api.models.InterestGroupInterestGroupParticipantBuilder;
import org.eclipsefoundation.efservices.api.models.InterestGroupOrganizationBuilder;
import org.eclipsefoundation.efservices.api.models.InterestGroupResourceBuilder;
import org.eclipsefoundation.efservices.api.models.Project;
import org.eclipsefoundation.efservices.api.models.Project.GithubProject;
import org.eclipsefoundation.efservices.api.models.Project.ProjectParticipant;
import org.eclipsefoundation.efservices.api.models.Project.Repo;
import org.eclipsefoundation.efservices.api.models.Project.WebsiteRepo;
import org.eclipsefoundation.efservices.api.models.ProjectBuilder;
import org.eclipsefoundation.efservices.api.models.ProjectGithubProjectBuilder;
import org.eclipsefoundation.efservices.api.models.ProjectProjectParticipantBuilder;
import org.eclipsefoundation.efservices.api.models.ProjectRepoBuilder;
import org.eclipsefoundation.efservices.api.models.ProjectWebsiteRepoBuilder;
import org.eclipsefoundation.testing.helpers.MockDataPaginationHandler;
import org.jboss.resteasy.reactive.RestResponse;
......@@ -52,150 +56,152 @@ public class MockProjectsAPI implements ProjectsAPI {
this.projects = new ArrayList<>();
// sample repos
Repo r1 = Repo.builder().setUrl("http://www.github.com/eclipsefdn/sample").build();
Repo r2 = Repo.builder().setUrl("http://www.github.com/eclipsefdn/test").build();
Repo r3 = Repo.builder().setUrl("http://www.github.com/eclipsefdn/prototype.git").build();
Repo r4 = Repo.builder().setUrl("http://www.github.com/eclipsefdn/tck-proto").build();
Repo r5 = Repo.builder().setUrl("/gitroot/sample/gerrit.project.git").build();
Repo r6 = Repo.builder().setUrl("/gitroot/sample/gerrit.other-project").build();
Repo r1 = ProjectRepoBuilder.builder().url("http://www.github.com/eclipsefdn/sample").build();
Repo r2 = ProjectRepoBuilder.builder().url("http://www.github.com/eclipsefdn/test").build();
Repo r3 = ProjectRepoBuilder.builder().url("http://www.github.com/eclipsefdn/prototype.git").build();
Repo r4 = ProjectRepoBuilder.builder().url("http://www.github.com/eclipsefdn/tck-proto").build();
Repo r5 = ProjectRepoBuilder.builder().url("/gitroot/sample/gerrit.project.git").build();
Repo r6 = ProjectRepoBuilder.builder().url("/gitroot/sample/gerrit.other-project").build();
// sample users
ProjectParticipant u1 = ProjectParticipant.builder().setUrl("").setUsername("da_wizz").setFullName("da_wizz").build();
ProjectParticipant u2 = ProjectParticipant.builder().setUrl("").setUsername("grunter").setFullName("grunter").build();
ProjectParticipant u1 = ProjectProjectParticipantBuilder.builder().url("").username("da_wizz").fullName("da_wizz").build();
ProjectParticipant u2 = ProjectProjectParticipantBuilder.builder().url("").username("grunter").fullName("grunter").build();
this.projects
.add(Project
.add(ProjectBuilder
.builder()
.setName("Sample project")
.setProjectId("sample.proj")
.setSpecProjectWorkingGroup(Collections.emptyMap())
.setGithubRepos(Arrays.asList(r1, r2))
.setGerritRepos(Arrays.asList(r5))
.setCommitters(Arrays.asList(u1, u2))
.setProjectLeads(Collections.emptyList())
.setGitlab(GitlabProject.builder().setIgnoredSubGroups(Collections.emptyList()).setProjectGroup("").build())
.setShortProjectId("sample.proj")
.setSummary("summary")
.setUrl("project.url.com")
.setWebsiteUrl("someproject.com")
.setWebsiteRepo(Arrays
.asList(WebsiteRepo.builder().setCheckoutDir("").setSourceBranch("").setUrl(WEBSITE_REPO_URL).build()))
.setLogo("logoUrl.com")
.setTags(Collections.emptyList())
.setGithub(GithubProject.builder().setOrg("").setIgnoredRepos(Collections.emptyList()).build())
.setContributors(Collections.emptyList())
.setIndustryCollaborations(Collections.emptyList())
.setReleases(Collections.emptyList())
.setTopLevelProject("eclipse")
.name("Sample project")
.projectId("sample.proj")
.specProjectWorkingGroup(Collections.emptyMap())
.githubRepos(Arrays.asList(r1, r2))
.gitlabRepos(Collections.emptyList())
.gerritRepos(Arrays.asList(r5))
.committers(Arrays.asList(u1, u2))
.projectLeads(Collections.emptyList())
.gitlab(GitlabProjectBuilder.builder().ignoredSubGroups(Collections.emptyList()).projectGroup("").build())
.shortProjectId("sample.proj")
.summary("summary")
.url("project.url.com")
.websiteUrl("someproject.com")
.websiteRepo(Arrays
.asList(ProjectWebsiteRepoBuilder.builder().checkoutDir("").sourceBranch("").url(WEBSITE_REPO_URL).build()))
.logo("logoUrl.com")
.tags(Collections.emptyList())
.github(ProjectGithubProjectBuilder.builder().org("").ignoredRepos(Collections.emptyList()).build())
.contributors(Collections.emptyList())
.industryCollaborations(Collections.emptyList())
.releases(Collections.emptyList())
.topLevelProject("eclipse")
.build());
this.projects
.add(Project
.add(ProjectBuilder
.builder()
.setName("Prototype thing")
.setProjectId("sample.proto")
.setSpecProjectWorkingGroup(Collections.emptyMap())
.setGithubRepos(Arrays.asList(r3))
.setGerritRepos(Arrays.asList(r6))
.setCommitters(Arrays.asList(u2))
.setProjectLeads(Collections.emptyList())
.setGitlab(GitlabProject
.name("Prototype thing")
.projectId("sample.proto")
.specProjectWorkingGroup(Collections.emptyMap())
.githubRepos(Arrays.asList(r3))
.gitlabRepos(Collections.emptyList())
.gerritRepos(Arrays.asList(r6))
.committers(Arrays.asList(u2))
.projectLeads(Collections.emptyList())
.gitlab(GitlabProjectBuilder
.builder()
.setIgnoredSubGroups(Collections.emptyList())
.setProjectGroup("eclipse/dash-second")
.ignoredSubGroups(Collections.emptyList())
.projectGroup("eclipse/dash-second")
.build())
.setShortProjectId("sample.proto")
.setWebsiteUrl("someproject.com")
.setSummary("summary")
.setUrl("project.url.com")
.setWebsiteRepo(Collections.emptyList())
.setLogo("logoUrl.com")
.setTags(Collections.emptyList())
.setGithub(GithubProject.builder().setOrg("").setIgnoredRepos(Collections.emptyList()).build())
.setContributors(Collections.emptyList())
.setIndustryCollaborations(Collections.emptyList())
.setReleases(Collections.emptyList())
.setTopLevelProject("eclipse")
.shortProjectId("sample.proto")
.websiteUrl("someproject.com")
.summary("summary")
.url("project.url.com")
.websiteRepo(Collections.emptyList())
.logo("logoUrl.com")
.tags(Collections.emptyList())
.github(ProjectGithubProjectBuilder.builder().org("").ignoredRepos(Collections.emptyList()).build())
.contributors(Collections.emptyList())
.industryCollaborations(Collections.emptyList())
.releases(Collections.emptyList())
.topLevelProject("eclipse")
.build());
this.projects
.add(Project
.add(ProjectBuilder
.builder()
.setName("Spec project")
.setProjectId("spec.proj")
.setSpecProjectWorkingGroup(Map.of("id", "proj1", "name", "proj1"))
.setGithubRepos(Arrays.asList(r4))
.setGerritRepos(Collections.emptyList())
.setGitlab(GitlabProject
.name("Spec project")
.projectId("spec.proj")
.specProjectWorkingGroup(Map.of("id", "proj1", "name", "proj1"))
.githubRepos(Arrays.asList(r4))
.gerritRepos(Collections.emptyList())
.gitlab(GitlabProjectBuilder
.builder()
.setIgnoredSubGroups(Arrays.asList("eclipse/dash/mirror"))
.setProjectGroup("eclipse/dash")
.ignoredSubGroups(Arrays.asList("eclipse/dash/mirror"))
.projectGroup("eclipse/dash")
.build())
.setGitlabRepos(
Arrays.asList(Repo.builder().setUrl("http://www.gitlab.eclipse.org/eclipsefdn/sample/repo").build()))
.setCommitters(Arrays.asList(u1, u2))
.setProjectLeads(Collections.emptyList())
.setShortProjectId("spec.proj")
.setSummary("summary")
.setUrl("project.url.com")
.setWebsiteUrl("someproject.com")
.setWebsiteRepo(Collections.emptyList())
.setLogo("logoUrl.com")
.setTags(Collections.emptyList())
.setGithub(GithubProject
.gitlabRepos(
Arrays.asList(ProjectRepoBuilder.builder().url("http://www.gitlab.eclipse.org/eclipsefdn/sample/repo").build()))
.committers(Arrays.asList(u1, u2))
.projectLeads(Collections.emptyList())
.shortProjectId("spec.proj")
.summary("summary")
.url("project.url.com")
.websiteUrl("someproject.com")
.websiteRepo(Collections.emptyList())
.logo("logoUrl.com")
.tags(Collections.emptyList())
.github(ProjectGithubProjectBuilder
.builder()
.setOrg("eclipsefdn-tck")
.setIgnoredRepos(Arrays.asList("eclipsefdn-tck/tck-ignored"))
.org("eclipsefdn-tck")
.ignoredRepos(Arrays.asList("eclipsefdn-tck/tck-ignored"))
.build())
.setContributors(Collections.emptyList())
.setIndustryCollaborations(Collections.emptyList())
.setReleases(Collections.emptyList())
.setTopLevelProject("eclipse")
.contributors(Collections.emptyList())
.industryCollaborations(Collections.emptyList())
.releases(Collections.emptyList())
.topLevelProject("eclipse")
.build());
this.igs = Arrays
.asList(InterestGroup
.asList(InterestGroupBuilder
.builder()
.setProjectId("foundation-internal.ig.mittens")
.setId("1")
.setLogo("")
.setState("active")
.setTitle("Magical IG Tributed To Eclipse News Sources")
.setDescription(Descriptor.builder().setFull("Sample").setSummary("Sample").build())
.setScope(Descriptor.builder().setFull("Sample").setSummary("Sample").build())
.setGitlab(GitlabProject
.projectId("foundation-internal.ig.mittens")
.id("1")
.logo("")
.state("active")
.title("Magical IG Tributed To Eclipse News Sources")
.description(InterestGroupDescriptorBuilder.builder().full("Sample").summary("Sample").build())
.scope(InterestGroupDescriptorBuilder.builder().full("Sample").summary("Sample").build())
.gitlab(GitlabProjectBuilder
.builder()
.setIgnoredSubGroups(Collections.emptyList())
.setProjectGroup("eclipse-ig/mittens")
.ignoredSubGroups(Collections.emptyList())
.projectGroup("eclipse-ig/mittens")
.build())
.setLeads(Arrays
.asList(InterestGroupParticipant
.leads(Arrays
.asList(InterestGroupInterestGroupParticipantBuilder
.builder()
.setUrl("https://api.eclipse.org/account/profile/zacharysabourin")
.setUsername("zacharysabourin")
.setFullName("zachary sabourin")
.setOrganization(Organization
.url("https://api.eclipse.org/account/profile/zacharysabourin")
.username("zacharysabourin")
.fullName("zachary sabourin")
.organization(InterestGroupOrganizationBuilder
.builder()
.setDocuments(Collections.emptyMap())
.setId("id")
.setName("org")
.documents(Collections.emptyMap())
.id("id")
.name("org")
.build())
.build()))
.setParticipants(Arrays
.asList(InterestGroupParticipant
.participants(Arrays
.asList(InterestGroupInterestGroupParticipantBuilder
.builder()
.setUrl("https://api.eclipse.org/account/profile/skilpatrick")
.setUsername("skilpatrick")
.setFullName("Skil Patrick")
.setOrganization(Organization
.url("https://api.eclipse.org/account/profile/skilpatrick")
.username("skilpatrick")
.fullName("Skil Patrick")
.organization(InterestGroupOrganizationBuilder
.builder()
.setDocuments(Collections.emptyMap())
.setId("id")
.setName("org")
.documents(Collections.emptyMap())
.id("id")
.name("org")
.build())
.build()))
.setShortProjectId("mittens")
.setResources(Resource.builder().setMembers("members").setWebsite("google.com").build())
.setMailingList("mailinglist.com")
.shortProjectId("mittens")
.resources(InterestGroupResourceBuilder.builder().members("members").website("google.com").build())
.mailingList("mailinglist.com")
.build());
}
......
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