Skip to main content
Version: 3.0.1 (Unmaintained)

Direct

Direct executes a callback. In 3.x it is builder-only so context mode is explicit and discoverable.

private static Action step() {
return Direct.builder("step")
.execute(context -> {})
.build();
}

To share the context received from the parent action:

private static Action step() {
return Direct.builder("step")
.contextMode(Action.ContextMode.SHARED)
.execute(context -> {})
.build();
}

Throw SkipException to skip or FailException to fail intentionally. Other non-Error throwables are reported and converted to failures.

Direct is the simplest built-in action.

Builder​

Direct.builder(String name)
.contextMode(Action.ContextMode contextMode) // optional
.execute(Direct.Executable executable)
.build()

The callback shape is:

void execute(Context context) throws Throwable

Example​

public class MyTest {

@Paramixel.ActionFactory
public static Action actionFactory() {
Action createUser = createUser();

return Container.builder("MyTest")
.child(createUser)
.build();
}

private static Action createUser() {
return Direct.builder("create user")
.execute(context -> {
String baseUrl = context.getConfiguration().get("service.url");
// test logic here
})
.build();
}
}

Result behavior​

  • normal return -> PASS
  • throw SkipException.skip(...) -> SKIP
  • throw FailException.fail(...) -> FAIL
  • any other thrown exception -> listener gets actionThrowable(...), then result becomes FAIL
  • throw Error -> propagates immediately (not caught, no result set)

Exceptions​

FailException and SkipException live in org.paramixel.core.exception:

import org.paramixel.core.exception.FailException;
import org.paramixel.core.exception.SkipException;