@Test public void testCodecForRfc822() { Date date = new Date(1000); assertEquals(rfc822Codec.toDate(rfc822Codec.toString(date)), date); assertEquals(rfc822Codec.toDate("Thu, 01 Dec 1994 16:00:00 GMT"), new Date(786297600000L)); }
@Test public void testCodecForIso8601() { Date date = new Date(1000); assertEquals(iso8601Codec.toDate(iso8601Codec.toString(date)), date); assertEquals(iso8601Codec.toDate("1994-12-01T16:00:00.000Z"), new Date(786297600000L)); }
@Test public void testCodecForRfc1123() { Date date = new Date(1000); assertEquals(rfc1123Codec.toDate(rfc1123Codec.toString(date)), date); assertEquals(rfc1123Codec.toDate("Thu, 01 Dec 1994 16:00:00 GMT"), new Date(786297600000L)); }
@Test public void testCodecForIso8601Seconds() { Date date = new Date(1000); assertEquals(iso8601SecondsCodec.toDate(iso8601SecondsCodec.toString(date)), date); assertEquals(iso8601SecondsCodec.toDate("2012-11-14T21:51:28UTC").getTime(), 1352929888000l); }
@Test public void testCodecForRfc1123() { Date date = new Date(1000); assertEquals(rfc1123Codec.toDate(rfc1123Codec.toString(date)), date); assertEquals(rfc1123Codec.toDate("Thu, 01 Dec 1994 16:00:00 GMT"), new Date(786297600000L)); }
@Test public void testCodecForAsctime() { Date date = new Date(1000); assertEquals(asctimeCodec.toDate(asctimeCodec.toString(date)), date); assertEquals(asctimeCodec.toDate("Thu Dec 01 16:00:00 GMT 1994"), new Date(786297600000L)); }
@Test public void testCodecForIso8601() { Date date = new Date(1000); assertEquals(iso8601Codec.toDate(iso8601Codec.toString(date)), date); assertEquals(iso8601Codec.toDate("1994-12-01T16:00:00.000Z"), new Date(786297600000L)); }
@Test public void testCodecForIso8601Seconds() { Date date = new Date(1000); assertEquals(iso8601SecondsCodec.toDate(iso8601SecondsCodec.toString(date)), date); assertEquals(iso8601SecondsCodec.toDate("2012-11-14T21:51:28UTC").getTime(), 1352929888000L); }
@Test public void testCodecForRfc822() { Date date = new Date(1000); assertEquals(rfc822Codec.toDate(rfc822Codec.toString(date)), date); assertEquals(rfc822Codec.toDate("Thu, 01 Dec 1994 16:00:00 GMT"), new Date(786297600000L)); }
@Override public Multimap<String, String> toHeaders(ContentMetadata md) { Builder<String, String> builder = ImmutableMultimap.builder(); if (md.getContentType() != null) builder.put(CONTENT_TYPE, md.getContentType()); if (md.getContentDisposition() != null) builder.put(CONTENT_DISPOSITION, md.getContentDisposition()); if (md.getContentEncoding() != null) builder.put(CONTENT_ENCODING, md.getContentEncoding()); if (md.getContentLanguage() != null) builder.put(CONTENT_LANGUAGE, md.getContentLanguage()); if (md.getContentLength() != null) builder.put(CONTENT_LENGTH, md.getContentLength() + ""); if (md.getContentMD5() != null) builder.put(CONTENT_MD5, base64().encode(md.getContentMD5())); if (md.getExpires() != null) builder.put(EXPIRES, getExpiresDateCodec().toString(md.getExpires())); return builder.build(); }
@Override public Multimap<String, String> toHeaders(ContentMetadata md) { Builder<String, String> builder = ImmutableMultimap.builder(); if (md.getContentType() != null) builder.put(CONTENT_TYPE, md.getContentType()); if (md.getContentDisposition() != null) builder.put(CONTENT_DISPOSITION, md.getContentDisposition()); if (md.getContentEncoding() != null) builder.put(CONTENT_ENCODING, md.getContentEncoding()); if (md.getContentLanguage() != null) builder.put(CONTENT_LANGUAGE, md.getContentLanguage()); if (md.getContentLength() != null) builder.put(CONTENT_LENGTH, md.getContentLength() + ""); if (md.getContentMD5() != null) builder.put(CONTENT_MD5, base64().encode(md.getContentMD5())); if (md.getExpires() != null) builder.put(EXPIRES, getExpiresDateCodec().toString(md.getExpires())); return builder.build(); }
@Override public Multimap<String, String> toHeaders(ContentMetadata md) { Builder<String, String> builder = ImmutableMultimap.builder(); if (md.getContentType() != null) builder.put(CONTENT_TYPE, md.getContentType()); if (md.getContentDisposition() != null) builder.put(CONTENT_DISPOSITION, md.getContentDisposition()); if (md.getContentEncoding() != null) builder.put(CONTENT_ENCODING, md.getContentEncoding()); if (md.getContentLanguage() != null) builder.put(CONTENT_LANGUAGE, md.getContentLanguage()); if (md.getContentLength() != null) builder.put(CONTENT_LENGTH, md.getContentLength() + ""); if (md.getContentMD5() != null) builder.put(CONTENT_MD5, base64().encode(md.getContentMD5())); if (md.getExpires() != null) builder.put(EXPIRES, getExpiresDateCodec().toString(md.getExpires())); return builder.build(); }
@Override public Multimap<String, String> toHeaders(ContentMetadata md) { Builder<String, String> builder = ImmutableMultimap.builder(); if (md.getCacheControl() != null) builder.put(CACHE_CONTROL, md.getCacheControl()); if (md.getContentType() != null) builder.put(CONTENT_TYPE, md.getContentType()); if (md.getContentDisposition() != null) builder.put(CONTENT_DISPOSITION, md.getContentDisposition()); if (md.getContentEncoding() != null) builder.put(CONTENT_ENCODING, md.getContentEncoding()); if (md.getContentLanguage() != null) builder.put(CONTENT_LANGUAGE, md.getContentLanguage()); if (md.getContentLength() != null) builder.put(CONTENT_LENGTH, md.getContentLength() + ""); if (md.getContentMD5() != null) builder.put(CONTENT_MD5, base64().encode(md.getContentMD5())); if (md.getExpires() != null) builder.put(EXPIRES, getExpiresDateCodec().toString(md.getExpires())); return builder.build(); }
@Override public Multimap<String, String> toHeaders(ContentMetadata md) { Builder<String, String> builder = ImmutableMultimap.builder(); if (md.getCacheControl() != null) builder.put(CACHE_CONTROL, md.getCacheControl()); if (md.getContentType() != null) builder.put(CONTENT_TYPE, md.getContentType()); if (md.getContentDisposition() != null) builder.put(CONTENT_DISPOSITION, md.getContentDisposition()); if (md.getContentEncoding() != null) builder.put(CONTENT_ENCODING, md.getContentEncoding()); if (md.getContentLanguage() != null) builder.put(CONTENT_LANGUAGE, md.getContentLanguage()); if (md.getContentLength() != null) builder.put(CONTENT_LENGTH, md.getContentLength() + ""); if (md.getContentMD5() != null) builder.put(CONTENT_MD5, base64().encode(md.getContentMD5())); if (md.getExpires() != null) builder.put(EXPIRES, getExpiresDateCodec().toString(md.getExpires())); return builder.build(); }
@Override public Multimap<String, String> toHeaders(ContentMetadata md) { Builder<String, String> builder = ImmutableMultimap.builder(); if (md.getCacheControl() != null) builder.put(CACHE_CONTROL, md.getCacheControl()); if (md.getContentType() != null) builder.put(CONTENT_TYPE, md.getContentType()); if (md.getContentDisposition() != null) builder.put(CONTENT_DISPOSITION, md.getContentDisposition()); if (md.getContentEncoding() != null) builder.put(CONTENT_ENCODING, md.getContentEncoding()); if (md.getContentLanguage() != null) builder.put(CONTENT_LANGUAGE, md.getContentLanguage()); if (md.getContentLength() != null) builder.put(CONTENT_LENGTH, md.getContentLength() + ""); if (md.getContentMD5() != null) builder.put(CONTENT_MD5, base64().encode(md.getContentMD5())); if (md.getExpires() != null) builder.put(EXPIRES, getExpiresDateCodec().toString(md.getExpires())); return builder.build(); }