diff --git a/java/steps/yaks-camel/src/main/java/org/citrusframework/yaks/camel/CamelSteps.java b/java/steps/yaks-camel/src/main/java/org/citrusframework/yaks/camel/CamelSteps.java index a2754f31..f02f8609 100644 --- a/java/steps/yaks-camel/src/main/java/org/citrusframework/yaks/camel/CamelSteps.java +++ b/java/steps/yaks-camel/src/main/java/org/citrusframework/yaks/camel/CamelSteps.java @@ -149,7 +149,7 @@ public void defaultContext() { @Given("^(?:Default|New) global Camel context$") public void defaultGlobalContext() { destroyCamelContext(); - citrus.getCitrusContext().getReferenceResolver().bind(contextName, camelContext()); + citrus.getCitrusContext().bind(contextName, camelContext()); globalCamelContext = true; } @@ -163,7 +163,7 @@ public void camelContext(String beans) { @Given("^(?:Default|New) global Spring Camel context$") public void defaultGlobalContext(String beans) { destroyCamelContext(); - citrus.getCitrusContext().getReferenceResolver().bind(contextName, springCamelContext(beans)); + citrus.getCitrusContext().bind(contextName, springCamelContext(beans)); globalCamelContext = true; } diff --git a/java/steps/yaks-groovy/src/main/java/org/citrusframework/yaks/groovy/GroovyScript.java b/java/steps/yaks-groovy/src/main/java/org/citrusframework/yaks/groovy/GroovyScript.java index a193afb5..a0eec599 100644 --- a/java/steps/yaks-groovy/src/main/java/org/citrusframework/yaks/groovy/GroovyScript.java +++ b/java/steps/yaks-groovy/src/main/java/org/citrusframework/yaks/groovy/GroovyScript.java @@ -35,6 +35,14 @@ public Object getProperty(String propertyName) { try { return getMetaClass().getProperty(this, propertyName); } catch (NullPointerException | MissingPropertyException e) { + if (propertyName.equals("citrus")) { + return citrusFramework; + } + + if (propertyName.equals("context")) { + return context; + } + if (context != null) { if (context.getReferenceResolver().isResolvable(propertyName)) { return context.getReferenceResolver().resolve(propertyName); diff --git a/java/steps/yaks-groovy/src/test/resources/org/citrusframework/yaks/groovy/component.script.feature b/java/steps/yaks-groovy/src/test/resources/org/citrusframework/yaks/groovy/component.script.feature index f129537d..6598aa96 100644 --- a/java/steps/yaks-groovy/src/test/resources/org/citrusframework/yaks/groovy/component.script.feature +++ b/java/steps/yaks-groovy/src/test/resources/org/citrusframework/yaks/groovy/component.script.feature @@ -10,3 +10,4 @@ Feature: Component script Scenario: Use new component Given $(echo(foo.text)) + And run script: println foo.text