[infinispan-commits] Infinispan SVN: r1637 - in trunk/client/hotrod-client/src/test: java/org/infinispan/client/hotrod and 1 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Mar 29 11:47:36 EDT 2010


Author: mircea.markus
Date: 2010-03-29 11:47:35 -0400 (Mon, 29 Mar 2010)
New Revision: 1637

Added:
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java
   trunk/client/hotrod-client/src/test/resources/
   trunk/client/hotrod-client/src/test/resources/log4j.xml
Removed:
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodClientIntegrationTest.java
Modified:
   trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/VHelperTest.java
Log:
ongoing work on hotrod client

Deleted: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodClientIntegrationTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodClientIntegrationTest.java	2010-03-29 15:46:53 UTC (rev 1636)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodClientIntegrationTest.java	2010-03-29 15:47:35 UTC (rev 1637)
@@ -1,274 +0,0 @@
-package org.infinispan.client.hotrod;
-
-import hotrod.ClientDisconnectedException;
-import hotrod.ClusterTopologyListener;
-import hotrod.impl.VersionedEntry;
-import hotrod.impl.RemoteCacheSpi;
-import hotrod.RemoteCacheManager;
-import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
-import org.infinispan.test.MultipleCacheManagersTest;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-
-
-/**
- * // TODO: Document this
- *
- * @author mmarkus
- * @since 4.1
- */
- at Test (testName = "client.hotrod.HotRodClientIntegrationTest", groups = "functional", enabled = false) 
-public class HotRodClientIntegrationTest extends MultipleCacheManagersTest {
-
-   private static final String CACHE_NAME = "replSync";
-   private Cache cache;
-   private Cache defaultCache;
-
-   RemoteCacheSpi defaultRemoteCacheSpi;
-   RemoteCacheSpi remoteCacheSpi;
-
-   @Override
-   protected void createCacheManagers() throws Throwable {
-      Configuration replSync = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC);
-      createClusteredCaches(2, CACHE_NAME, replSync);
-
-      //pass the config file to the cache
-      RemoteCacheManager cacheManager = new RemoteCacheManager();
-      defaultRemoteCacheSpi = cacheManager.getDefaultRemoteCache();
-      remoteCacheSpi = cacheManager.getRemoteCache(CACHE_NAME);
-   }
-
-   @AfterClass
-   public void testDestroyRemoteCacheFactory() {
-      RemoteCacheManager cacheManager = remoteCacheSpi.getRemoteCacheFactory();
-      cacheManager.stop();
-      try {
-         remoteCacheSpi.get("aKey".getBytes());
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.clear();
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.evict("aKey".getBytes());
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.addClusterTopologyListener(null);
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.removeClusterTopologyListener(null);
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.putForExternalRead("aKey".getBytes(), "aValue".getBytes());
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.putIfAbsent("aKey".getBytes(), "aValue".getBytes());
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.remove("aKey".getBytes());
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.removeIfUnmodified("aKey".getBytes(), 12321L);
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.replaceIfUnmodified("aKey".getBytes(), "aNewValue".getBytes(), 12321L);
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-      try {
-         remoteCacheSpi.replace("aKey".getBytes(), "aNewValue".getBytes());
-         assert false;
-      } catch (ClientDisconnectedException e) {}
-   }
-
-   @AfterClass (alwaysRun = true)
-   @Override
-   protected void destroy() {
-      TestTopologyListener listener = new TestTopologyListener();
-      remoteCacheSpi.addClusterTopologyListener(listener);
-      super.destroy();
-      assert listener.invocationCount == 2; 
-   }
-
-   public void testPut() {
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      assertEquals("aValue", get(cache, "aKey"));
-      defaultRemoteCacheSpi.put("otherKey".getBytes(), "otherValue".getBytes());
-      assertEquals("otherValue", get(defaultCache, "otherKey"));
-
-      assert Arrays.equals("aKey".getBytes(), remoteCacheSpi.get("aValue".getBytes()));
-      assert Arrays.equals("otherKey".getBytes(), remoteCacheSpi.get("otherKey".getBytes()));
-   }
-
-   public void testRemove() {
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      assert Arrays.equals("aKey".getBytes(), remoteCacheSpi.get("aValue".getBytes()));
-
-      assert get(cache, "aKey").equals("aValue");
-      assertEquals(true, remoteCacheSpi.remove("aKey".getBytes()));
-      assert remoteCacheSpi.remove("aKey".getBytes());
-      assert get(cache,"aKey") == null;
-      assert !remoteCacheSpi.remove("aKey".getBytes());
-   }
-
-   public void testContains() {
-      assert !remoteCacheSpi.contains("aKey".getBytes());
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      assert !remoteCacheSpi.contains("aKey".getBytes());
-   }
-
-   public void testGetVersionedCacheEntry() {
-      assert null == remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      VersionedEntry entry = remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-      assert entry != null;
-      assert Arrays.equals(entry.getKey(), "aKey".getBytes());
-      assert Arrays.equals(entry.getValue(), "aValue".getBytes());
-
-      //now put the same value
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      VersionedEntry entry2 = remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-      assert Arrays.equals(entry2.getKey(), "aKey".getBytes());
-      assert Arrays.equals(entry2.getValue(), "aValue".getBytes());
-
-      assert entry2.getVersion() != entry.getVersion();
-      assert !entry.equals(entry2);
-
-      //now put a different value
-      remoteCacheSpi.put("aKey".getBytes(), "anotherValue".getBytes());
-      VersionedEntry entry3 = remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-      assert Arrays.equals(entry3.getKey(), "aKey".getBytes());
-      assert Arrays.equals(entry3.getValue(), "anotherValue".getBytes());
-      assert entry3.getVersion() != entry2.getVersion();
-      assert !entry3.equals(entry2);
-   }
-
-   public void testReplace() {
-      assert !remoteCacheSpi.replace("aKey".getBytes(), "anotherValue".getBytes());
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      assert remoteCacheSpi.replace("aKey".getBytes(), "anotherValue".getBytes());
-      assert get(cache, "aKey").equals("anotherValue");
-   }
-
-   public void testReplaceIfUnmodified() {
-      RemoteCacheSpi.VersionedOperationResponse response = remoteCacheSpi.replaceIfUnmodified("aKey".getBytes(), "aValue".getBytes(), 12321212l);
-      assert response == RemoteCacheSpi.VersionedOperationResponse.NO_SUCH_KEY;
-      assert !response.isUpdated();
-
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      VersionedEntry entry = remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-      response = remoteCacheSpi.replaceIfUnmodified("aKey".getBytes(), "aNewValue".getBytes(), entry.getVersion());
-      assert response == RemoteCacheSpi.VersionedOperationResponse.SUCCESS;
-      assert response.isUpdated();
-
-      VersionedEntry entry2 = remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-      assert entry2.getVersion() != entry.getVersion();
-      assert Arrays.equals(entry2.getKey(), "aKey".getBytes());
-      assert Arrays.equals(entry2.getValue(), "aNewValue".getBytes());
-
-      response = remoteCacheSpi.replaceIfUnmodified("aKey".getBytes(), "aNewValue".getBytes(), entry.getVersion());
-      assert response == RemoteCacheSpi.VersionedOperationResponse.MODIFIED_KEY;
-      assert !response.isUpdated();
-   }
-
-   public void testRemoveIfUnmodified() {
-      RemoteCacheSpi.VersionedOperationResponse response = remoteCacheSpi.removeIfUnmodified("aKey".getBytes(), 12321212l);
-      assert response == RemoteCacheSpi.VersionedOperationResponse.NO_SUCH_KEY;
-      assert !response.isUpdated();
-
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      VersionedEntry entry = remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-      response = remoteCacheSpi.removeIfUnmodified("aKey".getBytes(), entry.getVersion());
-      assert response == RemoteCacheSpi.VersionedOperationResponse.SUCCESS;
-      assert response.isUpdated();
-      assert !cache.containsKey("aKey".getBytes());
-
-      remoteCacheSpi.put("aKey".getBytes(), "aValueNew".getBytes());
-
-      VersionedEntry entry2 = remoteCacheSpi.getVersionedCacheEntry("aKey".getBytes());
-      assert entry2.getVersion() != entry.getVersion();
-      assert Arrays.equals(entry2.getKey(), "aKey".getBytes());
-      assert Arrays.equals(entry2.getValue(), "aNewValue".getBytes());
-
-      response = remoteCacheSpi.removeIfUnmodified("aKey".getBytes(), entry.getVersion());
-      assert response == RemoteCacheSpi.VersionedOperationResponse.MODIFIED_KEY;
-      assert !response.isUpdated();
-   }
-
-   public void testPutIfAbsent() {
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      assert !remoteCacheSpi.putIfAbsent("aKey".getBytes(), "anotherValue".getBytes());
-      assert get(cache, "aKey").equals("aValue");
-
-      assert cache.remove("aKey".getBytes()).equals("aValue".getBytes());
-      assert !remoteCacheSpi.contains("aKey".getBytes());
-
-      assert true : remoteCacheSpi.replace("aKey".getBytes(), "anotherValue".getBytes());
-   }
-
-   public void testPutForExternalRead() {
-      remoteCacheSpi.putForExternalRead("aKey".getBytes(), "aValue".getBytes());
-      remoteCacheSpi.putForExternalRead("aKey".getBytes(), "anotherValue".getBytes());
-      assert get(cache, "aKey").equals("aValue");
-
-      assert cache.remove("aKey".getBytes()).equals("aValue".getBytes());
-      assert !remoteCacheSpi.contains("aKey".getBytes());
-   }
-
-   public void testClear() {
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      remoteCacheSpi.put("aKey2".getBytes(), "aValue".getBytes());
-      remoteCacheSpi.clear();
-      assert cache.isEmpty();
-      assert !remoteCacheSpi.contains("aKey".getBytes());
-      assert !remoteCacheSpi.contains("aKey2".getBytes());
-   }
-
-   public void testEvict() {
-      assert  !remoteCacheSpi.evict("aKey".getBytes());
-      remoteCacheSpi.put("aKey".getBytes(), "aValue".getBytes());
-      assert remoteCacheSpi.evict("aKey".getBytes());
-   }
-
-   public void testStats() {
-      //todo implement
-   }
-
-   private Object get(Cache cache, String s) {
-      return new String((byte[])cache.get(s.getBytes()));
-   }
-
-   private static class TestTopologyListener implements ClusterTopologyListener {
-
-      private int invocationCount;
-
-      public void nodeAdded(List<Address> currentTopology, Address addedNode) {
-         // TODO: Customise this generated block
-      }
-
-      public void nodeRemoved(List<Address> currentTopology, Address removedNode) {
-         invocationCount++;
-      }
-   }
-}

Copied: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java (from rev 1617, trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodClientIntegrationTest.java)
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java	                        (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java	2010-03-29 15:47:35 UTC (rev 1637)
@@ -0,0 +1,228 @@
+package org.infinispan.client.hotrod;
+
+import org.infinispan.Cache;
+import org.infinispan.client.hotrod.impl.SerializationMarshaller;
+import org.infinispan.config.Configuration;
+import org.infinispan.manager.CacheManager;
+import org.infinispan.server.core.CacheValue;
+import org.infinispan.server.hotrod.CacheKey;
+import org.infinispan.server.hotrod.HotRodServer;
+import org.infinispan.server.hotrod.test.HotRodTestingUtil;
+import org.infinispan.test.SingleCacheManagerTest;
+import org.infinispan.test.fwk.TestCacheManagerFactory;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+
+import static junit.framework.Assert.assertEquals;
+
+
+/**
+ * // TODO: Document this
+ *
+ * @author mmarkus
+ * @since 4.1
+ */
+ at Test (testName = "client.hotrod.HotRodClientIntegrationTest", groups = "functional", enabled = true) 
+public class HotRodIntegrationTest extends SingleCacheManagerTest {
+
+   private static final String CACHE_NAME = "replSync";
+   private Cache cache;
+   private Cache defaultCache;
+
+   RemoteCache defaultRemote;
+   RemoteCache remoteCache;
+   private RemoteCacheManager remoteCacheManager;
+
+   private HotRodServer hotrodServer;
+
+   @Override
+   protected CacheManager createCacheManager() throws Exception {
+      Configuration standaloneConfig = getDefaultStandaloneConfig(false);
+      cacheManager = TestCacheManagerFactory.createLocalCacheManager();
+      cacheManager.defineConfiguration(CACHE_NAME, standaloneConfig);
+      defaultCache = cacheManager.getCache();
+      cache = cacheManager.getCache(CACHE_NAME);
+
+
+      //pass the config file to the cache
+      hotrodServer = HotRodTestingUtil.startHotRodServer(cacheManager);
+      
+      remoteCacheManager = new RemoteCacheManager();
+      defaultRemote = remoteCacheManager.getCache();
+      remoteCache = remoteCacheManager.getCache(CACHE_NAME);
+      return cacheManager;
+   }
+
+
+
+   @AfterClass (enabled = false)
+   public void testDestroyRemoteCacheFactory() {
+      hotrodServer.stop();
+//      try {
+//         remoteCache.get("aKey");
+//         assert false;
+//      } catch (ClientDisconnectedException e) {}
+//      try {
+//         remoteCache.clear();
+//         assert false;
+//      } catch (ClientDisconnectedException e) {}
+//      try {
+//         remoteCache.put("aKey", "aValue");
+//         assert false;
+//      } catch (ClientDisconnectedException e) {}
+//      try {
+//         remoteCache.putIfAbsent("aKey", "aValue");
+//         assert false;
+//      } catch (ClientDisconnectedException e) {}
+//      try {
+//         remoteCache.remove("aKey", 0);
+//         assert false;
+//      } catch (ClientDisconnectedException e) {}
+//      try {
+//         remoteCache.remove("aKey");
+//         assert false;
+//      } catch (ClientDisconnectedException e) {}
+//      try {
+//         remoteCache.replace("aKey", "aNewValue");
+//         assert false;
+//      } catch (ClientDisconnectedException e) {}
+//      try {
+//         remoteCache.replace("aKey", "aNewValue");
+//         assert false;
+//      } catch (ClientDisconnectedException e) {}
+   }
+
+   public void testPut() {
+      assert null == remoteCache.put("aKey", "aValue");
+      assertCacheContains(cache, "aKey", "aValue");
+      assert null == defaultRemote.put("otherKey", "otherValue");
+      assertCacheContains(defaultCache, "otherKey", "otherValue");
+      assert remoteCache.containsKey("aKey");
+      assert defaultRemote.containsKey("otherKey");
+      assert remoteCache.get("aKey").equals("aValue");
+      assert defaultRemote.get("otherKey").equals("otherValue");
+   }
+
+   public void testRemove() {
+      assert null == remoteCache.put("aKey", "aValue");
+      assertCacheContains(cache, "aKey", "aValue");
+
+      assert remoteCache.get("aKey").equals("aValue");
+      
+      assert null == remoteCache.remove("aKey");
+      assertCacheContains(cache, "aKey", null);
+      assert !remoteCache.containsKey("aKey");
+   }
+
+   public void testContains() {
+      assert !remoteCache.containsKey("aKey");
+      remoteCache.put("aKey", "aValue");
+      assert remoteCache.containsKey("aKey");
+   }
+
+   public void testGetVersionedCacheEntry() {
+      assert null == remoteCache.getVersioned("aKey");
+      remoteCache.put("aKey", "aValue");
+      RemoteCache.VersionedValue valueBinary = remoteCache.getVersioned("aKey");
+      assert valueBinary != null;
+      assertEquals(valueBinary.getValue(), "aValue");
+
+      //now put the same value
+      remoteCache.put("aKey", "aValue");
+      RemoteCache.VersionedValue entry2 = remoteCache.getVersioned("aKey");
+      assertEquals(entry2.getValue(), "aValue");
+
+      assert entry2.getVersion() != valueBinary.getVersion();
+      assert !valueBinary.equals(entry2);
+
+      //now put a different value
+      remoteCache.put("aKey", "anotherValue");
+      RemoteCache.VersionedValue entry3 = remoteCache.getVersioned("aKey");
+      assertEquals(entry3.getValue(), "anotherValue");
+      assert entry3.getVersion() != entry2.getVersion();
+      assert !entry3.equals(entry2);
+   }
+
+   public void testReplace() {
+      assert null == remoteCache.replace("aKey", "anotherValue");
+      remoteCache.put("aKey", "aValue");
+      assert null == remoteCache.replace("aKey", "anotherValue");
+      assert get(cache, "aKey").equals("anotherValue");
+   }
+
+   public void testReplaceIfUnmodified() {
+      assert null == remoteCache.replace("aKey", "aValue");
+      
+
+      remoteCache.put("aKey", "aValue");
+      RemoteCache.VersionedValue valueBinary = remoteCache.getVersioned("aKey");
+      assert remoteCache.replace("aKey", "aNewValue", valueBinary.getVersion());
+
+      RemoteCache.VersionedValue entry2 = remoteCache.getVersioned("aKey");
+      assert entry2.getVersion() != valueBinary.getVersion();
+      assertEquals(entry2.getValue(), "aNewValue");
+
+      assert !remoteCache.replace("aKey", "aNewValue", valueBinary.getVersion());
+   }
+
+   public void testRemoveIfUnmodified() {
+      assert !remoteCache.remove("aKey", 12321212l);
+
+      remoteCache.put("aKey", "aValue");
+      RemoteCache.VersionedValue valueBinary = remoteCache.getVersioned("aKey");
+      assert !remoteCache.remove("aKey", valueBinary.getVersion());
+      assert !cache.containsKey("aKey");
+
+      remoteCache.put("aKey", "aValueNew");
+
+      RemoteCache.VersionedValue entry2 = remoteCache.getVersioned("aKey");
+      assert entry2.getVersion() != valueBinary.getVersion();
+      assertEquals(entry2.getValue(), "aNewValue");
+
+      assert  !remoteCache.remove("aKey", valueBinary.getVersion());
+   }
+
+   public void testPutIfAbsent() {
+      remoteCache.put("aKey", "aValue");
+      assert null == remoteCache.putIfAbsent("aKey", "anotherValue");
+      assert get(cache, "aKey").equals("aValue");
+
+      assert cache.remove("aKey").equals("aValue");
+      assert !remoteCache.containsKey("aKey");
+
+      assert true : remoteCache.replace("aKey", "anotherValue");
+   }
+
+   public void testClear() {
+      remoteCache.put("aKey", "aValue");
+      remoteCache.put("aKey2", "aValue");
+      remoteCache.clear();
+      assert cache.isEmpty();
+      assert !remoteCache.containsKey("aKey");
+      assert !remoteCache.containsKey("aKey2");
+   }
+
+   public void testStats() {
+      //todo implement
+   }
+
+   private void assertCacheContains(Cache cache, String key, String value) {
+      SerializationMarshaller marshaller = new SerializationMarshaller();
+      byte[] keyBytes = marshaller.marshallObject(key);
+      byte[] valueBytes = marshaller.marshallObject(value);
+      CacheKey cacheKey = new CacheKey(keyBytes);
+      CacheValue cacheValue = (CacheValue) cache.get(cacheKey);
+      if (value == null) {
+         assert cacheValue == null : "Expected null value but received: " + cacheValue;
+      } else {
+         assert Arrays.equals(valueBytes, cacheValue.data());
+      }
+   }
+
+   private Object get(Cache cache, String s) {
+
+      return new String((byte[])cache.get(s));
+   }
+}

Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/VHelperTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/VHelperTest.java	2010-03-29 15:46:53 UTC (rev 1636)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/VHelperTest.java	2010-03-29 15:47:35 UTC (rev 1637)
@@ -1,6 +1,6 @@
 package org.infinispan.client.hotrod;
 
-import hotrod.impl.transport.VHelper;
+import org.infinispan.client.hotrod.impl.transport.VHelper;
 import org.testng.annotations.Test;
 
 import java.io.ByteArrayInputStream;

Added: trunk/client/hotrod-client/src/test/resources/log4j.xml
===================================================================
--- trunk/client/hotrod-client/src/test/resources/log4j.xml	                        (rev 0)
+++ trunk/client/hotrod-client/src/test/resources/log4j.xml	2010-03-29 15:47:35 UTC (rev 1637)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!--
+   For more configuration infromation and examples see the Apache Log4j website: http://logging.apache.org/log4j/
+ -->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- A time/date based rolling appender -->
+   <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
+      <param name="File" value="jdbc_cache_store.log"/>
+      <param name="Append" value="false"/>
+
+      <!-- Rollover at midnight each day -->
+      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+      <!-- Rollover at the top of each hour
+         <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+      -->
+      <param name="Threshold" value="TRACE"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n"/>
+
+         <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+        <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+         -->
+      </layout>
+   </appender>
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Threshold" value="TRACE"/>
+      <param name="Target" value="System.out"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d %-5p [%c{1}] (%t) %m%n"/>
+      </layout>
+   </appender>
+
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="org.infinispan">
+      <priority value="INFO"/>
+   </category>
+
+   <category name="org.infinispan.server.hotrod">
+      <priority value="TRACE"/>
+   </category>
+
+   <category name="org.infinispan">
+      <priority value="INFO"/>
+   </category>
+
+   <category name="com.mchange">
+      <priority value="TRACE"/>
+   </category>
+
+   <category name="org.infinispan.profiling">
+      <priority value="WARN"/>
+   </category>
+
+   <category name="org.infinispan.jmx">
+      <priority value="WARN"/>
+   </category>
+
+   <category name="org.infinispan.factories">
+      <priority value="WARN"/>
+   </category>
+   
+   <category name="com.mchange.v2">
+      <priority value="INFO"/>
+   </category>
+
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <priority value="WARN"/>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>



More information about the infinispan-commits mailing list