List of usage examples for org.apache.commons.lang.time DateUtils isSameInstant
public static boolean isSameInstant(Calendar cal1, Calendar cal2)
Checks if two calendar objects represent the same instant in time.
This method compares the long millisecond time of the two objects.
From source file:org.jasig.schedassist.model.CommonDateOperations.java
/** * Returns true if the specified dates are equal OR if date1 is after date2. * //from ww w.jav a 2s . c o m * @see DateUtils#isSameInstant(Date, Date) * @see Date#after(Date) * @param date1 * @param date2 * @return true if date1 is equal to or after date2 */ public static boolean equalsOrAfter(Date date1, Date date2) { return DateUtils.isSameInstant(date1, date2) || date1.after(date2); }
From source file:org.jasig.schedassist.model.CommonDateOperations.java
/** * Returns true if the specified dates are equal OR if date1 is before date2. * //from w ww .ja v a 2 s .co m * @see DateUtils#isSameInstant(Date, Date) * @see Date#before(Date) * @param date1 * @param date2 * @return true if date1 is equal to or before date2 */ public static boolean equalsOrBefore(Date date1, Date date2) { return DateUtils.isSameInstant(date1, date2) || date1.before(date2); }
From source file:org.sipfoundry.sipxconfig.acd.stats.AcdHistoricalStatsTestDb.java
public void testSignoutActivityReportSigninTime() { List<Map<String, Object>> stats = m_history.getReport("agentAvailablityReport", new Date(0), new Date()); Map<String, Object> record; Iterator<Map<String, Object>> i = stats.iterator(); record = i.next();/*from www . j a v a2 s. c o m*/ // seed file is in UTC and so it shoudl equal this date which is 5 hours from GMT Date expectedSigninTime = TestUtil.localizeDateTime("12/19/06 8:40:50 AM EST"); Timestamp actualSigninTime = (Timestamp) record.get("sign_in_time"); assertTrue(DateUtils.isSameInstant(expectedSigninTime, actualSigninTime)); }
From source file:org.sipfoundry.sipxconfig.acd.stats.AcdHistoricalStatsTestIntegration.java
public void testSignoutActivityReportSigninTime() throws Exception { loadDataSetXml("admin/commserver/seedLocationsAndServices3.xml"); List<AcdServer> acdServers = m_acdContext.getServers(); assertEquals(1, acdServers.size());//from w ww. j a va 2 s . co m Location location = acdServers.get(0).getLocation(); List<Map<String, Object>> stats = m_acdHistoricalStats.getReport("agentAvailablityReport", new Date(0), new Date(), location); Map<String, Object> record; Iterator<Map<String, Object>> i = stats.iterator(); record = i.next(); // seed file is in UTC and so it should equal this date which is 5 hours from GMT Date expectedSigninTime = TestUtil.localizeDateTime("12/19/06 8:40:50 AM EST"); Timestamp actualSigninTime = (Timestamp) record.get("sign_in_time"); assertTrue(DateUtils.isSameInstant(expectedSigninTime, actualSigninTime)); }
From source file:org.sipfoundry.sipxconfig.acd.stats.historical.AcdHistoricalStatsTestIntegration.java
public void testSignoutActivityReportSigninTime() throws Exception { loadDataSetXml("commserver/seedLocationsAndServices3.xml"); List<AcdServer> acdServers = m_acdContext.getServers(); assertEquals(1, acdServers.size());/*from www .j a va2 s .com*/ Location location = acdServers.get(0).getLocation(); List<Map<String, Object>> stats = m_acdHistoricalStats.getReport("agentAvailablityReport", new Date(0), new Date(), location); Map<String, Object> record; Iterator<Map<String, Object>> i = stats.iterator(); record = i.next(); // seed file is in UTC and so it should equal this date which is 5 hours from GMT Date expectedSigninTime = TestHelper.localizeDateTime("12/19/06 8:40:50 AM EST"); Timestamp actualSigninTime = (Timestamp) record.get("sign_in_time"); assertTrue(DateUtils.isSameInstant(expectedSigninTime, actualSigninTime)); }
From source file:org.sonar.server.rule.RegisterRulesMediumTest.java
@Test public void do_not_update_rules_if_no_changes() throws Exception { Rules rules = new Rules() { @Override// w w w . j a v a 2 s .c o m public void init(RulesDefinition.NewRepository repository) { repository.createRule("x1").setName("x1 name").setHtmlDescription("x1 desc"); } }; register(rules); // Store updated at date Date updatedAt = ruleIndex.getByKey(RuleTesting.XOO_X1).updatedAt(); // Re-execute startup tasks register(rules); // Verify rule has not been updated Rule customRuleReloaded = ruleIndex.getByKey(RuleTesting.XOO_X1); assertThat(DateUtils.isSameInstant(customRuleReloaded.updatedAt(), updatedAt)); }