use of org.mule.runtime.core.privileged.event.BaseEventContext in project mule by mulesoft.
the class ParameterizedConfigParserTestCase method configWithExpressionFunctionIsSameInstanceForDifferentEvents.
@Test
public void configWithExpressionFunctionIsSameInstanceForDifferentEvents() throws Exception {
CoreEvent event = null;
try {
event = getHeisenbergEvent();
CoreEvent anotherEvent = testEvent();
HeisenbergExtension config = lookupHeisenberg(HEISENBERG_BYNAME, event);
HeisenbergExtension anotherConfig = lookupHeisenberg(HEISENBERG_BYNAME, anotherEvent);
assertThat(config, is(sameInstance(anotherConfig)));
} finally {
if (event != null) {
((BaseEventContext) event.getContext()).success();
}
}
}
use of org.mule.runtime.core.privileged.event.BaseEventContext in project mule by mulesoft.
the class ParameterizedConfigParserTestCase method sameInstanceForEquivalentEvent.
@Test
public void sameInstanceForEquivalentEvent() throws Exception {
CoreEvent event = null;
try {
event = getHeisenbergEvent();
HeisenbergExtension heisenberg = lookupHeisenberg(testConfig, event);
assertThat(heisenberg, is(sameInstance(lookupHeisenberg(testConfig, event))));
} finally {
if (event != null) {
((BaseEventContext) event.getContext()).success();
}
}
}
use of org.mule.runtime.core.privileged.event.BaseEventContext in project mule by mulesoft.
the class SingleConfigParserTestCase method getHealthProgression.
@Test
public void getHealthProgression() throws Exception {
CoreEvent event = null;
try {
event = getHeisenbergEvent();
HeisenbergExtension config = lookupHeisenberg(HEISENBERG_BYNAME, event);
assertThat(config.getHealthProgression(), is(not(nullValue())));
assertThat(config.getHealthProgression().size(), is(3));
assertThat(config.getHealthProgression(), contains(HEALTHY, CANCER, DEAD));
} finally {
if (event != null) {
((BaseEventContext) event.getContext()).success();
}
}
}
use of org.mule.runtime.core.privileged.event.BaseEventContext in project mule by mulesoft.
the class SingleConfigParserTestCase method initializedOptionalValueWithoutDefaultValue.
@Test
public void initializedOptionalValueWithoutDefaultValue() throws Exception {
CoreEvent event = null;
try {
event = getHeisenbergEvent();
HeisenbergExtension config = lookupHeisenberg(HEISENBERG_EXPRESSION_BYREF, event);
assertThat(config.getWeapon(), is(not(nullValue())));
assertThat(config.getWeapon(), is(instanceOf(Ricin.class)));
} finally {
if (event != null) {
((BaseEventContext) event.getContext()).success();
}
}
}
use of org.mule.runtime.core.privileged.event.BaseEventContext in project mule by mulesoft.
the class SingleConfigParserTestCase method configWithExpressionFunctionStillDynamic.
@Test
public void configWithExpressionFunctionStillDynamic() throws Exception {
CoreEvent event = null;
CoreEvent anotherEvent = null;
try {
event = getHeisenbergEvent();
anotherEvent = CoreEvent.builder(getHeisenbergEvent()).addVariable("age", 40).build();
HeisenbergExtension config = lookupHeisenberg(HEISENBERG_EXPRESSION, event);
HeisenbergExtension anotherConfig = lookupHeisenberg(HEISENBERG_EXPRESSION, anotherEvent);
assertThat(config, is(not(sameInstance(anotherConfig))));
} finally {
if (event != null) {
((BaseEventContext) event.getContext()).success();
}
if (anotherEvent != null) {
((BaseEventContext) anotherEvent.getContext()).success();
}
}
}
Aggregations