Example usage for org.joda.time DateTimeZone UTC

List of usage examples for org.joda.time DateTimeZone UTC

Introduction

In this page you can find the example usage for org.joda.time DateTimeZone UTC.

Prototype

DateTimeZone UTC

To view the source code for org.joda.time DateTimeZone UTC.

Click Source Link

Document

The time zone for Universal Coordinated Time

Usage

From source file:com.google.gerrit.server.mail.receive.data.Base64HeaderMessage.java

License:Apache License

@Override
public MailMessage expectedMailMessage() {
    MailMessage.Builder expect = MailMessage.builder();
    expect.id("<001a114da7ae26e2eb053fe0c29c@google.com>")
            .from(new Address("Jonathan Nieder (Gerrit)",
                    "noreply-gerritcodereview-CtTy0igsBrnvL7dKoWEIEg@google.com"))
            .addTo(new Address("ekempin", "ekempin@google.com")).textContent(textContent)
            .subject("\uD83D\uDE1B test")
            .dateReceived(new DateTime(2016, 10, 25, 9, 11, 35, 0, DateTimeZone.UTC));
    return expect.build();
}

From source file:com.google.gerrit.server.mail.receive.data.HtmlMimeMessage.java

License:Apache License

@Override
public MailMessage expectedMailMessage() {
    MailMessage.Builder expect = MailMessage.builder();
    expect.id("<001a114cd8be55b4ab053face5cd@google.com>")
            .from(new Address("ekempin (Gerrit)", "noreply-gerritcodereview-qUgXfQecoDLHwp0MldAzig@google.com"))
            .addCc(new Address("ekempin", "ekempin@google.com"))
            .addTo(new Address("Patrick Hiesel", "hiesel@google.com")).textContent(textContent)
            .htmlContent(unencodedHtmlContent)
            .subject("Change in gerrit[master]: Implement receiver class structure and bindings")
            .addAdditionalHeader("MIME-Version: 1.0")
            .dateReceived(new DateTime(2016, 10, 25, 9, 11, 35, 0, DateTimeZone.UTC));
    return expect.build();
}

From source file:com.google.gerrit.server.mail.receive.data.QuotedPrintableHeaderMessage.java

License:Apache License

@Override
public MailMessage expectedMailMessage() {
    System.out.println("\uD83D\uDE1B test");
    MailMessage.Builder expect = MailMessage.builder();
    expect.id("<001a114da7ae26e2eb053fe0c29c@google.com>")
            .from(new Address("Jonathan Nieder (Gerrit)",
                    "noreply-gerritcodereview-CtTy0igsBrnvL7dKoWEIEg@google.com"))
            .addTo(new Address("ekempin", "ekempin@google.com")).textContent(textContent)
            .subject("me vulgaire").dateReceived(new DateTime(2016, 10, 25, 9, 11, 35, 0, DateTimeZone.UTC));
    return expect.build();
}

From source file:com.google.gerrit.server.mail.receive.data.SimpleTextMessage.java

License:Apache License

@Override
public MailMessage expectedMailMessage() {
    MailMessage.Builder expect = MailMessage.builder();
    expect.id("<001a114da7ae26e2eb053fe0c29c@google.com>")
            .from(new Address("Jonathan Nieder (Gerrit)",
                    "noreply-gerritcodereview-CtTy0igsBrnvL7dKoWEIEg@google.com"))
            .addTo(new Address("ekempin", "ekempin@google.com"))
            .addCc(new Address("Dave Borowitz", "dborowitz@google.com"))
            .addCc(new Address("Jonathan Nieder", "jrn@google.com"))
            .addCc(new Address("Patrick Hiesel", "hiesel@google.com")).textContent(textContent)
            .subject("Change in gerrit[master]: (Re)enable voting buttons for merged changes")
            .dateReceived(new DateTime(2016, 10, 25, 9, 11, 35, 0, DateTimeZone.UTC))
            .addAdditionalHeader("Authentication-Results: mx.google.com; dkim=pass header.i=@google.com;")
            .addAdditionalHeader("In-Reply-To: <gerrit.1477487889000.Iba501e00bee"
                    + "77be3bd0ced72f88fd04ba0accaed@gerrit-review.googlesource.com>")
            .addAdditionalHeader("References: <gerrit.1477487889000.Iba501e00bee"
                    + "77be3bd0ced72f88fd04ba0accaed@gerrit-review.googlesource.com>");
    return expect.build();
}

From source file:com.google.ical.compat.jodatime.DateTimeIteratorFactory.java

License:Apache License

static DateTime dateValueToDateTime(DateValue dvUtc) {
    if (dvUtc instanceof TimeValue) {
        TimeValue tvUtc = (TimeValue) dvUtc;
        return new DateTime(dvUtc.year(), dvUtc.month(), // java.util's dates are zero-indexed
                dvUtc.day(), tvUtc.hour(), tvUtc.minute(), tvUtc.second(), 0, DateTimeZone.UTC);
    } else {/* w  w w .ja  v  a 2s  . co  m*/
        return new DateTime(dvUtc.year(), dvUtc.month(), // java.util's dates are zero-indexed
                dvUtc.day(), 0, 0, 0, 0, DateTimeZone.UTC);
    }
}

From source file:com.google.ical.compat.jodatime.LocalDateIteratorFactory.java

License:Apache License

/**
 * given a block of RRULE, EXRULE, RDATE, and EXDATE content lines, parse
 * them into a single local date iterator.
 * @param rdata RRULE, EXRULE, RDATE, and EXDATE lines.
 * @param start the first occurrence of the series.
 * @param strict true if any failure to parse should result in a
 *   ParseException.  false causes bad content lines to be logged and ignored.
 *//* w w  w  . j  a va2s.  c om*/
public static LocalDateIterator createLocalDateIterator(String rdata, LocalDate start, boolean strict)
        throws ParseException {
    return createLocalDateIterator(rdata, start, DateTimeZone.UTC, strict);
}

From source file:com.google.ical.compat.jodatime.LocalDateIteratorFactory.java

License:Apache License

/**
 * given a block of RRULE, EXRULE, RDATE, and EXDATE content lines, parse
 * them into a single local date iterable.
 * @param rdata RRULE, EXRULE, RDATE, and EXDATE lines.
 * @param start the first occurrence of the series.
 * @param strict true if any failure to parse should result in a
 *   ParseException.  false causes bad content lines to be logged and ignored.
 *//*from   w  ww. java  2s  .  c  o m*/
public static LocalDateIterable createLocalDateIterable(String rdata, LocalDate start, boolean strict)
        throws ParseException {
    return createLocalDateIterable(rdata, start, DateTimeZone.UTC, strict);
}

From source file:com.google.jenkins.plugins.cloudbackup.backup.BackupProcedure.java

License:Open Source License

/**
 * Performs a backup employing the extension point implementations provided
 * in the constructor./*from w  ww . ja v a  2  s  .c o m*/
 *
 * @return the date and time the backup was taken.
 * @throws IOException if backup creation fails.
 */
public DateTime performBackup() throws IOException {
    logger.fine("Start creating backup");
    final DateTime backupTime = new DateTime(DateTimeZone.UTC);
    // This is a no-op if the scratch directory already exists.
    if (tempDir != null) {
        Files.createDirectories(tempDir);
    }
    final Path tempDirectory = tempDir == null ? Files.createTempDirectory(TMP_DIR_PREFIX)
            : Files.createTempDirectory(tempDir, TMP_DIR_PREFIX);
    final String backupVolumeName = calculateBackupName(backupTime)
            + (backupNameSuffix != null ? backupNameSuffix : "") + "." + volume.getFileExtension();
    logger.fine("Using temporary directory: " + tempDirectory);
    final Path volumePath = tempDirectory.resolve(Paths.get(backupVolumeName));

    try {
        logger.fine("Creating backup volume");
        int fileCount;
        Set<String> existingFileNames = new HashSet<>();
        try (Volume.Creator creator = volume.createNew(volumePath)) {
            scope.addFiles(jenkinsHome, creator, existingFileNames);
            fileCount = creator.getFileCount();
        } // auto-close creator

        if (fileCount > 0) {
            logger.fine("Storing backup volume");
            storage.storeFile(volumePath, backupVolumeName);

            logger.fine("Updating last backup reference");
            storage.updateLastBackup(Arrays.asList(backupVolumeName));

            logger.fine("Applying backup history policy");
            backupHistory.processHistoricBackups(storage, backupVolumeName);
        } else {
            logger.fine("Volume is empty, will skip storing backup");
        }

        // This must happen after processHistoricBackups, which can delete files.
        logger.fine("Updating list of existing files : Size " + existingFileNames.size());
        storage.updateExistingFilesMetaData(existingFileNames);

        String version = VersionUtility.getFileSystemVersion(jenkinsHome);
        logger.fine("Updating version : " + version);
        storage.updateVersionInfo(version);
    } finally {
        // cleanup after ourselves
        try {
            logger.fine("Deleting local backup volume");
            Files.deleteIfExists(volumePath);
            logger.fine("Deleting temp directory");
            Files.deleteIfExists(tempDirectory);
        } catch (IOException e) {
            // be silent about cleanup errors, only log them
            logger.log(Level.FINE, "IOException while performing cleanup", e);
        }
    }
    logger.fine("Finished creating backup");
    return backupTime;
}

From source file:com.google.jenkins.plugins.cloudbackup.CloudBackupPlugin.java

License:Open Source License

private static DateTime calculateLastBackupTime(Storage storage) {
    List<String> lastBackupFiles;
    try {//  w  w  w .  j ava 2s.co m
        lastBackupFiles = storage.findLatestBackup();
    } catch (IOException e) {
        return null; // assume no backup exists
    }
    if (lastBackupFiles != null && !lastBackupFiles.isEmpty()) {
        // this means that a backup does exist, and since we just started jenkins,
        // we just applied the latest backup, therefore the last backup time is
        // (about) now.
        return new DateTime(DateTimeZone.UTC);
    }
    return null;
}

From source file:com.google.jenkins.plugins.cloudbackup.CloudBackupSaveableListener.java

License:Open Source License

@Override
public void onChange(Saveable o, XmlFile file) {
    mostRecentConfigFileChangeTime = new DateTime(DateTimeZone.UTC);
}