Skip to content

Commit

Permalink
updated dependencies, fixed bugs and updated some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Wicpar committed Jul 20, 2021
1 parent 546734c commit b524a99
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 38 deletions.
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'com.github.papsign'
version '0.2-beta.18-SNAPSHOT'
version '0.2-beta.19-SNAPSHOT'

repositories {
mavenCentral()
Expand Down Expand Up @@ -34,6 +34,7 @@ dependencies {

implementation "org.reflections:reflections:0.9.11" // only used while initializing

testImplementation "org.jetbrains.kotlin:kotlin-test"
testImplementation "io.ktor:ktor-server-netty:$ktor_version"
testImplementation "io.ktor:ktor-server-test-host:$ktor_version"
testImplementation "ch.qos.logback:logback-classic:$logback_version"
Expand All @@ -44,13 +45,13 @@ dependencies {
}

compileKotlin {
kotlinOptions.jvmTarget = "1.6"
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.ExperimentalStdlibApi"]
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.6"
kotlinOptions.jvmTarget = "1.8"
}

wrapper {
gradleVersion = '6.0.1'
gradleVersion = '7.1.1'
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kotlin.code.style=official
ktor_version=1.3.2
ktor_version=1.6.1
logback_version=1.2.1
slf4j_version=1.7.30
kotlin_version=1.3.70
kotlin_version=1.5.21
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Mar 02 14:17:20 CET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 3 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
Expand All @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
25 changes: 7 additions & 18 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand All @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -61,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class CollectionDeepBuilder(type: KType) : DeepBuilder {
val indices =
names.entries.groupBy { (k, _) -> k.substring(key.length + 1, k.indexOf("]", key.length)).toInt() }
indices.entries.fold(
ArrayList<Any?>((0..(indices.keys.max() ?: 0)).map { null })
ArrayList<Any?>((0..(indices.keys.maxOrNull() ?: 0)).map { null })
) { acc, (idx, params) ->
acc[idx] = builder.build("$key[$idx]", params.associate { (key, value) -> key to value })
acc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OpenAPIAuthenticatedRoute<TAuth>(
body: suspend OpenAPIPipelineAuthContext<TAuth, TResponse>.(TParams, TRequest) -> Unit
) {
child().apply {// child in case path is branch to prevent propagation of the mutable nature of the provider
provider.registerModule(authProvider)
provider.registerModule(authProvider as AuthProvider<*>)
handle<TParams, TResponse, TRequest>(
paramsType,
responseType,
Expand All @@ -46,7 +46,7 @@ class OpenAPIAuthenticatedRoute<TAuth>(
body: suspend OpenAPIPipelineAuthContext<TAuth, TResponse>.(TParams) -> Unit
) {
child().apply {// child in case path is branch to prevent propagation of the mutable nature of the provider
provider.registerModule(authProvider)
provider.registerModule(authProvider as AuthProvider<*>)
handle<TParams, TResponse, Unit>(
paramsType,
responseType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import com.papsign.ktor.openapigen.route.path.normal.post
import com.papsign.ktor.openapigen.route.response.respond
import com.papsign.ktor.openapigen.route.route
import installOpenAPI
import io.ktor.http.ContentType
import io.ktor.http.HttpHeaders
import io.ktor.http.HttpMethod
import io.ktor.http.*
import io.ktor.server.testing.contentType
import io.ktor.server.testing.handleRequest
import io.ktor.server.testing.setBody
Expand Down Expand Up @@ -68,7 +66,7 @@ class BinaryContentTypeParserTest {
addHeader(HttpHeaders.Accept, contentType)
setBody(bytes)
}.apply {
assertNull(response.status())
assertEquals(HttpStatusCode.NotFound, response.status())
}

println("Test: Bad Accept")
Expand All @@ -77,7 +75,7 @@ class BinaryContentTypeParserTest {
addHeader(HttpHeaders.Accept, ContentType.Application.Json.toString())
setBody(bytes)
}.apply {
assertNull(response.status())
assertEquals(HttpStatusCode.NotFound, response.status())
}

println("Test: Bad Content-Type")
Expand All @@ -86,8 +84,8 @@ class BinaryContentTypeParserTest {
addHeader(HttpHeaders.Accept, contentType)
setBody(bytes)
}.apply {
assertNull(response.status())
assertEquals(HttpStatusCode.NotFound, response.status())
}
}
}
}
}

0 comments on commit b524a99

Please sign in to comment.