diff --git a/config/application/secret.properties.sample b/config/application/secret.properties.sample index 8c30fd9280007ee7db60c2c23c575a188bba12cb..4de58a1f7f2ab8df02a2f16c21e3400ec18c9177 100644 --- a/config/application/secret.properties.sample +++ b/config/application/secret.properties.sample @@ -1,8 +1,8 @@ eclipse.internal-host=localhost ## Required for authenticated requests to profile API (api.eclipse.org: git.eclipse.org/r/ (dev-git-eca-rest-api))) ## Ask webdev@eclipse-foundation.org if you think you should have access to this client. -oauth2.client-id= -oauth2.client-secret= +eclipse.security.oauth2.token-generation.client-id= +eclipse.security.oauth2.token-generation.client-secret= ## mariadb username and password quarkus.datasource.username= @@ -10,4 +10,6 @@ quarkus.datasource.password= ## database connection quarkus.datasource.jdbc.url=jdbc:mariadb://mariadb/dev_eclipse_eca -%dev.quarkus.datasource.jdbc.url=jdbc:mariadb://${eclipse.internal-host}:10101/dev_eclipse_eca \ No newline at end of file +%dev.quarkus.datasource.jdbc.url=jdbc:mariadb://${eclipse.internal-host}:10101/dev_eclipse_eca + +eclipse.gitlab.access-token= \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5598b3431f04d1d1f0b5a65a16ec3b9bea23d463..95295716e30fefbb0f2c7845984343049f923601 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ <artifactId>git-eca</artifactId> <version>1.1.0</version> <properties> - <eclipse-api-version>0.7.6</eclipse-api-version> + <eclipse-api-version>0.7.7</eclipse-api-version> <compiler-plugin.version>3.8.1</compiler-plugin.version> <maven.compiler.parameters>true</maven.compiler.parameters> <maven.compiler.source>11</maven.compiler.source> @@ -14,7 +14,7 @@ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id> <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id> - <quarkus.platform.version>2.16.3.Final</quarkus.platform.version> + <quarkus.platform.version>2.16.7.Final</quarkus.platform.version> <surefire-plugin.version>2.22.1</surefire-plugin.version> <auto-value.version>1.8.2</auto-value.version> <org.mapstruct.version>1.4.1.Final</org.mapstruct.version> diff --git a/src/main/java/org/eclipsefoundation/git/eca/config/EcaReportsConfig.java b/src/main/java/org/eclipsefoundation/git/eca/config/EcaReportsConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..8cafe93774505274c35d541c3bdba810cf4934ce --- /dev/null +++ b/src/main/java/org/eclipsefoundation/git/eca/config/EcaReportsConfig.java @@ -0,0 +1,27 @@ +/********************************************************************* +* Copyright (c) 2023 Eclipse Foundation. +* +* This program and the accompanying materials are made +* available under the terms of the Eclipse Public License 2.0 +* which is available at https://www.eclipse.org/legal/epl-2.0/ +* +* Author: Zachary Sabourin <zachary.sabourin@eclipse-foundation.org> +* +* SPDX-License-Identifier: EPL-2.0 +**********************************************************************/ +package org.eclipsefoundation.git.eca.config; + +import java.util.List; + +import io.smallrye.config.ConfigMapping; + +/** + * Captures all configs related to eca reports. Includes resource access key and list of allowed users. + */ +@ConfigMapping(prefix = "eclipse.git-eca.reports") +public interface EcaReportsConfig { + + String accessKey(); + + List<String> allowedUsers(); +} diff --git a/src/main/java/org/eclipsefoundation/git/eca/config/HcaptchaConfig.java b/src/main/java/org/eclipsefoundation/git/eca/config/HcaptchaConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d99a38df3d1df0b7b88ace02cf87ce34c9eab518 --- /dev/null +++ b/src/main/java/org/eclipsefoundation/git/eca/config/HcaptchaConfig.java @@ -0,0 +1,29 @@ +/********************************************************************* +* Copyright (c) 2023 Eclipse Foundation. +* +* This program and the accompanying materials are made +* available under the terms of the Eclipse Public License 2.0 +* which is available at https://www.eclipse.org/legal/epl-2.0/ +* +* Author: Zachary Sabourin <zachary.sabourin@eclipse-foundation.org> +* +* SPDX-License-Identifier: EPL-2.0 +**********************************************************************/ +package org.eclipsefoundation.git.eca.config; + +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; + +/** + * Captures all configs related to hcaptcha. Includes enabled flag, site key, and secret. + */ +@ConfigMapping(prefix = "eclipse.hcaptcha") +public interface HcaptchaConfig { + + @WithDefault("true") + boolean enabled(); + + String siteKey(); + + String secret(); +} diff --git a/src/main/java/org/eclipsefoundation/git/eca/config/MailValidationConfig.java b/src/main/java/org/eclipsefoundation/git/eca/config/MailValidationConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..666613113b6e1840db73c782465a8ae12f44b6bd --- /dev/null +++ b/src/main/java/org/eclipsefoundation/git/eca/config/MailValidationConfig.java @@ -0,0 +1,27 @@ +/********************************************************************* +* Copyright (c) 2023 Eclipse Foundation. +* +* This program and the accompanying materials are made +* available under the terms of the Eclipse Public License 2.0 +* which is available at https://www.eclipse.org/legal/epl-2.0/ +* +* Author: Zachary Sabourin <zachary.sabourin@eclipse-foundation.org> +* +* SPDX-License-Identifier: EPL-2.0 +**********************************************************************/ +package org.eclipsefoundation.git.eca.config; + +import java.util.List; + +import io.smallrye.config.ConfigMapping; + +/** + * Captures all configs related to mail validation. Includesan allow list and a list of no-reply email patterns. + */ +@ConfigMapping(prefix = "eclipse.git-eca.mail-validation") +public interface MailValidationConfig { + + public List<String> allowList(); + + public List<String> noreplyEmailPatterns(); +} diff --git a/src/main/java/org/eclipsefoundation/git/eca/config/WebhooksConfig.java b/src/main/java/org/eclipsefoundation/git/eca/config/WebhooksConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..2d7f00dfa049ce7f29ebbbe51d4732ac78353f84 --- /dev/null +++ b/src/main/java/org/eclipsefoundation/git/eca/config/WebhooksConfig.java @@ -0,0 +1,29 @@ +/********************************************************************* +* Copyright (c) 2023 Eclipse Foundation. +* +* This program and the accompanying materials are made +* available under the terms of the Eclipse Public License 2.0 +* which is available at https://www.eclipse.org/legal/epl-2.0/ +* +* Author: Zachary Sabourin <zachary.sabourin@eclipse-foundation.org> +* +* SPDX-License-Identifier: EPL-2.0 +**********************************************************************/ +package org.eclipsefoundation.git.eca.config; + +import io.smallrye.config.ConfigMapping; + +/** + * Captures all configs related to webhooks. Includes github configs such as server target and request context. + */ +@ConfigMapping(prefix = "eclipse.webhooks") +public interface WebhooksConfig { + + GithubWebhooksDefinition github(); + + interface GithubWebhooksDefinition { + String context(); + + String serverTarget(); + } +} diff --git a/src/main/java/org/eclipsefoundation/git/eca/helper/CaptchaHelper.java b/src/main/java/org/eclipsefoundation/git/eca/helper/CaptchaHelper.java index 6555b3a30f23e4fa00e0fea3fd61658665ec5286..03fc9cc75ca4d9d49af6083ed0d01913ff2acc0c 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/helper/CaptchaHelper.java +++ b/src/main/java/org/eclipsefoundation/git/eca/helper/CaptchaHelper.java @@ -16,12 +16,13 @@ import java.util.Collections; import java.util.List; import java.util.Optional; +import javax.inject.Inject; import javax.inject.Singleton; import org.apache.commons.lang3.StringUtils; -import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.rest.client.inject.RestClient; import org.eclipsefoundation.git.eca.api.HCaptchaCallbackAPI; +import org.eclipsefoundation.git.eca.config.HcaptchaConfig; import org.eclipsefoundation.git.eca.namespace.HCaptchaErrorCodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,12 +37,8 @@ import org.slf4j.LoggerFactory; public class CaptchaHelper { private static final Logger LOGGER = LoggerFactory.getLogger(CaptchaHelper.class); - @ConfigProperty(name = "eclipse.hcaptcha.enabled", defaultValue = "true") - boolean isEnabled; - @ConfigProperty(name = "eclipse.hcaptcha.sitekey") - String siteKey; - @ConfigProperty(name = "eclipse.hcaptcha.secret") - String captchaSecret; + @Inject + HcaptchaConfig config; @RestClient HCaptchaCallbackAPI hcaptchaApi; @@ -54,7 +51,7 @@ public class CaptchaHelper { */ public List<HCaptchaErrorCodes> validateCaptchaResponse(String response) { // allow for disabling the captcha in case there are service issues, or in testing - if (!isEnabled) { + if (!config.enabled()) { LOGGER.trace("Captcha validation is currently disabled, skipping captcha check"); return Collections.emptyList(); } else if (StringUtils.isBlank(response)) { @@ -63,7 +60,8 @@ public class CaptchaHelper { } // validate the hcaptcha response with the site API, passing the secret and response return Optional - .ofNullable(hcaptchaApi.validateCaptchaRequest(response, captchaSecret, siteKey).getErrorCodes()) + .ofNullable( + hcaptchaApi.validateCaptchaRequest(response, config.secret(), config.siteKey()).getErrorCodes()) .orElse(Collections.emptyList()); } } diff --git a/src/main/java/org/eclipsefoundation/git/eca/resource/GithubAdjacentResource.java b/src/main/java/org/eclipsefoundation/git/eca/resource/GithubAdjacentResource.java index f1fc549635a92b590695ab70c033d920ce1b09c7..a7fc852eb799a75c9f58672b3a3648bad92c5c0c 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/resource/GithubAdjacentResource.java +++ b/src/main/java/org/eclipsefoundation/git/eca/resource/GithubAdjacentResource.java @@ -35,6 +35,7 @@ import org.eclipsefoundation.git.eca.api.models.GithubCommit.ParentCommit; import org.eclipsefoundation.git.eca.api.models.GithubCommitStatusRequest; import org.eclipsefoundation.git.eca.api.models.GithubWebhookRequest; import org.eclipsefoundation.git.eca.api.models.GithubWebhookRequest.PullRequest; +import org.eclipsefoundation.git.eca.config.WebhooksConfig; import org.eclipsefoundation.git.eca.dto.GithubWebhookTracking; import org.eclipsefoundation.git.eca.helper.JwtHelper; import org.eclipsefoundation.git.eca.model.Commit; @@ -64,13 +65,12 @@ public abstract class GithubAdjacentResource { private static final String VALIDATION_LOGGING_MESSAGE = "Setting validation state for {}/#{} to {}"; - @ConfigProperty(name = "eclipse.webhooks.github.context") - String context; - @ConfigProperty(name = "eclipse.webhooks.github.server-target") - String serverTarget; @ConfigProperty(name = "eclipse.github.default-api-version", defaultValue = "2022-11-28") String apiVersion; + @Inject + WebhooksConfig webhooksConfig; + @Inject JwtHelper jwtHelper; @Inject @@ -268,9 +268,9 @@ public abstract class GithubAdjacentResource { .builder() .setDescription(state.getMessage()) .setState(state.toString()) - .setTargetUrl(serverTarget + "/git/eca/status/gh/" + request.getRepository().getFullName() + '/' + .setTargetUrl(webhooksConfig.github().serverTarget() + "/git/eca/status/gh/" + request.getRepository().getFullName() + '/' + request.getPullRequest().getNumber()) - .setContext(context) + .setContext(webhooksConfig.github().context()) .build()); } diff --git a/src/main/java/org/eclipsefoundation/git/eca/resource/ReportsResource.java b/src/main/java/org/eclipsefoundation/git/eca/resource/ReportsResource.java index 284dce189f87b81be5d65889cbd950c0d515bfe3..3ff3389f1afa75b6e777420c920da792b72d527e 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/resource/ReportsResource.java +++ b/src/main/java/org/eclipsefoundation/git/eca/resource/ReportsResource.java @@ -21,8 +21,8 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; -import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipsefoundation.core.model.RequestWrapper; +import org.eclipsefoundation.git.eca.config.EcaReportsConfig; import org.eclipsefoundation.git.eca.namespace.GitEcaParameterNames; import org.eclipsefoundation.git.eca.service.ReportsService; import org.slf4j.Logger; @@ -32,8 +32,8 @@ import org.slf4j.LoggerFactory; public class ReportsResource { private static final Logger LOGGER = LoggerFactory.getLogger(ReportsResource.class); - @ConfigProperty(name = "eclipse.reports.access-key") - String key; + @Inject + EcaReportsConfig config; @Inject RequestWrapper wrap; @@ -44,7 +44,7 @@ public class ReportsResource { @Path("/gitlab/private-projects") public Response getPrivateProjectEvents(@QueryParam("key") String passedKey, @QueryParam("status") String status, @QueryParam("since") LocalDate since, @QueryParam("until") LocalDate until) { - if (!key.equals(passedKey)) { + if (!config.accessKey().equals(passedKey)) { LOGGER.debug("Bad key passed for access, access blocked"); return Response.status(401).build(); } diff --git a/src/main/java/org/eclipsefoundation/git/eca/resource/ValidationResource.java b/src/main/java/org/eclipsefoundation/git/eca/resource/ValidationResource.java index a567bcda314ed2d588a4b3595fdbea22c72ff9ca..36eb596b693a4ffc0dd85e751f02c2a8116d7ea9 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/resource/ValidationResource.java +++ b/src/main/java/org/eclipsefoundation/git/eca/resource/ValidationResource.java @@ -25,7 +25,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipsefoundation.core.model.RequestWrapper; import org.eclipsefoundation.core.service.CachingService; import org.eclipsefoundation.git.eca.api.models.EclipseUser; @@ -52,13 +51,6 @@ import org.slf4j.LoggerFactory; public class ValidationResource { private static final Logger LOGGER = LoggerFactory.getLogger(ValidationResource.class); - @Inject - @ConfigProperty(name = "eclipse.mail.allowlist") - List<String> allowListUsers; - @Inject - @ConfigProperty(name = "eclipse.noreply.email-patterns") - List<String> emailPatterns; - @Inject RequestWrapper wrapper; diff --git a/src/main/java/org/eclipsefoundation/git/eca/service/impl/CachedUserService.java b/src/main/java/org/eclipsefoundation/git/eca/service/impl/CachedUserService.java index de6836a89bc78fcc25411b8ec63aed7b4c47e5c0..df38a198863c53ed488fc5b9296fc796fbf90d35 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/service/impl/CachedUserService.java +++ b/src/main/java/org/eclipsefoundation/git/eca/service/impl/CachedUserService.java @@ -25,7 +25,6 @@ import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import org.apache.commons.lang3.StringUtils; -import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipse.microprofile.rest.client.inject.RestClient; import org.eclipsefoundation.core.service.CachingService; import org.eclipsefoundation.efservices.api.models.Project; @@ -33,6 +32,7 @@ import org.eclipsefoundation.efservices.services.DrupalTokenService; import org.eclipsefoundation.git.eca.api.AccountsAPI; import org.eclipsefoundation.git.eca.api.BotsAPI; import org.eclipsefoundation.git.eca.api.models.EclipseUser; +import org.eclipsefoundation.git.eca.config.MailValidationConfig; import org.eclipsefoundation.git.eca.service.UserService; import org.jboss.resteasy.specimpl.MultivaluedMapImpl; import org.slf4j.Logger; @@ -51,8 +51,7 @@ public class CachedUserService implements UserService { private static final Logger LOGGER = LoggerFactory.getLogger(CachedUserService.class); @Inject - @ConfigProperty(name = "eclipse.noreply.email-patterns") - List<String> emailPatterns; + MailValidationConfig config; // eclipse API rest client interfaces @Inject @@ -73,7 +72,7 @@ public class CachedUserService implements UserService { @PostConstruct void init() { // compile the patterns once per object to save processing time - this.patterns = emailPatterns.stream().map(Pattern::compile).collect(Collectors.toList()); + this.patterns = config.noreplyEmailPatterns().stream().map(Pattern::compile).collect(Collectors.toList()); } @Override diff --git a/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultValidationService.java b/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultValidationService.java index 7c45cd7888ee0499982a6fa20dd208cc2b869fe0..5491d3b3098fc7c7a53dbd08e64242804246b96c 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultValidationService.java +++ b/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultValidationService.java @@ -24,12 +24,12 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; -import org.eclipse.microprofile.config.inject.ConfigProperty; import org.eclipsefoundation.core.helper.DateTimeHelper; import org.eclipsefoundation.core.model.RequestWrapper; import org.eclipsefoundation.core.service.CachingService; import org.eclipsefoundation.efservices.api.models.Project; import org.eclipsefoundation.git.eca.api.models.EclipseUser; +import org.eclipsefoundation.git.eca.config.MailValidationConfig; import org.eclipsefoundation.git.eca.dto.CommitValidationMessage; import org.eclipsefoundation.git.eca.dto.CommitValidationStatus; import org.eclipsefoundation.git.eca.dto.CommitValidationStatusGrouping; @@ -61,8 +61,8 @@ import org.slf4j.LoggerFactory; public class DefaultValidationService implements ValidationService { private static final Logger LOGGER = LoggerFactory.getLogger(DefaultValidationService.class); - @ConfigProperty(name = "eclipse.mail.allowlist") - List<String> allowListUsers; + @Inject + MailValidationConfig config; @Inject ProjectHelper projects; @@ -413,7 +413,7 @@ public class DefaultValidationService implements ValidationService { * @return true if user email is in allow list, false otherwise */ private boolean isAllowedUser(String mail) { - return StringUtils.isNotBlank(mail) && allowListUsers.indexOf(mail) != -1; + return StringUtils.isNotBlank(mail) && config.allowList().indexOf(mail) != -1; } /** diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 456b0527eccb9dc4eef02f8bfb4a96b75ba69c65..f113468ea24cac9a9228775226d298540d23034c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,20 +1,17 @@ -quarkus.rest-client."org.eclipsefoundation.git.eca.api.AccountsAPI".scope=javax.enterprise.context.ApplicationScoped -quarkus.rest-client."org.eclipsefoundation.git.eca.api.AccountsAPI".url=https://api.eclipse.org -projects-api/mp-rest/url=https://projects.eclipse.org -org.eclipsefoundation.git.eca.api.BotsAPI/mp-rest/url=https://api.eclipse.org -quarkus.rest-client."org.eclipsefoundation.git.eca.api.GitlabAPI".url=https://gitlab.eclipse.org/api/v4/ - -eclipse.noreply.email-patterns=@users.noreply.github.com\$,@noreply.github.com\$ - -## Base HTTP settings +## Base Quarkus HTTP settings quarkus.http.enable-compression=true quarkus.http.port=8080 -## Expect to be mounted to '/git' to match current URL spec quarkus.http.root-path=/git +## RestClient configs +org.eclipsefoundation.git.eca.api.AccountsAPI/mp-rest/url=https://api.eclipse.org +projects-api/mp-rest/url=https://projects.eclipse.org +org.eclipsefoundation.git.eca.api.BotsAPI/mp-rest/url=https://api.eclipse.org +org.eclipsefoundation.git.eca.api.GitlabAPI/mp-rest/url=https://gitlab.eclipse.org/api/v4/ + ## DATASOURCE CONFIG -eclipse.db.default.limit=10 -eclipse.db.default.limit.max=100 +eclipse.persistence.pagination-limit=10 +eclipse.persistence.pagination-limit.max=100 quarkus.datasource.db-kind=mariadb quarkus.datasource.jdbc.min-size = 5 quarkus.datasource.jdbc.max-size = 15 @@ -23,13 +20,12 @@ quarkus.datasource.jdbc.max-size = 15 quarkus.hibernate-orm.packages=org.eclipsefoundation.git.eca.dto quarkus.hibernate-orm.datasource=<default> -## OAUTH CONFIG +## Security configs quarkus.oauth2.enabled=false quarkus.oidc.enabled=false -oauth2.scope=eclipsefdn_view_all_profiles -oauth2.client-id=placeholder -oauth2.client-secret=placeholder -eclipse.reports.allowed-users=mbarbaro,webdev +eclipse.security.oauth2.token-generation.scope=eclipsefdn_view_all_profiles +eclipse.security.oauth2.token-generation.client-id=placeholder +eclipse.security.oauth2.token-generation.client-secret=placeholder ## CACHE SETTINGS eclipse.cache.loading."projects".timeout=10 @@ -47,9 +43,17 @@ quarkus.cache.caffeine."accesstoken".expire-after-write=119S ## JWT Placeholders/defaults smallrye.jwt.new-token.lifespan=120 smallrye.jwt.new-token.issuer=262450 + +## Webhook configs eclipse.webhooks.github.context=eclipsefdn/eca eclipse.webhooks.github.server-target=https://api.eclipse.org -eclipse.mail.allowlist=noreply@github.com,49699333+dependabot[bot]@users.noreply.github.com,bot@stepsecurity.io +## Git-eca mail configs +eclipse.git-eca.mail-validation.allow-list=noreply@github.com,49699333+dependabot[bot]@users.noreply.github.com,bot@stepsecurity.io +eclipse.git-eca.mail-validation.noreply-email-patterns=@users.noreply.github.com\$,@noreply.github.com\$ + +## Reports configs +eclipse.git-eca.reports.allowed-users=mbarbaro,webdev +## Misc eclipse.system-hook.pool-size=5 diff --git a/src/test/java/org/eclipsefoundation/git/eca/resource/ReportsResourceTest.java b/src/test/java/org/eclipsefoundation/git/eca/resource/ReportsResourceTest.java index e8be810faee032f2bc440e4cb0097ea8a0890e90..e329ce2f3377814f7846b100a3fc55afdd682e1b 100644 --- a/src/test/java/org/eclipsefoundation/git/eca/resource/ReportsResourceTest.java +++ b/src/test/java/org/eclipsefoundation/git/eca/resource/ReportsResourceTest.java @@ -56,7 +56,8 @@ class ReportsResourceTest { SchemaNamespaceHelper.PRIVATE_PROJECT_EVENTS_SCHEMA_PATH); public static final EndpointTestCase GET_REPORT_RANGE_SUCCESS_CASE = TestCaseHelper - .buildSuccessCase(REPORTS_PROJECTS_RANGE_URL, new String[] { VALID_TEST_ACCESS_KEY, "2022-11-15", "2022-11-15" }, + .buildSuccessCase(REPORTS_PROJECTS_RANGE_URL, + new String[] { VALID_TEST_ACCESS_KEY, "2022-11-15", "2022-11-15" }, SchemaNamespaceHelper.PRIVATE_PROJECT_EVENTS_SCHEMA_PATH); public static final EndpointTestCase GET_REPORT_BAD_ACCESS_KEY = EndpointTestCase @@ -97,10 +98,13 @@ class ReportsResourceTest { } @Test - void getPrivProjReport_failure_invalidRequestFormat() { + void getPrivProjReport_failure_invalidResponseFormat() { RestAssuredTemplates .testGet(TestCaseHelper - .buildInvalidFormatCase(REPORTS_PROJECTS_URL, new String[] { VALID_TEST_ACCESS_KEY }, ContentType.TEXT)); + .prepareTestCase(REPORTS_PROJECTS_URL, new String[] { VALID_TEST_ACCESS_KEY }, null) + .setResponseContentType(ContentType.TEXT) + .setStatusCode(500) + .build()); } @Test diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index ba7455409d09aa157add6f3e9367082b706675bd..b468fd8f1c70edda794f5b7ff65f270b7ee6d2e6 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -1,34 +1,39 @@ +## Quarkus configs +quarkus.http.root-path=/git +quarkus.http.port=8080 + quarkus.jacoco.includes=**/git/eca/**/* +## Prevents test profile from pulling docker images for testing org.eclipsefoundation.git.eca.api.ProjectsAPI/mp-rest/url=https://projects.eclipse.org org.eclipsefoundation.git.eca.api.BotsAPI/mp-rest/url=https://api.eclipse.org -eclipse.noreply.email-patterns=@users.noreply.github.com\$,@noreply.github.com\$ -eclipse.mail.allowlist=noreply@github.com -eclipse.reports.access-key=samplekey -eclipse.gitlab.access-token=token_val - ## DATASOURCE CONFIG quarkus.datasource.db-kind=h2 -eclipse.db.default.limit=25 -eclipse.db.default.limit.max=100 +eclipse.persistence.pagination-limit=25 +eclipse.persistence.pagination-limit.max=100 quarkus.hibernate-orm.database.generation=none # Flyway configuration for the default datasource quarkus.flyway.locations=classpath:database/default quarkus.flyway.migrate-at-start=true -## Expect to be mounted to '/git' to match current URL spec -quarkus.http.root-path=/git -quarkus.http.port=8080 - ## OIDC Connection/Authentication Info quarkus.oidc.enabled=false quarkus.keycloak.devservices.enabled=false quarkus.oidc-client.enabled=false smallrye.jwt.sign.key.location=test.pem - # hCaptcha test key and secret -eclipse.hcaptcha.sitekey=20000000-ffff-ffff-ffff-000000000002 -eclipse.hcaptcha.secret=0x0000000000000000000000000000000000000000 \ No newline at end of file +eclipse.hcaptcha.site-key=20000000-ffff-ffff-ffff-000000000002 +eclipse.hcaptcha.secret=0x0000000000000000000000000000000000000000 + +## Git-eca mail configs +eclipse.git-eca.mail.noreply-email-patterns=@users.noreply.github.com\$,@noreply.github.com\$ +eclipse.git-eca.mail.allow-list=noreply@github.com + +## Reports configs +eclipse.git-eca.reports.access-key=samplekey + +## Misc +eclipse.gitlab.access-token=token_val \ No newline at end of file