1 16 17 package org.springframework.jmx.export; 18 19 import java.text.ParseException ; 20 import java.text.SimpleDateFormat ; 21 import java.util.Date ; 22 23 import javax.management.ObjectName ; 24 25 import org.springframework.jmx.AbstractJmxTests; 26 27 30 public class CustomEditorConfigurerTests extends AbstractJmxTests { 31 32 private final SimpleDateFormat df = new SimpleDateFormat ("yyyy/MM/dd"); 33 34 protected String getApplicationContextPath() { 35 return "org/springframework/jmx/export/customConfigurer.xml"; 36 } 37 38 public void testDatesInJmx() throws Exception { 39 System.out.println(server.getClass().getName()); 40 ObjectName oname = new ObjectName ("bean:name=dateRange"); 41 42 Date startJmx = (Date ) server.getAttribute(oname, "StartDate"); 43 Date endJmx = (Date ) server.getAttribute(oname, "EndDate"); 44 45 assertEquals("startDate ", getStartDate(), startJmx); 46 assertEquals("endDate ", getEndDate(), endJmx); 47 } 48 49 public void testGetDates() throws Exception { 50 DateRange dr = (DateRange) getContext().getBean("dateRange"); 51 52 assertEquals("startDate ", getStartDate(), dr.getStartDate()); 53 assertEquals("endDate ", getEndDate(), dr.getEndDate()); 54 } 55 56 private Date getStartDate() throws ParseException { 57 Date start = df.parse("2004/10/12"); 58 return start; 59 } 60 61 private Date getEndDate() throws ParseException { 62 Date end = df.parse("2004/11/13"); 63 return end; 64 } 65 66 } 67 | Popular Tags |