KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > util > perf > PerformanceMonitorTest


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.util.perf;
18
19 import java.lang.reflect.Method JavaDoc;
20
21 import junit.framework.TestCase;
22
23 /**
24  * Enabled vm performance monitoring for <b>performance.summary.vm</b> and
25  * <b>performance.PerformanceMonitorTest</b> to check.
26  *
27  * @see org.alfresco.util.perf.PerformanceMonitor
28  *
29  * @author Derek Hulley
30  */

31 public class PerformanceMonitorTest extends TestCase
32 {
33     private PerformanceMonitor testTimingMonitor;
34     
35     @Override JavaDoc
36     public void setUp() throws Exception JavaDoc
37     {
38         Method JavaDoc testTimingMethod = PerformanceMonitorTest.class.getMethod("testTiming");
39         testTimingMonitor = new PerformanceMonitor("PerformanceMonitorTest", "testTiming");
40     }
41     
42     public void testSetUp() throws Exception JavaDoc
43     {
44         assertNotNull(testTimingMonitor);
45     }
46     
47     public synchronized void testTiming() throws Exception JavaDoc
48     {
49         testTimingMonitor.start();
50         
51         wait(50);
52         
53         testTimingMonitor.stop();
54     }
55 }
56
Popular Tags