Skip to content

Commit

Permalink
Merge pull request #16 from gdams/main
Browse files Browse the repository at this point in the history
Merge in main line to marketplace
  • Loading branch information
gdams authored Oct 20, 2023
2 parents eaa3f85 + 75951a2 commit 91e7e43
Show file tree
Hide file tree
Showing 37 changed files with 194 additions and 159 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-marketplace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-vendor-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "api.adoptium.net"]
path = api.adoptium.net
url = https://github.com/adoptium/api.adoptium.net
branch = marketplace

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,19 @@
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
Expand Down Expand Up @@ -99,7 +110,7 @@
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr353</artifactId>
<artifactId>jackson-datatype-jakarta-jsonp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -217,7 +228,7 @@
<plugin>all-open</plugin>
</compilerPlugins>
<pluginOptions>
<option>all-open:annotation=javax.ws.rs.Path</option>
<option>all-open:annotation=jakarta.ws.rs.Path</option>
</pluginOptions>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Vendor, VendorReleases> = mutableMapOf()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit 91e7e43

Please sign in to comment.