execute method
Executes the lifecycle operation selected by its registry handler key.
Implementation
Future<void> execute(TestOperation operation) async {
final descriptor = _descriptorsByHandlerKey[operation.handlerKey];
if (descriptor == null) {
throw ArgumentError.value(
operation.handlerKey,
'operation.handlerKey',
'Unsupported lifecycle operation',
);
}
if (descriptor.name != operation.name ||
descriptor.handlerKey != operation.handlerKey) {
throw ArgumentError.value(
operation,
'operation',
'Lifecycle operation does not match its selected descriptor.',
);
}
session.policy.ensureLifecycleOperationPermitted(descriptor.name);
await session.executor.executeRegisteredLifecycleInput(
descriptor,
operation,
);
}