package Ġcom . web performance . m use . measure ments . steps Ċ Ċ import Ġcom . fasterxml . jackson . annotation .* Ċ import Ġorg . mu set est . core .* Ċ import Ġorg . mu set est . core . plugins .* Ċ import Ġorg . mu set est . core . resource . generic .* Ċ import Ġorg . mu set est . core . resource . types .* Ċ import Ġorg . mu set est . core . values .* Ċ import Ġorg . mu set est . core . values . descriptor .* Ċ Ċ /** Ċ Ġ* Ġ@ author ĠCh ristopher ĠL ĠM err ill Ġ( see ĠLICENSE . txt Ġfor Ġlicense Ġdetails ) Ċ Ġ*/ Ċ @ M use TypeId (" step - measure ments - producer ") Ċ @ M use Sub source Descriptors ( Ċ ĉ M use Sub source Descriptor ( displayName Ġ= Ġ" Apply Ġautomatically ?", Ġdescription Ġ= Ġ" If Ġthis Ġsource Ġresolves Ġto Ġtrue , Ġthis Ġplugin Ġconfiguration Ġwill Ġbe Ġautomatically Ġapplied Ġto Ġtests ", Ġtype Ġ= ĠSub source Descriptor . Type . Named , Ġname Ġ= ĠGeneric Configurable Plugin . AUTO _ AP PLY _ PARAM ), Ċ ĉ M use Sub source Descriptor ( displayName Ġ= Ġ" Apply Ġonly Ġif ", Ġdescription Ġ= Ġ" Apply Ġonly Ġif Ġthis Ġsource Ġthis Ġsource Ġresolves Ġto Ġtrue ", Ġtype Ġ= ĠSub source Descriptor . Type . Named , Ġname Ġ= ĠGeneric Configurable Plugin . AP PLY _ CONDITION _ PARAM ), Ċ ĉ M use Sub source Descriptor ( displayName Ġ= Ġ" Step Ġtag ", Ġdescription Ġ= Ġ" If Ġthis Ġparameter Ġis Ġpresent , Ġonly Ġcollect Ġmeasurements Ġon Ġsteps Ġtagged Ġwith Ġthe Ġvalue Ġof Ġthis Ġparameter ", Ġtype Ġ= ĠSub source Descriptor . Type . Named , Ġname Ġ= ĠStep Measure ments Producer Configuration . STEP _ TAG _ PARAM , Ġoptional Ġ= Ġtrue ), Ċ ĉ M use Sub source Descriptor ( displayName Ġ= Ġ" Overall ĠAverage ", Ġdescription Ġ= Ġ" If Ġtrue , Ġcompute Ġthe Ġoverall Ġaverage Ġduration Ġof Ġall Ġmeasured Ġsteps ", Ġtype Ġ= ĠSub source Descriptor . Type . Named , Ġname Ġ= ĠStep Measure ments Producer Configuration . OVER ALL _ AVG _ PARAM , Ġoptional Ġ= Ġtrue , ĠdefaultValue Ġ= Ġ" true "), Ċ ĉ M use Sub source Descriptor ( displayName Ġ= Ġ" Completed ĠSteps ", Ġdescription Ġ= Ġ" If Ġtrue , Ġcount Ġtotal Ġsteps Ġcompleted ", Ġtype Ġ= ĠSub source Descriptor . Type . Named , Ġname Ġ= ĠStep Measure ments Producer Configuration . OVER ALL _ COMPLETED _ PARAM , Ġoptional Ġ= Ġtrue , ĠdefaultValue Ġ= Ġ" true ") Ċ ) Ċ class ĠStep Measure ments Producer Configuration Ġ: ĠGeneric Resource Configuration (), ĠPlugin Configuration Ċ { Ċ ĉ override Ġfun ĠgetType (): ĠResource Type ? Ċ ĉ { Ċĉ ĉ return ĠStep Measure ments Producer Type () Ċ ĉ } ĊĊ ĉ override Ġfun Ġcreate Plugin (): ĠStep Measure ments Producer Ċ ĉ { Ċĉ ĉ return ĠStep Measure ments Producer ( this ) Ċ ĉ } ĊĊ ĉ fun Ġcount Total Steps ( context : ĠM use ExecutionContext ): ĠBoolean Ċ ĉ { Ċĉ ĉ return Ġis Param True ( context , ĠOVER ALL _ COMPLETED _ PARAM ) Ċ ĉ } ĊĉĊ ĉ fun Ġcalculate Overall Average Duration ( context : ĠM use ExecutionContext ): ĠBoolean Ċ ĉ { Ċĉ ĉ return Ġis Param True ( context , ĠOVER ALL _ AVG _ PARAM ) Ċ ĉ } ĊĊ ĉ fun Ġis Param True ( context : ĠM use ExecutionContext , Ġparam : ĠString ): ĠBoolean Ċ ĉ { Ċĉ ĉ if Ġ( parameters Ġ!= Ġnull Ġ&& Ġparameters . containsKey ( param )) Ċĉ ĉ { Ċĉĉ ĉ val Ġconfig Ġ= Ġparameters [ param ] Ċĉĉ ĉ if Ġ( config Ġ!= Ġnull ) Ċĉĉ ĉ { Ċĉĉĉ ĉ val Ġsource Ġ= Ġconfig . create Source ( context . project ) Ċĉĉĉ ĉ val Ġvalue Ġ= Ġsource . resolve Value ( context ) Ċĉĉĉ ĉ if Ġ( value Ġis ĠBoolean ) Ċĉĉĉĉ ĉ return Ġvalue Ċĉĉĉ ĉ if Ġ(" true ". equals ( value . toString (). toLowerCase ())) Ċĉĉĉĉ ĉ return Ġtrue Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ return Ġfalse Ċ ĉ } ĊĉĊ ĉ @ JsonIgnore Ċ ĉ fun Ġget Step Tag ( context : ĠM use ExecutionContext ): ĠString ? Ċ ĉ { Ċĉ ĉ if Ġ( parameters Ġ!= Ġnull Ġ&& Ġparameters . containsKey ( STEP _ TAG _ PARAM )) Ċĉ ĉ { Ċĉĉ ĉ val Ġstep _ tag _ source _ config Ġ= Ġparameters [ STEP _ TAG _ PARAM ] Ċĉĉ ĉ if Ġ( step _ tag _ source _ config Ġ!= Ġnull ) Ċĉĉ ĉ { Ċĉĉĉ ĉ val Ġtag _ source Ġ= Ġstep _ tag _ source _ config . create Source ( context . project ) Ċĉĉĉ ĉ return Ġtag _ source . resolve Value ( context ). toString () Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ return Ġnull Ċ ĉ } ĊĉĊ ĉ class ĠStep Measure ments Producer Type Ġ: ĠResource Subtype ( TYPE _ ID , Ġ" Step ĠMeasure ments ĠProducer ", ĠStep Measure ments Producer Configuration :: class . java , ĠPlugin Configuration . Plugin Configuration ResourceType ()) Ċ ĉ { ĊĊĉ ĉ override Ġfun Ġcreate (): ĠStep Measure ments Producer Configuration Ċĉ ĉ { Ċĉĉ ĉ val Ġconfig Ġ= ĠStep Measure ments Producer Configuration () Ċĉĉ ĉ config . parameters (). add Source ( Generic Configurable Plugin . AUTO _ AP PLY _ PARAM , ĠValue Source Configuration . for Value ( true )) Ċĉĉ ĉ config . parameters (). add Source ( Generic Configurable Plugin . AP PLY _ CONDITION _ PARAM , ĠValue Source Configuration . for Value ( true )) Ċĉĉ ĉ config . parameters (). add Source ( STEP _ TAG _ PARAM , ĠValue Source Configuration . for Value (" measure ")) Ċĉĉ ĉ return Ġconfig Ċĉ ĉ } ĊĊĉ ĉ override Ġfun ĠgetDescriptor (): ĠResource Descriptor Ċĉ ĉ { Ċĉĉ ĉ return ĠDefault Resource Descriptor ( this , Ġ" Collect s Ġaggregated Ġmeasurements Ġof Ġstep Ġexecution ") Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ comp anion Ġobject Ċ ĉ { Ċĉ ĉ val ĠTYPE _ ID Ġ= ĠStep Measure ments Producer Configuration :: class . java . getAnnotation ( M use TypeId :: class . java ). value Ċĉ ĉ const Ġval ĠSTEP _ TAG _ PARAM Ġ= Ġ" ste pt ag " Ċĉ ĉ const Ġval ĠOVER ALL _ AVG _ PARAM Ġ= Ġ" overall - avg " Ċĉ ĉ const Ġval ĠOVER ALL _ COMPLETED _ PARAM Ġ= Ġ" o var all - completed " Ċ ĉ } Ċĉ Ċ } Ċ