Skip to content

Commit

Permalink
Merge pull request #639 from hexagonkt/develop
Browse files Browse the repository at this point in the history
Test CI
  • Loading branch information
jaguililla authored Jun 29, 2023
2 parents 751e66a + 2378140 commit d2595fc
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ jobs:
os: ${{ matrix.os }}
ref: develop
check_directory: core/build
tasks: publishToMavenLocal -x test -x apiDump
tasks: publishToMavenLocal -x test
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
uses: hexagonkt/.github/.github/workflows/graalvm_gradle.yml@master
with:
check_directory: core/build
tasks: publishToMavenLocal -x test -x apiDump
tasks: publishToMavenLocal -x test
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
git remote set-url origin "$REMOTE"
git clone "$REMOTE" --branch gh-pages build/gh-pages
./gradlew --info build
./gradlew --info -x build -x apiDump buildSite
./gradlew --info -x build buildSite
ls -AlF site/build/site
- name: Publish Packages
Expand All @@ -50,7 +50,7 @@ jobs:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew --info --no-daemon -x test -x apiDump release
run: ./gradlew --info --no-daemon -x test release

- name: Publish Site
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
run: ./gradlew --info --stacktrace build

- name: Build Site
run: ./gradlew --info --stacktrace -x build buildSite -x apiDump
run: ./gradlew --info --stacktrace -x build buildSite

- name: Check Build
if: ${{ inputs.check_directory != '' }}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ plugins {
id("eclipse")
id("project-report")
id("org.jetbrains.dokka") version("1.8.20")
id("com.github.jk1.dependency-license-report") version("2.4")
id("com.github.jk1.dependency-license-report") version("2.5")
id("org.jetbrains.kotlinx.binary-compatibility-validator") version("0.13.2")
id("org.graalvm.buildtools.native") version("0.9.23") apply(false)
id("io.gitlab.arturbosch.detekt") version("1.23.0") apply(false)
Expand Down
3 changes: 2 additions & 1 deletion core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ public final class com/hexagonkt/core/Jvm {
public static final field INSTANCE Lcom/hexagonkt/core/Jvm;
public final fun getCharset ()Ljava/nio/charset/Charset;
public final fun getCpuCount ()I
public final fun getHostname ()Ljava/lang/String;
public final fun getHostName ()Ljava/lang/String;
public final fun getIp ()Ljava/lang/String;
public final fun getLocale ()Ljava/util/Locale;
public final fun getLocaleCode ()Ljava/lang/String;
public final fun getName ()Ljava/lang/String;
public final fun getRuntime ()Ljava/lang/Runtime;
public final fun getTimeZone ()Ljava/util/TimeZone;
public final fun getVersion ()Ljava/lang/String;
public final fun getZoneId ()Ljava/time/ZoneId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package com.hexagonkt.core
import java.net.URLStreamHandler
import java.net.spi.URLStreamHandlerProvider

/**
* JDK 11 only
*/
internal class ClasspathHandlerProvider : URLStreamHandlerProvider() {

override fun createURLStreamHandler(protocol: String): URLStreamHandler? {
Expand Down
7 changes: 4 additions & 3 deletions core/src/main/kotlin/com/hexagonkt/core/Jvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import kotlin.reflect.KClass
* Object with utilities to gather information about the running JVM.
*/
object Jvm {
private val runtime: Runtime by lazy { Runtime.getRuntime() }
/** Current JVM runtime. */
val runtime: Runtime by lazy { Runtime.getRuntime() }

/** Default timezone. */
val timeZone: TimeZone by lazy { TimeZone.getDefault() }
Expand All @@ -25,8 +26,8 @@ object Jvm {
/** Default locale for this instance of the Java Virtual Machine. */
val locale: Locale by lazy { Locale.getDefault() }

/** The hostname of the machine running this program. */
val hostname: String by lazy { InetAddress.getLocalHost().hostName }
/** The host name of the machine running this program. */
val hostName: String by lazy { InetAddress.getLocalHost().hostName }

/** The IP address of the machine running this program. */
val ip: String by lazy { InetAddress.getLocalHost().hostAddress }
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/com/hexagonkt/core/JvmTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ internal class JvmTest {
val ipv4Regex = Regex("\\d{1,3}(\\.\\d{1,3}){3}")

assert(Jvm.ip.matches(ipv4Regex) || Jvm.ip.matches(ipv6Regex))
assert(Jvm.hostname.isNotBlank())
assert(Inet4Address.getAllByName(Jvm.hostname).isNotEmpty())
assert(Jvm.hostName.isNotBlank())
assert(Inet4Address.getAllByName(Jvm.hostName).isNotEmpty())
assert(Inet4Address.getAllByName(Jvm.ip).isNotEmpty())
}

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.warning.mode=all
org.gradle.console=plain

# Gradle
version=3.0.0-B5
version=3.0.0-B6
group=com.hexagonkt
description=The atoms of your platform

Expand Down Expand Up @@ -51,7 +51,7 @@ jettyVersion=11.0.15

# rest_tools
vertxVersion=4.4.4
swaggerParserVersion=2.1.15
swaggerParserVersion=2.1.16

# logging
slf4jVersion=2.0.7
Expand Down
4 changes: 1 addition & 3 deletions gradle/dokka.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ private void setUpDokka(final Object dokkaTask) {
"compileKotlin",
"compileTestKotlin",
"processResources",
"processTestResources",
"apiCheck",
"apiDump"
"processTestResources"
)

dokkaTask.moduleName.set(project.name)
Expand Down
2 changes: 1 addition & 1 deletion http/http_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Check the details in the following code fragment:

You can also check the [full test] for more details.

[full test]: https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CookiesTest.kt
[full test]: https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CookiesTest.kt

# Multipart (forms and files)
Using the HTTP client you can send MIME multipart parts to the server. You can use it to post forms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.hexagonkt.http.server
import com.hexagonkt.core.logging.Logger
import com.hexagonkt.core.Jvm.charset
import com.hexagonkt.core.Jvm.cpuCount
import com.hexagonkt.core.Jvm.hostname
import com.hexagonkt.core.Jvm.hostName
import com.hexagonkt.core.Jvm.name
import com.hexagonkt.core.Jvm.version
import com.hexagonkt.core.Jvm.localeCode
Expand Down Expand Up @@ -159,7 +159,7 @@ data class HttpServer(
.map { (k, v) -> "$k($v)" }
.joinToString("$RESET, $CYAN", CYAN, RESET)

val hostnameValue = "$BLUE$hostname$RESET"
val hostnameValue = "$BLUE$hostName$RESET"
val cpuCountValue = "$BLUE$cpuCount$RESET"

val javaVersionValue = "$BOLD${BLUE}Java $version$RESET [$BLUE$name$RESET]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.hexagonkt.http.server.async
import com.hexagonkt.core.logging.Logger
import com.hexagonkt.core.Jvm.charset
import com.hexagonkt.core.Jvm.cpuCount
import com.hexagonkt.core.Jvm.hostname
import com.hexagonkt.core.Jvm.ip
import com.hexagonkt.core.Jvm.name
import com.hexagonkt.core.Jvm.version
Expand All @@ -19,6 +18,7 @@ import com.hexagonkt.core.Ansi.DEFAULT
import com.hexagonkt.core.Ansi.MAGENTA
import com.hexagonkt.core.Ansi.RESET
import com.hexagonkt.core.Ansi.UNDERLINE
import com.hexagonkt.core.Jvm
import com.hexagonkt.core.Jvm.timeZone
import com.hexagonkt.core.Jvm.totalMemory
import com.hexagonkt.core.Jvm.usedMemory
Expand Down Expand Up @@ -166,7 +166,7 @@ data class HttpServer(
.map { (k, v) -> "$k($v)" }
.joinToString("$RESET, $CYAN", CYAN, RESET)

val hostnameValue = "$BLUE$hostname$RESET"
val hostnameValue = "$BLUE${Jvm.hostName}$RESET"
val cpuCountValue = "$BLUE$cpuCount$RESET"

val javaVersionValue = "$BOLD${BLUE}Java $version$RESET [$BLUE$name$RESET]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ abstract class ServletServer(

val serverAdapterValue = "$BOLD$CYAN${javaClass.simpleName}$RESET"

val hostnameValue = "$BLUE${Jvm.hostname}$RESET"
val hostnameValue = "$BLUE${Jvm.hostName}$RESET"
val cpuCountValue = "$BLUE${Jvm.cpuCount}$RESET"
val jvmMemoryValue = "$BLUE$jvmMemory$RESET"

Expand Down
10 changes: 5 additions & 5 deletions site/pages/examples/http_client_examples.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# HTTP Client Creation Example
This example shows how to create HTTP Client instances. Check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ClientTest.kt)
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ClientTest.kt)
for more information.

## Without setting parameters
Expand All @@ -12,7 +12,7 @@ for more information.

# Send Requests Example
This example shows send HTTP requests to a server. Here you can check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ClientTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ClientTest.kt).

## Generic request
@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ClientTest.kt?genericRequest
Expand All @@ -27,12 +27,12 @@ This example shows send HTTP requests to a server. Here you can check the
@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ClientTest.kt?bodyAndContentTypeRequests

# Use Cookies Example
Check the details at the [full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CookiesTest.kt).
Check the details at the [full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CookiesTest.kt).

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CookiesTest.kt?clientCookies

# Multipart Requests Example
Refer to the [full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/FilesTest.kt)
Refer to the [full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/FilesTest.kt)
for more details.

## Send form fields
Expand All @@ -43,7 +43,7 @@ for more details.

# Mutual TLS Example
This example shows how make requests using mutual TLS between the client and the server. You can
check the [full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/HttpsTest.kt)
check the [full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/HttpsTest.kt)
for more details.

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/HttpsTest.kt?https
14 changes: 7 additions & 7 deletions site/pages/examples/http_server_examples.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@

# Books Example
A simple CRUD example showing how to manage book resources. Here you can check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/BooksTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/BooksTest.kt).

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/BooksTest.kt?books

# Cookies Example
Demo server to show the use of cookies. Here you can check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CookiesTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CookiesTest.kt).

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CookiesTest.kt?cookies

# Error Handling Example
Code to show how to handle callback exceptions and HTTP error codes. Here you can check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ErrorsTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ErrorsTest.kt).

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/ErrorsTest.kt?errors

# Filters Example
This example shows how to add filters before and after route execution. Here you can check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/FiltersTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/FiltersTest.kt).

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/FiltersTest.kt?filters

# Files Example
The following code shows how to serve resources and receive files. Here you can check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/FilesTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/FilesTest.kt).

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/FilesTest.kt?files

# CORS Example
This example shows how to set up CORS for REST APIs used from the browser. Here you can check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CorsTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CorsTest.kt).

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/CorsTest.kt?cors

# HTTPS Example
The snippet below shows how to set up your server to use HTTPS and HTTP/2. You can check the
[full test](https://github.com/hexagonkt/hexagon/blob/master/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/HttpsTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/HttpsTest.kt).

@code http/http_test/src/main/kotlin/com/hexagonkt/http/test/examples/HttpsTest.kt?https
4 changes: 2 additions & 2 deletions site/pages/examples/templates_examples.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Register Template Adapters
Example to show how to register template adapters.
[full test](https://github.com/hexagonkt/hexagon/blob/master/templates/src/test/kotlin/com/hexagonkt/templates/examples/TemplatesTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/templates/templates/src/test/kotlin/com/hexagonkt/templates/examples/TemplatesTest.kt).

## Using regular Expressions
@code templates/templates/src/test/kotlin/com/hexagonkt/templates/examples/TemplatesTest.kt?templateRegex
Expand All @@ -11,6 +11,6 @@ Example to show how to register template adapters.

# Process Templates
Simple example to show how to process templates.
[full test](https://github.com/hexagonkt/hexagon/blob/master/templates/src/test/kotlin/com/hexagonkt/templates/examples/TemplatesTest.kt).
[full test](https://github.com/hexagonkt/hexagon/blob/master/templates/templates/src/test/kotlin/com/hexagonkt/templates/examples/TemplatesTest.kt).

@code templates/templates/src/test/kotlin/com/hexagonkt/templates/examples/TemplatesTest.kt?templateUsage

0 comments on commit d2595fc

Please sign in to comment.