Package com._1c.g5.v8.dt.ptests.aspects
Class AbstractProfilingAspect
- java.lang.Object
-
- com._1c.g5.v8.dt.ptests.aspects.AbstractProfilingAspect
-
- Direct Known Subclasses:
AbstractProfilingAspectForMethodReturnValue
,AbstractProfilingAspectForVoidMethod
public abstract class AbstractProfilingAspect extends Object
Abstract aspect class for profiling method.
Also contains some infrastructure methods for creating performance test based on information about profiling methods
For using this class clients should link all "Pointcut" with real methods.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DELIMETER
protected static int
NAME_LIMIT
protected String
testClassName
protected String
testName
protected String
topLevelMethod
-
Constructor Summary
Constructors Constructor Description AbstractProfilingAspect(String topLevelMethod, Map<String,CustomPerformanceMeter> methodMetrics)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
afterTestStop()
Default implementation will execute alltest*()
methods withafterTestStop(JoinPoint)
aspect.void
afterTestStop(org.aspectj.lang.JoinPoint joinPoint)
Special aspect code that will be executed after testing method linking through "Pointcut" "afterTestStop"protected void
assertPerformanceInRelativeBand(org.eclipse.test.performance.PerformanceMeter performanceMeter, org.eclipse.test.performance.Dimension dim, int lowerPercentage, int upperPercentage)
Asserts that the measurement specified by the given dimension is within a certain range with respect to some reference value.protected void
beforeTestStart()
Default implementation will execute alltest*()
methods withbeforeTestStart(JoinPoint)
aspect.void
beforeTestStart(org.aspectj.lang.JoinPoint joinPoint)
Special aspect code that will be executed before testing method linking through "Pointcut" "beforeTestStart"protected org.eclipse.test.performance.Dimension[]
getDimensions()
Gets allDimension
which will be measured during profilingprotected CustomPerformanceMeter
getPerformanceMeter(org.aspectj.lang.ProceedingJoinPoint thisJoinPoint)
Gets special performance meter for accumulation profiling metricsprotected String
getScenarioName(org.aspectj.lang.ProceedingJoinPoint thisJoinPoint)
Gets scenario name.protected String
getShortScenarioName(org.aspectj.lang.ProceedingJoinPoint thisJoinPoint)
Gets short scenario name for profiling method.protected abstract void
profile()
Special "Pointcut" for linking real aspect class with profiling method.
-
-
-
Field Detail
-
DELIMETER
protected static final String DELIMETER
- See Also:
- Constant Field Values
-
NAME_LIMIT
protected static final int NAME_LIMIT
- See Also:
- Constant Field Values
-
topLevelMethod
protected final String topLevelMethod
-
testName
protected String testName
-
testClassName
protected String testClassName
-
-
Constructor Detail
-
AbstractProfilingAspect
public AbstractProfilingAspect(String topLevelMethod, Map<String,CustomPerformanceMeter> methodMetrics)
Constructor- Parameters:
topLevelMethod
- name of the profiling method, can't benull
methodMetrics
- need for accumulation performance metrics by performance scenario name, can't benull
-
-
Method Detail
-
afterTestStop
public void afterTestStop(org.aspectj.lang.JoinPoint joinPoint)
Special aspect code that will be executed after testing method linking through "Pointcut" "afterTestStop"- Parameters:
joinPoint
- actualJoinPoint
, can't benull
-
beforeTestStart
public void beforeTestStart(org.aspectj.lang.JoinPoint joinPoint)
Special aspect code that will be executed before testing method linking through "Pointcut" "beforeTestStart"- Parameters:
joinPoint
- actualJoinPoint
, can't benull
-
profile
protected abstract void profile()
Special "Pointcut" for linking real aspect class with profiling method. Special aspect code will be executed around the linking method
-
afterTestStop
protected void afterTestStop()
Default implementation will execute alltest*()
methods withafterTestStop(JoinPoint)
aspect.
-
beforeTestStart
protected void beforeTestStart()
Default implementation will execute alltest*()
methods withbeforeTestStart(JoinPoint)
aspect.
-
getScenarioName
protected String getScenarioName(org.aspectj.lang.ProceedingJoinPoint thisJoinPoint)
Gets scenario name. The name contains name of the test class and test method- Parameters:
thisJoinPoint
- actualProceedingJoinPoint
of profiling method, can't benull
- Returns:
- Scenario name, never
null
-
getDimensions
protected org.eclipse.test.performance.Dimension[] getDimensions()
Gets allDimension
which will be measured during profiling- Returns:
- list of
Dimension
, nevernull
-
getShortScenarioName
protected String getShortScenarioName(org.aspectj.lang.ProceedingJoinPoint thisJoinPoint)
Gets short scenario name for profiling method.- Parameters:
thisJoinPoint
- actualProceedingJoinPoint
of profiling method, can't benull
- Returns:
- a short (shorter than 40 characters) descriptive name of the scenario, never
null
-
assertPerformanceInRelativeBand
protected void assertPerformanceInRelativeBand(org.eclipse.test.performance.PerformanceMeter performanceMeter, org.eclipse.test.performance.Dimension dim, int lowerPercentage, int upperPercentage)
Asserts that the measurement specified by the given dimension is within a certain range with respect to some reference value. If the specified dimension isn't available, the call has no effect.- Parameters:
performanceMeter
- actualPerformanceMeter
, can't benull
dim
- the Dimension to checklowerPercentage
- a negative number indicating the percentage the measured value is allowed to be smaller than some reference valueupperPercentage
- a positive number indicating the percentage the measured value is allowed to be greater than some reference value- Throws:
RuntimeException
- if the properties do not hold
-
getPerformanceMeter
protected CustomPerformanceMeter getPerformanceMeter(org.aspectj.lang.ProceedingJoinPoint thisJoinPoint)
Gets special performance meter for accumulation profiling metrics- Parameters:
thisJoinPoint
- actualProceedingJoinPoint
of profiling method, can't benull
- Returns:
- special performance meter for accumulation profiling metrics, never
null
-
-