diff --git a/.github/workflows/build-marketplace.yml b/.github/workflows/build-marketplace.yml index 85a8683f..b4427bbb 100644 --- a/.github/workflows/build-marketplace.yml +++ b/.github/workflows/build-marketplace.yml @@ -40,7 +40,7 @@ jobs: uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 id: cache-api with: - path: api.adoptium.net/target + path: api.adoptium.net/**/target key: api-build-${{ steps.get-submodule-sha.outputs.SUBMODULE_SHA }} restore-keys: | api-build-${{ steps.get-submodule-sha.outputs.SUBMODULE_SHA }} diff --git a/.github/workflows/run-vendor-validation.yml b/.github/workflows/run-vendor-validation.yml index 059140e4..a8a14999 100644 --- a/.github/workflows/run-vendor-validation.yml +++ b/.github/workflows/run-vendor-validation.yml @@ -31,7 +31,7 @@ jobs: uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 id: cache-api with: - path: api.adoptium.net/target + path: api.adoptium.net/**/target key: api-build-${{ steps.get-submodule-sha.outputs.SUBMODULE_SHA }} restore-keys: | api-build-${{ steps.get-submodule-sha.outputs.SUBMODULE_SHA }} diff --git a/.gitmodules b/.gitmodules index 3984e755..ea632314 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "api.adoptium.net"] path = api.adoptium.net url = https://github.com/adoptium/api.adoptium.net - branch = marketplace + diff --git a/adoptium-marketplace-client/src/main/java/net/adoptium/marketplace/client/MarketplaceHttpClient.java b/adoptium-marketplace-client/src/main/java/net/adoptium/marketplace/client/MarketplaceHttpClient.java index b4b68fe2..dd12596a 100644 --- a/adoptium-marketplace-client/src/main/java/net/adoptium/marketplace/client/MarketplaceHttpClient.java +++ b/adoptium-marketplace-client/src/main/java/net/adoptium/marketplace/client/MarketplaceHttpClient.java @@ -3,7 +3,7 @@ import net.adoptium.marketplace.client.signature.FailedToValidateSignatureException; import net.adoptium.marketplace.client.signature.SignatureVerifier; import org.eclipse.jetty.client.HttpClient; -import org.eclipse.jetty.client.api.ContentResponse; +import org.eclipse.jetty.client.ContentResponse; import org.eclipse.jetty.http.HttpStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/adoptium-marketplace-client/src/test/java/net/adoptium/marketplace/client/TestServer.java b/adoptium-marketplace-client/src/test/java/net/adoptium/marketplace/client/TestServer.java index ca1395bf..db240a7f 100644 --- a/adoptium-marketplace-client/src/test/java/net/adoptium/marketplace/client/TestServer.java +++ b/adoptium-marketplace-client/src/test/java/net/adoptium/marketplace/client/TestServer.java @@ -3,8 +3,8 @@ import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.DefaultHandler; -import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.ResourceHandler; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.BeforeAllCallback; @@ -28,10 +28,15 @@ public void beforeAll(ExtensionContext extensionContext) throws Exception { ResourceHandler resource_handler = new ResourceHandler(); String repo = searchForRepo("exampleRepositories"); - resource_handler.setResourceBase(new File(repo).getAbsolutePath()); + resource_handler.setBaseResourceAsString(new File(repo).getAbsolutePath()); - HandlerList handlers = new HandlerList(); - handlers.setHandlers(new Handler[]{resource_handler, new DefaultHandler()}); + // Using ContextHandlerCollection instead of HandlerList + ContextHandlerCollection handlers = new ContextHandlerCollection(); + handlers.setHandlers(new Handler[]{resource_handler}); + + // Set DefaultHandler directly on the server + server.setDefaultHandler(new DefaultHandler()); + server.setHandler(handlers); server.start(); } diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/pom.xml b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/pom.xml index 95163a1d..1a6c05f2 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/pom.xml +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/pom.xml @@ -51,8 +51,19 @@ org.awaitility awaitility + + + org.hamcrest + hamcrest + + test + + org.hamcrest + hamcrest + 2.2 + org.skyscreamer jsonassert @@ -99,7 +110,7 @@ com.fasterxml.jackson.datatype - jackson-datatype-jsr353 + jackson-datatype-jakarta-jsonp test @@ -217,7 +228,7 @@ all-open - + diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/AdoptiumMarketplace.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/AdoptiumMarketplace.kt index 9792325a..e5e0b841 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/AdoptiumMarketplace.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/AdoptiumMarketplace.kt @@ -9,10 +9,10 @@ import net.adoptium.marketplace.schema.Vendor import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition import org.eclipse.microprofile.openapi.annotations.info.Info import org.eclipse.microprofile.openapi.annotations.servers.Server -import javax.enterprise.context.ApplicationScoped -import javax.inject.Inject -import javax.ws.rs.ApplicationPath -import javax.ws.rs.core.Application +import jakarta.enterprise.context.ApplicationScoped +import jakarta.inject.Inject +import jakarta.ws.rs.ApplicationPath +import jakarta.ws.rs.core.Application @UnlessBuildProfile("test") @ApplicationScoped diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/JsonSerialiserConfig.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/JsonSerialiserConfig.kt index e80ed35e..ab28d3d5 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/JsonSerialiserConfig.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/JsonSerialiserConfig.kt @@ -13,7 +13,7 @@ import net.adoptium.marketplace.dataSources.TimeSource import java.time.ZonedDateTime import java.time.format.DateTimeFormatter import java.util.* -import javax.ws.rs.ext.Provider +import jakarta.ws.rs.ext.Provider /* @Provider diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/Pagination.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/Pagination.kt index 9a2ba686..b8f286c0 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/Pagination.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/Pagination.kt @@ -1,6 +1,6 @@ package net.adoptium.marketplace.server.frontend -import javax.ws.rs.NotFoundException +import jakarta.ws.rs.NotFoundException import kotlin.math.min object Pagination { diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/metrics/AppInsightsInterceptor.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/metrics/AppInsightsInterceptor.kt index 69466341..def33851 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/metrics/AppInsightsInterceptor.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/metrics/AppInsightsInterceptor.kt @@ -4,13 +4,13 @@ import com.microsoft.applicationinsights.telemetry.Duration import com.microsoft.applicationinsights.telemetry.RequestTelemetry import net.adoptium.marketplace.ai.AppInsightsTelemetry import java.util.* -import javax.ws.rs.container.ContainerRequestContext -import javax.ws.rs.container.ContainerRequestFilter -import javax.ws.rs.container.ContainerResponseContext -import javax.ws.rs.container.ContainerResponseFilter -import javax.ws.rs.ext.Provider -import javax.ws.rs.ext.WriterInterceptor -import javax.ws.rs.ext.WriterInterceptorContext +import jakarta.ws.rs.ext.Provider +import jakarta.ws.rs.ext.WriterInterceptor +import jakarta.ws.rs.ext.WriterInterceptorContext +import jakarta.ws.rs.container.ContainerResponseContext +import jakarta.ws.rs.container.ContainerResponseFilter +import jakarta.ws.rs.container.ContainerRequestFilter +import jakarta.ws.rs.container.ContainerRequestContext private const val START_TIME_KEY = "appInsightsRequestStartTime" private const val TELEMETERY_KEY = "appInsightsTelemetery" diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/AssetsResource.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/AssetsResource.kt index d862f333..228c062b 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/AssetsResource.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/AssetsResource.kt @@ -28,18 +28,20 @@ import org.eclipse.microprofile.openapi.annotations.parameters.Parameter import org.eclipse.microprofile.openapi.annotations.responses.APIResponse import org.eclipse.microprofile.openapi.annotations.responses.APIResponses import org.eclipse.microprofile.openapi.annotations.tags.Tag -import javax.enterprise.context.ApplicationScoped -import javax.inject.Inject -import javax.ws.rs.BadRequestException -import javax.ws.rs.GET -import javax.ws.rs.NotFoundException -import javax.ws.rs.Path -import javax.ws.rs.PathParam -import javax.ws.rs.Produces -import javax.ws.rs.QueryParam -import javax.ws.rs.ServerErrorException -import javax.ws.rs.core.MediaType -import javax.ws.rs.core.Response +import jakarta.enterprise.context.ApplicationScoped +import jakarta.inject.Inject +import jakarta.ws.rs.BadRequestException +import jakarta.ws.rs.GET +import jakarta.ws.rs.NotFoundException +import jakarta.ws.rs.Path +import jakarta.ws.rs.PathParam +import jakarta.ws.rs.Produces +import jakarta.ws.rs.QueryParam +import jakarta.ws.rs.ServerErrorException +import jakarta.ws.rs.core.Context +import jakarta.ws.rs.core.MediaType +import jakarta.ws.rs.core.Response +import jakarta.ws.rs.core.UriInfo @Tag(name = "Assets") @Path("/v1/assets/") diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/ReleaseEndpoint.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/ReleaseEndpoint.kt index 650435b5..b17323a7 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/ReleaseEndpoint.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/ReleaseEndpoint.kt @@ -18,11 +18,11 @@ import net.adoptium.marketplace.server.frontend.models.SortMethod import net.adoptium.marketplace.server.frontend.models.SortOrder import net.adoptium.marketplace.server.frontend.versions.FailedToParse import java.util.function.Predicate -import javax.inject.Inject -import javax.inject.Singleton -import javax.ws.rs.BadRequestException +import jakarta.inject.Inject +import jakarta.enterprise.context.ApplicationScoped +import jakarta.ws.rs.BadRequestException -@Singleton +@ApplicationScoped class ReleaseEndpoint @Inject constructor(private val apiDataStore: APIDataStore) { diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/SwaggerUiRoute.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/SwaggerUiRoute.kt index cd61df32..5d431be7 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/SwaggerUiRoute.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/SwaggerUiRoute.kt @@ -3,12 +3,12 @@ package net.adoptium.marketplace.server.frontend.routes import org.eclipse.microprofile.openapi.annotations.Operation import org.eclipse.microprofile.openapi.annotations.media.Schema import java.net.URI -import javax.ws.rs.GET -import javax.ws.rs.Path -import javax.ws.rs.PathParam -import javax.ws.rs.Produces -import javax.ws.rs.core.MediaType -import javax.ws.rs.core.Response +import jakarta.ws.rs.GET +import jakarta.ws.rs.Path +import jakarta.ws.rs.PathParam +import jakarta.ws.rs.Produces +import jakarta.ws.rs.core.MediaType +import jakarta.ws.rs.core.Response @Path("/") @Schema(hidden = true) diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/VendorStatusRoute.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/VendorStatusRoute.kt index 634ae1de..0f9b6c12 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/VendorStatusRoute.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/VendorStatusRoute.kt @@ -8,15 +8,15 @@ import net.adoptium.marketplace.server.frontend.models.ReleaseUpdateSummary import org.eclipse.microprofile.openapi.annotations.Operation import org.eclipse.microprofile.openapi.annotations.media.Schema import org.eclipse.microprofile.openapi.annotations.parameters.Parameter -import javax.inject.Inject -import javax.inject.Singleton -import javax.ws.rs.GET -import javax.ws.rs.Path -import javax.ws.rs.PathParam +import jakarta.inject.Inject +import jakarta.enterprise.context.ApplicationScoped +import jakarta.ws.rs.GET +import jakarta.ws.rs.Path +import jakarta.ws.rs.PathParam @Path("/v1/updateStatus") @Schema(hidden = true) -@Singleton +@ApplicationScoped class VendorStatusRoute @Inject constructor(private val apiDataStore: APIDataStore) { diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/info/AvailableReleasesResource.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/info/AvailableReleasesResource.kt index 380030c2..c8dd4997 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/info/AvailableReleasesResource.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/info/AvailableReleasesResource.kt @@ -7,13 +7,13 @@ import net.adoptium.marketplace.server.frontend.OpenApiDocs import org.eclipse.microprofile.openapi.annotations.Operation import org.eclipse.microprofile.openapi.annotations.parameters.Parameter import org.eclipse.microprofile.openapi.annotations.tags.Tag -import javax.enterprise.context.ApplicationScoped -import javax.inject.Inject -import javax.ws.rs.GET -import javax.ws.rs.Path -import javax.ws.rs.PathParam -import javax.ws.rs.Produces -import javax.ws.rs.core.MediaType +import jakarta.enterprise.context.ApplicationScoped +import jakarta.inject.Inject +import jakarta.ws.rs.GET +import jakarta.ws.rs.Path +import jakarta.ws.rs.PathParam +import jakarta.ws.rs.Produces +import jakarta.ws.rs.core.MediaType @Tag(name = "Release Info") @Path("/v1/info/") diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/info/ReleaseListResource.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/info/ReleaseListResource.kt index 649a0c44..ba153b60 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/info/ReleaseListResource.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/main/kotlin/net/adoptium/marketplace/server/frontend/routes/info/ReleaseListResource.kt @@ -19,14 +19,14 @@ import org.eclipse.microprofile.openapi.annotations.enums.SchemaType import org.eclipse.microprofile.openapi.annotations.media.Schema import org.eclipse.microprofile.openapi.annotations.parameters.Parameter import org.eclipse.microprofile.openapi.annotations.tags.Tag -import javax.enterprise.context.ApplicationScoped -import javax.inject.Inject -import javax.ws.rs.GET -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 jakarta.enterprise.context.ApplicationScoped +import jakarta.inject.Inject +import jakarta.ws.rs.GET +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 @Tag(name = "Release Info") @Path("/v1/info") diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/test/kotlin/FrontendRunner.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/test/kotlin/FrontendRunner.kt index 33195d1d..054dafeb 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/test/kotlin/FrontendRunner.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/test/kotlin/FrontendRunner.kt @@ -4,7 +4,7 @@ import org.awaitility.Awaitility import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test import java.util.concurrent.TimeUnit -import javax.inject.Inject +import jakarta.inject.Inject @QuarkusTest @Disabled("For manual execution") diff --git a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/test/kotlin/FrontendRunnerNoDb.kt b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/test/kotlin/FrontendRunnerNoDb.kt index c86a39eb..a6d928d2 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/test/kotlin/FrontendRunnerNoDb.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-frontend-parent/adoptium-marketplace-frontend/src/test/kotlin/FrontendRunnerNoDb.kt @@ -4,7 +4,7 @@ import org.awaitility.Awaitility import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test import java.util.concurrent.TimeUnit -import javax.inject.Inject +import jakarta.inject.Inject @QuarkusTest @Disabled("For manual execution") diff --git a/adoptium-marketplace-server/adoptium-marketplace-persistence/pom.xml b/adoptium-marketplace-server/adoptium-marketplace-persistence/pom.xml index 787a62c5..f7d0f349 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-persistence/pom.xml +++ b/adoptium-marketplace-server/adoptium-marketplace-persistence/pom.xml @@ -42,8 +42,8 @@ test - javax.enterprise - cdi-api + jakarta.enterprise + jakarta.enterprise.cdi-api org.jboss.weld diff --git a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/APIDataStore.kt b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/APIDataStore.kt index 55f7a9c5..86b1702e 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/APIDataStore.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/APIDataStore.kt @@ -1,14 +1,14 @@ package net.adoptium.marketplace.dataSources import net.adoptium.marketplace.schema.Vendor -import javax.inject.Inject -import javax.inject.Singleton +import jakarta.inject.Inject +import jakarta.enterprise.context.ApplicationScoped interface APIDataStore { fun getReleases(vendor: Vendor): VendorReleases } -@Singleton +@ApplicationScoped class APIDataStoreImpl @Inject constructor(private val vendorReleasesFactory: VendorReleasesFactory) : APIDataStore { private val vendorReleases: MutableMap = mutableMapOf() diff --git a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/VendorReleases.kt b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/VendorReleases.kt index 57a1eb13..11e5e8fe 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/VendorReleases.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/VendorReleases.kt @@ -8,14 +8,14 @@ import net.adoptium.marketplace.schema.Vendor import java.time.Duration import java.time.ZonedDateTime import java.util.* -import javax.inject.Inject -import javax.inject.Singleton +import jakarta.inject.Inject +import jakarta.enterprise.context.ApplicationScoped interface VendorReleasesFactory { fun get(vendor: Vendor): VendorReleases } -@Singleton +@ApplicationScoped class VendorReleasesFactoryImpl @Inject constructor( private val vendorPersistenceFactory: VendorPersistenceFactory ) : VendorReleasesFactory { diff --git a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/persitence/VendorPersistence.kt b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/persitence/VendorPersistence.kt index 90264a50..cb4b7de7 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/persitence/VendorPersistence.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/persitence/VendorPersistence.kt @@ -8,14 +8,14 @@ import net.adoptium.marketplace.schema.ReleaseList import net.adoptium.marketplace.schema.ReleaseUpdateInfo import net.adoptium.marketplace.schema.Vendor import java.util.* -import javax.inject.Inject -import javax.inject.Singleton +import jakarta.inject.Inject +import jakarta.enterprise.context.ApplicationScoped interface VendorPersistenceFactory { fun get(vendor: Vendor): VendorPersistence } -@Singleton +@ApplicationScoped class DefaultVendorPersistenceFactory @Inject constructor( var mongoClient: MongoClient ) : VendorPersistenceFactory { diff --git a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/persitence/mongo/MongoClient.kt b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/persitence/mongo/MongoClient.kt index 377eff45..eff627d8 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/persitence/mongo/MongoClient.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/main/kotlin/net/adoptium/marketplace/dataSources/persitence/mongo/MongoClient.kt @@ -12,13 +12,13 @@ import org.litote.kmongo.id.jackson.IdJacksonModule import org.litote.kmongo.reactivestreams.KMongo import org.litote.kmongo.util.KMongoConfiguration import org.slf4j.LoggerFactory -import javax.inject.Singleton +import jakarta.enterprise.context.ApplicationScoped interface MongoClient { fun getDatabase(): CoroutineDatabase } -@Singleton +@ApplicationScoped class MongoClientImpl : MongoClient { private var db: CoroutineDatabase? = null diff --git a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/test/kotlin/net/adoptium/marketplace/dataSources/persitence/mongo/MongoTest.kt b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/test/kotlin/net/adoptium/marketplace/dataSources/persitence/mongo/MongoTest.kt index 483b42a2..535c7e63 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-persistence/src/test/kotlin/net/adoptium/marketplace/dataSources/persitence/mongo/MongoTest.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-persistence/src/test/kotlin/net/adoptium/marketplace/dataSources/persitence/mongo/MongoTest.kt @@ -1,45 +1,37 @@ package net.adoptium.marketplace.dataSources.persitence.mongo -import de.flapdoodle.embed.mongo.MongodExecutable -import de.flapdoodle.embed.mongo.MongodStarter -import de.flapdoodle.embed.mongo.config.MongodConfigBuilder import de.flapdoodle.embed.mongo.config.Net import de.flapdoodle.embed.mongo.distribution.Version +import de.flapdoodle.embed.mongo.transitions.Mongod +import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess import de.flapdoodle.embed.process.runtime.Network +import de.flapdoodle.reverse.transitions.Start import org.junit.jupiter.api.extension.AfterAllCallback import org.junit.jupiter.api.extension.BeforeAllCallback import org.junit.jupiter.api.extension.ExtensionContext import org.slf4j.LoggerFactory -import kotlin.random.Random class MongoTest : BeforeAllCallback, AfterAllCallback { companion object { + private var mongodExecutable: RunningMongodProcess? = null + @JvmStatic private val LOGGER = LoggerFactory.getLogger(this::class.java) - private var mongodExecutable: MongodExecutable? = null - @JvmStatic fun startFongo() { - startFongo(Random.nextInt(10000, 16000)) - } - - fun startFongo(port: Int) { - val starter = MongodStarter.getDefaultInstance() - val bindIp = "localhost" - val mongodConfig = MongodConfigBuilder() - .version(Version.V4_0_2) - .net(Net(bindIp, port, Network.localhostIsIPv6())) - .build() + val net = Net.of("localhost", + Network.freeServerPort(Network.getLocalHost()), + Network.localhostIsIPv6() + ) - val mongodbTestConnectionString = "mongodb://$bindIp:$port" + val mongodbTestConnectionString = "mongodb://$bindIp:${net.port}" LOGGER.info("Mongo test connection string - $mongodbTestConnectionString") System.setProperty("MONGODB_TEST_CONNECTION_STRING", mongodbTestConnectionString) - mongodExecutable = starter.prepare(mongodConfig) - mongodExecutable!!.start() + mongodExecutable = Mongod.instance().withNet(Start.to(Net::class.java).initializedWith(net)).start(Version.V6_0_8).current() LOGGER.info("FMongo started") } diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/pom.xml b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/pom.xml index 8e1ccdcf..ab6fc88f 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/pom.xml +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/pom.xml @@ -44,8 +44,19 @@ org.awaitility awaitility + + + org.hamcrest + hamcrest + + test + + org.hamcrest + hamcrest + 2.2 + org.skyscreamer jsonassert @@ -175,9 +186,8 @@ classes - **/V3Updater** + **/AdoptiumMarketplaceUpdater** **/KickOffUpdate** - **/UpdateTrigger** diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/AdoptiumMarketplaceUpdater.kt b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/AdoptiumMarketplaceUpdater.kt index 7a10652b..7ea3d020 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/AdoptiumMarketplaceUpdater.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/AdoptiumMarketplaceUpdater.kt @@ -2,6 +2,10 @@ package net.adoptium.marketplace.server.updater import io.quarkus.arc.profile.UnlessBuildProfile import io.quarkus.runtime.Startup +import jakarta.enterprise.context.ApplicationScoped +import jakarta.inject.Inject +import jakarta.ws.rs.ApplicationPath +import jakarta.ws.rs.core.Application import kotlinx.coroutines.runBlocking import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock @@ -12,15 +16,9 @@ import net.adoptium.marketplace.dataSources.ModelComparators import net.adoptium.marketplace.schema.ReleaseList import net.adoptium.marketplace.schema.ReleaseUpdateInfo import net.adoptium.marketplace.schema.Vendor -import net.adoptium.marketplace.server.updater.routes.UpdateTrigger import org.slf4j.LoggerFactory import java.util.concurrent.Executors import java.util.concurrent.TimeUnit -import javax.enterprise.context.ApplicationScoped -import javax.inject.Inject -import javax.inject.Singleton -import javax.ws.rs.ApplicationPath -import javax.ws.rs.core.Application import kotlin.concurrent.timerTask @UnlessBuildProfile("test") @@ -32,27 +30,9 @@ import kotlin.concurrent.timerTask */ class AdoptiumMarketplaceUpdaterApp : Application() -@UnlessBuildProfile("test") -@Singleton -@Startup -/** - * Init application tasks - */ -class KickOffUpdate @Inject constructor( - adoptiumMarketplaceUpdater: AdoptiumMarketplaceUpdater -) { - init { - adoptiumMarketplaceUpdater.scheduleUpdates() - } -} -interface Updater { - suspend fun update(vendor: Vendor): ReleaseUpdateInfo - fun scheduleUpdates() -} - -@Singleton -class AdoptiumMarketplaceUpdater @Inject constructor( +@ApplicationScoped +open class AdoptiumMarketplaceUpdater @Inject constructor( private val apiDataStore: APIDataStore, private val vendorList: VendorList ) : Updater { @@ -75,7 +55,11 @@ class AdoptiumMarketplaceUpdater @Inject constructor( private fun buildClientMap(): Map { return vendorList.getVendorInfo() .map { - return@map it.key to MarketplaceClient.build(it.value.getUrl(), it.value.getSignatureType(), it.value.getKey())!! + return@map it.key to MarketplaceClient.build( + it.value.getUrl(), + it.value.getSignatureType(), + it.value.getKey() + )!! }.toMap() } @@ -120,7 +104,11 @@ class AdoptiumMarketplaceUpdater @Inject constructor( } } - private suspend fun logInfoAboutUpdate(vendor: Vendor, newReleases: ReleaseUpdateInfo, releasesBeforeUpdate: ReleaseList? = null) { + private suspend fun logInfoAboutUpdate( + vendor: Vendor, + newReleases: ReleaseUpdateInfo, + releasesBeforeUpdate: ReleaseList? = null + ) { if (newReleases.errorMessage != null) { LOGGER.error(newReleases.errorMessage); return diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/KickOffUpdate.kt b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/KickOffUpdate.kt new file mode 100644 index 00000000..d775f67a --- /dev/null +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/KickOffUpdate.kt @@ -0,0 +1,17 @@ +package net.adoptium.marketplace.server.updater + +import io.quarkus.arc.profile.UnlessBuildProfile +import io.quarkus.runtime.Startup +import jakarta.enterprise.context.ApplicationScoped +import jakarta.inject.Inject + +@UnlessBuildProfile("test") +@ApplicationScoped +@Startup +class KickOffUpdate @Inject constructor( + adoptiumMarketplaceUpdater: AdoptiumMarketplaceUpdater +) { + init { + adoptiumMarketplaceUpdater.scheduleUpdates() + } +} diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/Updater.kt b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/Updater.kt new file mode 100644 index 00000000..3f06e480 --- /dev/null +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/Updater.kt @@ -0,0 +1,9 @@ +package net.adoptium.marketplace.server.updater + +import net.adoptium.marketplace.schema.ReleaseUpdateInfo +import net.adoptium.marketplace.schema.Vendor + +interface Updater { + suspend fun update(vendor: Vendor): ReleaseUpdateInfo + fun scheduleUpdates() +} \ No newline at end of file diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/VendorList.kt b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/VendorList.kt index 877bb8b1..bf00fdbe 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/VendorList.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/VendorList.kt @@ -2,13 +2,13 @@ package net.adoptium.marketplace.server.updater import net.adoptium.marketplace.schema.Vendor import org.slf4j.LoggerFactory -import javax.inject.Singleton +import jakarta.enterprise.context.ApplicationScoped interface VendorList { fun getVendorInfo(): Map } -@Singleton +@ApplicationScoped class DefaultVendorList : VendorList { companion object { diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/routes/UpdateTrigger.kt b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/routes/UpdateTrigger.kt index bbadab5f..384d5ca3 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/routes/UpdateTrigger.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/main/kotlin/net/adoptium/marketplace/server/updater/routes/UpdateTrigger.kt @@ -6,16 +6,16 @@ import net.adoptium.marketplace.schema.Vendor import net.adoptium.marketplace.server.updater.Updater import org.eclipse.microprofile.openapi.annotations.parameters.Parameter import org.slf4j.LoggerFactory -import javax.annotation.security.RolesAllowed -import javax.inject.Inject -import javax.ws.rs.GET -import javax.ws.rs.Path -import javax.ws.rs.PathParam -import javax.ws.rs.Produces -import javax.ws.rs.core.Context -import javax.ws.rs.core.MediaType -import javax.ws.rs.core.Response -import javax.ws.rs.core.SecurityContext +import jakarta.annotation.security.RolesAllowed +import jakarta.inject.Inject +import jakarta.ws.rs.GET +import jakarta.ws.rs.Path +import jakarta.ws.rs.PathParam +import jakarta.ws.rs.Produces +import jakarta.ws.rs.core.Context +import jakarta.ws.rs.core.MediaType +import jakarta.ws.rs.core.Response +import jakarta.ws.rs.core.SecurityContext @Path("/updateForVendor/") @Produces(MediaType.TEXT_PLAIN) diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/kotlin/net/adoptium/api/UpdateRunner.kt b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/kotlin/net/adoptium/api/UpdateRunner.kt index c4fcdc83..b35b0297 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/kotlin/net/adoptium/api/UpdateRunner.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/kotlin/net/adoptium/api/UpdateRunner.kt @@ -20,7 +20,7 @@ class UpdateRunner { @Test @Disabled("For Manual Testing") fun run(apiDataStore: APIDataStore) { - MongoTest.startFongo(22222) + MongoTest.startFongo() val adoptiumMarketplaceUpdater = AdoptiumMarketplaceUpdater(apiDataStore, MockVendorList()) adoptiumMarketplaceUpdater.scheduleUpdates() diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/kotlin/net/adoptium/api/UpdateTriggerTest.kt b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/kotlin/net/adoptium/api/UpdateTriggerTest.kt index 7fdded45..6619678b 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/kotlin/net/adoptium/api/UpdateTriggerTest.kt +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/kotlin/net/adoptium/api/UpdateTriggerTest.kt @@ -33,14 +33,14 @@ import org.litote.kmongo.coroutine.coroutine import org.litote.kmongo.id.jackson.IdJacksonModule import org.litote.kmongo.reactivestreams.KMongo import org.litote.kmongo.util.KMongoConfiguration -import javax.annotation.Priority -import javax.enterprise.inject.Alternative -import javax.inject.Singleton -import javax.ws.rs.core.Response +import jakarta.annotation.Priority +import jakarta.enterprise.inject.Alternative +import jakarta.enterprise.context.ApplicationScoped +import jakarta.ws.rs.core.Response @Priority(1) @Alternative -@Singleton +@ApplicationScoped class MockVendorList : VendorList { override fun getVendorInfo(): Map { return mapOf( @@ -51,7 +51,7 @@ class MockVendorList : VendorList { @Priority(1) @Alternative -@Singleton +@ApplicationScoped class FongoClient : MongoClient { private val settingsBuilder: MongoClientSettings.Builder = MongoClientSettings.builder() diff --git a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/resources/application.properties b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/resources/application.properties index cd2b70df..0f88e8a0 100644 --- a/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/resources/application.properties +++ b/adoptium-marketplace-server/adoptium-marketplace-updater-parent/adoptium-marketplace-updater/src/test/resources/application.properties @@ -16,4 +16,4 @@ quarkus.security.users.embedded.algorithm=digest_sha_512 quarkus.log.category."org.jboss".level=WARN quarkus.log.category."io.quarkus.*".level=WARN quarkus.log.category."io.quarkus".level=WARN - +quarkus.log.category."io.quarkus.*".use-parent-handlers=true diff --git a/adoptium-marketplace-server/adoptium-repo/pom.xml b/adoptium-marketplace-server/adoptium-repo/pom.xml index d9ebe064..e170d036 100644 --- a/adoptium-marketplace-server/adoptium-repo/pom.xml +++ b/adoptium-marketplace-server/adoptium-repo/pom.xml @@ -80,7 +80,7 @@ org.jetbrains.kotlin kotlin-maven-allopen - 1.6.10 + 1.8.10 @@ -88,7 +88,7 @@ all-open - + diff --git a/adoptium-marketplace-utils/pom.xml b/adoptium-marketplace-utils/pom.xml index 9567440a..03063df3 100644 --- a/adoptium-marketplace-utils/pom.xml +++ b/adoptium-marketplace-utils/pom.xml @@ -89,7 +89,7 @@ org.jetbrains.kotlin kotlin-maven-allopen - 1.6.10 + 1.8.10 @@ -97,7 +97,7 @@ all-open - + diff --git a/api.adoptium.net b/api.adoptium.net index d782bd65..6fd13d33 160000 --- a/api.adoptium.net +++ b/api.adoptium.net @@ -1 +1 @@ -Subproject commit d782bd65f998c16ce34b131b50f6dadaedf6b8cf +Subproject commit 6fd13d33058e426abd9c53fe5ceb9b1e6004c215 diff --git a/pom.xml b/pom.xml index 2a8cf533..415759f3 100644 --- a/pom.xml +++ b/pom.xml @@ -11,10 +11,11 @@ 17 17 - - 2.14.0.Final + 17 + 17 + 3.5.0 0.8.8 - 1.7.21 + 1.8.10 3.0.1-SNAPSHOT @@ -105,7 +106,7 @@ io.mockk mockk - 1.13.4 + 1.13.7