-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1026 from adoptium/main
merge main into prod
- Loading branch information
Showing
19 changed files
with
232 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "main", "production" ] | ||
pull_request: | ||
branches: [ "main", "production" ] | ||
schedule: | ||
- cron: '26 5 * * 0' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- language: java-kotlin | ||
build-mode: manual | ||
# Learn more about CodeQL language support at https://git.io/codeql-language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
|
||
- if: matrix.build-mode == 'manual' | ||
run: | | ||
./mvnw --batch-mode clean -Dmaven.test.skip=true install -Padoptium,-adoptopenjdk | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...v3-frontend/src/main/kotlin/net/adoptium/api/v3/routes/info/TypesArchitecturesResource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.adoptium.api.v3.routes.info | ||
|
||
import jakarta.enterprise.context.ApplicationScoped | ||
import jakarta.ws.rs.GET | ||
import jakarta.ws.rs.Path | ||
import jakarta.ws.rs.Produces | ||
import jakarta.ws.rs.core.MediaType | ||
import net.adoptium.api.v3.models.Architecture | ||
import org.eclipse.microprofile.openapi.annotations.Operation | ||
import org.eclipse.microprofile.openapi.annotations.tags.Tag | ||
|
||
@Tag(name = "Types") | ||
@Path("/v3/types") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@ApplicationScoped | ||
class TypesArchitecturesResource { | ||
|
||
@GET | ||
@Path("/architectures") | ||
@Operation(summary = "Returns names of architectures", operationId = "getArchitectures") | ||
fun get(): List<String> { | ||
return Architecture.values().map { it.name }.toList() | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...frontend/src/main/kotlin/net/adoptium/api/v3/routes/info/TypesOperatingSystemsResource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.adoptium.api.v3.routes.info | ||
|
||
import jakarta.enterprise.context.ApplicationScoped | ||
import jakarta.ws.rs.GET | ||
import jakarta.ws.rs.Path | ||
import jakarta.ws.rs.Produces | ||
import jakarta.ws.rs.core.MediaType | ||
import net.adoptium.api.v3.models.OperatingSystem | ||
import org.eclipse.microprofile.openapi.annotations.Operation | ||
import org.eclipse.microprofile.openapi.annotations.tags.Tag | ||
|
||
@Tag(name = "Types") | ||
@Path("/v3/types") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@ApplicationScoped | ||
class TypesOperatingSystemsResource { | ||
|
||
@GET | ||
@Path("/operating_systems") | ||
@Operation(summary = "Returns names of operating systems", operationId = "getOperatingSystems") | ||
fun get(): List<String> { | ||
return OperatingSystem.values().map { it.name }.toList() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...t/adoptium-api-v3-frontend/src/test/kotlin/net/adoptium/api/TypesArchitecturesPathTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package net.adoptium.api | ||
|
||
import io.restassured.RestAssured | ||
import net.adoptium.api.v3.JsonMapper | ||
import net.adoptium.api.v3.models.Architecture | ||
import org.junit.jupiter.api.Test | ||
|
||
class TypesArchitecturesPathTest : FrontendTest() { | ||
|
||
@Test | ||
fun getArchitectures() { | ||
RestAssured.given() | ||
.`when`() | ||
.get("/v3/types/architectures") | ||
.then() | ||
.statusCode(200) | ||
} | ||
|
||
@Test | ||
fun getArchitecturesAreCorrect() { | ||
var body = RestAssured.given() | ||
.`when`() | ||
.get("/v3/types/architectures") | ||
.body | ||
|
||
val architectures = parseArchitectures(body.asString()) | ||
|
||
assert(architectures.contains(Architecture.x64.name)) | ||
assert(architectures.size == Architecture.values().size) | ||
} | ||
|
||
private fun parseArchitectures(json: String?): List<String> = | ||
JsonMapper.mapper.readValue(json, JsonMapper.mapper.typeFactory.constructCollectionType(MutableList::class.java, String::class.java)) | ||
} |
Oops, something went wrong.