michael-o commented on a change in pull request #187: Implement HTTP-based 
cache serializer-deserializer.
URL: 
https://github.com/apache/httpcomponents-client/pull/187#discussion_r358105936
 
 

 ##########
 File path: 
httpclient-cache/src/test/java/org/apache/http/impl/client/cache/MemcachedCacheEntryHttpTestUtils.java
 ##########
 @@ -0,0 +1,440 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl.client.cache;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.Header;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.StatusLine;
+import org.apache.http.client.cache.HttpCacheEntry;
+import org.apache.http.client.cache.Resource;
+import org.apache.http.impl.client.cache.memcached.MemcachedCacheEntry;
+import org.apache.http.impl.client.cache.memcached.MemcachedCacheEntryFactory;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.message.BasicStatusLine;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+class MemcachedCacheEntryHttpTestUtils {
+    private final static String TEST_RESOURCE_DIR = "src/test/resources/";
+
+    /**
+     * Create a new HttpCacheEntry object with default fields, except for 
those overridden by name in the template.
+     *
+     * @param template Map of field names to override in the test object
+     * @return New object for testing
+     */
+    static HttpCacheEntry buildSimpleTestObjectFromTemplate(final Map<String, 
Object> template) {
+        final Resource resource = getOrDefault(template, "resource",
+                new HeapResource("Hello 
World".getBytes(Charset.forName("UTF-8"))));
 
 Review comment:
   Use `StandardCharsets`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to