Java 类com.android.volley.toolbox.DiskBasedCache.CacheHeader 实例源码

项目:GitHub    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:GitHub    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:Codeforces    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:iosched-reader    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:VoV    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:smconf-android    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:volley    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:InfoQ-Android-App    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:volley-public-key-pinning    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:device-database    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:ShoppingApp    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:2015-Google-I-O-app    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:Simplified-Zhihu-Daily    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:TastySnake    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:SaveVolley    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:Jacket-    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:android-project-wo2b    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:FMTech    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:AzureML_Recommend_Android    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:spark-android-SDK    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:saarang-iosched    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:proximity-manager    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:AppDevFestSudeste2015    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:JJCamera    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:android-discourse    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:product-emm    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:product-emm    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:iosched    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:devfestnorte-app    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:GomeOnline    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:light-novel-library_Wenku8_Android    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:saarang-iosched    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:ipz2014    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:upes-academics    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:egg-android    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:CrossBow    文件:DiskBasedCacheTest.java   
@Test public void cacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.lastModified = 13572468L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.lastModified, second.lastModified);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:CS492-FA13    文件:DiskBasedCacheTest.java   
public void testCacheHeaderSerialization() throws Exception {
    Cache.Entry e = new Cache.Entry();
    e.data = new byte[8];
    e.serverDate = 1234567L;
    e.ttl = 9876543L;
    e.softTtl = 8765432L;
    e.etag = "etag";
    e.responseHeaders = new HashMap<String, String>();
    e.responseHeaders.put("fruit", "banana");

    CacheHeader first = new CacheHeader("my-magical-key", e);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    first.writeHeader(baos);
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader second = CacheHeader.readHeader(bais);

    assertEquals(first.key, second.key);
    assertEquals(first.serverDate, second.serverDate);
    assertEquals(first.ttl, second.ttl);
    assertEquals(first.softTtl, second.softTtl);
    assertEquals(first.etag, second.etag);
    assertEquals(first.responseHeaders, second.responseHeaders);
}
项目:spark-android-SDK    文件:DiskBasedCacheTest.java   
/** deserializing the old format into the new one. */
@Test public void testCacheHeaderSerializationOldToNewFormat() throws Exception {

    final int CACHE_MAGIC = 0x20140623;
    final String key = "key";
    final String etag = "etag";
    final long serverDate = 1234567890l;
    final long ttl = 1357924680l;
    final long softTtl = 2468013579l;

    Map<String, String> responseHeaders = new HashMap<String, String>();
    responseHeaders.put("first", "thing");
    responseHeaders.put("second", "item");

    // write old sytle header (without lastModified)
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DiskBasedCache.writeInt(baos, CACHE_MAGIC);
    DiskBasedCache.writeString(baos, key);
    DiskBasedCache.writeString(baos, etag == null ? "" : etag);
    DiskBasedCache.writeLong(baos, serverDate);
    DiskBasedCache.writeLong(baos, ttl);
    DiskBasedCache.writeLong(baos, softTtl);
    DiskBasedCache.writeStringStringMap(responseHeaders, baos);

    // read / test new style header (with lastModified)
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    CacheHeader cacheHeader = CacheHeader.readHeader(bais);

    assertEquals(cacheHeader.key, key);
    assertEquals(cacheHeader.etag, etag);
    assertEquals(cacheHeader.serverDate, serverDate);
    assertEquals(cacheHeader.ttl, ttl);
    assertEquals(cacheHeader.softTtl, softTtl);
    assertEquals(cacheHeader.responseHeaders, responseHeaders);

    // the old format doesn't know lastModified
    assertEquals(cacheHeader.lastModified, 0);
}