3 Replies Latest reply on Sep 21, 2010 11:06 AM by John Ament

    Default vs Remote behavior

    John Ament Master

      So I've been tinkering with Infinispan on and off, and I wanted to upgrade one of our apps to 4.1  However, I've run into an issue using the default cache manager.  My unit test passes successfully when I use the remote cache manager, but fails when I use the default one.  The failure seems to be that the second unit test cannot find the key inserted into the "a" cache container's cache..

       

      Here's what my cache config looks like:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="urn:infinispan:config:4.0">
          <global>
              <globalJmxStatistics enabled="true" jmxDomain="infinispan" allowDuplicateDomains="true"/>
              <transport clusterName="local-infinispan-cluster" />
          </global>
          <default>
              <jmxStatistics enabled="true" />
              <clustering mode="replicated">
                  <sync replTimeout="2000" />
              </clustering>
          </default>
      </infinispan>

       

      Here's my remote unit test:

       

      CacheContainer a = new RemoteCacheManager("localhost:11311;localhost:11312");
              CacheContainer b = new RemoteCacheManager("localhost:11312;localhost:11311");

       

              Cache aCache = a.getCache();

       

              aCache.put("mykey","myvalue");
              Cache bCache = b.getCache();

       

              String val = bCache.get("mykey").toString();
              Assert.assertEquals(val,"myvalue");

       

      Here's my default unit test:

       

      CacheContainer a = new DefaultCacheManager("/tmp/inf_config.xml");
      CacheContainer b = new DefaultCacheManager("/tmp/inf_config.xml");

       

              Cache aCache = a.getCache();

       

              aCache.put("mykey","myvalue");
              Cache bCache = b.getCache();

       

              String val = bCache.get("mykey").toString();
              Assert.assertEquals(val,"myvalue");