This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/master by this push: new 9a61431 Update groovy to v3.0.5 9a61431 is described below commit 9a61431ecdcb9a611f614f1c8be58365202844a1 Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Thu Jul 23 09:53:44 2020 +0200 Update groovy to v3.0.5 --- .../apache/camel/k/loader/yaml/RoutesTest.groovy | 14 +++++------ ...st.groovy => RoutesWithPlaceholdersTest.groovy} | 10 ++++---- .../apache/camel/k/loader/yaml/TestSupport.groovy | 27 ++++++++-------------- ...m.yaml => RoutesWithPlaceholdersTest_from.yaml} | 0 ....yaml => RoutesWithPlaceholdersTest_route.yaml} | 0 ..._to.yaml => RoutesWithPlaceholdersTest_to.yaml} | 0 ...od.yaml => RoutesWithPlaceholdersTest_tod.yaml} | 0 pom.xml | 2 +- 8 files changed, 22 insertions(+), 31 deletions(-) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesTest.groovy index 29263cd..5eb5f6d 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesTest.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesTest.groovy @@ -25,7 +25,7 @@ class RoutesTest extends TestSupport { def 'split'() { setup: - def context = startContext() + def context = startContextForSpec() mockEndpoint(context,'mock:split') { expectedMessageCount = 3 @@ -52,7 +52,7 @@ class RoutesTest extends TestSupport { def 'filter'() { setup: - def context = startContext() + def context = startContextForSpec() mockEndpoint(context, 'mock:route') { expectedMessageCount 2 @@ -81,7 +81,7 @@ class RoutesTest extends TestSupport { def 'aggregator'() { setup: - def context = startContext { + def context = startContextForSpec { registry.bind('aggregatorStrategy', new UseLatestAggregationStrategy()) } @@ -104,7 +104,7 @@ class RoutesTest extends TestSupport { def 'idempotentConsumer'() { setup: - def context = startContext { + def context = startContextForSpec { registry.bind('myRepo', new MemoryIdempotentRepository()) } @@ -132,7 +132,7 @@ class RoutesTest extends TestSupport { def 'onExceptionHandled'() { setup: - def context = startContext { + def context = startContextForSpec { registry.bind('myFailingProcessor', new MyFailingProcessor()) } when: @@ -145,7 +145,7 @@ class RoutesTest extends TestSupport { def 'errorHandler'() { setup: - def context = startContext { + def context = startContextForSpec { registry.bind('myFailingProcessor', new MyFailingProcessor()) } @@ -162,7 +162,7 @@ class RoutesTest extends TestSupport { def 'bean'() { setup: - def context = startContext() + def context = startContextForSpec() when: def out = context.createProducerTemplate().requestBody('direct:route', 'test'); then: diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RouteWithPlaceholdersTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithPlaceholdersTest.groovy similarity index 93% rename from camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RouteWithPlaceholdersTest.groovy rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithPlaceholdersTest.groovy index eece082..1e7f2ea 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RouteWithPlaceholdersTest.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithPlaceholdersTest.groovy @@ -18,7 +18,7 @@ package org.apache.camel.k.loader.yaml import org.apache.camel.component.direct.DirectEndpoint -class RouteWithPlaceholdersTest extends TestSupport { +class RoutesWithPlaceholdersTest extends TestSupport { def 'route'() { setup: def parameters = [ @@ -26,7 +26,7 @@ class RouteWithPlaceholdersTest extends TestSupport { 'direct.timeout': 1234, 'direct.result': UUID.randomUUID().toString() ] - def context = startContext { + def context = startContextForSpec { propertiesComponent.initialProperties = parameters as Properties } when: @@ -44,7 +44,7 @@ class RouteWithPlaceholdersTest extends TestSupport { 'direct.timeout': 1234, 'direct.result': UUID.randomUUID().toString() ] - def context = startContext { + def context = startContextForSpec { propertiesComponent.initialProperties = parameters as Properties } when: @@ -67,7 +67,7 @@ class RouteWithPlaceholdersTest extends TestSupport { 'direct.timeout': 1234, 'direct.result': UUID.randomUUID().toString() ] - def context = startContext { + def context = startContextForSpec { propertiesComponent.initialProperties = parameters as Properties } when: @@ -85,7 +85,7 @@ class RouteWithPlaceholdersTest extends TestSupport { 'direct.timeout': 1234, 'direct.result': UUID.randomUUID().toString() ] - def context = startContext { + def context = startContextForSpec { propertiesComponent.initialProperties = parameters as Properties } when: diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy index 0971ad0..ed2bb78 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy @@ -23,6 +23,9 @@ import org.apache.camel.FluentProducerTemplate import org.apache.camel.builder.RouteBuilder import org.apache.camel.component.mock.MockEndpoint import org.apache.camel.impl.DefaultCamelContext +import org.apache.camel.k.Runtime +import org.apache.camel.k.Source +import org.apache.camel.k.Sources import org.apache.camel.k.loader.yaml.spi.ProcessorStepParser import org.apache.camel.k.loader.yaml.spi.StartStepParser import org.apache.camel.k.loader.yaml.spi.StepParser @@ -58,28 +61,20 @@ class TestSupport extends Specification { return new StepParser.Context(builder, new RouteDefinition(), MAPPER, content, RESOLVER) } - static CamelContext startContext(String content) { - return startContext(content, null) - } - static CamelContext startContext( String content, @DelegatesTo(CamelContext) Closure<CamelContext> closure) { return startContext( - new ByteArrayInputStream(content.stripMargin().getBytes(StandardCharsets.UTF_8)), + Sources.fromBytes('yaml', content.getBytes(StandardCharsets.UTF_8)), closure ) } - static CamelContext startContext(InputStream content) { - return startContext(content, null) - } - static CamelContext startContext( - InputStream content, + Source source, @DelegatesTo(CamelContext) Closure closure) { def context = new DefaultCamelContext() - def builder = new YamlSourceLoader().builder(content) + def builder = new YamlSourceLoader().load(Runtime.on(context), source).builder().orElseThrow(() -> new IllegalArgumentException()); context.disableJMX() context.setStreamCaching(true) @@ -96,16 +91,12 @@ class TestSupport extends Specification { return context } - CamelContext startContext() { - return startContext(null as Closure) - } - - CamelContext startContext(@DelegatesTo(CamelContext) Closure closure) { + CamelContext startContextForSpec(@DelegatesTo(CamelContext) Closure closure) { def name = specificationContext.currentIteration.name.replace(' ', '_') - def path = "/routes/${specificationContext.currentSpec.name}_${name}.yaml" + def path = "classpath:/routes/${specificationContext.currentSpec.name}_${name}.yaml" return startContext( - TestSupport.class.getResourceAsStream(path) as InputStream, + Sources.fromURI(path), closure ) } diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithPlaceholdersTest_from.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithPlaceholdersTest_from.yaml similarity index 100% rename from camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithPlaceholdersTest_from.yaml rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithPlaceholdersTest_from.yaml diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithPlaceholdersTest_route.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithPlaceholdersTest_route.yaml similarity index 100% rename from camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithPlaceholdersTest_route.yaml rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithPlaceholdersTest_route.yaml diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithPlaceholdersTest_to.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithPlaceholdersTest_to.yaml similarity index 100% rename from camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithPlaceholdersTest_to.yaml rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithPlaceholdersTest_to.yaml diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithPlaceholdersTest_tod.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithPlaceholdersTest_tod.yaml similarity index 100% rename from camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithPlaceholdersTest_tod.yaml rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithPlaceholdersTest_tod.yaml diff --git a/pom.xml b/pom.xml index 36c9853..1a9d162 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ <assertj.version>3.16.1</assertj.version> <log4j2.version>2.13.3</log4j2.version> <slf4j.version>1.7.30</slf4j.version> - <groovy.version>3.0.4</groovy.version> + <groovy.version>3.0.5</groovy.version> <kotlin.version>1.3.72</kotlin.version> <snakeyaml.version>1.26</snakeyaml.version> <spock.version>2.0-M3-groovy-3.0</spock.version>