Skip to content

Commit

Permalink
Merge pull request #45 from hexagonkt/develop
Browse files Browse the repository at this point in the history
Update Hexagon version
  • Loading branch information
jaguililla committed Oct 11, 2023
2 parents dd61ad6 + 77531ff commit eb6f317
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 49 deletions.
2 changes: 1 addition & 1 deletion args/src/main/kotlin/com/hexagonkt/args/Option.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hexagonkt.args

import com.hexagonkt.core.parseOrNull
import com.hexagonkt.core.text.parseOrNull
import kotlin.reflect.KClass

data class Option<T : Any>(
Expand Down
2 changes: 1 addition & 1 deletion args/src/main/kotlin/com/hexagonkt/args/Parameter.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hexagonkt.args

import com.hexagonkt.core.parseOrNull
import com.hexagonkt.core.text.parseOrNull
import kotlin.reflect.KClass

data class Parameter<T : Any>(
Expand Down
2 changes: 1 addition & 1 deletion args/src/main/kotlin/com/hexagonkt/args/Property.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hexagonkt.args

import com.hexagonkt.core.parsedClasses
import com.hexagonkt.core.text.parsedClasses
import kotlin.reflect.KClass

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.hexagonkt.args.Flag
import com.hexagonkt.args.Option
import com.hexagonkt.args.Parameter
import com.hexagonkt.args.Property
import com.hexagonkt.core.camelToSnake
import com.hexagonkt.core.text.camelToSnake

data class PropertyFormatter(
val namesSeparator: String = ", ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.hexagonkt.args.formatter
import com.hexagonkt.args.Option
import com.hexagonkt.args.Parameter
import com.hexagonkt.args.Property
import com.hexagonkt.core.camelToWords
import com.hexagonkt.core.wordsToSnake
import com.hexagonkt.core.text.camelToWords
import com.hexagonkt.core.text.wordsToSnake
import java.io.File
import java.net.InetAddress
import java.net.URI
Expand Down
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL

/*
* Main build script, responsible for:
*
Expand Down Expand Up @@ -65,3 +67,8 @@ task("release") {
project.exec { commandLine = listOf("git", "push", "--tags") }
}
}

tasks.wrapper {
gradleVersion = "8.4"
distributionType = ALL
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.console=plain

# Gradle
# Version synchronized with Hexagon release (master)
version=3.2.0
version=3.3.0
group=com.hexagonkt.extra
description=The atoms of your platform

Expand All @@ -20,7 +20,7 @@ siteHost=https://hexagonkt.com
# VERSIONS
mockkVersion=1.13.7
dokkaVersion=1.9.0
testcontainersVersion=1.19.0
testcontainersVersion=1.19.1
dockerJavaVersion=3.3.2

# scheduler
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.hexagonkt.processor.schema
import com.hexagonkt.processor.Type
import com.hexagonkt.processor.Field
import com.hexagonkt.processor.schema.PropertyType.*
import com.hexagonkt.core.camelToWords
import com.hexagonkt.core.text.camelToWords
import com.hexagonkt.models.Country
import com.hexagonkt.models.Email
import com.hexagonkt.models.Language
Expand Down
2 changes: 1 addition & 1 deletion scheduler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ synchronization yourself.
### Example
You can check a usage example in the following code:

@code scheduler/src/test/kotlin/CronSchedulerSamplesTest.kt:sample
@code scheduler/src/test/kotlin/CronSchedulerTest.kt:sample

# Package com.hexagonkt.scheduler
Classes for scheduling blocks of code repeatedly based on a [Cron] expression.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import java.util.concurrent.TimeUnit.SECONDS
* @param threads Number of threads used by the thread pool. By default, it is equals to the number
* of processors.
*
* @sample com.hexagonkt.scheduler.CronSchedulerSamplesTest.callbackExecutedProperly
* @sample com.hexagonkt.scheduler.CronSchedulerTest.callbackExecutedProperly
*/
class CronScheduler(threads: Int = getRuntime().availableProcessors()) {
private val log: Logger = Logger(this::class)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ package com.hexagonkt.scheduler

import kotlin.test.Test
import java.lang.Thread.sleep
import kotlin.test.assertEquals

internal class CronSchedulerTest {

@Test fun `Callback is executed properly`() {
@Test fun callbackExecutedProperly() {
// sample
val cron = CronScheduler()
val times = 1
var count = 0

// Increments the counter by one each second
cron.schedule("0/1 * * * * ?") {
count++
}

sleep((times * 1_000) + 100L)
sleep((times * 1_000) + 200L)
cron.shutdown()
assert(count == times)
assertEquals(count, times)
// sample
}

@Test fun `Failing callback does not prevent future executions`() {
Expand All @@ -29,8 +33,8 @@ internal class CronSchedulerTest {
error("Error in cron job")
}

sleep((times * 1_000) + 200L)
sleep((times * 1_000) + 400L)
cron.shutdown()
assert(count == times)
assertEquals(count, times)
}
}
12 changes: 12 additions & 0 deletions settings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Module settings
Combine `args` and `serialization` to provide a full package to support applications configuration.

It allows to load a parameter from command line, environment variable or a set of files with a
priority:

1. command line
2. environment variable
3. java property (only for testing)
4. $HOME/.config/app/*.{json,yaml}
5. $HOME/.config/app/*.{json,yaml}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hexagonkt.terminal

import com.hexagonkt.core.Ansi.CSI
import com.hexagonkt.core.text.Ansi.CSI

/**
* Constants for console cursor handling with [ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hexagonkt.terminal

import com.hexagonkt.core.Ansi.CSI
import com.hexagonkt.core.text.Ansi.CSI

object AnsiMouse {
const val ENABLE: String = "${CSI}?1003h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.hexagonkt.terminal

import com.hexagonkt.core.Ansi.CSI
import com.hexagonkt.core.text.Ansi.CSI
import com.hexagonkt.terminal.AnsiScreen.Region.FULL

/**
Expand Down

0 comments on commit eb6f317

Please sign in to comment.