Skip to content

SPI changes in Drone 2

Matous Jobanek edited this page Feb 2, 2016 · 2 revisions

SPI changes in Drone 2

Multiple Drone life cycle scopes

  • Class scoped life cycle

    • Drone will be prepared in the BeforeClass phase and destroyed in the AfterClass phase, resulting in a one instance for all tests.

    • For declaration is used an annotation @ClassLifecycle

  • Deployment scoped life cycle

    • Drone will be prepared in the AfterDeploy phase and destroyed in the BeforeUnDeploy phase, resulting in a one instance for all tests belonging to a deployment.

    • For declaration is used an annotation @OperateOnDeployment with a defined name of the deployment

  • Method scoped life cycle

    • Drone will be prepared in the Before phase and destroyed in the After phase, resulting in a fresh instance of drone for every test.

    • For declaration is used an annotation @MethodLifecycle

  • Default scope

    • For injection point used as a field the Class scope is used as the default scope

    • For injection point used as a method parameter of some test method the Method scope is used as the default scope

DronePoint

  • Added an injection point called DronePoint which is a unique description of a Drone in a code

  • Provides:

    • Lifecycle representing a scope the Drone belongs to

    • Qualifiers

    • A Drone type

  • The DronePoint is used there in the event calls as a parameter instead of the former two parameters - drone type and list of qualifiers

DronePointContext

  • For each DronePoint there is an unique DronePointContext which stores configuration, future instance and metadata.

DroneContext

  • All the DronePointContexts for the drone points and the global configuration are stored there in the DroneContext class. This class also allows to find drone points based on given filters.

CachingCallable

  • Added a cache CachingCallable for caching a return value of java.util.concurrent.Callable#call() and each next call of the method

Filters

  • Added filters to make finding injection points much easier:

  • Classes:

    • Utility classes:

      • DronePointFilter - Utility class used for filtering injection points.

      • FilterableResult - Utility for performing filter operation over a set of drone points.

    • Filters:

      • AnnotationFilter - for finding injection points by the qualifier

      • DeploymentFilter - for finding deployment injection points.

      • DroneInstantiatedFilter - for finding all injection points for which drone has been instantiated.

      • InverseFilter - for finding everything that its underlying one do not

      • LifecycleFilter - for finding injection points by the lifecycle.

      • QualifierFilter - for finding injection points by the qualifier.

Commands

  • Introduced a new abstraction of commands

  • They are basically events which when fired they trigger series of events and operations resulting in some complete result

  • Classes:

    • InjectionPointCommand - an abstract parent class

    • PrepareDrone - trigger the preparation of a drone

    • DestroyDrone - trigger the destruction of a drone

Events:

  • Added new couple of events:

    BeforeDroneExtensionConfigured
    AfterDroneExtensionConfigured
    • They are called before/after the drone extension is being configured

 

  • There has been replaced two couples of events:

    BeforeDroneCallableCreated
    AfterDroneConfigured
    
    BeforeDroneConfigured
    AfterDroneCallableCreated

    with one couple of events:

    BeforeDronePrepared
    AfterDronePrepared
    • They are called before/after a Drone configuration and a Drone callable instance are prepared. This ensures that both or none of the objects should be present.

 

  • Event flow:

Drone 2 event flow