1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.stats;
18
19 import org.apache.commons.lang.StringUtils;
20 import org.junit.Test;
21 import org.kuali.rice.kew.service.KEWServiceLocator;
22 import org.kuali.rice.kew.stats.service.StatsService;
23 import org.kuali.rice.kew.test.KEWTestCase;
24
25 import static junit.framework.Assert.assertTrue;
26
27
28
29
30
31
32 public class StatsServiceTest extends KEWTestCase{
33
34 @Test
35 public void testStatsService() throws Exception{
36 StatsService statsService = KEWServiceLocator.getService(KEWServiceLocator.STATS_SERVICE);
37
38 Stats stats = new Stats();
39 statsService.NumActiveItemsReport(stats);
40 statsService.DocumentsRoutedReport(stats, new java.util.Date(System.currentTimeMillis()),new java.util.Date(System.currentTimeMillis()));
41 statsService.NumberOfDocTypesReport(stats);
42 statsService.NumInitiatedDocsByDocTypeReport(stats);
43 statsService.NumUsersReport(stats);
44
45 assertTrue("Stats object populated", stats != null &&
46 StringUtils.equals(stats.getNumActionItems(),"0") &&
47 stats.getNumInitiatedDocsByDocType().size() == 0);
48 assertTrue("Number of document types", StringUtils.equals(stats.getNumDocTypes(),"6"));
49 }
50
51
52 }