cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r942123 - in /cxf/trunk/rt/management/src: main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java test/java/org/apache/cxf/management/counters/CounterRepositoryTest.java
Date Fri, 07 May 2010 15:24:30 GMT
Author: dkulp
Date: Fri May  7 15:24:30 2010
New Revision: 942123

URL: http://svn.apache.org/viewvc?rev=942123&view=rev
Log:
[CXF-2804] Allow reset of response counters

Modified:
    cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
    cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/counters/CounterRepositoryTest.java

Modified: cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java?rev=942123&r1=942122&r2=942123&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
(original)
+++ cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
Fri May  7 15:24:30 2010
@@ -84,6 +84,18 @@ public class ResponseTimeCounter impleme
             minHandlingTime = handlingTime;
         }
     }
+
+    public void reset() {
+        invocations.set(0);
+        checkedApplicationFaults.set(0);
+        unCheckedApplicationFaults.set(0);
+        runtimeFaults.set(0);
+        logicalRuntimeFaults.set(0);
+        
+        totalHandlingTime = 0;    
+        maxHandlingTime = 0;
+        minHandlingTime = Integer.MAX_VALUE;   
+    }
     
     public ObjectName getObjectName() {
         return objectName;

Modified: cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/counters/CounterRepositoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/counters/CounterRepositoryTest.java?rev=942123&r1=942122&r2=942123&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/counters/CounterRepositoryTest.java
(original)
+++ cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/counters/CounterRepositoryTest.java
Fri May  7 15:24:30 2010
@@ -132,6 +132,16 @@ public class CounterRepositoryTest exten
                      opCounter.getMinResponseTime(), (long)1000);
         assertEquals("The Service counter isn't increased", sCounter.getNumInvocations(),
2);
         
+        opCounter.reset();
+        assertTrue(opCounter.getNumCheckedApplicationFaults().intValue() == 0);
+        assertTrue(opCounter.getNumInvocations().intValue() == 0);
+        assertTrue(opCounter.getNumLogicalRuntimeFaults().intValue() == 0);
+        assertTrue(opCounter.getNumRuntimeFaults().intValue() == 0);
+        assertTrue(opCounter.getNumUnCheckedApplicationFaults().intValue() == 0);
+        assertTrue(opCounter.getTotalHandlingTime().intValue() == 0);
+        assertTrue(opCounter.getMinResponseTime().longValue() == Integer.MAX_VALUE);
+        assertTrue(opCounter.getMaxResponseTime().intValue() == 0);
+        
         EasyMock.verify(bus);
         EasyMock.verify(mhtr1);
         EasyMock.verify(mhtr2);



Mime
View raw message