Skip to content

Commit

Permalink
Release version 0.0.2
Browse files Browse the repository at this point in the history
Merge pull request #18 from qualersoft/release/0.0.2
  • Loading branch information
mathze committed Jun 25, 2021
2 parents e953c76 + 2e1689d commit 13752e1
Show file tree
Hide file tree
Showing 35 changed files with 1,039 additions and 90 deletions.
25 changes: 24 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ plugins {
id("org.asciidoctor.jvm.convert")
}

jacoco {
toolVersion = "0.8.7"
}

allprojects {
apply(plugin = "idea")
apply(plugin = "io.spring.dependency-management")
Expand Down Expand Up @@ -83,7 +87,7 @@ subprojects {
}

configure<DetektExtension> {
failFast = true
allRules = true
config = files("$rootDir/detekt.yml")
input = files("src/main/kotlin")

Expand All @@ -96,6 +100,7 @@ subprojects {

tasks.withType<Test> {
useJUnitPlatform()
finalizedBy(tasks.withType<JacocoReport>())
}

tasks.withType<KotlinCompile>().configureEach {
Expand Down Expand Up @@ -169,6 +174,24 @@ subprojects {
}
}

val jMerge = tasks.register<JacocoMerge>("jacocoMerge") {
subprojects.forEach {
executionData(it.tasks.withType<Test>())
}
}

tasks.register<JacocoReport>("jacocoRootReport") {
dependsOn(jMerge)
subprojects.forEach {
val srcDirs = it.sourceSets.main.get().allSource.srcDirs
additionalSourceDirs.from(srcDirs)
sourceDirectories.from(srcDirs)
classDirectories.from(it.sourceSets.main.get().output)

}
executionData.from(jMerge.get().destinationFile)
}

tasks.register("updateVersion") {
description = """ONLY FOR CI/CD purposes!
|
Expand Down
2 changes: 1 addition & 1 deletion detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ style:
active: false
ThrowsCount:
active: true
max: 2
max: 4
TrailingWhitespace:
active: false
UnderscoresInNumericLiterals:
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Tue Jun 01 21:53:17 UTC 2021
version=0.0.1
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
#Fri Jun 25 17:55:04 UTC 2021
org.gradle.jvmargs=-XX\:MaxMetaspaceSize\=512m
version=0.0.2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.qualersoft.robotframework.library.annotation

@Retention(AnnotationRetention.RUNTIME)
annotation class KeywordTag(val value:String)
annotation class KeywordTag(val value:String)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import kotlin.reflect.KClass
@Target(AnnotationTarget.VALUE_PARAMETER)
@Retention(AnnotationRetention.RUNTIME)
annotation class KwdArg(

/**
* Documentation of the argument, will be put in generated documentation of the keyword.
*/
Expand All @@ -25,11 +24,19 @@ annotation class KwdArg(

/**
* Type of the argument.
* Can be used to override the normal type
* Can be used to override the normal type.
* Defaults to [Nothing] class which indicates to use the real type.
*/
val type: KClass<*> = Nothing::class,

/**
* Only used if dealing with java functions, where the name can not be retrieved.
* Gives the user the possibility to avoid argument names like `arg1`.
* Defaults to [NULL_STRING] which indicates to use the build in detection mode.
*/
val type: KClass<*> = Nothing::class
val name: String = NULL_STRING
) {
companion object {
const val NULL_STRING = "\u0000"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ enum class LibraryScope {
* Alias for [TEST] in case of RPA
*/
TASK
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ interface MinimalDynamicLibrary {
* Robot Framework interface method 'run_keyword' required for dynamic libraries.
*
* __Remark__:
* >If your library also implements [RFKwArgsSupport], robot framework will call
* >[RFKwArgsSupport.runKeyword] instead of this!
* >If your library also implements [RfKwArgsSupport], robot framework will call
* >[RfKwArgsSupport.runKeyword] instead of this!
*
* @param name The Name of keyword to be executed
* @param args A list of positional arguments given to the keyword in the test data
*
* @return result of the keyword execution. `null` may also indicate `void` call
*/
fun runKeyword(name: String, args: List<Any?>): Any?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package de.qualersoft.robotframework.library.binding
* keywords, and under these circumstances they would need to check the argument
* counts themselves.
*/
interface RFArgumentSpecSupport {
interface RfArgumentSpecSupport {

/**
* Retrieves parameter name (and default value) for the given keyword.
Expand All @@ -19,4 +19,4 @@ interface RFArgumentSpecSupport {
* @return List of `pair` of parameters name and default value
*/
fun getKeywordArguments(name: String): List<List<Any?>>
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package de.qualersoft.robotframework.library.binding

import kotlin.reflect.KClass

/**
* Interface to provide Robot Framework with
* [type information](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#getting-keyword-argument-types)
Expand All @@ -12,7 +10,7 @@ import kotlin.reflect.KClass
*
* @since RF 3.1
*/
interface RFArgumentTypesSupport {
interface RfArgumentTypesSupport {

/**
* Retrieves the type of a keyword's arguments.
Expand All @@ -26,4 +24,4 @@ interface RFArgumentTypesSupport {
* @since RF 3.1
*/
fun getKeywordTypes(name: String): Map<String, Any>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package de.qualersoft.robotframework.library.binding
/**
*
*/
interface RFKwArgsSupport {
interface RfKwArgsSupport {

/**
* Robot Framework interface method 'run_keyword' required for dynamic libraries.
Expand All @@ -15,4 +15,4 @@ interface RFKwArgsSupport {
* @return result of the keyword execution. `null` may also indicate `void` call
*/
fun runKeyword(name: String, args: List<Any?>, kwArgs: Map<String, Any?>): Any?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ interface RfLibdocSupport {
* @return The documentation
*/
fun getKeywordDocumentation(name: String): String
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package de.qualersoft.robotframework.library.binding

/**
* The interface a library has to implement **iff** you want to have
* source information available to robot framework.
* Useful for tools using go-to.
* Also useful if you implement [RfLibdocSupport], so the source will also be integrated.
*/
interface RfSourceSupport {
/**
* Gets the full-qualified path to the class that implements the keyword.
* The returned path may also contain the line number. The line number has to
* be appended to the path in the format `<path>[:<lineno>]`
*/
fun getKeywordSource(name: String): String?
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.qualersoft.robotframework.library.binding

interface RFTagSupport {
interface RfTagSupport {

/**
* Gets the tags of a keyword, if any.
Expand All @@ -14,4 +14,4 @@ interface RFTagSupport {
* @since RF 3.0.2
*/
fun getKeywordTags(name: String): List<String> = emptyList()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ object EnumConverter {

return candidates.first()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ object NumberConverter {
BigDecimal::class -> BigDecimal.valueOf(value.toDouble())
else -> throw UnsupportedOperationException("No converter defined to convert number '$value' to type '$targetType'")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,23 @@ object TemporalConverter {
if (tmp is LocalDateTime) {
tmp = tmp.atOffset(ZoneOffset.UTC)
}
return temporalOfInstant(targetType, Instant.from(tmp))
val zone = ZoneOffset.ofTotalSeconds(tmp.get(ChronoField.OFFSET_SECONDS)).normalized()
return temporalOfInstant(targetType, Instant.from(tmp), zone)
}

private fun temporalOfInstant(targetType: KClass<*>, value: Instant): Any {
val zone = retrieveZoneId(value)
private fun temporalOfInstant(targetType: KClass<*>, value: Instant, zoneId: ZoneId? = null): Any {
val zone = zoneId ?: retrieveZoneId(value)
@Suppress("MagicNumber")
val msOffset = zone.rules.getOffset(value).totalSeconds * 1000
return when (targetType) {
Timestamp::class -> Timestamp(value.toEpochMilli())
Date::class -> Date(value.toEpochMilli())
Timestamp::class -> Timestamp(value.toEpochMilli() + msOffset)
Date::class -> Date(value.toEpochMilli() + msOffset)
LocalDate::class -> LocalDate.ofInstant(value, zone)
LocalTime::class -> LocalTime.ofInstant(value, zone)
LocalDateTime::class -> LocalDateTime.ofInstant(value, zone)
ZonedDateTime::class -> ZonedDateTime.ofInstant(value, zone)
OffsetTime::class -> OffsetTime.ofInstant(value, zone)
OffsetDateTime::class -> OffsetDateTime.ofInstant(value, zone)

else -> throw UnsupportedOperationException(
"No temporal converter defined to convert instant '$value' to type '$targetType'"
)
Expand All @@ -114,5 +116,4 @@ object TemporalConverter {
ZoneId.of(ZoneOffset.UTC.id)
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ open class KeywordDescriptor(private val function: KFunction<*>) {
val newMap = originMap.entries.associate { it.key.toString() to it.value }.toMutableMap()
newMap.putAll(remainingKwArgs)
result[desc.name] = Optional.of(newMap)
} catch (ex: Exception) {
} catch (ex: ClassCastException) {
validationErrors += "Unable to extend existing kwArg-map: ${kwEntry.get()}" +
" with remaining kwArgs $remainingKwArgs! $ex"
}
Expand Down Expand Up @@ -287,11 +287,10 @@ open class KeywordDescriptor(private val function: KFunction<*>) {

private fun createParameterDoc() =
if (parameters.isNotEmpty()) {
val sep = System.lineSeparator()
"$sep*Parameters*:$sep" + parameters.joinToString(
"$sep- ", prefix = "- "
"\n*Parameters*:\n" + parameters.joinToString(
"\n- ", prefix = "- "
) { it.documentation }
} else {
""
}
}
}

0 comments on commit 13752e1

Please sign in to comment.