1 16 package net.sf.dozer.util.mapping.jmx; 17 18 import java.util.Set ; 19 20 import net.sf.dozer.util.mapping.DozerTestBase; 21 import net.sf.dozer.util.mapping.stats.StatisticTypeConstants; 22 23 24 27 public class DozerStatisticsControllerTest extends DozerTestBase { 28 29 private DozerStatisticsController controller; 30 31 protected void setUp() throws Exception { 32 super.setUp(); 33 controller = new DozerStatisticsController(); 34 } 35 36 public void testIsStatisticsEnabled() throws Exception { 37 boolean isStatisticsEnabled = controller.isStatisticsEnabled(); 38 controller.setStatisticsEnabled(!isStatisticsEnabled); 39 assertEquals("statistics enabled value was not updated", !isStatisticsEnabled, controller.isStatisticsEnabled()); 40 } 41 42 public void testGetStatisticValues() throws Exception { 43 controller.clearAll(); 45 assertEquals(0,controller.getMappingSuccessCount()); 46 assertEquals(0,controller.getMappingFailureCount()); 47 assertEquals(0,controller.getMapperInstancesCount()); 48 assertEquals(0,controller.getMappingOverallTime()); 49 assertEquals(0,controller.getFieldMappingSuccessCount()); 50 assertEquals(0,controller.getFieldMappingFailureCount()); 51 assertEquals(0,controller.getFieldMappingFailureIgnoredCount()); 52 } 53 54 public void testGetStatisticEntries() throws Exception { 55 controller.clearAll(); 56 Set entries = controller.getStatisticEntries(StatisticTypeConstants.CACHE_HIT_COUNT); 57 assertEquals("incorrect entries size", 0, entries.size()); 58 } 59 60 public void testGetStatisticEntries_UnknownType() throws Exception { 61 controller.clearAll(); 62 Set entries = controller.getStatisticEntries(String.valueOf(System.currentTimeMillis())); 63 assertEquals("incorrect entries size", 0, entries.size()); 64 } 65 66 public void testGetStatisticValue_UnknownType() throws Exception { 67 controller.clearAll(); 68 long value = controller.getStatisticValue(String.valueOf(System.currentTimeMillis())); 69 assertEquals("incorrect value", 0, value); 70 } 71 72 73 74 75 } 76 | Popular Tags |