diff --git a/pom.xml b/pom.xml index aaea57fd7821553f3f7c31a81fadb4d68af991dd..7cb832584c7636f8bf66d30f3a2b68c2b569121f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ <artifactId>eclipsefdn-downloads-api</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> - <eclipse-api-version>0.7.6</eclipse-api-version> + <eclipse-api-version>0.7.7</eclipse-api-version> <surefire-plugin.version>2.22.1</surefire-plugin.version> <compiler-plugin.version>3.8.1</compiler-plugin.version> <maven.compiler.target>11</maven.compiler.target> diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 80426ea5690f316fc891c61bce0a8bb32b7d3d55..b6794fc55a0b3f5d79ca8ec150878029100958cb 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,28 +1,30 @@ -0quarkus.log.level=INFO +## Quarkus configs +quarkus.log.level=INFO quarkus.http.port=8090 quarkus.http.root-path=/download quarkus.http.cors=true quarkus.http.enable-compression=true quarkus.http.non-application-root-path=non-application -security.csrf.enabled=true -security.csrf.distributed-mode.default-provider=false +## Security configs +eclipse.security.csrf.enabled=true +eclipse.security.csrf.distributed-mode.is-default-provider=false +eclipse.security.csrf.distributed-mode.enabled=false -quarkus.oidc.enabled = false -security.csrf.enabled.distributed-mode=false +quarkus.oidc.enabled=false ## 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 -quarkus.oidc.enabled=false +## RestClient configs drupal/mp-rest/url=https://eclipse.org drupal/mp-rest/followRedirects=true -# Tells Quarkus which objects are associated with what databases (used to generate entity tables internally) +## Tells Quarkus which objects are associated with what databases (used to generate entity tables internally) quarkus.hibernate-orm.packages=org.eclipsefoundation.downloads.dto,org.eclipsefoundation.persistence.dto quarkus.hibernate-orm.datasource=<default> quarkus.hibernate-orm.physical-naming-strategy=org.eclipsefoundation.downloads.config.DefaultPhysicalNamingStrategy \ No newline at end of file diff --git a/src/test/java/org/eclipsefoundation/downloads/resources/DownloadsResourceTest.java b/src/test/java/org/eclipsefoundation/downloads/resources/DownloadsResourceTest.java index 504e70b84d6a1cdd397fe5d75b0edb58b7272675..50322830f1c7e19e497f8a356528e9cd08c221ab 100644 --- a/src/test/java/org/eclipsefoundation/downloads/resources/DownloadsResourceTest.java +++ b/src/test/java/org/eclipsefoundation/downloads/resources/DownloadsResourceTest.java @@ -21,7 +21,6 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import io.quarkus.test.junit.QuarkusTest; -import io.restassured.http.ContentType; @TestInstance(Lifecycle.PER_CLASS) @QuarkusTest @@ -34,8 +33,7 @@ class DownloadsResourceTest { public static final String LEGACY_RELEASE_URL = DOWNLOADS_BASE_URL + "/release/{releaseType}"; public static final String LEGACY_RELEASE_NAME_URL = LEGACY_RELEASE_URL + "?release_name={param}"; public static final String LEGACY_RELEASE_VERSION_URL = LEGACY_RELEASE_URL + "?release_version={param}"; - public static final String LEGACY_RELEASE_NAME_VERSION_URL = LEGACY_RELEASE_URL - + "?release_name={param1}&release_version={param2}"; + public static final String LEGACY_RELEASE_NAME_VERSION_URL = LEGACY_RELEASE_URL + "?release_name={param1}&release_version={param2}"; public static final String RELEASES_URL = RELEASE_BASE_URL + "/{releaseType}/{releaseName}"; public static final String RELEASE_VERSION_URL = RELEASES_URL + "/{releaseVersion}"; @@ -43,84 +41,69 @@ class DownloadsResourceTest { /* * FILE BY ID */ - public static final EndpointTestCase FILE_BY_ID_SUCCESS = TestCaseHelper.buildSuccessCase(FILE_BY_ID_URL, - new String[] { "1" }, SchemaNamespaceHelper.FILE_SCHEMA_PATH); + public static final EndpointTestCase FILE_BY_ID_SUCCESS = TestCaseHelper + .buildSuccessCase(FILE_BY_ID_URL, new String[] { "1" }, SchemaNamespaceHelper.FILE_SCHEMA_PATH); - public static final EndpointTestCase FILE_BY_ID_NOT_FOUND = TestCaseHelper.buildNotFoundCase(FILE_BY_ID_URL, - new String[] { "99999" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); - - public static final EndpointTestCase FILE_BY_ID_INVALID_FORMAT = TestCaseHelper - .buildInvalidFormatCase(FILE_BY_ID_URL, new String[] { "1" }, ContentType.TEXT); + public static final EndpointTestCase FILE_BY_ID_NOT_FOUND = TestCaseHelper + .buildNotFoundCase(FILE_BY_ID_URL, new String[] { "99999" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); /* * LEGACY RELEASE */ - public static final EndpointTestCase LEGACY_RELEASE_SUCCESS_NAME = TestCaseHelper.buildSuccessCase( - LEGACY_RELEASE_NAME_URL, new String[] { "epp", "2021-12" }, - SchemaNamespaceHelper.RELEASES_SCHEMA_PATH); - - public static final EndpointTestCase LEGACY_RELEASE_SUCCESS_NAME_VERSION = TestCaseHelper.buildSuccessCase( - LEGACY_RELEASE_NAME_VERSION_URL, new String[] { "epp", "2021-12", "r" }, - SchemaNamespaceHelper.RELEASE_SCHEMA_PATH); + public static final EndpointTestCase LEGACY_RELEASE_SUCCESS_NAME = TestCaseHelper + .buildSuccessCase(LEGACY_RELEASE_NAME_URL, new String[] { "epp", "2021-12" }, SchemaNamespaceHelper.RELEASES_SCHEMA_PATH); - public static final EndpointTestCase LEGACY_RELEASE_INVALID_TYPE = TestCaseHelper.buildBadRequestCase( - LEGACY_RELEASE_NAME_VERSION_URL, new String[] { "new", "2021-12", "r" }, - SchemaNamespaceHelper.ERROR_SCHEMA_PATH); + public static final EndpointTestCase LEGACY_RELEASE_SUCCESS_NAME_VERSION = TestCaseHelper + .buildSuccessCase(LEGACY_RELEASE_NAME_VERSION_URL, new String[] { "epp", "2021-12", "r" }, + SchemaNamespaceHelper.RELEASE_SCHEMA_PATH); - public static final EndpointTestCase LEGACY_RELEASE_NO_NAME = TestCaseHelper.buildSuccessCase( - LEGACY_RELEASE_URL, new String[] { "eclipse_packages" }, SchemaNamespaceHelper.RELEASE_SCHEMA_PATH); + public static final EndpointTestCase LEGACY_RELEASE_INVALID_TYPE = TestCaseHelper + .buildBadRequestCase(LEGACY_RELEASE_NAME_VERSION_URL, new String[] { "new", "2021-12", "r" }, + SchemaNamespaceHelper.ERROR_SCHEMA_PATH); - public static final EndpointTestCase LEGACY_RELEASE_NO_NAME_VERSION = TestCaseHelper.buildBadRequestCase( - LEGACY_RELEASE_VERSION_URL, new String[] { "eclipse_packages", "r" }, - SchemaNamespaceHelper.ERROR_SCHEMA_PATH); + public static final EndpointTestCase LEGACY_RELEASE_NO_NAME = TestCaseHelper + .buildSuccessCase(LEGACY_RELEASE_URL, new String[] { "eclipse_packages" }, SchemaNamespaceHelper.RELEASE_SCHEMA_PATH); - public static final EndpointTestCase LEGACY_RELEASE_NAME_NOT_FOUND = TestCaseHelper.buildNotFoundCase( - LEGACY_RELEASE_NAME_URL, new String[] { "eclipse_packages", "nitro" }, - SchemaNamespaceHelper.ERROR_SCHEMA_PATH); + public static final EndpointTestCase LEGACY_RELEASE_NO_NAME_VERSION = TestCaseHelper + .buildBadRequestCase(LEGACY_RELEASE_VERSION_URL, new String[] { "eclipse_packages", "r" }, + SchemaNamespaceHelper.ERROR_SCHEMA_PATH); - public static final EndpointTestCase LEGACY_RELEASE_VERSION_NOT_FOUND = TestCaseHelper.buildNotFoundCase( - LEGACY_RELEASE_NAME_VERSION_URL, new String[] { "eclipse_packages", "epp", "nitro" }, - SchemaNamespaceHelper.ERROR_SCHEMA_PATH); + public static final EndpointTestCase LEGACY_RELEASE_NAME_NOT_FOUND = TestCaseHelper + .buildNotFoundCase(LEGACY_RELEASE_NAME_URL, new String[] { "eclipse_packages", "nitro" }, + SchemaNamespaceHelper.ERROR_SCHEMA_PATH); - public static final EndpointTestCase LEGACY_RELEASE_INVALID_FORMAT = TestCaseHelper - .buildInvalidFormatCase(LEGACY_RELEASE_NAME_URL, new String[] { "epp", "2021-12" }, - ContentType.TEXT); + public static final EndpointTestCase LEGACY_RELEASE_VERSION_NOT_FOUND = TestCaseHelper + .buildNotFoundCase(LEGACY_RELEASE_NAME_VERSION_URL, new String[] { "eclipse_packages", "epp", "nitro" }, + SchemaNamespaceHelper.ERROR_SCHEMA_PATH); /* * GET RELEASES */ - public static final EndpointTestCase GET_RELEASES_SUCCESS = TestCaseHelper.buildSuccessCase(RELEASES_URL, - new String[] { "epp", "2021-06" }, SchemaNamespaceHelper.RELEASES_SCHEMA_PATH); + public static final EndpointTestCase GET_RELEASES_SUCCESS = TestCaseHelper + .buildSuccessCase(RELEASES_URL, new String[] { "epp", "2021-06" }, SchemaNamespaceHelper.RELEASES_SCHEMA_PATH); - public static final EndpointTestCase GET_RELEASES_NOT_FOUND = TestCaseHelper.buildNotFoundCase(RELEASES_URL, - new String[] { "epp", "nitro" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); + public static final EndpointTestCase GET_RELEASES_NOT_FOUND = TestCaseHelper + .buildNotFoundCase(RELEASES_URL, new String[] { "epp", "nitro" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); - public static final EndpointTestCase GET_RELEASES_INVALID_TYPE = TestCaseHelper.buildBadRequestCase( - RELEASES_URL, new String[] { "new", "2021-06" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); - - public static final EndpointTestCase GET_RELEASES_INVALID_FORMAT = TestCaseHelper - .buildInvalidFormatCase(RELEASES_URL, new String[] { "epp", "2021-06" }, ContentType.TEXT); + public static final EndpointTestCase GET_RELEASES_INVALID_TYPE = TestCaseHelper + .buildBadRequestCase(RELEASES_URL, new String[] { "new", "2021-06" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); /* * GET RELEASE VERSION */ - public static final EndpointTestCase GET_RELEASE_VERSION_SUCCESS = TestCaseHelper.buildSuccessCase( - RELEASE_VERSION_URL, new String[] { "eclipse_packages", "2021-06", "r" }, - SchemaNamespaceHelper.RELEASE_SCHEMA_PATH); - - public static final EndpointTestCase GET_RELEASE_VERSION_NOT_FOUND_NAME = TestCaseHelper.buildNotFoundCase( - RELEASE_VERSION_URL, new String[] { "eclipse_packages", "nitro", "m1" }, - SchemaNamespaceHelper.ERROR_SCHEMA_PATH); + public static final EndpointTestCase GET_RELEASE_VERSION_SUCCESS = TestCaseHelper + .buildSuccessCase(RELEASE_VERSION_URL, new String[] { "eclipse_packages", "2021-06", "r" }, + SchemaNamespaceHelper.RELEASE_SCHEMA_PATH); - public static final EndpointTestCase GET_RELEASE_VERSION_NOT_FOUND_VERSION = TestCaseHelper.buildNotFoundCase( - RELEASE_VERSION_URL, new String[] { "epp", "2020-03", "version1" }, - SchemaNamespaceHelper.ERROR_SCHEMA_PATH); + public static final EndpointTestCase GET_RELEASE_VERSION_NOT_FOUND_NAME = TestCaseHelper + .buildNotFoundCase(RELEASE_VERSION_URL, new String[] { "eclipse_packages", "nitro", "m1" }, + SchemaNamespaceHelper.ERROR_SCHEMA_PATH); - public static final EndpointTestCase GET_RELEASE_VERSION_INVALID_TYPE = TestCaseHelper.buildBadRequestCase( - RELEASE_VERSION_URL, new String[] { "new", "2021-06", "r" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); + public static final EndpointTestCase GET_RELEASE_VERSION_NOT_FOUND_VERSION = TestCaseHelper + .buildNotFoundCase(RELEASE_VERSION_URL, new String[] { "epp", "2020-03", "version1" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); - public static final EndpointTestCase GET_RELEASE_VERSION_INVALID_FORMAT = TestCaseHelper - .buildInvalidFormatCase(RELEASE_VERSION_URL, new String[] { "epp", "2021-06", "m1" }, ContentType.TEXT); + public static final EndpointTestCase GET_RELEASE_VERSION_INVALID_TYPE = TestCaseHelper + .buildBadRequestCase(RELEASE_VERSION_URL, new String[] { "new", "2021-06", "r" }, SchemaNamespaceHelper.ERROR_SCHEMA_PATH); /* * FILE BY ID @@ -150,11 +133,6 @@ class DownloadsResourceTest { RestAssuredTemplates.testGet_validateSchema(FILE_BY_ID_NOT_FOUND); } - @Test - void getFileByID_failure_invalidRequestFormat() { - RestAssuredTemplates.testGet(FILE_BY_ID_INVALID_FORMAT); - } - /* * LEGACY RELEASE */ @@ -212,11 +190,6 @@ class DownloadsResourceTest { RestAssuredTemplates.testGet_validateSchema(LEGACY_RELEASE_VERSION_NOT_FOUND); } - @Test - void getReleaseLegacy_failure_invalidRequestFormat() { - RestAssuredTemplates.testGet(LEGACY_RELEASE_INVALID_FORMAT); - } - /* * GET RELEASE */ @@ -255,11 +228,6 @@ class DownloadsResourceTest { RestAssuredTemplates.testGet_validateSchema(GET_RELEASES_INVALID_TYPE); } - @Test - void getRelease_failure_invalidRequestFormat() { - RestAssuredTemplates.testGet(GET_RELEASES_INVALID_FORMAT); - } - /* * GET RELEASE VERSION */ @@ -307,8 +275,4 @@ class DownloadsResourceTest { void getReleaseVersion_failure_invalidReleaseType_validSchema() { RestAssuredTemplates.testGet_validateSchema(GET_RELEASE_VERSION_INVALID_TYPE); } - - void getReleaseVersion_failure_invalidRequestFormat() { - RestAssuredTemplates.testGet(GET_RELEASE_VERSION_INVALID_FORMAT); - } } diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 469482dd30473e4c63c3aec24657108bbfcfefa7..2137aae6f07a6c24a0380301d0af4c0038c93e61 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -1,7 +1,7 @@ ## 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 @@ -12,9 +12,9 @@ quarkus.flyway.migrate-at-start=true quarkus.oauth2.enabled=false quarkus.oidc.enabled=false quarkus.keycloak.devservices.enabled=false - quarkus.oidc-client.enabled=false quarkus.oidc.auth-server-url=/realms/quarkus/ quarkus.oidc.client-id=quarkus-service-app quarkus.oidc.application-type=service + smallrye.jwt.sign.key.location=privateKey.jwk \ No newline at end of file