Skip to content

Commit

Permalink
2024.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
toronik committed Aug 9, 2024
1 parent a96d76c commit 236ff31
Show file tree
Hide file tree
Showing 36 changed files with 958 additions and 793 deletions.
8 changes: 7 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{yml,yaml,js,json,md,adoc,asciidoc,asc}]
[*.{yml,yaml,js,json,md,asc}]
indent_size = 2

[*.{kt,kts}]
Expand All @@ -28,3 +28,9 @@ ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_property-naming = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_annotation = disabled

[{*.ad,*.adoc,*.asciidoc,.asciidoctorconfig}]
ij_asciidoc_blank_lines_after_header = 1
ij_asciidoc_blank_lines_keep_after_header = 1
ij_asciidoc_formatting_enabled = true
ij_asciidoc_one_sentence_per_line = true
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
ext.kotlin_version = '2.0.0'
ext.klogging_version = '3.0.5'
ext.jacksonKt_version = '2.17.1'
ext.libVersion = '2024.0.7'
ext.libVersion = '2024.0.8'
repositories {
mavenCentral()
maven {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ open class AdocExtension : ConcordionExtension {
.icons(FONT_ICONS)
.attributes(
mapOf(
"table-caption!" to "",
"toclevels" to "4",
"diagram-cachedir" to getBaseOutputDir().path,
"imagesoutdir" to getBaseOutputDir().path + BASE_DIR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import net.javacrumbs.jsonunit.providers.Jackson2ObjectMapperProvider
import org.concordion.api.extension.ConcordionExtender
import org.concordion.api.extension.ConcordionExtension
import org.concordion.api.listener.ExampleEvent
import org.concordion.internal.FailFastException
import org.hamcrest.Matcher
import org.xmlunit.diff.DefaultNodeMatcher
import org.xmlunit.diff.ElementSelectors.byName
Expand Down Expand Up @@ -155,7 +156,7 @@ class ExamExtension(private vararg var plugins: ExamPlugin) : ConcordionExtensio
if (enableLoggingFormatterExtension) {
LoggingFormatterExtension().addTo(ex)
}
// ex.withThrowableListener(ErrorListener())
ex.withThrowableListener { if (it.throwable is FailFastException) throw it.throwable }
if (focusOnError) {
ex.withSpecificationProcessingListener(FocusOnErrorsListener())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.concordion.api.Fixture
import org.concordion.api.ResultRecorder
import org.concordion.api.listener.ExecuteEvent
import org.concordion.api.listener.ExecuteListener
import org.concordion.internal.FailFastException
import java.time.Duration

abstract class ExamCommand<M, R>(
Expand All @@ -27,31 +28,39 @@ abstract class ExamCommand<M, R>(
resultRecorder: ResultRecorder,
fixture: Fixture
) {
commandCall.children.processSequentially(evaluator, resultRecorder, fixture)
val el = commandCall.html()
val result = process(
model = model(
Context(
attrs = attrs.associateWith {
el.getAttr(it, evaluator)
?: evaluator.resolveToObj(commandCall.getParameter(it.removePrefix("e:")))?.toString()
},
el = el,
expression = commandCall.expression.trim(),
eval = evaluator,
awaitConfig = AwaitConfig.build(commandCall)
)
),
eval = evaluator,
recorder = resultRecorder
)
if (el["rendered"] == null) {
render(commandCall = commandCall, result = result)
el.attr("rendered", "true")
runCatching {
commandCall.children.processSequentially(evaluator, resultRecorder, fixture)
val el = commandCall.html()
val result = process(
model = model(
Context(
attrs = attrs.associateWith {
el.getAttr(it, evaluator)
?: evaluator.resolveToObj(commandCall.getParameter(it.removePrefix("e:")))?.toString()
},
el = el,
expression = commandCall.expression.trim(),
eval = evaluator,
awaitConfig = AwaitConfig.build(commandCall)
)
),
eval = evaluator,
recorder = resultRecorder
)
if (el["rendered"] == null) {
render(commandCall = commandCall, result = result)
el.attr("rendered", "true")
}
listener.executeCompleted(ExecuteEvent(commandCall.element))
}.onFailure {
if (inBeforeExample(commandCall)) {
throw FailFastException("Failed before example", it)
} else throw it
}
listener.executeCompleted(ExecuteEvent(commandCall.element))
}

private fun inBeforeExample(commandCall: CommandCall) = commandCall.parent.getParameter("example") == "before"

data class Context(
val attrs: Map<String, String?>,
val el: Html,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import io.github.adven27.concordion.extensions.exam.core.ExamPlugin
import io.github.adven27.concordion.extensions.exam.core.html.pre
import io.github.adven27.concordion.extensions.exam.core.html.span
import io.github.adven27.concordion.extensions.exam.db.commands.DbCleanCommand
import io.github.adven27.concordion.extensions.exam.db.commands.DbExecuteCommand
import io.github.adven27.concordion.extensions.exam.db.commands.DbSetCommand
import io.github.adven27.concordion.extensions.exam.db.commands.set.DbSetCommand
import io.github.adven27.concordion.extensions.exam.db.commands.DbShowCommand
import io.github.adven27.concordion.extensions.exam.db.commands.DbVerifyCommand
import io.github.adven27.concordion.extensions.exam.db.commands.ExamMatchersAwareValueComparer
import io.github.adven27.concordion.extensions.exam.db.commands.check.DbCheckCommand
import mu.KLogging
Expand All @@ -27,7 +25,7 @@ import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME
import java.time.format.DateTimeFormatter.ISO_TIME
import java.util.Date
import java.util.*
import kotlin.collections.component1
import kotlin.collections.component2
import kotlin.collections.set
Expand Down Expand Up @@ -90,8 +88,6 @@ class DbPlugin @JvmOverloads constructor(
}

override fun commands(): Map<String, Command> = mapOf(
"db-execute" to DbExecuteCommand(dbTester, valuePrinter),
"db-verify" to DbVerifyCommand(dbTester, valuePrinter),
"db-show" to DbShowCommand(dbTester, valuePrinter),
"db-check" to DbCheckCommand(dbTester, valuePrinter),
"db-set" to DbSetCommand(dbTester, valuePrinter),
Expand Down
Loading

0 comments on commit 236ff31

Please sign in to comment.