Search in sources :

Example 1 with ConcordExecutionContext

use of com.walmartlabs.concord.runner.engine.ConcordExecutionContextFactory.ConcordExecutionContext in project concord by walmartlabs.

the class ConcordExecutionContextTest method testProtectedVariable.

@Test
public void testProtectedVariable() {
    ConcordExecutionContext ctx = ctx();
    varContext.preTask("task", null, null);
    ctx.setProtectedVariable("s", "s-var");
    varContext.postTask("task", null, null);
    assertEquals("s-var", ctx.getVariable("s"));
    assertEquals("s-var", ctx.getProtectedVariable("s"));
    assertNull(ctx.getVariable("not-found"));
    assertNull(ctx.getProtectedVariable("not-found"));
    try {
        ctx.removeVariable("s");
        fail("exception expected");
    } catch (RuntimeException e) {
    // ignore
    }
}
Also used : ConcordExecutionContext(com.walmartlabs.concord.runner.engine.ConcordExecutionContextFactory.ConcordExecutionContext) Test(org.junit.jupiter.api.Test)

Example 2 with ConcordExecutionContext

use of com.walmartlabs.concord.runner.engine.ConcordExecutionContextFactory.ConcordExecutionContext in project concord by walmartlabs.

the class ConcordExecutionContextTest method testProtectedVariableWithoutContext.

@Test
public void testProtectedVariableWithoutContext() {
    assertThrows(RuntimeException.class, () -> {
        ConcordExecutionContext ctx = ctx();
        ctx.setProtectedVariable("oops", 1);
    });
}
Also used : ConcordExecutionContext(com.walmartlabs.concord.runner.engine.ConcordExecutionContextFactory.ConcordExecutionContext) Test(org.junit.jupiter.api.Test)

Example 3 with ConcordExecutionContext

use of com.walmartlabs.concord.runner.engine.ConcordExecutionContextFactory.ConcordExecutionContext in project concord by walmartlabs.

the class ConcordExecutionContextTest method ctx.

private ConcordExecutionContext ctx() {
    ExecutionContextFactory<? extends ExecutionContext> ctxFactory = null;
    ExpressionManager expressionManager = null;
    FormService formService = null;
    Variables source = new Variables();
    return new ConcordExecutionContext(ctxFactory, expressionManager, source, varContext, formService);
}
Also used : Variables(io.takari.bpm.api.Variables) ExpressionManager(io.takari.bpm.el.ExpressionManager) FormService(io.takari.bpm.form.FormService) ConcordExecutionContext(com.walmartlabs.concord.runner.engine.ConcordExecutionContextFactory.ConcordExecutionContext)

Aggregations

ConcordExecutionContext (com.walmartlabs.concord.runner.engine.ConcordExecutionContextFactory.ConcordExecutionContext)3 Test (org.junit.jupiter.api.Test)2 Variables (io.takari.bpm.api.Variables)1 ExpressionManager (io.takari.bpm.el.ExpressionManager)1 FormService (io.takari.bpm.form.FormService)1