Examples of minusSeconds()


Examples of org.joda.time.DateTime.minusSeconds()

        StorageResultSetFuture resultSetFuture = dao.insertRawData(expected);
        Futures.addCallback(resultSetFuture, waitForResults);
        waitForResults.await("Failed to insert raw data");

        List<RawNumericMetric> actualMetrics = Lists.newArrayList(dao.findRawMetrics(scheduleId,
            threeMinutesAgo.minusSeconds(1).getMillis(), threeMinutesAgo.plusSeconds(1).getMillis()));

        assertEquals(actualMetrics.size(), 1, "Expected to get back one raw metric");
        assertEquals(actualMetrics.get(0), new RawNumericMetric(scheduleId, expected.getTimestamp(),
            expected.getValue()), "The raw metric does not match the expected value");
    }
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER);
        callbackHandler.setIssuer(TEST_RSTR_ISSUER);
        callbackHandler.setSubjectName(TEST_USER);
        ConditionsBean cp = new ConditionsBean();
        DateTime currentTime = new DateTime();
        currentTime = currentTime.minusSeconds(60);
        cp.setNotAfter(currentTime);
        currentTime = new DateTime();
        currentTime = currentTime.minusSeconds(300);
        cp.setNotBefore(currentTime);
        cp.setAudienceURI(TEST_AUDIENCE);
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

        ConditionsBean cp = new ConditionsBean();
        DateTime currentTime = new DateTime();
        currentTime = currentTime.minusSeconds(60);
        cp.setNotAfter(currentTime);
        currentTime = new DateTime();
        currentTime = currentTime.minusSeconds(300);
        cp.setNotBefore(currentTime);
        cp.setAudienceURI(TEST_AUDIENCE);
        callbackHandler.setConditions(cp);
       
        SAMLParms samlParms = new SAMLParms();
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

   * @return
   */
  private DateTime getNextHalfHour() {
    DateTime next = DateTime.now();
    next = next.minusMillis(next.getMillisOfSecond());
    next = next.minusSeconds(next.getSecondOfMinute());

    if (next.getMinuteOfHour() > 30) {
      next = next.minusMinutes(next.getMinuteOfHour());
      next = next.plusMinutes(60);
    } else {
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

    DateTime lastSeen = val.getLastSeen();
   
    DateTime now = new DateTime();
    DateTime before = now.minus(rateInMillis);
    //give it 15 seconds before it really should be up to date in the table
    before = before.minusSeconds(15);
   
    if(lastSeen.isBefore(before)) {
      return false;
    }
    return true;
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

    DateTime lastSeen = val.getLastSeen();
   
    DateTime now = new DateTime();
    DateTime before = now.minus(rateInMillis);
    //give it 15 seconds before it really should be up to date in the table
    before = before.minusSeconds(15);
   
    if(lastSeen.isBefore(before)) {
      return false;
    }
    return true;
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

        case DataType.DATETIME:
            DateTime dt = (DateTime) v;
            if (dt.getMillisOfSecond() != 0) {
                return dt.minusMillis(1);
            } else if (dt.getSecondOfMinute() != 0) {
                return dt.minusSeconds(1);
            } else if (dt.getMinuteOfHour() != 0) {
                return dt.minusMinutes(1);
            } else if (dt.getHourOfDay() != 0) {
                return dt.minusHours(1);
            } else {
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

        tokenResponse.setMessage(null);
     
        int lifetime = 14400;
        int expiresIn = json.get("expires_in").asInt();
        DateTime created = new DateTime();
        created = created.minusSeconds(lifetime - expiresIn);
       
        AccessToken token = new AccessToken();
        token.setAccessToken(json.get("access_token").asText());
        token.setClientSecret(clientSecret);
        token.setClientKey(clientKey);
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

        case DataType.DATETIME:
            DateTime dt = (DateTime) v;
            if (dt.getMillisOfSecond() != 0) {
                return dt.minusMillis(1);
            } else if (dt.getSecondOfMinute() != 0) {
                return dt.minusSeconds(1);
            } else if (dt.getMinuteOfHour() != 0) {
                return dt.minusMinutes(1);
            } else if (dt.getHourOfDay() != 0) {
                return dt.minusHours(1);
            } else {
View Full Code Here

Examples of org.joda.time.DateTime.minusSeconds()

        if (ctime.endsWith("M")) return dateTime.minusMonths(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("w")) return dateTime.minusWeeks(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("d")) return dateTime.minusDays(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("h")) return dateTime.minusHours(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("m")) return dateTime.minusMinutes(getCtimeNumber(ctime)).getMillis();
        if (ctime.endsWith("s")) return dateTime.minusSeconds(getCtimeNumber(ctime)).getMillis();
        throw new IllegalArgumentException("Invalid option for ctime: "+ctime);
    }

    private int getCtimeNumber(String ctime) {
        return Integer.parseInt(ctime.substring(0, ctime.length() - 1));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.