Clover Coverage Report - Atlassian XWork(Aggregated)
Coverage timestamp: Wed Jul 27 2011 23:39:31 CDT
10   47   6   2
4   36   0.6   5
5     1.2  
1    
 
 
  XWorkProfilingInterceptor       Line # 10 10 6 0% 0.0
 
No Tests
 
1    package com.atlassian.xwork.interceptors;
2   
3    import com.opensymphony.xwork.interceptor.AroundInterceptor;
4    import com.opensymphony.xwork.ActionInvocation;
5    import com.opensymphony.xwork.ActionProxy;
6    import com.opensymphony.webwork.ServletActionContext;
7    import com.atlassian.util.profiling.UtilTimerStack;
8    import com.atlassian.util.profiling.ProfilingUtils;
9   
 
10    public class XWorkProfilingInterceptor extends AroundInterceptor
11    {
12    String location;
13   
 
14  0 toggle protected void before(ActionInvocation actionInvocation) throws Exception
15    {
16  0 UtilTimerStack.push(makeStackKey(actionInvocation.getProxy()));
17  0 ServletActionContext.getRequest(); // needed to make sure the request is present (I think)
18    }
19   
 
20  0 toggle protected void after(ActionInvocation actionInvocation, String string) throws Exception
21    {
22  0 UtilTimerStack.pop(makeStackKey(actionInvocation.getProxy()));
23    }
24   
 
25  0 toggle private String makeStackKey(ActionProxy proxy)
26    {
27  0 String methodName = proxy.getConfig().getMethodName();
28   
29  0 if (methodName == null)
30  0 methodName = "execute";
31   
32  0 String actionClazz = ProfilingUtils.getJustClassName(proxy.getConfig().getClassName());
33   
34  0 return "XW Interceptor: " + (location != null ? location + ": " : "") + proxy.getNamespace() + "/" + proxy.getActionName() + ".action (" + actionClazz + "." + methodName + "())";
35    }
36   
 
37  0 toggle public String getLocation()
38    {
39  0 return location;
40    }
41   
 
42  0 toggle public void setLocation(String location)
43    {
44  0 this.location = location;
45    }
46   
47    }