diff --git a/core/support/.gitignore b/core/support/.gitignore
new file mode 100644
index 00000000..3cceda55
--- /dev/null
+++ b/core/support/.gitignore
@@ -0,0 +1,7 @@
+# https://dart.dev/guides/libraries/private-files
+# Created by `dart pub`
+.dart_tool/
+
+# Avoid committing pubspec.lock for library packages; see
+# https://dart.dev/guides/libraries/private-files#pubspeclock.
+pubspec.lock
diff --git a/core/support/CHANGELOG.md b/core/support/CHANGELOG.md
new file mode 100644
index 00000000..effe43c8
--- /dev/null
+++ b/core/support/CHANGELOG.md
@@ -0,0 +1,3 @@
+## 1.0.0
+
+- Initial version.
diff --git a/core/support/LICENSE.md b/core/support/LICENSE.md
new file mode 100644
index 00000000..0fd0d03b
--- /dev/null
+++ b/core/support/LICENSE.md
@@ -0,0 +1,10 @@
+The MIT License (MIT)
+
+The Laravel Framework is Copyright (c) Taylor Otwell
+The Fabric Framework is Copyright (c) Vieo, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/core/support/README.md b/core/support/README.md
new file mode 100644
index 00000000..757f4c9f
--- /dev/null
+++ b/core/support/README.md
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/core/support/analysis_options.yaml b/core/support/analysis_options.yaml
new file mode 100644
index 00000000..dee8927a
--- /dev/null
+++ b/core/support/analysis_options.yaml
@@ -0,0 +1,30 @@
+# This file configures the static analysis results for your project (errors,
+# warnings, and lints).
+#
+# This enables the 'recommended' set of lints from `package:lints`.
+# This set helps identify many issues that may lead to problems when running
+# or consuming Dart code, and enforces writing Dart using a single, idiomatic
+# style and format.
+#
+# If you want a smaller set of lints you can change this to specify
+# 'package:lints/core.yaml'. These are just the most critical lints
+# (the recommended set includes the core lints).
+# The core lints are also what is used by pub.dev for scoring packages.
+
+include: package:lints/recommended.yaml
+
+# Uncomment the following section to specify additional rules.
+
+# linter:
+# rules:
+# - camel_case_types
+
+# analyzer:
+# exclude:
+# - path/to/excluded/files/**
+
+# For more information about the core and recommended set of lints, see
+# https://dart.dev/go/core-lints
+
+# For additional information about configuring this file, see
+# https://dart.dev/guides/language/analysis-options
diff --git a/core/support/build.yaml b/core/support/build.yaml
new file mode 100644
index 00000000..1e7689ec
--- /dev/null
+++ b/core/support/build.yaml
@@ -0,0 +1,8 @@
+targets:
+ $default:
+ builders:
+ reflectable:
+ generate_for:
+ - test/**.dart
+ options:
+ formatted: true
diff --git a/core/support/lib/service_provider.dart b/core/support/lib/service_provider.dart
new file mode 100644
index 00000000..59672800
--- /dev/null
+++ b/core/support/lib/service_provider.dart
@@ -0,0 +1,13 @@
+/*
+ * This file is part of the Protevus Platform.
+ *
+ * (C) Protevus
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+library;
+
+export '../src/service_provider.dart';
+export '../src/discoverable_service_provider.dart';
diff --git a/core/support/lib/src/discoverable_service_provider.dart b/core/support/lib/src/discoverable_service_provider.dart
new file mode 100644
index 00000000..7049a26c
--- /dev/null
+++ b/core/support/lib/src/discoverable_service_provider.dart
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the Protevus Platform.
+ *
+ * (C) Protevus
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+import 'package:reflectable/reflectable.dart';
+
+/// A reflectable class that provides capabilities for discovering services.
+///
+/// This class extends [Reflectable] and enables invoking, typing, and reflected type capabilities.
+/// It is used to facilitate service discovery and reflection-based operations in the application.
+///
+/// The capabilities provided by this class are:
+/// - [invokingCapability]: Allows invoking methods on reflected instances.
+/// - [typingCapability]: Enables access to type information of reflected instances.
+/// - [reflectedTypeCapability]: Provides access to the reflected type of instances.
+/// - [newInstanceCapability]: Allows creation of new instances of reflected types.
+///
+/// Usage:
+/// ```dart
+/// const provider = DiscoverableServiceProvider();
+/// // Use the provider to perform reflection-based operations
+/// ```
+///
+/// This class is typically used in conjunction with the [discoverableServiceProvider]
+/// constant to provide a shared instance for reflection operations throughout the application.
+class DiscoverableServiceProvider extends Reflectable {
+ const DiscoverableServiceProvider()
+ : super(
+ invokingCapability,
+ typingCapability,
+ declarationsCapability,
+ reflectedTypeCapability,
+ newInstanceCapability,
+ superclassQuantifyCapability);
+}
+
+/// A constant instance of [DiscoverableServiceProvider].
+///
+/// This constant provides a single, shared instance of the [DiscoverableServiceProvider] class.
+/// It can be used throughout the application to access the reflection capabilities
+/// defined in the [DiscoverableServiceProvider] class, such as invoking methods,
+/// accessing type information, and working with reflected types.
+///
+/// Usage:
+/// ```dart
+/// var reflector = discoverableServiceProvider;
+/// // Use the reflector to perform reflection operations
+/// ```
+const discoverableServiceProvider = DiscoverableServiceProvider();
diff --git a/core/support/lib/src/service_provider.dart b/core/support/lib/src/service_provider.dart
new file mode 100644
index 00000000..96cdacb9
--- /dev/null
+++ b/core/support/lib/src/service_provider.dart
@@ -0,0 +1,887 @@
+/*
+ * This file is part of the Protevus Platform.
+ *
+ * (C) Protevus
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+import 'package:angel3_framework/angel3_framework.dart';
+import 'package:angel3_container/angel3_container.dart';
+import 'package:meta/meta.dart';
+import 'package:logging/logging.dart';
+import 'package:reflectable/reflectable.dart';
+import 'discoverable_service_provider.dart';
+
+@discoverableServiceProvider
+abstract class ServiceProvider {
+ /// Static variable to hold the logger instance for the ServiceProvider class.
+ /// This logger is lazily initialized and can be accessed via the `logger` getter.
+ /// It can also be set explicitly for testing purposes using the `setLogger` method.
+ static Logger? _logger;
+
+ /// Returns the logger for the ServiceProvider class.
+ ///
+ /// If a logger has not been explicitly set using the `setLogger` method,
+ /// this getter creates and returns a new Logger instance with the name 'ServiceProvider'.
+ ///
+ /// If a logger has been set, it returns that logger instance.
+ ///
+ /// This approach allows for lazy initialization of the logger and provides
+ /// flexibility for testing by allowing the logger to be explicitly set when needed.
+ static Logger get logger => _logger ?? Logger('ServiceProvider');
+
+ /// Constructs a [ServiceProvider] instance.
+ ///
+ /// The [priority] parameter determines the order in which service providers are registered.
+ /// Service providers with higher priority values are registered before those with lower priority values.
+ /// By default, the priority is set to 0.
+ ///
+ /// Example:
+ /// ```dart
+ /// class MyServiceProvider extends ServiceProvider {
+ /// MyServiceProvider() : super(priority: 10);
+ /// }
+ /// ```
+ const ServiceProvider({this.priority = 0});
+
+ /// The priority of this service provider. Higher priority providers are registered first.
+ ///
+ /// This integer value determines the order in which service providers are registered
+ /// within the Angel. Service providers with higher priority values are processed
+ /// before those with lower priority values. This allows for fine-grained control over
+ /// the initialization sequence of services, ensuring that dependencies are properly
+ /// set up before they are needed by other components.
+ ///
+ /// For example, a service provider with a priority of 10 will be registered before
+ /// a service provider with a priority of 5. If two service providers have the same
+ /// priority, their registration order is not guaranteed.
+ final int priority;
+
+ /// Sets a custom logger for the ServiceProvider class.
+ ///
+ /// This method allows changing the logger used by the ServiceProvider class,
+ /// which is particularly useful for testing purposes. It replaces the default
+ /// logger with the provided custom logger.
+ ///
+ /// Parameters:
+ /// - logger: The custom Logger instance to be used.
+ ///
+ /// Example:
+ /// ```dart
+ /// ServiceProvider.setLogger(MockLogger());
+ /// ```
+ ///
+ /// Note: This method is marked as `@visibleForTesting` to indicate that it
+ /// should only be used in test environments.
+ @visibleForTesting
+ static void setLogger(Logger logger) {
+ _logger = logger;
+ print('Logger set to: $logger'); // Add this line
+ }
+
+ /// Registers the service provider with the given container and Angel.
+ ///
+ /// This method is responsible for registering the service provider's dependencies
+ /// and services into the provided [container]. It also has access to the [app]
+ /// instance for any Angel-specific configurations.
+ ///
+ /// The method is annotated with [@mustCallSuper], indicating that subclasses
+ /// overriding this method must call the superclass implementation.
+ ///
+ /// This implementation logs the registration process, performs a sample
+ /// registration (which should be replaced with actual logic in subclasses),
+ /// and handles any exceptions that occur during the registration process.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [app]: The Angel instance, providing access to app-wide configurations.
+ ///
+ /// Throws:
+ /// Any exceptions caught during the registration process are logged
+ /// and then re-thrown.
+ @mustCallSuper
+ void register(Container container, Angel app) {
+ try {
+ logger.info('Registering ${runtimeType.toString()}');
+ // Actual registration logic
+ container.registerSingleton('test', as: null);
+ } catch (e, stackTrace) {
+ print('Caught exception in register: $e'); // Add this line
+ logger.severe(
+ 'Error registering ${runtimeType.toString()}', e, stackTrace);
+ print('Logged severe message in register'); // Add this line
+ rethrow;
+ }
+ }
+
+ /// Boots the service provider, performing necessary setup tasks.
+ ///
+ /// This method is responsible for initializing the service provider and
+ /// performing any required setup tasks. It's called during the Angel's
+ /// boot process.
+ ///
+ /// The method is annotated with [@mustCallSuper], indicating that subclasses
+ /// overriding this method must call the superclass implementation.
+ ///
+ /// This implementation logs the booting process, performs a sample
+ /// configuration (which should be replaced with actual logic in subclasses),
+ /// and handles any exceptions that occur during the booting process.
+ ///
+ /// Parameters:
+ /// - [app]: The Angel instance, providing access to app-wide configurations.
+ ///
+ /// Throws:
+ /// Any exceptions caught during the booting process are logged
+ /// and then re-thrown.
+ ///
+ /// Returns:
+ /// A [Future] that completes when the boot process is finished.
+ @mustCallSuper
+ Future boot(Angel app) async {
+ try {
+ logger.info('Booting ${runtimeType.toString()}');
+ // Actual booting logic
+ await app.configure((_) => null);
+ } catch (e, stackTrace) {
+ print('Caught exception in boot: $e'); // Add this line
+ logger.severe('Error booting ${runtimeType.toString()}', e, stackTrace);
+ print('Logged severe message in boot'); // Add this line
+ rethrow;
+ }
+ }
+
+ /// Indicates whether the service provider is deferred.
+ ///
+ /// This getter returns a boolean value that determines if the service provider
+ /// should be loaded in a deferred manner. By default, it returns `false`,
+ /// meaning the service provider is not deferred.
+ ///
+ /// Deferred loading can be useful for optimizing Angel startup time
+ /// by delaying the loading of certain services until they are actually needed.
+ ///
+ /// Subclasses can override this getter to implement custom deferral logic.
+ ///
+ /// Returns:
+ /// A boolean value. `false` indicates the service provider is not deferred,
+ /// while `true` would indicate it is deferred.
+ bool get isDeferred => false;
+
+ /// Returns a list of types that this service provider provides.
+ ///
+ /// This getter is intended to be overridden by subclasses to specify
+ /// the types of services or dependencies that the service provider
+ /// makes available to the Angel.
+ ///
+ /// By default, it returns an empty list, indicating that the base
+ /// ServiceProvider class doesn't provide any specific types.
+ ///
+ /// Subclasses should override this getter to return a list of
+ /// [Type] objects representing the services they provide.
+ ///
+ /// Example:
+ /// ```dart
+ /// @override
+ /// List get provides => [DatabaseService, LoggingService];
+ /// ```
+ ///
+ /// Returns:
+ /// A [List] of [Type] objects representing the provided services.
+ List get provides => const [];
+
+ /// Determines whether the service provider should be registered.
+ ///
+ /// This method is used to conditionally register the service provider based on
+ /// the current state of the Angel. By default, it always returns `true`,
+ /// meaning the service provider will be registered in all cases.
+ ///
+ /// Subclasses can override this method to implement custom logic for determining
+ /// when the service provider should be registered. This can be useful for
+ /// conditional registration based on environment variables, configuration settings,
+ /// or other Angel-specific criteria.
+ ///
+ /// Parameters:
+ /// - [app]: The current [Angel] instance, which can be used to access
+ /// Angel-wide settings or configurations.
+ ///
+ /// Returns:
+ /// A boolean value. `true` indicates that the service provider should be
+ /// registered, while `false` indicates it should not be registered.
+ ///
+ /// Example:
+ /// ```dart
+ /// @override
+ /// bool when(Angel app) {
+ /// return app.environment == 'production';
+ /// }
+ /// ```
+ bool when(Angel app) => true;
+
+ /// Determines if the service provider is ready to be registered with the Angel.
+ ///
+ /// This method checks two conditions:
+ /// 1. The service provider is not deferred (checked via the [isDeferred] property).
+ /// 2. The [when] method returns true for the given [app].
+ ///
+ /// If both conditions are met, the method returns true, indicating that the
+ /// service provider is ready to be registered.
+ ///
+ /// Parameters:
+ /// - [app]: The [Angel] instance to check against.
+ ///
+ /// Returns:
+ /// A boolean value. `true` if the service provider is ready to be registered,
+ /// `false` otherwise.
+ bool isReadyToRegister(Angel app) => !isDeferred && when(app);
+
+ /// Registers a singleton instance of type [T] with the provided [container].
+ ///
+ /// This method ensures that the same [instance] of type [T] is always returned
+ /// when requested from the container. This is useful for objects that should
+ /// maintain a single state throughout the Angel's lifecycle.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [instance]: The instance of type [T] to be registered as a singleton.
+ ///
+ /// Example:
+ /// ```dart
+ /// final myService = MyService();
+ /// singleton(container, myService);
+ /// ```
+ ///
+ /// After registration, any request for type [T] from the container will return
+ /// the same [instance].
+ void singleton(Container container, T instance) {
+ container.registerSingleton(instance);
+ }
+
+ /// Registers a factory that always returns the same instance of type [T].
+ ///
+ /// This method creates a singleton-like behavior using a factory function.
+ /// The first time the type [T] is requested from the container, the [factory]
+ /// function is called to create an instance. This instance is then cached and
+ /// returned for all subsequent requests.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [factory]: A function that takes a [Container] and returns an instance of [T].
+ ///
+ /// Example:
+ /// ```dart
+ /// singletonFactory(container, (c) => Database.connect());
+ /// ```
+ ///
+ /// After registration, any request for type [T] from the container will return
+ /// the same instance, created by the [factory] function on the first request.
+ void singletonFactory(Container container, T Function(Container) factory) {
+ T? instance;
+ container.registerFactory((c) {
+ instance ??= factory(c);
+ return instance!;
+ });
+ }
+
+ /// Registers a factory function for type [T] with the provided [container].
+ ///
+ /// This method allows you to register a factory function that creates instances
+ /// of type [T]. The factory function will be called each time an instance of [T]
+ /// is requested from the container.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [factory]: A function that takes a [Container] and returns an instance of [T].
+ ///
+ /// Example:
+ /// ```dart
+ /// bind(container, (c) => Logger('MyLogger'));
+ /// ```
+ ///
+ /// After registration, you can request an instance of [T] from the container,
+ /// and the [factory] function will be called to create a new instance each time.
+ void bind(Container container, T Function(Container) factory) {
+ container.registerFactory(factory);
+ }
+
+ /// Registers an instance of type [T] with the provided [container].
+ ///
+ /// This method creates a factory that always returns the same [instance] of type [T].
+ /// It's useful for registering existing objects into the dependency injection container.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [instance]: The instance of type [T] to be registered.
+ ///
+ /// Example:
+ /// ```dart
+ /// final myService = MyService();
+ /// bindInstance(container, myService);
+ /// ```
+ ///
+ /// After registration, any request for type [T] from the container will return
+ /// the same [instance].
+ void bindInstance(Container container, T instance) {
+ container.registerFactory((Container c) => instance);
+ }
+
+ /// Registers a factory function for type [T] with the provided [container], but only if a binding for [T] doesn't already exist.
+ ///
+ /// This method checks if the container already has a binding for type [T]. If it doesn't,
+ /// it registers the provided [factory] function. This is useful for providing default
+ /// implementations while allowing them to be overridden.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [factory]: A function that takes a [Container] and returns an instance of [T].
+ ///
+ /// Example:
+ /// ```dart
+ /// bindIf(container, (c) => Logger('DefaultLogger'));
+ /// ```
+ ///
+ /// If [T] is not already registered in the container, the [factory] function will be
+ /// registered. Otherwise, the existing binding will be preserved.
+ void bindIf(Container container, T Function(Container) factory) {
+ if (!container.has()) {
+ container.registerFactory(factory);
+ }
+ }
+
+ /// Registers multiple factory bindings at once with the provided container.
+ ///
+ /// This method allows for batch registration of multiple factory functions
+ /// for different types in a single call. It iterates through the provided
+ /// [bindings] map and registers each factory function with its corresponding type.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [bindings]: A map where each key is a Type and each value is a factory function.
+ ///
+ /// Example:
+ /// ```dart
+ /// bindMultiple(container, {
+ /// Logger: (c) => Logger('MyLogger'),
+ /// Database: (c) => Database.connect(),
+ /// UserService: (c) => UserService(c.make())
+ /// });
+ /// ```
+ ///
+ /// Note: The factory functions in the [bindings] map should match the
+ /// signature `T Function(Container)` where T is the type being registered.
+ void bindMultiple(Container container, Map bindings) {
+ bindings.forEach((type, factory) {
+ container.registerFactory(factory as Function(Container));
+ });
+ }
+
+ /// Registers an alias for an existing binding in the container.
+ ///
+ /// This method creates a new binding of type [A] that resolves to the same
+ /// instance as an existing binding of type [T]. This is useful when you want
+ /// to refer to the same service using different types, such as when working
+ /// with interfaces and implementations.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register the alias with.
+ ///
+ /// Type Parameters:
+ /// - [T]: The original type that is already bound in the container.
+ /// - [A]: The alias type that will be registered to resolve to the same instance as [T].
+ ///
+ /// Example:
+ /// ```dart
+ /// // Assuming UserService is already registered
+ /// alias(container);
+ /// ```
+ ///
+ /// After calling this method, requests for type [A] from the container will
+ /// return the same instance as requests for type [T].
+ ///
+ /// Note: This method assumes that [T] is already registered in the container
+ /// and that instances of [T] can be cast to [A]. If these conditions are not met,
+ /// it may result in runtime errors.
+ void alias(Container container) {
+ container.registerFactory((c) => c.make() as A);
+ }
+
+ /// Registers a scoped instance of type [T] with the provided [container].
+ ///
+ /// A scoped instance is created once per scope and reused within that scope.
+ /// This is useful for objects that should have a single instance per request
+ /// or transaction, but not shared across the entire Angel.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [factory]: A function that takes a [Container] and returns an instance of [T].
+ ///
+ /// Example:
+ /// ```dart
+ /// scoped(container, (c) => RequestContext());
+ /// ```
+ ///
+ /// After registration, a new instance of [T] will be created for each scope,
+ /// but within the same scope, the same instance will be reused.
+ void scoped(Container container, T Function(Container) factory) {
+ container.registerScoped(factory);
+ }
+
+ /// Registers a transient factory for type [T] with the provided [container].
+ ///
+ /// A transient factory creates a new instance every time it is requested, even within the same scope.
+ /// This is useful for objects that should not be shared and need a fresh instance each time they are used.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [factory]: A function that takes a [Container] and returns a new instance of [T].
+ ///
+ /// Example:
+ /// ```dart
+ /// transient(container, (c) => Logger('NewLogger'));
+ /// ```
+ ///
+ /// After registration, each request for type [T] from the container will return a new instance
+ /// created by the [factory] function, regardless of the scope or previous requests.
+ void transient(Container container, T Function(Container) factory) {
+ container.registerTransient(factory);
+ }
+
+ /// Registers a constant value of type [T] with the provided [container].
+ ///
+ /// This method allows you to register a constant value that will always be
+ /// returned when requesting an instance of type [T] from the container.
+ /// The registered value cannot be changed after registration.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [value]: The constant value of type [T] to be registered.
+ ///
+ /// Example:
+ /// ```dart
+ /// constant(container, 42);
+ /// constant(container, 'AppName');
+ /// ```
+ ///
+ /// After registration, any request for type [T] from the container will
+ /// always return the registered [value].
+ void constant(Container container, T value) {
+ container.registerConstant(value);
+ }
+
+ /// Registers a lazy-loaded singleton of type [T] with the provided [container].
+ ///
+ /// This method registers a factory function that creates a singleton instance of type [T]
+ /// only when it is first requested from the container. Subsequent requests will return
+ /// the same instance.
+ ///
+ /// Parameters:
+ /// - [container]: The dependency injection container to register with.
+ /// - [factory]: A function that takes a [Container] and returns an instance of [T].
+ ///
+ /// The lazy initialization can help improve performance by deferring the creation
+ /// of the singleton until it's actually needed.
+ ///
+ /// Example:
+ /// ```dart
+ /// lazySingleton(container, (c) => Database.connect());
+ /// ```
+ ///
+ /// After registration, the first request for type [T] from the container will trigger
+ /// the [factory] function to create the instance. All subsequent requests will return
+ /// the same instance without calling the factory again.
+ void lazySingleton(Container container, T Function(Container) factory) {
+ container.registerLazySingleton(factory);
+ }
+}
+
+/// A container that manages service providers for dependency injection.
+///
+/// This class extends the base [Container] and adds functionality to handle
+/// [ServiceProvider] instances. It allows for adding, configuring, booting,
+/// and discovering service providers.
+///
+/// The container maintains an internal list of providers, sorted by their priority.
+/// It provides methods to add providers manually, configure and boot them with
+/// an [Angel] instance, and automatically discover providers using reflection.
+///
+/// Key features:
+/// - Add providers with priority-based sorting
+/// - Configure providers with the Angel instance
+/// - Boot providers when the Angel starts
+/// - Automatically discover and instantiate providers using reflection
+///
+/// Usage:
+/// ```dart
+/// var container = ServiceProviderContainer(myReflector);
+/// container.addProvider(MyServiceProvider());
+/// container.configureProviders(app);
+/// container.bootProviders(app);
+/// container.discoverProviders();
+/// ```
+///
+/// This container is designed to work with the [ServiceProvider] abstract class
+/// and integrates with the Angel framework's [Angel] class.
+class ServiceProviderContainer extends Container {
+ /// Static logger instance for the ServiceProviderContainer class.
+ ///
+ /// This logger is used throughout the ServiceProviderContainer class to log
+ /// information, warnings, and errors related to service provider operations.
+ /// It is initialized with the name 'ServiceProviderContainer' to easily
+ /// identify log messages originating from this class.
+ static final Logger _logger = Logger('ServiceProviderContainer');
+
+ /// A list to store all registered [ServiceProvider] instances.
+ ///
+ /// This private field maintains an ordered collection of service providers
+ /// that have been added to the container. The order of providers in this list
+ /// is significant, as it determines the sequence in which they are configured
+ /// and booted.
+ ///
+ /// Service providers are typically added to this list through the [addProvider]
+ /// method, which also sorts them based on their priority.
+ final List _providers = [];
+
+ /// Constructs a new [ServiceProviderContainer] instance.
+ ///
+ /// This constructor initializes a [ServiceProviderContainer] with the provided [reflector].
+ /// The [reflector] is passed to the superclass constructor and is used for reflection-based
+ /// operations, such as discovering and instantiating service providers.
+ ///
+ /// Parameters:
+ /// - [reflector]: An instance of a reflector that complies with the requirements of the
+ /// superclass [Container]. This reflector is used for introspection and dynamic
+ /// instantiation of service providers.
+ ///
+ /// Example:
+ /// ```dart
+ /// var container = ServiceProviderContainer(myReflector);
+ /// ```
+ ServiceProviderContainer(super.reflector);
+
+ /// Adds a [ServiceProvider] to the container and sorts the providers by priority.
+ ///
+ /// This method performs the following operations:
+ /// 1. Adds the given [provider] to the internal list of providers.
+ /// 2. Sorts the list of providers based on their priority in descending order.
+ /// 3. Logs the addition of the provider.
+ ///
+ /// If any exception occurs during this process, it logs the error and rethrows the exception.
+ ///
+ /// Parameters:
+ /// - [provider]: The [ServiceProvider] instance to be added to the container.
+ ///
+ /// Throws:
+ /// Any exception that occurs during the addition or sorting process.
+ ///
+ /// Example:
+ /// ```dart
+ /// container.addProvider(MyServiceProvider());
+ /// ```
+ void addProvider(ServiceProvider provider) {
+ try {
+ _providers.add(provider);
+ _providers.sort((a, b) => b.priority.compareTo(a.priority));
+ _logger.info('Added provider: ${provider.runtimeType.toString()}');
+ } catch (e, stackTrace) {
+ _logger.severe('Error adding provider', e, stackTrace);
+ rethrow;
+ }
+ }
+
+ /// Boots all registered service providers that are ready to be registered.
+ ///
+ /// This method iterates through all registered service providers and calls
+ /// their `boot` method if they are ready to be registered. It handles the
+ /// booting process for each provider and logs any errors that occur.
+ ///
+ /// Parameters:
+ /// - [app]: The [Angel] instance that providers will use for booting.
+ ///
+ /// Throws:
+ /// Any exception that occurs during the booting process of a provider.
+ /// The exception is logged before being rethrown.
+ ///
+ /// Note:
+ /// - Only providers that return true for `isReadyToRegister(app)` are booted.
+ /// - If an error occurs while booting a provider, it's logged and rethrown,
+ /// which may interrupt the booting process for subsequent providers.
+ void bootProviders(Angel app) {
+ for (var provider in _providers) {
+ if (provider.isReadyToRegister(app)) {
+ try {
+ provider.boot(app);
+ } catch (e, stackTrace) {
+ _logger.severe(
+ 'Error booting provider: ${provider.runtimeType}', e, stackTrace);
+ rethrow;
+ }
+ }
+ }
+ }
+
+ /// Configures all registered service providers that are ready to be registered.
+ ///
+ /// This method iterates through all registered service providers and calls
+ /// their `register` method if they are ready to be registered. It handles the
+ /// configuration process for each provider and logs any errors that occur.
+ ///
+ /// Parameters:
+ /// - [app]: The [Angel] instance that providers will use for configuration.
+ ///
+ /// Throws:
+ /// Any exception that occurs during the configuration process of a provider.
+ /// The exception is logged before being rethrown.
+ ///
+ /// Note:
+ /// - Only providers that return true for `isReadyToRegister(app)` are configured.
+ /// - If an error occurs while configuring a provider, it's logged and rethrown,
+ /// which may interrupt the configuration process for subsequent providers.
+ void configureProviders(Angel app) {
+ for (var provider in _providers) {
+ if (provider.isReadyToRegister(app)) {
+ try {
+ provider.register(this, app);
+ } catch (e, stackTrace) {
+ _logger.severe('Error configuring provider: ${provider.runtimeType}',
+ e, stackTrace);
+ rethrow;
+ }
+ }
+ }
+ }
+
+ /// Discovers and adds service providers to the container using reflection.
+ ///
+ /// This method iterates through all classes annotated with [discoverableServiceProvider],
+ /// checks if they are non-abstract subclasses of [ServiceProvider], and if so,
+ /// instantiates and adds them to the container.
+ ///
+ /// The discovery process includes:
+ /// 1. Iterating through annotated classes.
+ /// 2. Checking if each class is a non-abstract ServiceProvider.
+ /// 3. Instantiating the provider and adding it to the container.
+ /// 4. Logging successful additions and any errors encountered.
+ ///
+ /// If an error occurs during the instantiation of a specific provider,
+ /// it is logged as a warning, and the method continues with the next provider.
+ /// If a general error occurs during the discovery process, it is logged
+ /// as a severe error and rethrown.
+ ///
+ /// This method is useful for automatically registering service providers
+ /// without manual instantiation and addition.
+ ///
+ /// Throws:
+ /// Any exception that occurs during the general discovery process,
+ /// excluding individual provider instantiation errors.
+ void discoverProviders() {
+ try {
+ for (var classMirror in discoverableServiceProvider.annotatedClasses) {
+ if (_isServiceProvider(classMirror) && !classMirror.isAbstract) {
+ try {
+ var provider = classMirror.newInstance('', []) as ServiceProvider;
+ addProvider(provider);
+ _logger.info(
+ 'Discovered and added provider: ${classMirror.simpleName}');
+ } catch (e, stackTrace) {
+ _logger.warning(
+ 'Error instantiating provider: ${classMirror.simpleName}',
+ e,
+ stackTrace);
+ // Continue to the next provider instead of rethrowing
+ }
+ }
+ }
+ } catch (e, stackTrace) {
+ _logger.severe('Error discovering providers', e, stackTrace);
+ rethrow;
+ }
+ }
+
+ /// Determines if a given ClassMirror represents a subclass of ServiceProvider.
+ ///
+ /// This method traverses the inheritance hierarchy of the provided [classMirror]
+ /// to check if it is a subclass of ServiceProvider. It does this by comparing
+ /// the simple name of each superclass with 'ServiceProvider'.
+ ///
+ /// Parameters:
+ /// - [classMirror]: The ClassMirror to check.
+ ///
+ /// Returns:
+ /// true if the class is a subclass of ServiceProvider, false otherwise.
+ ///
+ /// Note:
+ /// This method assumes that the ServiceProvider class is named exactly
+ /// 'ServiceProvider'. It will not detect classes that implement an interface
+ /// named ServiceProvider or classes that are renamed through imports.
+ bool _isServiceProvider(ClassMirror classMirror) {
+ ClassMirror? currentMirror = classMirror;
+ while (currentMirror != null) {
+ if (currentMirror.simpleName == 'ServiceProvider') {
+ return true;
+ }
+ currentMirror = currentMirror.superclass;
+ }
+ return false;
+ }
+}
+
+/// Extension on [Angel] to provide service provider functionality.
+extension ServiceProviderExtension on Angel {
+ /// A static logger instance for the ServiceProviderExtension.
+ ///
+ /// This logger is used throughout the ServiceProviderExtension to log
+ /// information, warnings, and errors related to service provider operations.
+ /// It is initialized with the name 'ServiceProviderExtension' to easily
+ /// identify log messages originating from this extension.
+ static final Logger _logger = Logger('ServiceProviderExtension');
+
+ /// Adds a [ServiceProvider] to the Angel's container.
+ ///
+ /// This method attempts to add the given [provider] to the Angel's
+ /// container. It performs the following steps:
+ ///
+ /// 1. Checks if the Angel's container is an instance of [ServiceProviderContainer].
+ /// 2. If it is, adds the provider to the container using the [addProvider] method.
+ /// 3. If it's not, throws an exception indicating that the container must be a [ServiceProviderContainer].
+ ///
+ /// If any error occurs during this process, it logs a severe error message
+ /// and rethrows the exception.
+ ///
+ /// Parameters:
+ /// - [provider]: The [ServiceProvider] instance to be added to the container.
+ ///
+ /// Throws:
+ /// - [Exception] if the Angel's container is not a [ServiceProviderContainer].
+ /// - Any other exception that occurs during the process of adding the provider.
+ ///
+ /// Usage:
+ /// ```dart
+ /// app.useServiceProvider(MyServiceProvider());
+ /// ```
+ void useServiceProvider(ServiceProvider provider) {
+ try {
+ if (container is ServiceProviderContainer) {
+ (container as ServiceProviderContainer).addProvider(provider);
+ } else {
+ throw Exception('Angel container must be a ServiceProviderContainer');
+ }
+ } catch (e, stackTrace) {
+ _logger.severe('Error using service provider', e, stackTrace);
+ rethrow;
+ }
+ }
+
+ /// Configures all registered service providers in the Angel's container.
+ ///
+ /// This method attempts to configure the service providers by calling the
+ /// `configureProviders` method on the Angel's container. It performs
+ /// the following steps:
+ ///
+ /// 1. Checks if the Angel's container is an instance of [ServiceProviderContainer].
+ /// 2. If it is, calls the `configureProviders` method on the container, passing `this` (the Angel).
+ /// 3. If it's not, throws an exception indicating that the container must be a [ServiceProviderContainer].
+ ///
+ /// If any error occurs during this process, it logs a severe error message
+ /// and rethrows the exception.
+ ///
+ /// Throws:
+ /// - [Exception] if the Angel's container is not a [ServiceProviderContainer].
+ /// - Any other exception that occurs during the configuration process.
+ ///
+ /// Usage:
+ /// ```dart
+ /// app.configureProviders();
+ /// ```
+ void configureProviders() {
+ try {
+ if (container is ServiceProviderContainer) {
+ (container as ServiceProviderContainer).configureProviders(this);
+ } else {
+ throw Exception('Angel container must be a ServiceProviderContainer');
+ }
+ } catch (e, stackTrace) {
+ _logger.severe('Error configuring providers', e, stackTrace);
+ rethrow;
+ }
+ }
+
+ /// Registers and boots all service providers in the Angel's container.
+ ///
+ /// This method performs the following operations:
+ /// 1. Checks if the Angel's container is an instance of [ServiceProviderContainer].
+ /// 2. If it is, it casts the container to [ServiceProviderContainer].
+ /// 3. Calls [configureProviders] on the container to register the providers.
+ /// 4. Calls [bootProviders] on the container to initialize the providers.
+ ///
+ /// If the container is not a [ServiceProviderContainer], it throws an exception.
+ ///
+ /// This method is typically called after all service providers have been added
+ /// to the container, either manually or through discovery.
+ ///
+ /// Throws:
+ /// - [Exception] if the Angel's container is not a [ServiceProviderContainer].
+ /// - Any other exception that occurs during the registration or booting process.
+ /// These exceptions are logged before being rethrown.
+ ///
+ /// Usage:
+ /// ```dart
+ /// app.registerAndBootProviders();
+ /// ```
+ void registerAndBootProviders() {
+ try {
+ if (container is ServiceProviderContainer) {
+ var providerContainer = container as ServiceProviderContainer;
+ providerContainer.configureProviders(this);
+ providerContainer.bootProviders(this);
+ } else {
+ throw Exception('Angel container must be a ServiceProviderContainer');
+ }
+ } catch (e, stackTrace) {
+ _logger.severe('Error registering and booting providers', e, stackTrace);
+ rethrow;
+ }
+ }
+
+ /// Discovers, registers, and boots all service providers in the Angel.
+ ///
+ /// This method performs a complete lifecycle for service providers:
+ /// 1. Discovers providers using reflection (if the container supports it).
+ /// 2. Configures the discovered providers.
+ /// 3. Registers and boots the providers.
+ ///
+ /// The process includes:
+ /// - Checking if the Angel's container is a [ServiceProviderContainer].
+ /// - Calling [discoverProviders] to find and instantiate providers.
+ /// - Calling [configureProviders] to set up the providers.
+ /// - Calling [registerAndBootProviders] to finalize provider initialization.
+ ///
+ /// If the container is not a [ServiceProviderContainer], an exception is thrown.
+ ///
+ /// This method is typically called once during Angel startup to set up
+ /// all service providers automatically.
+ ///
+ /// Throws:
+ /// - [Exception] if the Angel's container is not a [ServiceProviderContainer].
+ /// - Any exceptions that occur during the discovery, configuration, or booting process.
+ /// These exceptions are logged before being rethrown.
+ ///
+ /// Usage:
+ /// ```dart
+ /// app.discoverAndRegisterProviders();
+ /// ```
+ void discoverAndRegisterProviders() {
+ try {
+ if (container is ServiceProviderContainer) {
+ (container as ServiceProviderContainer).discoverProviders();
+ configureProviders();
+ registerAndBootProviders();
+ } else {
+ throw Exception('Angel container must be a ServiceProviderContainer');
+ }
+ } catch (e, stackTrace) {
+ _logger.severe(
+ 'Error discovering and registering providers', e, stackTrace);
+ rethrow;
+ }
+ }
+}
diff --git a/core/support/melos_angel3_support.iml b/core/support/melos_angel3_support.iml
new file mode 100644
index 00000000..389d07a1
--- /dev/null
+++ b/core/support/melos_angel3_support.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/support/pubspec.yaml b/core/support/pubspec.yaml
new file mode 100644
index 00000000..efbe5f32
--- /dev/null
+++ b/core/support/pubspec.yaml
@@ -0,0 +1,34 @@
+name: angel3_support
+description: The Support Package for the Protevus Platform
+version: 0.0.1
+homepage: https://protevus.com
+documentation: https://docs.protevus.com
+repository: https://github.com/protevus/platformo
+
+environment:
+ sdk: ^3.4.2
+
+# Add regular dependencies here.
+dependencies:
+ angel3_framework: ^7.0.0
+ angel3_configuration: ^9.0.0
+ angel3_container: ^9.0.0
+ angel3_migration: ^9.0.0
+ angel3_orm: ^9.0.0
+ angel3_route: ^9.0.0
+ angel3_validate: ^9.0.0
+ collection: ^1.15.0
+ file: ^7.0.0
+ get_it: ^7.7.0
+ injectable: ^2.4.4
+ logging: ^1.0.0
+ meta: ^1.3.0
+ mockito: ^5.4.4
+ path: ^1.8.0
+ reflectable: ^4.0.9
+
+dev_dependencies:
+ build_runner: ^2.3.3
+ build_test: ^2.1.0
+ lints: ^3.0.0
+ test: ^1.24.0
diff --git a/core/support/test/.gitkeep b/core/support/test/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/core/support/test/service_provider_test.dart b/core/support/test/service_provider_test.dart
new file mode 100644
index 00000000..aacb0c71
--- /dev/null
+++ b/core/support/test/service_provider_test.dart
@@ -0,0 +1,167 @@
+/*
+ * This file is part of the Protevus Platform.
+ *
+ * (C) Protevus
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+import 'package:mockito/annotations.dart';
+import 'package:mockito/mockito.dart';
+import 'package:test/test.dart';
+import 'package:angel3_container/angel3_container.dart';
+import 'package:angel3_framework/angel3_framework.dart';
+import 'package:logging/logging.dart';
+import 'package:angel3_support/service_provider.dart';
+
+@GenerateMocks([Logger, Container, Angel])
+import 'service_provider_test.mocks.dart';
+
+class TestServiceProvider extends ServiceProvider {
+ @override
+ void register(Container container, Angel app) {
+ try {
+ ServiceProvider.logger.info('Registering TestServiceProvider');
+ container.registerSingleton('test', as: null);
+ } catch (e, stackTrace) {
+ ServiceProvider.logger
+ .severe('Error registering TestServiceProvider', e, stackTrace);
+ rethrow;
+ }
+ }
+
+ @override
+ Future boot(Angel app) async {
+ try {
+ ServiceProvider.logger.info('Booting TestServiceProvider');
+ await app.configure((_) => null);
+ } catch (e, stackTrace) {
+ ServiceProvider.logger
+ .severe('Error booting TestServiceProvider', e, stackTrace);
+ rethrow;
+ }
+ }
+}
+
+void main() {
+ late MockContainer mockContainer;
+ late MockAngel mockAngel;
+ late MockLogger mockLogger;
+ late TestServiceProvider serviceProvider;
+
+ setUp(() {
+ mockContainer = MockContainer();
+ mockAngel = MockAngel();
+ mockLogger = MockLogger();
+ ServiceProvider.setLogger(mockLogger); // Set the mock logger
+ serviceProvider = TestServiceProvider();
+
+ // Setup default stubs
+ when(mockContainer.registerSingleton(any, as: anyNamed('as')))
+ .thenReturn('default');
+ when(mockContainer.registerFactory(any, as: anyNamed('as')))
+ .thenReturn((Container c) => 'default');
+ when(mockAngel.configure(any)).thenAnswer((_) async {});
+
+ // Allow any severe logging
+ when(mockLogger.info(any)).thenReturn(null);
+ when(mockLogger.severe(any, any, any)).thenReturn(null);
+ });
+
+ test('register method logs info and calls actual registration logic', () {
+ serviceProvider.register(mockContainer, mockAngel);
+ verify(mockLogger.info('Registering TestServiceProvider')).called(1);
+ });
+
+ test('boot method logs info and calls actual booting logic', () async {
+ await serviceProvider.boot(mockAngel);
+ verify(mockLogger.info('Booting TestServiceProvider')).called(1);
+ });
+
+ test('isDeferred returns false by default', () {
+ expect(serviceProvider.isDeferred, isFalse);
+ });
+
+ test('provides returns an empty list by default', () {
+ expect(serviceProvider.provides, isEmpty);
+ });
+
+ test('when returns true by default', () {
+ expect(serviceProvider.when(mockAngel), isTrue);
+ });
+
+ test(
+ 'isReadyToRegister returns true when not deferred and when condition is met',
+ () {
+ expect(serviceProvider.isReadyToRegister(mockAngel), isTrue);
+ });
+
+ test('singleton method registers a singleton in the container', () {
+ final instance = 'test instance';
+ serviceProvider.singleton(mockContainer, instance);
+ verify(mockContainer.registerSingleton(instance, as: null))
+ .called(1);
+ });
+
+ test('bind method registers a factory in the container', () {
+ String factory(Container c) => 'test instance';
+ serviceProvider.bind(mockContainer, factory);
+ verify(mockContainer.registerFactory(any, as: null)).called(1);
+ });
+
+ test('error in register method is thrown', () {
+ when(mockContainer.registerSingleton('test', as: null))
+ .thenThrow(Exception('Test error'));
+
+ expect(
+ () => serviceProvider.register(mockContainer, mockAngel),
+ throwsException,
+ );
+ });
+
+ test('error in boot method is thrown', () async {
+ when(mockAngel.configure(any)).thenThrow(Exception('Test error'));
+
+ await expectLater(
+ () => serviceProvider.boot(mockAngel),
+ throwsException,
+ );
+ });
+
+ test('error in register method is logged', () {
+ when(mockContainer.registerSingleton('test', as: null))
+ .thenThrow(Exception('Test error'));
+
+ expect(
+ () => serviceProvider.register(mockContainer, mockAngel),
+ throwsException,
+ );
+
+ final captured =
+ verify(mockLogger.severe(captureAny, captureAny, captureAny)).captured;
+ expect(captured[0], 'Error registering TestServiceProvider');
+ expect(captured[1], isA());
+ expect(captured[2], isA());
+ });
+
+ test('error in boot method is logged', () async {
+ when(mockAngel.configure(any)).thenThrow(Exception('Test error'));
+
+ await expectLater(
+ () => serviceProvider.boot(mockAngel),
+ throwsException,
+ );
+
+ final captured =
+ verify(mockLogger.severe(captureAny, captureAny, captureAny)).captured;
+ expect(captured[0], 'Error booting TestServiceProvider');
+ expect(captured[1], isA());
+ expect(captured[2], isA());
+ });
+
+ tearDown(() {
+ // Reset the logger to its original state after each test
+ ServiceProvider.setLogger(Logger('ServiceProvider'));
+ });
+}
diff --git a/core/support/test/service_provider_test.mocks.dart b/core/support/test/service_provider_test.mocks.dart
new file mode 100644
index 00000000..bc6fab2a
--- /dev/null
+++ b/core/support/test/service_provider_test.mocks.dart
@@ -0,0 +1,1569 @@
+// Mocks generated by Mockito 5.4.4 from annotations
+// in angel3_support/test/service_provider_test.dart.
+// Do not manually edit this file.
+
+// ignore_for_file: no_leading_underscores_for_library_prefixes
+import 'dart:async' as _i5;
+import 'dart:convert' as _i17;
+
+import 'package:angel3_container/angel3_container.dart' as _i4;
+import 'package:angel3_container/src/reflector.dart' as _i3;
+import 'package:angel3_framework/src/core/controller.dart' as _i22;
+import 'package:angel3_framework/src/core/env.dart' as _i7;
+import 'package:angel3_framework/src/core/hooked_service.dart' as _i11;
+import 'package:angel3_framework/src/core/request_context.dart' as _i20;
+import 'package:angel3_framework/src/core/response_context.dart' as _i21;
+import 'package:angel3_framework/src/core/routable.dart' as _i18;
+import 'package:angel3_framework/src/core/server.dart' as _i14;
+import 'package:angel3_framework/src/core/service.dart' as _i10;
+import 'package:angel3_http_exception/angel3_http_exception.dart' as _i19;
+import 'package:angel3_route/angel3_route.dart' as _i8;
+import 'package:belatuk_combinator/belatuk_combinator.dart' as _i16;
+import 'package:logging/logging.dart' as _i9;
+import 'package:logging/src/level.dart' as _i2;
+import 'package:logging/src/log_record.dart' as _i13;
+import 'package:mime/mime.dart' as _i6;
+import 'package:mockito/mockito.dart' as _i1;
+import 'package:mockito/src/dummies.dart' as _i12;
+import 'package:tuple/tuple.dart' as _i15;
+
+// ignore_for_file: type=lint
+// ignore_for_file: avoid_redundant_argument_values
+// ignore_for_file: avoid_setters_without_getters
+// ignore_for_file: comment_references
+// ignore_for_file: deprecated_member_use
+// ignore_for_file: deprecated_member_use_from_same_package
+// ignore_for_file: implementation_imports
+// ignore_for_file: invalid_use_of_visible_for_testing_member
+// ignore_for_file: prefer_const_constructors
+// ignore_for_file: unnecessary_parenthesis
+// ignore_for_file: camel_case_types
+// ignore_for_file: subtype_of_sealed_class
+
+class _FakeLevel_0 extends _i1.SmartFake implements _i2.Level {
+ _FakeLevel_0(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeReflector_1 extends _i1.SmartFake implements _i3.Reflector {
+ _FakeReflector_1(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeContainer_2 extends _i1.SmartFake implements _i4.Container {
+ _FakeContainer_2(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeFuture_3 extends _i1.SmartFake implements _i5.Future {
+ _FakeFuture_3(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeMimeTypeResolver_4 extends _i1.SmartFake
+ implements _i6.MimeTypeResolver {
+ _FakeMimeTypeResolver_4(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeAngelEnvironment_5 extends _i1.SmartFake
+ implements _i7.AngelEnvironment {
+ _FakeAngelEnvironment_5(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeRouter_6 extends _i1.SmartFake implements _i8.Router {
+ _FakeRouter_6(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeLogger_7 extends _i1.SmartFake implements _i9.Logger {
+ _FakeLogger_7(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeRoute_8 extends _i1.SmartFake implements _i8.Route {
+ _FakeRoute_8(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeSymlinkRoute_9 extends _i1.SmartFake
+ implements _i8.SymlinkRoute {
+ _FakeSymlinkRoute_9(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeHookedService_10>
+ extends _i1.SmartFake implements _i11.HookedService {
+ _FakeHookedService_10(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+class _FakeChainedRouter_11 extends _i1.SmartFake
+ implements _i8.ChainedRouter {
+ _FakeChainedRouter_11(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+/// A class which mocks [Logger].
+///
+/// See the documentation for Mockito's code generation for more information.
+class MockLogger extends _i1.Mock implements _i9.Logger {
+ MockLogger() {
+ _i1.throwOnMissingStub(this);
+ }
+
+ @override
+ String get name => (super.noSuchMethod(
+ Invocation.getter(#name),
+ returnValue: _i12.dummyValue(
+ this,
+ Invocation.getter(#name),
+ ),
+ ) as String);
+
+ @override
+ Map get children => (super.noSuchMethod(
+ Invocation.getter(#children),
+ returnValue: {},
+ ) as Map);
+
+ @override
+ String get fullName => (super.noSuchMethod(
+ Invocation.getter(#fullName),
+ returnValue: _i12.dummyValue(
+ this,
+ Invocation.getter(#fullName),
+ ),
+ ) as String);
+
+ @override
+ _i2.Level get level => (super.noSuchMethod(
+ Invocation.getter(#level),
+ returnValue: _FakeLevel_0(
+ this,
+ Invocation.getter(#level),
+ ),
+ ) as _i2.Level);
+
+ @override
+ set level(_i2.Level? value) => super.noSuchMethod(
+ Invocation.setter(
+ #level,
+ value,
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ _i5.Stream<_i2.Level?> get onLevelChanged => (super.noSuchMethod(
+ Invocation.getter(#onLevelChanged),
+ returnValue: _i5.Stream<_i2.Level?>.empty(),
+ ) as _i5.Stream<_i2.Level?>);
+
+ @override
+ _i5.Stream<_i13.LogRecord> get onRecord => (super.noSuchMethod(
+ Invocation.getter(#onRecord),
+ returnValue: _i5.Stream<_i13.LogRecord>.empty(),
+ ) as _i5.Stream<_i13.LogRecord>);
+
+ @override
+ void clearListeners() => super.noSuchMethod(
+ Invocation.method(
+ #clearListeners,
+ [],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ bool isLoggable(_i2.Level? value) => (super.noSuchMethod(
+ Invocation.method(
+ #isLoggable,
+ [value],
+ ),
+ returnValue: false,
+ ) as bool);
+
+ @override
+ void log(
+ _i2.Level? logLevel,
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ _i5.Zone? zone,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #log,
+ [
+ logLevel,
+ message,
+ error,
+ stackTrace,
+ zone,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void finest(
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #finest,
+ [
+ message,
+ error,
+ stackTrace,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void finer(
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #finer,
+ [
+ message,
+ error,
+ stackTrace,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void fine(
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #fine,
+ [
+ message,
+ error,
+ stackTrace,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void config(
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #config,
+ [
+ message,
+ error,
+ stackTrace,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void info(
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #info,
+ [
+ message,
+ error,
+ stackTrace,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void warning(
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #warning,
+ [
+ message,
+ error,
+ stackTrace,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void severe(
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #severe,
+ [
+ message,
+ error,
+ stackTrace,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void shout(
+ Object? message, [
+ Object? error,
+ StackTrace? stackTrace,
+ ]) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #shout,
+ [
+ message,
+ error,
+ stackTrace,
+ ],
+ ),
+ returnValueForMissingStub: null,
+ );
+}
+
+/// A class which mocks [Container].
+///
+/// See the documentation for Mockito's code generation for more information.
+class MockContainer extends _i1.Mock implements _i4.Container {
+ MockContainer() {
+ _i1.throwOnMissingStub(this);
+ }
+
+ @override
+ _i3.Reflector get reflector => (super.noSuchMethod(
+ Invocation.getter(#reflector),
+ returnValue: _FakeReflector_1(
+ this,
+ Invocation.getter(#reflector),
+ ),
+ ) as _i3.Reflector);
+
+ @override
+ bool get isRoot => (super.noSuchMethod(
+ Invocation.getter(#isRoot),
+ returnValue: false,
+ ) as bool);
+
+ @override
+ _i4.Container createChild() => (super.noSuchMethod(
+ Invocation.method(
+ #createChild,
+ [],
+ ),
+ returnValue: _FakeContainer_2(
+ this,
+ Invocation.method(
+ #createChild,
+ [],
+ ),
+ ),
+ ) as _i4.Container);
+
+ @override
+ bool has([Type? t]) => (super.noSuchMethod(
+ Invocation.method(
+ #has,
+ [t],
+ ),
+ returnValue: false,
+ ) as bool);
+
+ @override
+ bool hasNamed(String? name) => (super.noSuchMethod(
+ Invocation.method(
+ #hasNamed,
+ [name],
+ ),
+ returnValue: false,
+ ) as bool);
+
+ @override
+ _i5.Future makeAsync([Type? type]) => (super.noSuchMethod(
+ Invocation.method(
+ #makeAsync,
+ [type],
+ ),
+ returnValue: _i12.ifNotNull(
+ _i12.dummyValueOrNull(
+ this,
+ Invocation.method(
+ #makeAsync,
+ [type],
+ ),
+ ),
+ (T v) => _i5.Future.value(v),
+ ) ??
+ _FakeFuture_3(
+ this,
+ Invocation.method(
+ #makeAsync,
+ [type],
+ ),
+ ),
+ ) as _i5.Future);
+
+ @override
+ T make([Type? type]) => (super.noSuchMethod(
+ Invocation.method(
+ #make,
+ [type],
+ ),
+ returnValue: _i12.dummyValue(
+ this,
+ Invocation.method(
+ #make,
+ [type],
+ ),
+ ),
+ ) as T);
+
+ @override
+ T Function(_i4.Container) registerLazySingleton(
+ T Function(_i4.Container)? f, {
+ Type? as,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #registerLazySingleton,
+ [f],
+ {#as: as},
+ ),
+ returnValue: (_i4.Container __p0) => _i12.dummyValue(
+ this,
+ Invocation.method(
+ #registerLazySingleton,
+ [f],
+ {#as: as},
+ ),
+ ),
+ ) as T Function(_i4.Container));
+
+ @override
+ T Function(_i4.Container) registerFactory(
+ T Function(_i4.Container)? f, {
+ Type? as,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #registerFactory,
+ [f],
+ {#as: as},
+ ),
+ returnValue: (_i4.Container __p0) => _i12.dummyValue(
+ this,
+ Invocation.method(
+ #registerFactory,
+ [f],
+ {#as: as},
+ ),
+ ),
+ ) as T Function(_i4.Container));
+
+ @override
+ T registerSingleton(
+ T? object, {
+ Type? as,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #registerSingleton,
+ [object],
+ {#as: as},
+ ),
+ returnValue: _i12.dummyValue(
+ this,
+ Invocation.method(
+ #registerSingleton,
+ [object],
+ {#as: as},
+ ),
+ ),
+ ) as T);
+
+ @override
+ T findByName(String? name) => (super.noSuchMethod(
+ Invocation.method(
+ #findByName,
+ [name],
+ ),
+ returnValue: _i12.dummyValue(
+ this,
+ Invocation.method(
+ #findByName,
+ [name],
+ ),
+ ),
+ ) as T);
+
+ @override
+ T registerNamedSingleton(
+ String? name,
+ T? object,
+ ) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #registerNamedSingleton,
+ [
+ name,
+ object,
+ ],
+ ),
+ returnValue: _i12.dummyValue(
+ this,
+ Invocation.method(
+ #registerNamedSingleton,
+ [
+ name,
+ object,
+ ],
+ ),
+ ),
+ ) as T);
+
+ @override
+ void registerScoped(T Function(_i4.Container)? factory) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #registerScoped,
+ [factory],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void registerTransient(T Function(_i4.Container)? factory) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #registerTransient,
+ [factory],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ void registerConstant(T? value) => super.noSuchMethod(
+ Invocation.method(
+ #registerConstant,
+ [value],
+ ),
+ returnValueForMissingStub: null,
+ );
+}
+
+/// A class which mocks [Angel].
+///
+/// See the documentation for Mockito's code generation for more information.
+class MockAngel extends _i1.Mock implements _i14.Angel {
+ MockAngel() {
+ _i1.throwOnMissingStub(this);
+ }
+
+ @override
+ Map<
+ String,
+ _i15.Tuple4<
+ List,
+ Map,
+ _i16.ParseResult<_i8.RouteResult>,
+ _i8.MiddlewarePipeline>> get handlerCache =>
+ (super.noSuchMethod(
+ Invocation.getter(#handlerCache),
+ returnValue: ,
+ Map,
+ _i16.ParseResult<_i8.RouteResult>,
+ _i8.MiddlewarePipeline>>{},
+ ) as Map<
+ String,
+ _i15.Tuple4<
+ List,
+ Map,
+ _i16.ParseResult<_i8.RouteResult>,
+ _i8.MiddlewarePipeline>>);
+
+ @override
+ Map, List>> get encoders =>
+ (super.noSuchMethod(
+ Invocation.getter(#encoders),
+ returnValue: , List>>{},
+ ) as Map, List>>);
+
+ @override
+ _i6.MimeTypeResolver get mimeTypeResolver => (super.noSuchMethod(
+ Invocation.getter(#mimeTypeResolver),
+ returnValue: _FakeMimeTypeResolver_4(
+ this,
+ Invocation.getter(#mimeTypeResolver),
+ ),
+ ) as _i6.MimeTypeResolver);
+
+ @override
+ set serializer(_i5.FutureOr Function(dynamic)? _serializer) =>
+ super.noSuchMethod(
+ Invocation.setter(
+ #serializer,
+ _serializer,
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ bool get allowMethodOverrides => (super.noSuchMethod(
+ Invocation.getter(#allowMethodOverrides),
+ returnValue: false,
+ ) as bool);
+
+ @override
+ set allowMethodOverrides(bool? _allowMethodOverrides) => super.noSuchMethod(
+ Invocation.setter(
+ #allowMethodOverrides,
+ _allowMethodOverrides,
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ _i7.AngelEnvironment get environment => (super.noSuchMethod(
+ Invocation.getter(#environment),
+ returnValue: _FakeAngelEnvironment_5(
+ this,
+ Invocation.getter(#environment),
+ ),
+ ) as _i7.AngelEnvironment);
+
+ @override
+ List<_i14.AngelConfigurer> get startupHooks => (super.noSuchMethod(
+ Invocation.getter(#startupHooks),
+ returnValue: <_i14.AngelConfigurer>[],
+ ) as List<_i14.AngelConfigurer>);
+
+ @override
+ List<_i14.AngelConfigurer> get shutdownHooks => (super.noSuchMethod(
+ Invocation.getter(#shutdownHooks),
+ returnValue: <_i14.AngelConfigurer>[],
+ ) as List<_i14.AngelConfigurer>);
+
+ @override
+ List<_i18.RequestHandler> get responseFinalizers => (super.noSuchMethod(
+ Invocation.getter(#responseFinalizers),
+ returnValue: <_i18.RequestHandler>[],
+ ) as List<_i18.RequestHandler>);
+
+ @override
+ set viewGenerator(_i14.ViewGenerator? _viewGenerator) => super.noSuchMethod(
+ Invocation.setter(
+ #viewGenerator,
+ _viewGenerator,
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ _i14.AngelErrorHandler get errorHandler => (super.noSuchMethod(
+ Invocation.getter(#errorHandler),
+ returnValue: (
+ _i19.AngelHttpException e,
+ _i20.RequestContext req,
+ _i21.ResponseContext res,
+ ) =>
+ null,
+ ) as _i14.AngelErrorHandler);
+
+ @override
+ set errorHandler(_i14.AngelErrorHandler? _errorHandler) => super.noSuchMethod(
+ Invocation.setter(
+ #errorHandler,
+ _errorHandler,
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ Map get preContained => (super.noSuchMethod(
+ Invocation.getter(#preContained),
+ returnValue: {},
+ ) as Map);
+
+ @override
+ _i8.Router<_i18.RequestHandler> get optimizedRouter => (super.noSuchMethod(
+ Invocation.getter(#optimizedRouter),
+ returnValue: _FakeRouter_6<_i18.RequestHandler>(
+ this,
+ Invocation.getter(#optimizedRouter),
+ ),
+ ) as _i8.Router<_i18.RequestHandler>);
+
+ @override
+ List<_i14.Angel> get children => (super.noSuchMethod(
+ Invocation.getter(#children),
+ returnValue: <_i14.Angel>[],
+ ) as List<_i14.Angel>);
+
+ @override
+ Map get controllers => (super.noSuchMethod(
+ Invocation.getter(#controllers),
+ returnValue: {},
+ ) as Map);
+
+ @override
+ _i9.Logger get logger => (super.noSuchMethod(
+ Invocation.getter(#logger),
+ returnValue: _FakeLogger_7(
+ this,
+ Invocation.getter(#logger),
+ ),
+ ) as _i9.Logger);
+
+ @override
+ set logger(_i9.Logger? log) => super.noSuchMethod(
+ Invocation.setter(
+ #logger,
+ log,
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ Map get configuration => (super.noSuchMethod(
+ Invocation.getter(#configuration),
+ returnValue: {},
+ ) as Map);
+
+ @override
+ _i4.Container get container => (super.noSuchMethod(
+ Invocation.getter(#container),
+ returnValue: _FakeContainer_2(
+ this,
+ Invocation.getter(#container),
+ ),
+ ) as _i4.Container);
+
+ @override
+ Map> get services =>
+ (super.noSuchMethod(
+ Invocation.getter(#services),
+ returnValue: >{},
+ ) as Map>);
+
+ @override
+ _i5.Stream<_i10.Service> get onService =>
+ (super.noSuchMethod(
+ Invocation.getter(#onService),
+ returnValue: _i5.Stream<_i10.Service>.empty(),
+ ) as _i5.Stream<_i10.Service>);
+
+ @override
+ List<_i18.RequestHandler> get middleware => (super.noSuchMethod(
+ Invocation.getter(#middleware),
+ returnValue: <_i18.RequestHandler>[],
+ ) as List<_i18.RequestHandler>);
+
+ @override
+ Map> get mounted =>
+ (super.noSuchMethod(
+ Invocation.getter(#mounted),
+ returnValue: >{},
+ ) as Map>);
+
+ @override
+ List<_i8.Route<_i18.RequestHandler>> get routes => (super.noSuchMethod(
+ Invocation.getter(#routes),
+ returnValue: <_i8.Route<_i18.RequestHandler>>[],
+ ) as List<_i8.Route<_i18.RequestHandler>>);
+
+ @override
+ _i8.Route<_i18.RequestHandler> addRoute(
+ String? method,
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #addRoute,
+ [
+ method,
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #addRoute,
+ [
+ method,
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler>);
+
+ @override
+ _i8.SymlinkRoute<_i18.RequestHandler> mount(
+ String? path,
+ _i8.Router<_i18.RequestHandler>? router,
+ ) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #mount,
+ [
+ path,
+ router,
+ ],
+ ),
+ returnValue: _FakeSymlinkRoute_9<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #mount,
+ [
+ path,
+ router,
+ ],
+ ),
+ ),
+ ) as _i8.SymlinkRoute<_i18.RequestHandler>);
+
+ @override
+ void bootstrapContainer() => super.noSuchMethod(
+ Invocation.method(
+ #bootstrapContainer,
+ [],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ _i5.Future close() => (super.noSuchMethod(
+ Invocation.method(
+ #close,
+ [],
+ ),
+ returnValue: _i5.Future.value(),
+ returnValueForMissingStub: _i5.Future.value(),
+ ) as _i5.Future);
+
+ @override
+ void dumpTree({
+ dynamic Function(String)? callback,
+ String? header = r'Dumping route tree:',
+ String? tab = r' ',
+ bool? showMatchers = false,
+ }) =>
+ super.noSuchMethod(
+ Invocation.method(
+ #dumpTree,
+ [],
+ {
+ #callback: callback,
+ #header: header,
+ #tab: tab,
+ #showMatchers: showMatchers,
+ },
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ _i5.Future getHandlerResult(
+ dynamic handler,
+ _i20.RequestContext? req,
+ _i21.ResponseContext? res,
+ ) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #getHandlerResult,
+ [
+ handler,
+ req,
+ res,
+ ],
+ ),
+ returnValue: _i5.Future.value(),
+ ) as _i5.Future);
+
+ @override
+ _i5.Future executeHandler(
+ dynamic handler,
+ _i20.RequestContext? req,
+ _i21.ResponseContext? res,
+ ) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #executeHandler,
+ [
+ handler,
+ req,
+ res,
+ ],
+ ),
+ returnValue: _i5.Future.value(false),
+ ) as _i5.Future);
+
+ @override
+ void optimizeForProduction({bool? force = false}) => super.noSuchMethod(
+ Invocation.method(
+ #optimizeForProduction,
+ [],
+ {#force: force},
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ _i5.Future runContained(
+ Function? handler,
+ _i20.RequestContext? req,
+ _i21.ResponseContext? res, [
+ _i4.Container? container,
+ ]) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #runContained,
+ [
+ handler,
+ req,
+ res,
+ container,
+ ],
+ ),
+ returnValue: _i5.Future.value(),
+ ) as _i5.Future);
+
+ @override
+ _i5.Future runReflected(
+ Function? handler,
+ _i20.RequestContext? req,
+ _i21.ResponseContext? res, [
+ _i4.Container? container,
+ ]) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #runReflected,
+ [
+ handler,
+ req,
+ res,
+ container,
+ ],
+ ),
+ returnValue: _i5.Future.value(),
+ ) as _i5.Future);
+
+ @override
+ _i5.Future configure(_i14.AngelConfigurer? configurer) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #configure,
+ [configurer],
+ ),
+ returnValue: _i5.Future.value(),
+ ) as _i5.Future);
+
+ @override
+ _i5.Future mountController([Type? type]) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #mountController,
+ [type],
+ ),
+ returnValue: _i12.ifNotNull(
+ _i12.dummyValueOrNull(
+ this,
+ Invocation.method(
+ #mountController,
+ [type],
+ ),
+ ),
+ (T v) => _i5.Future.value(v),
+ ) ??
+ _FakeFuture_3(
+ this,
+ Invocation.method(
+ #mountController,
+ [type],
+ ),
+ ),
+ ) as _i5.Future);
+
+ @override
+ _i8.Route<_i18.RequestHandler?> fallback(_i18.RequestHandler? handler) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #fallback,
+ [handler],
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler?>(
+ this,
+ Invocation.method(
+ #fallback,
+ [handler],
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler?>);
+
+ @override
+ _i11.HookedService
+ use>(
+ String? path,
+ T? service,
+ ) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #use,
+ [
+ path,
+ service,
+ ],
+ ),
+ returnValue: _FakeHookedService_10(
+ this,
+ Invocation.method(
+ #use,
+ [
+ path,
+ service,
+ ],
+ ),
+ ),
+ ) as _i11.HookedService);
+
+ @override
+ T? findService>(Pattern? path) =>
+ (super.noSuchMethod(Invocation.method(
+ #findService,
+ [path],
+ )) as T?);
+
+ @override
+ _i10.Service? findServiceOf(Pattern? path) =>
+ (super.noSuchMethod(Invocation.method(
+ #findServiceOf,
+ [path],
+ )) as _i10.Service?);
+
+ @override
+ _i11.HookedService?
+ findHookedService>(
+ Pattern? path) =>
+ (super.noSuchMethod(Invocation.method(
+ #findHookedService,
+ [path],
+ )) as _i11.HookedService?);
+
+ @override
+ void enableCache() => super.noSuchMethod(
+ Invocation.method(
+ #enableCache,
+ [],
+ ),
+ returnValueForMissingStub: null,
+ );
+
+ @override
+ _i8.ChainedRouter<_i18.RequestHandler> chain(
+ Iterable<_i18.RequestHandler>? middleware) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #chain,
+ [middleware],
+ ),
+ returnValue: _FakeChainedRouter_11<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #chain,
+ [middleware],
+ ),
+ ),
+ ) as _i8.ChainedRouter<_i18.RequestHandler>);
+
+ @override
+ _i8.Router<_i18.RequestHandler> clone() => (super.noSuchMethod(
+ Invocation.method(
+ #clone,
+ [],
+ ),
+ returnValue: _FakeRouter_6<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #clone,
+ [],
+ ),
+ ),
+ ) as _i8.Router<_i18.RequestHandler>);
+
+ @override
+ _i8.SymlinkRoute<_i18.RequestHandler> group(
+ String? path,
+ void Function(_i8.Router<_i18.RequestHandler>)? callback, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ String? name = r'',
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #group,
+ [
+ path,
+ callback,
+ ],
+ {
+ #middleware: middleware,
+ #name: name,
+ },
+ ),
+ returnValue: _FakeSymlinkRoute_9<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #group,
+ [
+ path,
+ callback,
+ ],
+ {
+ #middleware: middleware,
+ #name: name,
+ },
+ ),
+ ),
+ ) as _i8.SymlinkRoute<_i18.RequestHandler>);
+
+ @override
+ _i5.Future<_i8.SymlinkRoute<_i18.RequestHandler>> groupAsync(
+ String? path,
+ _i5.FutureOr Function(_i8.Router<_i18.RequestHandler>)? callback, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ String? name = r'',
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #groupAsync,
+ [
+ path,
+ callback,
+ ],
+ {
+ #middleware: middleware,
+ #name: name,
+ },
+ ),
+ returnValue: _i5.Future<_i8.SymlinkRoute<_i18.RequestHandler>>.value(
+ _FakeSymlinkRoute_9<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #groupAsync,
+ [
+ path,
+ callback,
+ ],
+ {
+ #middleware: middleware,
+ #name: name,
+ },
+ ),
+ )),
+ ) as _i5.Future<_i8.SymlinkRoute<_i18.RequestHandler>>);
+
+ @override
+ String navigate(
+ Iterable? linkParams, {
+ bool? absolute = true,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #navigate,
+ [linkParams],
+ {#absolute: absolute},
+ ),
+ returnValue: _i12.dummyValue(
+ this,
+ Invocation.method(
+ #navigate,
+ [linkParams],
+ {#absolute: absolute},
+ ),
+ ),
+ ) as String);
+
+ @override
+ bool resolve(
+ String? absolute,
+ String? relative,
+ List<_i8.RoutingResult<_i18.RequestHandler?>>? out, {
+ String? method = r'GET',
+ bool? strip = true,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #resolve,
+ [
+ absolute,
+ relative,
+ out,
+ ],
+ {
+ #method: method,
+ #strip: strip,
+ },
+ ),
+ returnValue: false,
+ ) as bool);
+
+ @override
+ Iterable<_i8.RoutingResult<_i18.RequestHandler>> resolveAbsolute(
+ String? path, {
+ String? method = r'GET',
+ bool? strip = true,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #resolveAbsolute,
+ [path],
+ {
+ #method: method,
+ #strip: strip,
+ },
+ ),
+ returnValue: <_i8.RoutingResult<_i18.RequestHandler>>[],
+ ) as Iterable<_i8.RoutingResult<_i18.RequestHandler>>);
+
+ @override
+ Iterable<_i8.RoutingResult<_i18.RequestHandler>> resolveAll(
+ String? absolute,
+ String? relative, {
+ String? method = r'GET',
+ bool? strip = true,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #resolveAll,
+ [
+ absolute,
+ relative,
+ ],
+ {
+ #method: method,
+ #strip: strip,
+ },
+ ),
+ returnValue: <_i8.RoutingResult<_i18.RequestHandler>>[],
+ ) as Iterable<_i8.RoutingResult<_i18.RequestHandler>>);
+
+ @override
+ _i8.Route<_i18.RequestHandler> all(
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #all,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #all,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler>);
+
+ @override
+ _i8.Route<_i18.RequestHandler> delete(
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #delete,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #delete,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler>);
+
+ @override
+ _i8.Route<_i18.RequestHandler> get(
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #get,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #get,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler>);
+
+ @override
+ _i8.Route<_i18.RequestHandler> head(
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #head,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #head,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler>);
+
+ @override
+ _i8.Route<_i18.RequestHandler> options(
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const {},
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #options,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #options,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler>);
+
+ @override
+ _i8.Route<_i18.RequestHandler> post(
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #post,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #post,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler>);
+
+ @override
+ _i8.Route<_i18.RequestHandler> patch(
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #patch,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8<_i18.RequestHandler>(
+ this,
+ Invocation.method(
+ #patch,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route<_i18.RequestHandler>);
+
+ @override
+ _i8.Route put(
+ String? path,
+ _i18.RequestHandler? handler, {
+ Iterable<_i18.RequestHandler>? middleware = const [],
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #put,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ returnValue: _FakeRoute_8(
+ this,
+ Invocation.method(
+ #put,
+ [
+ path,
+ handler,
+ ],
+ {#middleware: middleware},
+ ),
+ ),
+ ) as _i8.Route);
+}
diff --git a/core/support/test/service_provider_test.reflectable.dart b/core/support/test/service_provider_test.reflectable.dart
new file mode 100644
index 00000000..a0cc9d15
--- /dev/null
+++ b/core/support/test/service_provider_test.reflectable.dart
@@ -0,0 +1,1168 @@
+// This file has been generated by the reflectable package.
+// https://github.com/dart-lang/reflectable.
+import 'dart:core';
+import 'dart:async' as prefix3;
+import 'package:angel3_container/src/container.dart' as prefix5;
+import 'package:angel3_framework/src/core/server.dart' as prefix6;
+import 'package:angel3_support/src/discoverable_service_provider.dart'
+ as prefix0;
+import 'package:angel3_support/src/service_provider.dart' as prefix1;
+import 'package:logging/src/logger.dart' as prefix4;
+import 'package:meta/meta.dart' as prefix2;
+
+// ignore_for_file: camel_case_types
+// ignore_for_file: implementation_imports
+// ignore_for_file: prefer_adjacent_string_concatenation
+// ignore_for_file: prefer_collection_literals
+// ignore_for_file: unnecessary_const
+// ignore_for_file: unused_import
+
+import 'package:reflectable/mirrors.dart' as m;
+import 'package:reflectable/src/reflectable_builder_based.dart' as r;
+import 'package:reflectable/reflectable.dart' as r show Reflectable;
+
+final _data = {
+ const prefix0.DiscoverableServiceProvider(): r.ReflectorData(
+ [
+ r.NonGenericClassMirrorImpl(
+ r'ServiceProvider',
+ r'.ServiceProvider',
+ 134218247,
+ 0,
+ const prefix0.DiscoverableServiceProvider(),
+ const [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 18,
+ 19,
+ 20,
+ 21
+ ],
+ const [
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 19,
+ 20
+ ],
+ const [1, 18],
+ 1,
+ {
+ r'setLogger': () => prefix1.ServiceProvider.setLogger,
+ r'logger': () => prefix1.ServiceProvider.logger
+ },
+ {},
+ {},
+ 0,
+ 0,
+ const [],
+ const [prefix0.discoverableServiceProvider],
+ null),
+ r.NonGenericClassMirrorImpl(
+ r'Object',
+ r'dart.core.Object',
+ 134217735,
+ 1,
+ const prefix0.DiscoverableServiceProvider(),
+ const [22, 23, 24, 27, 28, 29, 25, 26, 30],
+ const [22, 23, 24, 25, 26],
+ const [27, 28, 29],
+ null,
+ {
+ r'hash': () => Object.hash,
+ r'hashAll': () => Object.hashAll,
+ r'hashAllUnordered': () => Object.hashAllUnordered
+ },
+ {},
+ {r'': (bool b) => () => b ? Object() : null},
+ 1,
+ 1,
+ const [],
+ const [],
+ null)
+ ],
+ [
+ r.VariableMirrorImpl(
+ r'priority',
+ 134349829,
+ 0,
+ const prefix0.DiscoverableServiceProvider(),
+ -1,
+ 2,
+ 2, const [], const []),
+ r.MethodMirrorImpl(
+ r'setLogger',
+ 1310738,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [0],
+ const prefix0.DiscoverableServiceProvider(),
+ const [prefix2.visibleForTesting]),
+ r.MethodMirrorImpl(
+ r'register',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [1, 2],
+ const prefix0.DiscoverableServiceProvider(),
+ const [prefix2.mustCallSuper]),
+ r.MethodMirrorImpl(
+ r'boot',
+ 35651586,
+ 0,
+ -1,
+ 3,
+ 4,
+ const [-1],
+ const [3],
+ const prefix0.DiscoverableServiceProvider(),
+ const [prefix2.mustCallSuper]),
+ r.MethodMirrorImpl(
+ r'when',
+ 2097154,
+ 0,
+ -1,
+ 5,
+ 5,
+ const [],
+ const [4],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'isReadyToRegister',
+ 2097154,
+ 0,
+ -1,
+ 5,
+ 5,
+ const [],
+ const [5],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'singleton',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [6, 7],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'singletonFactory',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [8, 9],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'bind',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [10, 11],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'bindInstance',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [12, 13],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'bindIf',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [14, 15],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'bindMultiple',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [16, 17],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'alias',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [18],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'scoped',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [19, 20],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'transient',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [21, 22],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'constant',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [23, 24],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'lazySingleton',
+ 1310722,
+ 0,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [25, 26],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.ImplicitGetterMirrorImpl(
+ const prefix0.DiscoverableServiceProvider(), 0, 17),
+ r.MethodMirrorImpl(
+ r'logger',
+ 2097171,
+ 0,
+ -1,
+ 6,
+ 6,
+ const [],
+ const [],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'isDeferred',
+ 2097155,
+ 0,
+ -1,
+ 5,
+ 5,
+ const [],
+ const [],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'provides',
+ 35651587,
+ 0,
+ -1,
+ 8,
+ 9,
+ const [7],
+ const [],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'',
+ 128,
+ 0,
+ -1,
+ 0,
+ 0,
+ const [],
+ const [27],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'==',
+ 2097154,
+ 1,
+ -1,
+ 5,
+ 5,
+ const [],
+ const [28],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'toString',
+ 2097154,
+ 1,
+ -1,
+ 10,
+ 10,
+ const [],
+ const [],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'noSuchMethod',
+ 524290,
+ 1,
+ -1,
+ -1,
+ -1,
+ const [],
+ const [29],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'hashCode',
+ 2097155,
+ 1,
+ -1,
+ 2,
+ 2,
+ const [],
+ const [],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'runtimeType',
+ 2097155,
+ 1,
+ -1,
+ 7,
+ 7,
+ const [],
+ const [],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'hash',
+ 2097170,
+ 1,
+ -1,
+ 2,
+ 2,
+ const [],
+ const [
+ 30,
+ 31,
+ 32,
+ 33,
+ 34,
+ 35,
+ 36,
+ 37,
+ 38,
+ 39,
+ 40,
+ 41,
+ 42,
+ 43,
+ 44,
+ 45,
+ 46,
+ 47,
+ 48,
+ 49
+ ],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'hashAll',
+ 2097170,
+ 1,
+ -1,
+ 2,
+ 2,
+ const [],
+ const [50],
+ const prefix0.DiscoverableServiceProvider(),
+ const []),
+ r.MethodMirrorImpl(
+ r'hashAllUnordered',
+ 2097170,
+ 1,
+ -1,
+ 2,
+ 2,
+ const