commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1570993 [20/24] - in /commons/proper/jcs/trunk/src: assembly/ changes/ conf/ java/org/apache/commons/jcs/access/ java/org/apache/commons/jcs/access/exception/ java/org/apache/commons/jcs/admin/ java/org/apache/commons/jcs/auxiliary/ java/o...
Date Sun, 23 Feb 2014 10:37:52 GMT
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClientUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,276 +1,276 @@
-package org.apache.commons.jcs.auxiliary.remote.http.client;
-
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteRequestType;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.behavior.ICacheElement;
-
-/** Unit tests for the client. */
-public class RemoteHttpCacheClientUnitTest
-    extends TestCase
-{
-    /**
-     * Verify get functionality
-     * <p>
-     * @throws IOException
-     */
-    public void testGet_nullFromDispatcher()
-        throws IOException
-    {
-        // SETUP
-        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
-
-        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
-        client.setRemoteDispatcher( mockDispatcher );
-
-        String cacheName = "test";
-        String key = "key";
-
-        mockDispatcher.setupRemoteCacheResponse = null;
-
-        // DO WORK
-        ICacheElement<String, String> result = client.get( cacheName, key );
-
-        // VERIFY
-        assertNull( "Wrong result.", result );
-        assertEquals( "Wrong type.", RemoteRequestType.GET, mockDispatcher.lastRemoteCacheRequest
-            .getRequestType() );
-    }
-
-    /**
-     * Verify get functionality
-     * <p>
-     * @throws IOException
-     */
-    public void testGet_normal()
-        throws IOException
-    {
-        // SETUP
-        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
-
-        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
-        client.setRemoteDispatcher( mockDispatcher );
-
-        String cacheName = "test";
-        String key = "key";
-
-        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, key, "value" );
-        RemoteCacheResponse<ICacheElement<String, String>> remoteHttpCacheResponse =
-            new RemoteCacheResponse<ICacheElement<String,String>>();
-        remoteHttpCacheResponse.setPayload( expected );
-
-        mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
-
-        // DO WORK
-        ICacheElement<String, String> result = client.get( cacheName, key );
-
-        // VERIFY
-        assertEquals( "Wrong result.", expected, result );
-        assertEquals( "Wrong type.", RemoteRequestType.GET, mockDispatcher.lastRemoteCacheRequest
-            .getRequestType() );
-    }
-
-    /**
-     * Verify get functionality
-     * <p>
-     * @throws IOException
-     */
-    public void testGetMatching_normal()
-        throws IOException
-    {
-        // SETUP
-        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
-
-        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
-        client.setRemoteDispatcher( mockDispatcher );
-
-        String cacheName = "test";
-        String pattern = "key";
-
-        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, "key", "value" );
-        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<String, ICacheElement<String,String>>();
-        expectedMap.put( "key", expected );
-        RemoteCacheResponse<Map<String, ICacheElement<String, String>>> remoteHttpCacheResponse =
-            new RemoteCacheResponse<Map<String,ICacheElement<String,String>>>();
-        remoteHttpCacheResponse.setPayload( expectedMap );
-
-        mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
-
-        // DO WORK
-        Map<String, ICacheElement<String, String>> result = client.getMatching( cacheName, pattern );
-
-        // VERIFY
-        assertEquals( "Wrong result.", expected, result.get( "key" ) );
-        assertEquals( "Wrong type.", RemoteRequestType.GET_MATCHING,
-                      mockDispatcher.lastRemoteCacheRequest.getRequestType() );
-    }
-
-    /**
-     * Verify get functionality
-     * <p>
-     * @throws IOException
-     */
-    public void testGetMultiple_normal()
-        throws IOException
-    {
-        // SETUP
-        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
-
-        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
-        client.setRemoteDispatcher( mockDispatcher );
-
-        String cacheName = "test";
-        Set<String> keys = Collections.emptySet();
-
-        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, "key", "value" );
-        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<String, ICacheElement<String,String>>();
-        expectedMap.put( "key", expected );
-        RemoteCacheResponse<Map<String, ICacheElement<String, String>>> remoteHttpCacheResponse =
-            new RemoteCacheResponse<Map<String,ICacheElement<String,String>>>();
-        remoteHttpCacheResponse.setPayload( expectedMap );
-
-        mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
-
-        // DO WORK
-        Map<String, ICacheElement<String, String>> result = client.getMultiple( cacheName, keys );
-
-        // VERIFY
-        assertEquals( "Wrong result.", expected, result.get( "key" ) );
-        assertEquals( "Wrong type.", RemoteRequestType.GET_MULTIPLE,
-                      mockDispatcher.lastRemoteCacheRequest.getRequestType() );
-    }
-
-    /**
-     * Verify remove functionality
-     * <p>
-     * @throws IOException
-     */
-    public void testRemove_normal()
-        throws IOException
-    {
-        // SETUP
-        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
-
-        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
-        client.setRemoteDispatcher( mockDispatcher );
-
-        String cacheName = "test";
-        String key = "key";
-
-        // DO WORK
-        client.remove( cacheName, key );
-
-        // VERIFY
-        assertEquals( "Wrong type.", RemoteRequestType.REMOVE, mockDispatcher.lastRemoteCacheRequest
-            .getRequestType() );
-    }
-
-    /**
-     * Verify removeall functionality
-     * <p>
-     * @throws IOException
-     */
-    public void testRemoveAll_normal()
-        throws IOException
-    {
-        // SETUP
-        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
-
-        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
-        client.setRemoteDispatcher( mockDispatcher );
-
-        String cacheName = "test";
-
-        // DO WORK
-        client.removeAll( cacheName );
-
-        // VERIFY
-        assertEquals( "Wrong type.", RemoteRequestType.REMOVE_ALL, mockDispatcher.lastRemoteCacheRequest
-            .getRequestType() );
-    }
-
-    /**
-     * Verify update functionality
-     * <p>
-     * @throws IOException
-     */
-    public void testUpdate_normal()
-        throws IOException
-    {
-        // SETUP
-        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
-
-        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
-        client.setRemoteDispatcher( mockDispatcher );
-
-        String cacheName = "test";
-
-        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
-
-        // DO WORK
-        client.update( element );
-
-        // VERIFY
-        assertEquals( "Wrong type.", RemoteRequestType.UPDATE, mockDispatcher.lastRemoteCacheRequest
-            .getRequestType() );
-    }
-
-    /**
-     * Verify dispose functionality
-     * <p>
-     * @throws IOException
-     */
-    public void testDispose_normal()
-        throws IOException
-    {
-        // SETUP
-        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
-
-        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
-        client.setRemoteDispatcher( mockDispatcher );
-
-        String cacheName = "test";
-
-        // DO WORK
-        client.dispose( cacheName );
-
-        // VERIFY
-        assertEquals( "Wrong type.", RemoteRequestType.DISPOSE, mockDispatcher.lastRemoteCacheRequest
-            .getRequestType() );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.client;
+
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteRequestType;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.behavior.ICacheElement;
+
+/** Unit tests for the client. */
+public class RemoteHttpCacheClientUnitTest
+    extends TestCase
+{
+    /**
+     * Verify get functionality
+     * <p>
+     * @throws IOException
+     */
+    public void testGet_nullFromDispatcher()
+        throws IOException
+    {
+        // SETUP
+        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+
+        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
+        client.setRemoteDispatcher( mockDispatcher );
+
+        String cacheName = "test";
+        String key = "key";
+
+        mockDispatcher.setupRemoteCacheResponse = null;
+
+        // DO WORK
+        ICacheElement<String, String> result = client.get( cacheName, key );
+
+        // VERIFY
+        assertNull( "Wrong result.", result );
+        assertEquals( "Wrong type.", RemoteRequestType.GET, mockDispatcher.lastRemoteCacheRequest
+            .getRequestType() );
+    }
+
+    /**
+     * Verify get functionality
+     * <p>
+     * @throws IOException
+     */
+    public void testGet_normal()
+        throws IOException
+    {
+        // SETUP
+        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+
+        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
+        client.setRemoteDispatcher( mockDispatcher );
+
+        String cacheName = "test";
+        String key = "key";
+
+        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, key, "value" );
+        RemoteCacheResponse<ICacheElement<String, String>> remoteHttpCacheResponse =
+            new RemoteCacheResponse<ICacheElement<String,String>>();
+        remoteHttpCacheResponse.setPayload( expected );
+
+        mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
+
+        // DO WORK
+        ICacheElement<String, String> result = client.get( cacheName, key );
+
+        // VERIFY
+        assertEquals( "Wrong result.", expected, result );
+        assertEquals( "Wrong type.", RemoteRequestType.GET, mockDispatcher.lastRemoteCacheRequest
+            .getRequestType() );
+    }
+
+    /**
+     * Verify get functionality
+     * <p>
+     * @throws IOException
+     */
+    public void testGetMatching_normal()
+        throws IOException
+    {
+        // SETUP
+        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+
+        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
+        client.setRemoteDispatcher( mockDispatcher );
+
+        String cacheName = "test";
+        String pattern = "key";
+
+        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, "key", "value" );
+        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<String, ICacheElement<String,String>>();
+        expectedMap.put( "key", expected );
+        RemoteCacheResponse<Map<String, ICacheElement<String, String>>> remoteHttpCacheResponse =
+            new RemoteCacheResponse<Map<String,ICacheElement<String,String>>>();
+        remoteHttpCacheResponse.setPayload( expectedMap );
+
+        mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
+
+        // DO WORK
+        Map<String, ICacheElement<String, String>> result = client.getMatching( cacheName, pattern );
+
+        // VERIFY
+        assertEquals( "Wrong result.", expected, result.get( "key" ) );
+        assertEquals( "Wrong type.", RemoteRequestType.GET_MATCHING,
+                      mockDispatcher.lastRemoteCacheRequest.getRequestType() );
+    }
+
+    /**
+     * Verify get functionality
+     * <p>
+     * @throws IOException
+     */
+    public void testGetMultiple_normal()
+        throws IOException
+    {
+        // SETUP
+        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+
+        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
+        client.setRemoteDispatcher( mockDispatcher );
+
+        String cacheName = "test";
+        Set<String> keys = Collections.emptySet();
+
+        ICacheElement<String, String> expected = new CacheElement<String, String>( cacheName, "key", "value" );
+        Map<String, ICacheElement<String, String>> expectedMap = new HashMap<String, ICacheElement<String,String>>();
+        expectedMap.put( "key", expected );
+        RemoteCacheResponse<Map<String, ICacheElement<String, String>>> remoteHttpCacheResponse =
+            new RemoteCacheResponse<Map<String,ICacheElement<String,String>>>();
+        remoteHttpCacheResponse.setPayload( expectedMap );
+
+        mockDispatcher.setupRemoteCacheResponse = remoteHttpCacheResponse;
+
+        // DO WORK
+        Map<String, ICacheElement<String, String>> result = client.getMultiple( cacheName, keys );
+
+        // VERIFY
+        assertEquals( "Wrong result.", expected, result.get( "key" ) );
+        assertEquals( "Wrong type.", RemoteRequestType.GET_MULTIPLE,
+                      mockDispatcher.lastRemoteCacheRequest.getRequestType() );
+    }
+
+    /**
+     * Verify remove functionality
+     * <p>
+     * @throws IOException
+     */
+    public void testRemove_normal()
+        throws IOException
+    {
+        // SETUP
+        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+
+        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
+        client.setRemoteDispatcher( mockDispatcher );
+
+        String cacheName = "test";
+        String key = "key";
+
+        // DO WORK
+        client.remove( cacheName, key );
+
+        // VERIFY
+        assertEquals( "Wrong type.", RemoteRequestType.REMOVE, mockDispatcher.lastRemoteCacheRequest
+            .getRequestType() );
+    }
+
+    /**
+     * Verify removeall functionality
+     * <p>
+     * @throws IOException
+     */
+    public void testRemoveAll_normal()
+        throws IOException
+    {
+        // SETUP
+        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+
+        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
+        client.setRemoteDispatcher( mockDispatcher );
+
+        String cacheName = "test";
+
+        // DO WORK
+        client.removeAll( cacheName );
+
+        // VERIFY
+        assertEquals( "Wrong type.", RemoteRequestType.REMOVE_ALL, mockDispatcher.lastRemoteCacheRequest
+            .getRequestType() );
+    }
+
+    /**
+     * Verify update functionality
+     * <p>
+     * @throws IOException
+     */
+    public void testUpdate_normal()
+        throws IOException
+    {
+        // SETUP
+        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+
+        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
+        client.setRemoteDispatcher( mockDispatcher );
+
+        String cacheName = "test";
+
+        ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" );
+
+        // DO WORK
+        client.update( element );
+
+        // VERIFY
+        assertEquals( "Wrong type.", RemoteRequestType.UPDATE, mockDispatcher.lastRemoteCacheRequest
+            .getRequestType() );
+    }
+
+    /**
+     * Verify dispose functionality
+     * <p>
+     * @throws IOException
+     */
+    public void testDispose_normal()
+        throws IOException
+    {
+        // SETUP
+        RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes );
+
+        MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher();
+        client.setRemoteDispatcher( mockDispatcher );
+
+        String cacheName = "test";
+
+        // DO WORK
+        client.dispose( cacheName );
+
+        // VERIFY
+        assertEquals( "Wrong type.", RemoteRequestType.DISPOSE, mockDispatcher.lastRemoteCacheRequest
+            .getRequestType() );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcherUniTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcherUniTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcherUniTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcherUniTest.java Sun Feb 23 10:37:48 2014
@@ -1,34 +1,53 @@
-package org.apache.commons.jcs.auxiliary.remote.http.client;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteRequestType;
-
-/** Unit tests for the dispatcher. */
-public class RemoteHttpCacheDispatcherUniTest
-    extends TestCase
-{
-    /**
-     * Verify that we don't get two ?'s
-     */
-    public void testAddParameters_withQueryString()
-    {
-        // SETUP
-        RemoteHttpCacheAttributes remoteHttpCacheAttributes = new RemoteHttpCacheAttributes();
-        RemoteHttpCacheDispatcher dispatcher = new RemoteHttpCacheDispatcher( remoteHttpCacheAttributes );
-
-        RemoteCacheRequest<String, String> remoteCacheRequest = new RemoteCacheRequest<String, String>();
-        remoteCacheRequest.setRequestType( RemoteRequestType.REMOVE_ALL );
-        String cacheName = "myCache";
-        remoteCacheRequest.setCacheName( cacheName );
-
-        String baseUrl = "http://localhost?thishasaquestionmark";
-
-        // DO WORK
-        String result = dispatcher.addParameters( remoteCacheRequest, baseUrl );
-
-        // VERIFY
-        assertEquals( "Wrong url", baseUrl + "&CacheName=" + cacheName + "&Key=&RequestType=REMOVE_ALL", result  );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.client;
+
+/*
+ * 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.
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteRequestType;
+
+/** Unit tests for the dispatcher. */
+public class RemoteHttpCacheDispatcherUniTest
+    extends TestCase
+{
+    /**
+     * Verify that we don't get two ?'s
+     */
+    public void testAddParameters_withQueryString()
+    {
+        // SETUP
+        RemoteHttpCacheAttributes remoteHttpCacheAttributes = new RemoteHttpCacheAttributes();
+        RemoteHttpCacheDispatcher dispatcher = new RemoteHttpCacheDispatcher( remoteHttpCacheAttributes );
+
+        RemoteCacheRequest<String, String> remoteCacheRequest = new RemoteCacheRequest<String, String>();
+        remoteCacheRequest.setRequestType( RemoteRequestType.REMOVE_ALL );
+        String cacheName = "myCache";
+        remoteCacheRequest.setCacheName( cacheName );
+
+        String baseUrl = "http://localhost?thishasaquestionmark";
+
+        // DO WORK
+        String result = dispatcher.addParameters( remoteCacheRequest, baseUrl );
+
+        // VERIFY
+        assertEquals( "Wrong url", baseUrl + "&CacheName=" + cacheName + "&Key=&RequestType=REMOVE_ALL", result  );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManagerUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManagerUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManagerUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManagerUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,98 +1,98 @@
-package org.apache.commons.jcs.auxiliary.remote.http.client;
-
-/*
- * 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.
- */
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.auxiliary.AuxiliaryCache;
-import org.apache.commons.jcs.auxiliary.remote.http.client.behavior.IRemoteHttpCacheClient;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
-import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
-
-/** Unit tests for the manager. */
-public class RemoteHttpCacheManagerUnitTest
-    extends TestCase
-{
-    /** Verify that we get the default. */
-    public void testCreateRemoteHttpCacheClient_Bad()
-    {
-        // SETUP
-        ICompositeCacheManager cacheMgr = null;
-        ICacheEventLogger cacheEventLogger = null;
-        IElementSerializer elementSerializer = null;
-
-        String remoteHttpClientClassName = "junk";
-        RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes();
-        cattr.setRemoteHttpClientClassName( remoteHttpClientClassName );
-
-        RemoteHttpCacheManager manager = RemoteHttpCacheManager.getInstance( cacheMgr, cacheEventLogger,
-                                                                             elementSerializer );
-
-        // DO WORK
-        IRemoteHttpCacheClient<String, String> result = manager.createRemoteHttpCacheClientForAttributes( cattr );
-
-        // VEIFY
-        assertNotNull( "Should have a cache.", result );
-        assertTrue( "Wrong default.", result instanceof RemoteHttpCacheClient );
-        assertTrue( "Should be initialized", ((RemoteHttpCacheClient<String, String>)result).isInitialized() );
-    }
-
-    /** Verify that we get the default. */
-    public void testCreateRemoteHttpCacheClient_deafult()
-    {
-        // SETUP
-        ICompositeCacheManager cacheMgr = null;
-        ICacheEventLogger cacheEventLogger = null;
-        IElementSerializer elementSerializer = null;
-
-        RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes();
-
-        RemoteHttpCacheManager manager = RemoteHttpCacheManager.getInstance( cacheMgr, cacheEventLogger,
-                                                                             elementSerializer );
-
-        // DO WORK
-        IRemoteHttpCacheClient<String, String> result = manager.createRemoteHttpCacheClientForAttributes( cattr );
-
-        // VEIFY
-        assertNotNull( "Should have a cache.", result );
-        assertTrue( "Wrong default.", result instanceof RemoteHttpCacheClient );
-    }
-
-    /** Verify that we get a cache no wait. */
-    public void testGetCache_normal()
-    {
-        // SETUP
-        ICompositeCacheManager cacheMgr = null;
-        ICacheEventLogger cacheEventLogger = null;
-        IElementSerializer elementSerializer = null;
-
-        RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes();
-
-        RemoteHttpCacheManager manager = RemoteHttpCacheManager.getInstance( cacheMgr, cacheEventLogger,
-                                                                             elementSerializer );
-
-        // DO WORK
-        AuxiliaryCache<String, String> result = manager.getCache( cattr );
-
-        // VEIFY
-        assertNotNull( "Should have a cache.", result );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.client;
+
+/*
+ * 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.
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.auxiliary.AuxiliaryCache;
+import org.apache.commons.jcs.auxiliary.remote.http.client.behavior.IRemoteHttpCacheClient;
+import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
+import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
+
+/** Unit tests for the manager. */
+public class RemoteHttpCacheManagerUnitTest
+    extends TestCase
+{
+    /** Verify that we get the default. */
+    public void testCreateRemoteHttpCacheClient_Bad()
+    {
+        // SETUP
+        ICompositeCacheManager cacheMgr = null;
+        ICacheEventLogger cacheEventLogger = null;
+        IElementSerializer elementSerializer = null;
+
+        String remoteHttpClientClassName = "junk";
+        RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes();
+        cattr.setRemoteHttpClientClassName( remoteHttpClientClassName );
+
+        RemoteHttpCacheManager manager = RemoteHttpCacheManager.getInstance( cacheMgr, cacheEventLogger,
+                                                                             elementSerializer );
+
+        // DO WORK
+        IRemoteHttpCacheClient<String, String> result = manager.createRemoteHttpCacheClientForAttributes( cattr );
+
+        // VEIFY
+        assertNotNull( "Should have a cache.", result );
+        assertTrue( "Wrong default.", result instanceof RemoteHttpCacheClient );
+        assertTrue( "Should be initialized", ((RemoteHttpCacheClient<String, String>)result).isInitialized() );
+    }
+
+    /** Verify that we get the default. */
+    public void testCreateRemoteHttpCacheClient_deafult()
+    {
+        // SETUP
+        ICompositeCacheManager cacheMgr = null;
+        ICacheEventLogger cacheEventLogger = null;
+        IElementSerializer elementSerializer = null;
+
+        RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes();
+
+        RemoteHttpCacheManager manager = RemoteHttpCacheManager.getInstance( cacheMgr, cacheEventLogger,
+                                                                             elementSerializer );
+
+        // DO WORK
+        IRemoteHttpCacheClient<String, String> result = manager.createRemoteHttpCacheClientForAttributes( cattr );
+
+        // VEIFY
+        assertNotNull( "Should have a cache.", result );
+        assertTrue( "Wrong default.", result instanceof RemoteHttpCacheClient );
+    }
+
+    /** Verify that we get a cache no wait. */
+    public void testGetCache_normal()
+    {
+        // SETUP
+        ICompositeCacheManager cacheMgr = null;
+        ICacheEventLogger cacheEventLogger = null;
+        IElementSerializer elementSerializer = null;
+
+        RemoteHttpCacheAttributes cattr = new RemoteHttpCacheAttributes();
+
+        RemoteHttpCacheManager manager = RemoteHttpCacheManager.getInstance( cacheMgr, cacheEventLogger,
+                                                                             elementSerializer );
+
+        // DO WORK
+        AuxiliaryCache<String, String> result = manager.getCache( cattr );
+
+        // VEIFY
+        assertNotNull( "Should have a cache.", result );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManualTester.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManualTester.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManualTester.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManualTester.java Sun Feb 23 10:37:48 2014
@@ -1,76 +1,76 @@
-package org.apache.commons.jcs.auxiliary.remote.http.client;
-
-/*
- * 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.
- */
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.JCS;
-import org.apache.commons.jcs.access.CacheAccess;
-
-/** Manual tester for a JCS instance configured to use the http client. */
-public class RemoteHttpCacheManualTester
-    extends TestCase
-{
-    /** number to use for the test */
-    private static int items = 100;
-
-    /**
-     * Test setup
-     */
-    @Override
-    public void setUp()
-    {
-        JCS.setConfigFilename( "/TestRemoteHttpCache.ccf" );
-    }
-
-    /**
-     * A unit test for JUnit
-     * @exception Exception Description of the Exception
-     */
-    public void testSimpleLoad()
-        throws Exception
-    {
-        CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
-
-        jcs.put( "TestKey", "TestValue" );
-
-        System.out.println( jcs.getStats() );
-
-        for ( int i = 1; i <= items; i++ )
-        {
-            jcs.put( i + ":key", "data" + i );
-        }
-
-        for ( int i = items; i > 0; i-- )
-        {
-            String res = jcs.get( i + ":key" );
-            if ( res == null )
-            {
-                //assertNotNull( "[" + i + ":key] should not be null", res );
-            }
-        }
-
-        // test removal
-        jcs.remove( "300:key" );
-        assertNull( jcs.get( "TestKey" ) );
-
-        System.out.println( jcs.getStats() );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.client;
+
+/*
+ * 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.
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
+
+/** Manual tester for a JCS instance configured to use the http client. */
+public class RemoteHttpCacheManualTester
+    extends TestCase
+{
+    /** number to use for the test */
+    private static int items = 100;
+
+    /**
+     * Test setup
+     */
+    @Override
+    public void setUp()
+    {
+        JCS.setConfigFilename( "/TestRemoteHttpCache.ccf" );
+    }
+
+    /**
+     * A unit test for JUnit
+     * @exception Exception Description of the Exception
+     */
+    public void testSimpleLoad()
+        throws Exception
+    {
+        CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
+
+        jcs.put( "TestKey", "TestValue" );
+
+        System.out.println( jcs.getStats() );
+
+        for ( int i = 1; i <= items; i++ )
+        {
+            jcs.put( i + ":key", "data" + i );
+        }
+
+        for ( int i = items; i > 0; i-- )
+        {
+            String res = jcs.get( i + ":key" );
+            if ( res == null )
+            {
+                //assertNotNull( "[" + i + ":key] should not be null", res );
+            }
+        }
+
+        // test removal
+        jcs.remove( "300:key" );
+        assertNull( jcs.get( "TestKey" ) );
+
+        System.out.println( jcs.getStats() );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptorUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,191 +1,191 @@
-package org.apache.commons.jcs.auxiliary.remote.http.server;
-
-/*
- * 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.
- */
-
-import java.util.Collections;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.auxiliary.remote.MockRemoteCacheService;
-import org.apache.commons.jcs.auxiliary.remote.util.RemoteCacheRequestFactory;
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
-import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
-import org.apache.commons.jcs.engine.CacheElement;
-
-/** Unit tests for the adaptor. */
-public class RemoteCacheServiceAdaptorUnitTest
-    extends TestCase
-{
-    /** Verify that we balk and return an error. */
-    public void testProcessRequest_null()
-    {
-        // SETUP
-        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
-
-        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
-        adaptor.setRemoteCacheService( remoteHttpCacheService );
-
-        RemoteCacheRequest<String, String> request = null;
-
-        // DO WORK
-        RemoteCacheResponse<String> result = adaptor.processRequest( request );
-
-        // VERIFY
-        assertNotNull( "Should have a result.", result );
-        assertTrue( "Should have 'The request is null' in the errorMessage", result.getErrorMessage().indexOf( "The request is null" ) != -1 );
-        assertTrue( "Should have 'The request is null' in the toString", result.toString().indexOf( "The request is null" ) != -1 );
-    }
-
-    /** Verify that the service is called. */
-    public void testProcessRequest_Get()
-    {
-        // SETUP
-        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
-
-        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
-        adaptor.setRemoteCacheService( remoteHttpCacheService );
-
-        String cacheName = "test";
-        String key = "key";
-        long requesterId = 2;
-        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId );
-
-        // DO WORK
-        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
-
-        // VERIFY
-        assertNotNull( "Should have a result.", result );
-        assertEquals( "Wrong key.", key, remoteHttpCacheService.lastGetKey );
-    }
-
-    /** Verify that the service is called. */
-    public void testProcessRequest_GetMatching()
-    {
-        // SETUP
-        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
-
-        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
-        adaptor.setRemoteCacheService( remoteHttpCacheService );
-
-        String cacheName = "test";
-        String pattern = "pattern";
-        long requesterId = 2;
-        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern,
-                                                                                                  requesterId );
-
-        // DO WORK
-        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
-
-        // VERIFY
-        assertNotNull( "Should have a result.", result );
-        assertEquals( "Wrong pattern.", pattern, remoteHttpCacheService.lastGetMatchingPattern );
-    }
-
-    /** Verify that the service is called. */
-    public void testProcessRequest_GetMultiple()
-    {
-        // SETUP
-        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
-
-        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
-        adaptor.setRemoteCacheService( remoteHttpCacheService );
-
-        String cacheName = "test";
-        Set<String> keys = Collections.emptySet();
-        long requesterId = 2;
-        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys,
-                                                                                                  requesterId );
-
-        // DO WORK
-        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
-
-        // VERIFY
-        assertNotNull( "Should have a result.", result );
-        assertEquals( "Wrong keys.", keys, remoteHttpCacheService.lastGetMultipleKeys );
-
-    }
-
-    /** Verify that the service is called. */
-    public void testProcessRequest_Update()
-    {
-        // SETUP
-        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
-
-        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
-        adaptor.setRemoteCacheService( remoteHttpCacheService );
-
-        String cacheName = "test";
-        String key = "key";
-        long requesterId = 2;
-        CacheElement<String, String> element = new CacheElement<String, String>( cacheName, key, null );
-        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId );
-
-        // DO WORK
-        RemoteCacheResponse<String> result = adaptor.processRequest( request );
-
-        // VERIFY
-        assertNotNull( "Should have a result.", result );
-        assertEquals( "Wrong object.", element, remoteHttpCacheService.lastUpdate );
-    }
-
-    /** Verify that the service is called. */
-    public void testProcessRequest_Remove()
-    {
-        // SETUP
-        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
-
-        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
-        adaptor.setRemoteCacheService( remoteHttpCacheService );
-
-        String cacheName = "test";
-        String key = "key";
-        long requesterId = 2;
-        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createRemoveRequest( cacheName, key, requesterId );
-
-        // DO WORK
-        RemoteCacheResponse<String> result = adaptor.processRequest( request );
-
-        // VERIFY
-        assertNotNull( "Should have a result.", result );
-        assertEquals( "Wrong key.", key, remoteHttpCacheService.lastRemoveKey );
-    }
-
-    /** Verify that the service is called. */
-    public void testProcessRequest_RemoveAll()
-    {
-        // SETUP
-        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
-
-        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
-        adaptor.setRemoteCacheService( remoteHttpCacheService );
-
-        String cacheName = "testRemoveALl";
-        long requesterId = 2;
-        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId );
-
-        // DO WORK
-        RemoteCacheResponse<String> result = adaptor.processRequest( request );
-
-        // VERIFY
-        assertNotNull( "Should have a result.", result );
-        assertEquals( "Wrong cacheName.", cacheName, remoteHttpCacheService.lastRemoveAllCacheName );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.server;
+
+/*
+ * 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.
+ */
+
+import java.util.Collections;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.auxiliary.remote.MockRemoteCacheService;
+import org.apache.commons.jcs.auxiliary.remote.util.RemoteCacheRequestFactory;
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
+import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheResponse;
+import org.apache.commons.jcs.engine.CacheElement;
+
+/** Unit tests for the adaptor. */
+public class RemoteCacheServiceAdaptorUnitTest
+    extends TestCase
+{
+    /** Verify that we balk and return an error. */
+    public void testProcessRequest_null()
+    {
+        // SETUP
+        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
+
+        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
+        adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+        RemoteCacheRequest<String, String> request = null;
+
+        // DO WORK
+        RemoteCacheResponse<String> result = adaptor.processRequest( request );
+
+        // VERIFY
+        assertNotNull( "Should have a result.", result );
+        assertTrue( "Should have 'The request is null' in the errorMessage", result.getErrorMessage().indexOf( "The request is null" ) != -1 );
+        assertTrue( "Should have 'The request is null' in the toString", result.toString().indexOf( "The request is null" ) != -1 );
+    }
+
+    /** Verify that the service is called. */
+    public void testProcessRequest_Get()
+    {
+        // SETUP
+        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
+
+        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
+        adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+        String cacheName = "test";
+        String key = "key";
+        long requesterId = 2;
+        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId );
+
+        // DO WORK
+        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
+
+        // VERIFY
+        assertNotNull( "Should have a result.", result );
+        assertEquals( "Wrong key.", key, remoteHttpCacheService.lastGetKey );
+    }
+
+    /** Verify that the service is called. */
+    public void testProcessRequest_GetMatching()
+    {
+        // SETUP
+        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
+
+        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
+        adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+        String cacheName = "test";
+        String pattern = "pattern";
+        long requesterId = 2;
+        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern,
+                                                                                                  requesterId );
+
+        // DO WORK
+        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
+
+        // VERIFY
+        assertNotNull( "Should have a result.", result );
+        assertEquals( "Wrong pattern.", pattern, remoteHttpCacheService.lastGetMatchingPattern );
+    }
+
+    /** Verify that the service is called. */
+    public void testProcessRequest_GetMultiple()
+    {
+        // SETUP
+        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
+
+        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
+        adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+        String cacheName = "test";
+        Set<String> keys = Collections.emptySet();
+        long requesterId = 2;
+        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys,
+                                                                                                  requesterId );
+
+        // DO WORK
+        RemoteCacheResponse<Object> result = adaptor.processRequest( request );
+
+        // VERIFY
+        assertNotNull( "Should have a result.", result );
+        assertEquals( "Wrong keys.", keys, remoteHttpCacheService.lastGetMultipleKeys );
+
+    }
+
+    /** Verify that the service is called. */
+    public void testProcessRequest_Update()
+    {
+        // SETUP
+        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
+
+        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
+        adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+        String cacheName = "test";
+        String key = "key";
+        long requesterId = 2;
+        CacheElement<String, String> element = new CacheElement<String, String>( cacheName, key, null );
+        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId );
+
+        // DO WORK
+        RemoteCacheResponse<String> result = adaptor.processRequest( request );
+
+        // VERIFY
+        assertNotNull( "Should have a result.", result );
+        assertEquals( "Wrong object.", element, remoteHttpCacheService.lastUpdate );
+    }
+
+    /** Verify that the service is called. */
+    public void testProcessRequest_Remove()
+    {
+        // SETUP
+        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
+
+        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
+        adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+        String cacheName = "test";
+        String key = "key";
+        long requesterId = 2;
+        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createRemoveRequest( cacheName, key, requesterId );
+
+        // DO WORK
+        RemoteCacheResponse<String> result = adaptor.processRequest( request );
+
+        // VERIFY
+        assertNotNull( "Should have a result.", result );
+        assertEquals( "Wrong key.", key, remoteHttpCacheService.lastRemoveKey );
+    }
+
+    /** Verify that the service is called. */
+    public void testProcessRequest_RemoveAll()
+    {
+        // SETUP
+        RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>();
+
+        MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>();
+        adaptor.setRemoteCacheService( remoteHttpCacheService );
+
+        String cacheName = "testRemoveALl";
+        long requesterId = 2;
+        RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId );
+
+        // DO WORK
+        RemoteCacheResponse<String> result = adaptor.processRequest( request );
+
+        // VERIFY
+        assertNotNull( "Should have a result.", result );
+        assertEquals( "Wrong cacheName.", cacheName, remoteHttpCacheService.lastRemoveAllCacheName );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheServiceUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,182 +1,182 @@
-package org.apache.commons.jcs.auxiliary.remote.http.server;
-
-/*
- * 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.
- */
-
-import java.util.HashSet;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.auxiliary.MockCacheEventLogger;
-import org.apache.commons.jcs.engine.CacheElement;
-import org.apache.commons.jcs.engine.control.MockCompositeCacheManager;
-
-/** Unit tests for the service. */
-public class RemoteHttpCacheServiceUnitTest
-    extends TestCase
-{
-    /**
-     * Verify event log calls.
-     * <p>
-     * @throws Exception
-     */
-    public void testUpdate_simple()
-        throws Exception
-    {
-        // SETUP
-        MockCompositeCacheManager manager = new MockCompositeCacheManager();
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-
-        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
-        RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
-
-        String cacheName = "test";
-        String key = "key";
-        long requesterId = 2;
-        CacheElement<String, String> element = new CacheElement<String, String>( cacheName, key, null );
-
-        // DO WORK
-        server.update( element, requesterId );
-
-        // VERIFY
-        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
-        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     * @throws Exception
-     */
-    public void testGet_simple()
-        throws Exception
-    {
-        // SETUP
-        MockCompositeCacheManager manager = new MockCompositeCacheManager();
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-
-        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
-        RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
-
-        // DO WORK
-        server.get( "region", "key" );
-
-        // VERIFY
-        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
-        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     * @throws Exception
-     */
-    public void testGetMatching_simple()
-        throws Exception
-    {
-        // SETUP
-        MockCompositeCacheManager manager = new MockCompositeCacheManager();
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-
-        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
-        RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
-
-        // DO WORK
-        server.getMatching( "region", "pattern", 0 );
-
-        // VERIFY
-        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
-        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     * @throws Exception
-     */
-    public void testGetMultiple_simple()
-        throws Exception
-    {
-        // SETUP
-        MockCompositeCacheManager manager = new MockCompositeCacheManager();
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-
-        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
-        RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
-
-        // DO WORK
-        server.getMultiple( "region", new HashSet<String>() );
-
-        // VERIFY
-        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
-        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     * @throws Exception
-     */
-    public void testRemove_simple()
-        throws Exception
-    {
-        // SETUP
-        MockCompositeCacheManager manager = new MockCompositeCacheManager();
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-
-        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
-        RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
-
-        // DO WORK
-        server.remove( "region", "key" );
-
-        // VERIFY
-        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
-        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
-    }
-
-    /**
-     * Verify event log calls.
-     * <p>
-     * @throws Exception
-     */
-    public void testRemoveAll_simple()
-        throws Exception
-    {
-        // SETUP
-        MockCompositeCacheManager manager = new MockCompositeCacheManager();
-        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
-
-        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
-        RemoteHttpCacheService<String, String> server =
-            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
-
-        // DO WORK
-        server.removeAll( "region" );
-
-        // VERIFY
-        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
-        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.server;
+
+/*
+ * 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.
+ */
+
+import java.util.HashSet;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.auxiliary.MockCacheEventLogger;
+import org.apache.commons.jcs.engine.CacheElement;
+import org.apache.commons.jcs.engine.control.MockCompositeCacheManager;
+
+/** Unit tests for the service. */
+public class RemoteHttpCacheServiceUnitTest
+    extends TestCase
+{
+    /**
+     * Verify event log calls.
+     * <p>
+     * @throws Exception
+     */
+    public void testUpdate_simple()
+        throws Exception
+    {
+        // SETUP
+        MockCompositeCacheManager manager = new MockCompositeCacheManager();
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+        RemoteHttpCacheService<String, String> server =
+            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+
+        String cacheName = "test";
+        String key = "key";
+        long requesterId = 2;
+        CacheElement<String, String> element = new CacheElement<String, String>( cacheName, key, null );
+
+        // DO WORK
+        server.update( element, requesterId );
+
+        // VERIFY
+        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     * @throws Exception
+     */
+    public void testGet_simple()
+        throws Exception
+    {
+        // SETUP
+        MockCompositeCacheManager manager = new MockCompositeCacheManager();
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+        RemoteHttpCacheService<String, String> server =
+            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+
+        // DO WORK
+        server.get( "region", "key" );
+
+        // VERIFY
+        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     * @throws Exception
+     */
+    public void testGetMatching_simple()
+        throws Exception
+    {
+        // SETUP
+        MockCompositeCacheManager manager = new MockCompositeCacheManager();
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+        RemoteHttpCacheService<String, String> server =
+            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+
+        // DO WORK
+        server.getMatching( "region", "pattern", 0 );
+
+        // VERIFY
+        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     * @throws Exception
+     */
+    public void testGetMultiple_simple()
+        throws Exception
+    {
+        // SETUP
+        MockCompositeCacheManager manager = new MockCompositeCacheManager();
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+        RemoteHttpCacheService<String, String> server =
+            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+
+        // DO WORK
+        server.getMultiple( "region", new HashSet<String>() );
+
+        // VERIFY
+        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     * @throws Exception
+     */
+    public void testRemove_simple()
+        throws Exception
+    {
+        // SETUP
+        MockCompositeCacheManager manager = new MockCompositeCacheManager();
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+        RemoteHttpCacheService<String, String> server =
+            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+
+        // DO WORK
+        server.remove( "region", "key" );
+
+        // VERIFY
+        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+    }
+
+    /**
+     * Verify event log calls.
+     * <p>
+     * @throws Exception
+     */
+    public void testRemoveAll_simple()
+        throws Exception
+    {
+        // SETUP
+        MockCompositeCacheManager manager = new MockCompositeCacheManager();
+        MockCacheEventLogger cacheEventLogger = new MockCacheEventLogger();
+
+        RemoteHttpCacheServerAttributes rcsa = new RemoteHttpCacheServerAttributes();
+        RemoteHttpCacheService<String, String> server =
+            new RemoteHttpCacheService<String, String>( manager, rcsa, cacheEventLogger );
+
+        // DO WORK
+        server.removeAll( "region" );
+
+        // VERIFY
+        assertEquals( "Start should have been called.", 1, cacheEventLogger.startICacheEventCalls );
+        assertEquals( "End should have been called.", 1, cacheEventLogger.endICacheEventCalls );
+    }
+}

Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheSeviceFactoryUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheSeviceFactoryUnitTest.java?rev=1570993&r1=1570992&r2=1570993&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheSeviceFactoryUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteHttpCacheSeviceFactoryUnitTest.java Sun Feb 23 10:37:48 2014
@@ -1,116 +1,116 @@
-package org.apache.commons.jcs.auxiliary.remote.http.server;
-
-/*
- * 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.
- */
-
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.jcs.auxiliary.AuxiliaryCacheConfigurator;
-import org.apache.commons.jcs.auxiliary.remote.http.behavior.IRemoteHttpCacheConstants;
-import org.apache.commons.jcs.engine.control.MockCompositeCacheManager;
-import org.apache.commons.jcs.engine.logging.MockCacheEventLogger;
-
-/** Unit tests for the factory */
-public class RemoteHttpCacheSeviceFactoryUnitTest
-    extends TestCase
-{
-    /** verify that we get the CacheEventLogger value */
-    public void testCreateRemoteHttpCacheService_WithLogger()
-    {
-        // SETUP
-        MockCompositeCacheManager manager = new MockCompositeCacheManager();
-        String className = MockCacheEventLogger.class.getName();
-
-        Properties props = new Properties();
-        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
-            + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX, className );
-
-        boolean allowClusterGet = false;
-        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String
-            .valueOf( allowClusterGet ) );
-
-        manager.setConfigurationProperties( props );
-
-        // DO WORK
-        RemoteHttpCacheService<String, String> result = RemoteHttpCacheSeviceFactory
-            .createRemoteHttpCacheService( manager );
-
-        // VERIFY
-        assertNotNull( "Should have a service.", result );
-    }
-
-    /** verify that we get the CacheEventLogger value */
-    public void testConfigureCacheEventLogger_Present()
-    {
-        // SETUP
-        String testPropertyValue = "This is the value";
-        String className = MockCacheEventLogger.class.getName();
-
-        Properties props = new Properties();
-        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
-            + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX, className );
-        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
-            + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX + AuxiliaryCacheConfigurator.ATTRIBUTE_PREFIX
-            + ".testProperty", testPropertyValue );
-
-        // DO WORK
-        MockCacheEventLogger result = (MockCacheEventLogger) RemoteHttpCacheSeviceFactory
-            .configureCacheEventLogger( props );
-
-        // VERIFY
-        assertNotNull( "Should have a logger.", result );
-        assertEquals( "Property should be set.", testPropertyValue, result.getTestProperty() );
-    }
-
-    /** verify that we get the allowClusterGet value */
-    public void testConfigureRemoteCacheServerAttributes_allowClusterGetPresent()
-    {
-        // SETUP
-        boolean allowClusterGet = false;
-        Properties props = new Properties();
-        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String
-            .valueOf( allowClusterGet ) );
-
-        // DO WORK
-        RemoteHttpCacheServerAttributes result = RemoteHttpCacheSeviceFactory
-            .configureRemoteHttpCacheServerAttributes( props );
-
-        // VERIFY
-        assertEquals( "Wrong allowClusterGet", allowClusterGet, result.isAllowClusterGet() );
-    }
-
-    /** verify that we get the startRegistry value */
-    public void testConfigureRemoteCacheServerAttributes_localClusterConsistencyPresent()
-    {
-        // SETUP
-        boolean localClusterConsistency = false;
-        Properties props = new Properties();
-        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".localClusterConsistency",
-                   String.valueOf( localClusterConsistency ) );
-
-        // DO WORK
-        RemoteHttpCacheServerAttributes result = RemoteHttpCacheSeviceFactory
-            .configureRemoteHttpCacheServerAttributes( props );
-
-        // VERIFY
-        assertEquals( "Wrong localClusterConsistency", localClusterConsistency, result.isLocalClusterConsistency() );
-    }
-}
+package org.apache.commons.jcs.auxiliary.remote.http.server;
+
+/*
+ * 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.
+ */
+
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.jcs.auxiliary.AuxiliaryCacheConfigurator;
+import org.apache.commons.jcs.auxiliary.remote.http.behavior.IRemoteHttpCacheConstants;
+import org.apache.commons.jcs.engine.control.MockCompositeCacheManager;
+import org.apache.commons.jcs.engine.logging.MockCacheEventLogger;
+
+/** Unit tests for the factory */
+public class RemoteHttpCacheSeviceFactoryUnitTest
+    extends TestCase
+{
+    /** verify that we get the CacheEventLogger value */
+    public void testCreateRemoteHttpCacheService_WithLogger()
+    {
+        // SETUP
+        MockCompositeCacheManager manager = new MockCompositeCacheManager();
+        String className = MockCacheEventLogger.class.getName();
+
+        Properties props = new Properties();
+        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
+            + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX, className );
+
+        boolean allowClusterGet = false;
+        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String
+            .valueOf( allowClusterGet ) );
+
+        manager.setConfigurationProperties( props );
+
+        // DO WORK
+        RemoteHttpCacheService<String, String> result = RemoteHttpCacheSeviceFactory
+            .createRemoteHttpCacheService( manager );
+
+        // VERIFY
+        assertNotNull( "Should have a service.", result );
+    }
+
+    /** verify that we get the CacheEventLogger value */
+    public void testConfigureCacheEventLogger_Present()
+    {
+        // SETUP
+        String testPropertyValue = "This is the value";
+        String className = MockCacheEventLogger.class.getName();
+
+        Properties props = new Properties();
+        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
+            + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX, className );
+        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_PREFIX
+            + AuxiliaryCacheConfigurator.CACHE_EVENT_LOGGER_PREFIX + AuxiliaryCacheConfigurator.ATTRIBUTE_PREFIX
+            + ".testProperty", testPropertyValue );
+
+        // DO WORK
+        MockCacheEventLogger result = (MockCacheEventLogger) RemoteHttpCacheSeviceFactory
+            .configureCacheEventLogger( props );
+
+        // VERIFY
+        assertNotNull( "Should have a logger.", result );
+        assertEquals( "Property should be set.", testPropertyValue, result.getTestProperty() );
+    }
+
+    /** verify that we get the allowClusterGet value */
+    public void testConfigureRemoteCacheServerAttributes_allowClusterGetPresent()
+    {
+        // SETUP
+        boolean allowClusterGet = false;
+        Properties props = new Properties();
+        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".allowClusterGet", String
+            .valueOf( allowClusterGet ) );
+
+        // DO WORK
+        RemoteHttpCacheServerAttributes result = RemoteHttpCacheSeviceFactory
+            .configureRemoteHttpCacheServerAttributes( props );
+
+        // VERIFY
+        assertEquals( "Wrong allowClusterGet", allowClusterGet, result.isAllowClusterGet() );
+    }
+
+    /** verify that we get the startRegistry value */
+    public void testConfigureRemoteCacheServerAttributes_localClusterConsistencyPresent()
+    {
+        // SETUP
+        boolean localClusterConsistency = false;
+        Properties props = new Properties();
+        props.put( IRemoteHttpCacheConstants.HTTP_CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX + ".localClusterConsistency",
+                   String.valueOf( localClusterConsistency ) );
+
+        // DO WORK
+        RemoteHttpCacheServerAttributes result = RemoteHttpCacheSeviceFactory
+            .configureRemoteHttpCacheServerAttributes( props );
+
+        // VERIFY
+        assertEquals( "Wrong localClusterConsistency", localClusterConsistency, result.isLocalClusterConsistency() );
+    }
+}



Mime
View raw message